Module 1 · Addresses, Subnets and Packets · Lesson 4 of 9

DNS lookups in a capture

Run nslookup during a capture, pair each query with its reply by transaction ID, and read the record returned.

In this lesson · about 26 minutes

  • Explain what a DNS query and response contain
  • Match a query to its response with the transaction ID
  • Recognise common record types and when DNS uses TCP

Whiteboard · watch and try

From a name to a number

Press Play. The tutor follows one lookup from your laptop to the server that knows the answer.

5 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.

The Domain Name System turns names like example.com into addresses. Your computer asks a resolver (a DNS server set by DHCP or by hand), which answers from its cache or asks other servers.

What's in a lookup

  • Transaction ID: a random number the client puts in the query. The reply carries the same ID, which is how you pair them in a busy capture.
  • Query name and type: what is being asked, such as example.com type A.
  • Answer: the record returned, with a time-to-live (TTL) saying how long it can be cached.
RecordHolds
AAn IPv4 address
AAAAAn IPv6 address
CNAMEAn alias pointing to another name
MXThe mail server for a domain
TXTFree text, often used for email security (SPF, DKIM, DMARC) and domain verification
PTRA reverse lookup: address to name

UDP and TCP

Most lookups use UDP port 53 because it's quick. DNS also uses TCP port 53 for large responses that don't fit (the server sets a "truncated" flag and the client retries over TCP) and for zone transfers between servers. A firewall that blocks 53/TCP can break DNS in odd, intermittent ways.

Try it · watch it move

Follow a name lookup (DNS)

Step through a lookup the resolver has never seen, then turn on the cache and look it up again. Notice the ID on the question and the answer.

💻Your laptop10.10.10.20📒Resolver10.10.10.53 :53🌳Root serverknows who has .com🏷️.com serverknows example.com's NS🏠example.com's serverthe real answerexample.com? #3f2a

The resolver's notebook (cache)

nothing about example.com yet

Step 1 of 7You type example.com. But computers connect using numbers (IP addresses), the way you need a phone number to call a person. So your laptop asks its resolver: “What's the number for example.com?” It tags the question with ID 0x3f2a.

Hands-on lab (simulated terminal)

Lab: pair a DNS query with its reply

Your lab resolver is 10.10.10.53. A capture is already running and will save to dns.pcap. Synthetic data: the addresses below are documentation and lab addresses.

Step 1 of 3. Type each command and press Enter. Nothing runs on your computer.

Lab: pair a DNS query with its reply

1. Look up example.com with nslookup.

analyst@lab-client:~$

Check your understanding0 of 3 correct

Question 1

1.Why might a DNS lookup use TCP?

Question 2

2.In a busy capture, how do you pair a DNS query with its reply?

Question 3

3.Which record type holds an IPv6 address?

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

Noviq Academy is free and for learning. Every lab here is simulated with synthetic data and private lab addresses. Only capture traffic and test networks that you own or have written permission to test. Wireshark and pfSense are trademarks of their owners; this course is independent of them.