Module 5 of 5Free to explore

IPv4, the gateway and a first DNS lookup

45–60 minutesTheory and practiceEasy

Lesson lab

Launch your own container and complete the task in your browser. Your link works with your account until the workspace closes, for up to 30 minutes.

  • Read a DNS response

    Compare the cache expiry and the authoritative DNS record to find the current IP address.

The school library website holds a timetable. Your computer is connected to the same switch as the printer. In the previous lesson you found the printer on the local link. How does the computer decide where to send a packet for the library? How can it get an address from the website name in the first place? Finish the workshop network map and hand it to someone who has never seen your diagram.

Where the local network ends

An IPv4 address is written as four numbers from 0 to 255. The notation 192.0.2.10/24 says that the first 24 bits form the network prefix. Here those bits fill exactly three numbers. The corresponding mask is 255.255.255.0. The addresses 192.0.2.10 and 192.0.2.20 are in the same subnet, 192.0.2.0/24. The address 198.51.100.7 lies outside it. Comparing only three numbers works for this prefix length. Other lengths can divide the address at a different place.

A host uses its routing table to choose a next hop. For this exercise it has one rule for its connected subnet and a default rule via 192.0.2.1. For the printer the next hop is the printer itself. For the remote address the local frame goes to the gateway interface. The IP destination inside the packet still identifies the remote host. The gateway makes the next forwarding decision separately.

A name and a DNS reply

Names are easier for people to remember. DNS provides records for names. An A record supplies an IPv4 address. An AAAA record refers to IPv6. A client asks a resolver, and the resolver may use a cached answer. TTL limits how long that record can be kept in a cache. It does not predict page load time or promise that a server will keep responding.

Read the observer’s card below. These names and addresses are reserved for examples. There is no need to visit them or change any settings. The observations belong to the same story but answer different questions.

Desk       192.0.2.10/24       Gateway       192.0.2.1
Printer    192.0.2.20          DNS resolver  192.0.2.53
10:00      library.example.    A             198.51.100.7   TTL 120 s
10:00      www.library.example.              NXDOMAIN
10:01      Browser connection to 198.51.100.7: no result recorded

The resolver is local in this exercise, so the request goes directly to it. Its answer for library.example provides a remote address and the later connection uses the gateway. The answer for www.library.example is NXDOMAIN, which indicates that the queried name does not exist according to that response. Adding www creates a different name. Using the second answer to judge the first would describe the wrong record.

What the first hop can tell us

Imagine the frame between the computer and the gateway. Its destination MAC identifies the first receiver. Inside is a packet with the library’s destination IP. When a router forwards it on another link it needs suitable link-layer information there. The gateway’s card cannot tell us the names or number of later hops. A home router may also translate addresses using NAT. No translation rule was provided here, so it does not belong on your observed map.

Compare “DNS replied, so the website works” with “we have an address to try”. Refer to the final line of the card. It records neither a successful connection nor a refusal. A missing observation is different from an observed reason for failure. To say something about availability you would need a recorded connection outcome or an application response.

Practice. Three envelopes

  1. Put the computer, printer, resolver and gateway inside a border labelled with the subnet. Put the library address outside the border. Label each device’s role. On a phone, five lines with arrows can work as well as a drawing.
  2. Make a table with the columns “purpose”, “destination IP”, “next-hop IP” and “reason”. Fill it in for printing at 192.0.2.20, querying 192.0.2.53 and reaching 198.51.100.7. In the last row compare the two IPs. If both are the gateway, you have lost the destination of the library packet.
  3. At 10:01 you have a cached answer obtained at exactly 10:00. Assuming no other changes, its original 120 seconds have not run out. Could you use the same cached answer with equal confidence at 10:03? State your assumption and explain why asking again does not itself prove the address changed.
  4. Try a boundary case. With a computer at 192.0.2.10/25 and a printer at 192.0.2.200, the conclusion changes. A /25 splits the last range into 0–127 and 128–255. Explain how looking only at the first three numbers would mislead you here.

Check your finished handover

For the printer the next address is 192.0.2.20, for the resolver it is 192.0.2.53, and for the first hop towards the library it is 192.0.2.1. The destination for the last packet remains 198.51.100.7. Add a line recording what you still cannot tell about the connection. Collect your computer card, file tree, shell transcript and switch exercise alongside the map. You are ready for the cybersecurity foundations course.

For the network layer see Tanenbaum, Feamster and Wetherall, Computer Networks. DNS concepts, RFC 1034 · Documentation addresses, RFC 5737

Try the idea yourself

Why a service cannot be reached

Change the conditions and observe this training model. It runs in your browser and does not change your computer.

DNS→Firewall→HTTPS :443
Observation

Choose conditions above to see an explanation of the result.

Independent exercise

Another group was given a different name for its book shelf. Analyse it separately from the main example.

Evidence

PC 192.0.2.10/24; gateway 192.0.2.1
09:05: shelf.example. A 192.0.2.90, TTL 60 s
09:07: no application observation

Assignment

Give the next hop to the address at 09:05. Explain which question needs checking again at 09:07 and what is still unknown about the service.

Compare your reasoning

The next hop to the local address is the shelf itself at 192.0.2.90. By 09:07 the original cache lifetime has expired, so the current name mapping needs checking. No successful connection has been observed.

Your next step

Choose what you want to do next

First compare your work with the course exercises. Then try the free introductory module of your next topic and check its prerequisites.

Explore every path and focused course
Personal practice environment

Check an excerpt, find matching lines and compute the SHA-256 of the original text. Temporary data expires after 30 minutes or when you close the environment.