Resolvers and authoritative servers
On this page
You asked dns for the web address from laptop. The zone lives on ns. Which machine answered? Watch the messages at dns, then ask both servers yourself to find out what each one does.
Before you start
Section titled “Before you start”Keep DNS mode on as in Names, zones, and records. Leave machine shells and run netlab reset on the VM. For the capture, give the lab a clean start before making any lookup. Open two VM terminals so you can leave the listener running while making the request.
Find which server the client asks
Section titled “Find which server the client asks”On laptop, run cat /etc/resolv.conf. The nameserver line names 10.77.20.53, the address of dns. The search lab.test line lets programs that use the search setting try that ending on a short name. Keep typing complete names for these tests.
learner@laptop:~$ cat /etc/resolv.confnameserver 10.77.20.53
search lab.testlearner@laptop:~$ Steps (3)
- Type
cat /etc/resolv.conf - Press Enter
- Output:
nameserver 10.77.20.53 search lab.test
A resolver finds DNS answers for a client. The client on laptop sends this lookup to the resolver in its settings. You can read its address before sending a single packet.
Watch the question travel
Section titled “Watch the question travel”In the first VM terminal enter netlab shell dns. Run sudo tcpdump -n -i eth0 port 53. Use your Ubuntu password when prompted. The filter keeps traffic with source or destination port 53. In the second terminal enter netlab shell laptop and run the lookup in the second card. Then return to the listener and press Ctrl+C.
Predict. How many messages does laptop send for one lookup? How many does dns send?
learner@dns:~$ sudo tcpdump -n -i eth0 port 53[sudo] password for learner: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes13:45:55.660250 IP 10.77.10.10.43011 > 10.77.20.53.53: 56196+ [1au] A? web.lab.test. (53)
13:45:55.660382 IP 10.77.20.53.52791 > 10.77.20.54.53: 27889+ [1au] A? web.lab.test. (53)
13:45:55.660505 IP 10.77.20.54.53 > 10.77.20.53.52791: 27889*- 1/1/1 A 10.77.20.80 (90)
13:45:55.660593 IP 10.77.20.53.53 > 10.77.10.10.43011: 56196* 1/1/1 A 10.77.20.80 (90)^C4 packets captured
4 packets received by filter
0 packets dropped by kernellearner@dns:~$ Steps (10)
- Type
sudo tcpdump -n -i eth0 port 53 - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- Output:
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes - In the second terminal on laptop, run the lookup. Then return here and stop the listener.
- Output:
13:45:55.660250 IP 10.77.10.10.43011 > 10.77.20.53.53: 56196+ [1au] A? web.lab.test. (53) 13:45:55.660382 IP 10.77.20.53.52791 > 10.77.20.54.53: 27889+ [1au] A? web.lab.test. (53) 13:45:55.660505 IP 10.77.20.54.53 > 10.77.20.53.52791: 27889*- 1/1/1 A 10.77.20.80 (90) 13:45:55.660593 IP 10.77.20.53.53 > 10.77.10.10.43011: 56196* 1/1/1 A 10.77.20.80 (90) - Press Ctrl + C
- Output:
4 packets captured 4 packets received by filter 0 packets dropped by kernel
learner@laptop:~$ dig web.lab.test +noall +answerweb.lab.test. 300 IN A 10.77.20.80learner@laptop:~$ Steps (3)
- Type
dig web.lab.test +noall +answer - Press Enter
- Output:
web.lab.test. 300 IN A 10.77.20.80
One lookup through dns
- laptop10.77.10.10
- dns10.77.20.53
- ns10.77.20.54
- Question: web.lab.test A: laptop to dns Captured at laptop:eth0.
- Question: web.lab.test A: dns to ns Captured at dns:eth0.
- Answer: 10.77.20.80: ns to dns Captured at dns:eth0.
- Answer: 10.77.20.80: dns to laptop Captured at laptop:eth0.
In the capture4 messages at laptop:eth0 and dns:eth0
- 1. Question: web.lab.test A Captured at laptop:eth0.
13:45:55.660205 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 95: 10.77.10.10.43011 > 10.77.20.53.53: 56196+ [1au] A? web.lab.test. (53) - 2. Question: web.lab.test A Captured at dns:eth0.
13:45:55.660382 02:77:20:00:00:53 > 02:77:20:00:00:54, ethertype IPv4 (0x0800), length 95: 10.77.20.53.52791 > 10.77.20.54.53: 27889+ [1au] A? web.lab.test. (53) - 3. Answer: 10.77.20.80 Captured at dns:eth0.
13:45:55.660506 02:77:20:00:00:54 > 02:77:20:00:00:53, ethertype IPv4 (0x0800), length 132: 10.77.20.54.53 > 10.77.20.53.52791: 27889*- 1/1/1 A 10.77.20.80 (90) - 4. Answer: 10.77.20.80 Captured at laptop:eth0.
13:45:55.660612 02:77:10:00:00:01 > 02:77:10:00:00:10, ethertype IPv4 (0x0800), length 132: 10.77.20.53.53 > 10.77.10.10.43011: 56196* 1/1/1 A 10.77.20.80 (90)
dig web.lab.test +noall +answer, on Ubuntu 24.04.5 LTS, netlab 1.1, tcpdump 4.99.4. The values are the capture's. Step-by-step model built from captured frames from the same lookup.Machines by IP address; captured at laptop:eth0 and dns:eth0. Routers on the path are not drawn.Steps (4)
Machines by IP address; captured at laptop:eth0 and dns:eth0. Routers on the path are not drawn.
- Question: web.lab.test A. laptop to dns. Captured at laptop:eth0. The client asks the server in its settings.
13:45:55.660205 02:77:10:00:00:10 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 95: 10.77.10.10.43011 > 10.77.20.53.53: 56196+ [1au] A? web.lab.test. (53) - Question: web.lab.test A. dns to ns. Captured at dns:eth0. The resolver asks the server that holds the zone.
13:45:55.660382 02:77:20:00:00:53 > 02:77:20:00:00:54, ethertype IPv4 (0x0800), length 95: 10.77.20.53.52791 > 10.77.20.54.53: 27889+ [1au] A? web.lab.test. (53) - Answer: 10.77.20.80. ns to dns. Captured at dns:eth0. The zone server returns the record to the resolver.
13:45:55.660506 02:77:20:00:00:54 > 02:77:20:00:00:53, ethertype IPv4 (0x0800), length 132: 10.77.20.54.53 > 10.77.20.53.52791: 27889*- 1/1/1 A 10.77.20.80 (90) - Answer: 10.77.20.80. dns to laptop. Captured at laptop:eth0. The resolver returns the record to the client.
13:45:55.660612 02:77:10:00:00:01 > 02:77:10:00:00:10, ethertype IPv4 (0x0800), length 132: 10.77.20.53.53 > 10.77.10.10.43011: 56196* 1/1/1 A 10.77.20.80 (90)
Check your answer
The client on laptop sends one message. The resolver dns sends two. It asks ns a question and sends the answer back to laptop.
| Message | From | To | What it carries |
|---|---|---|---|
| First | laptop |
dns |
Question for web.lab.test A |
| Second | dns |
ns |
Same question |
| Third | ns |
dns |
Answer with 10.77.20.80 |
| Fourth | dns |
laptop |
Answer with 10.77.20.80 |
Match the two question lines by name and type. Then follow the answers back. The listener on dns can see both conversations because both use its interface.
Find who holds the record
Section titled “Find who holds the record”An authoritative server answers from the records of a zone it holds. The server ns holds lab.test, so it is authoritative for that zone. The resolver dns holds no zone of its own in this lab. It asked ns for the record and passed the answer on. The reply to laptop came from dns. The record in it came from ns.
Follow the Internet model
Section titled “Follow the Internet model”The lab uses one level. Its resolver already knows where to send questions for the lab zone. Public DNS has a hierarchy of servers. In the model, laptop asks once for the address of www.example.com. The resolver starts at the root. It follows NS records to the com servers and then to the example.com servers. Those servers supply the example address. The resolver returns it to the client.
A delegation tells the resolver which servers to ask for a part of the hierarchy below the current zone. The two replies marked NS carry those directions. This model leaves out stored answers and the paths the packets take.
Ask both servers directly
Section titled “Ask both servers directly”From laptop, ask 10.77.20.54 for the web address. Then ask 10.77.20.53 the same question. Use @ with the server’s address in both commands. Compare the type and data first.
learner@laptop:~$ dig @10.77.20.54 web.lab.test +noall +answerweb.lab.test. 300 IN A 10.77.20.80learner@laptop:~$ dig @10.77.20.53 web.lab.test +noall +answerweb.lab.test. 300 IN A 10.77.20.80learner@laptop:~$ Steps (6)
- Type
dig @10.77.20.54 web.lab.test +noall +answer - Press Enter
- Output:
web.lab.test. 300 IN A 10.77.20.80 - Type
dig @10.77.20.53 web.lab.test +noall +answer - Press Enter
- Output:
web.lab.test. 300 IN A 10.77.20.80
The record and data match, so dns gave a faithful copy of what ns holds. Only the server you asked changed, as shown by the @ address.
Mistakes to recognize
Section titled “Mistakes to recognize”“My computer asks the website’s server for its address.” Read the first message. Its destination is dns. The web address appears later in the answer.
“The resolver knows every name.” The second message shows where dns went for this answer.
Good to know
Section titled “Good to know”In the listener, A? marks a question for an IPv4 address. The answer line shows the A record’s address. Each lookup can use a different client port. Compare the two lookups in Caching and TTLs to see that number change while the server port stays at 53.
Leave for later
Section titled “Leave for later”Operating DHCP and DNS covers running these servers.
Try it yourself
Section titled “Try it yourself”Ask each server for the text attached to lab.test from laptop. Choose the type. Keep the name and type the same, and change only the server. Write down whether the two answers agree and which server holds the record.
Solution
Use TXT. Both answers give the same text. The zone copy from the previous lesson identifies ns as the server that holds it.
learner@laptop:~$ dig @10.77.20.54 lab.test TXT +noall +answerlab.test. 300 IN TXT "RootVolt networking lab"learner@laptop:~$ dig @10.77.20.53 lab.test TXT +noall +answerlab.test. 300 IN TXT "RootVolt networking lab"learner@laptop:~$ Steps (6)
- Type
dig @10.77.20.54 lab.test TXT +noall +answer - Press Enter
- Output:
lab.test. 300 IN TXT "RootVolt networking lab" - Type
dig @10.77.20.53 lab.test TXT +noall +answer - Press Enter
- Output:
lab.test. 300 IN TXT "RootVolt networking lab"
- The client sends the question to the resolver in its settings.
- The resolver finds the answer and returns it.
- An authoritative server holds the zone. NS records can guide a resolver to it.
Next, Caching and TTLs shows what happens when dns already has an answer.