I'll break down the complete recursive DNS query flow for resolving example.com, showing the source and destination IP addresses and ports at each step:
- Initial Client Query:
Source: 192.168.10.10:32456 -> Destination: 192.168.20.2:53
Query: "What is the IP address of example.com?"
- Primary DNS to Root Server:
Source: 20.20.20.20:34567 -> Destination: 30.30.30.30:53
(NAT translates 192.168.20.2 to 20.20.20.20)
Query: "What is the IP address of example.com?"
- Root Server Response:
Source: 30.30.30.30:53 -> Destination: 20.20.20.20:34567
Response: "Ask the .com TLD server at 40.40.40.40"
- Primary DNS to TLD Server:
Source: 20.20.20.20:34567 -> Destination: 40.40.40.40:53
Query: "What is the IP address of example?"
- TLD Server Response:
Source: 40.40.40.40:53 -> Destination: 20.20.20.20:34567
Response: "Ask authoritative server at 50.50.50.50"
- Primary DNS to Authoritative Server:
Source: 20.20.20.20:34567 -> Destination: 50.50.50.50:53
Query: "What is the IP address of example.com?"
- Authoritative Server Response:
Source: 50.50.50.50:53 -> Destination: 20.20.20.20:34567
Response: "example.com's IP address is 60.60.60.60"
- Final Response to Client:
Source: 192.168.20.2:53 -> Destination: 192.168.10.10:32456
Response: "example.com's IP address is 60.60.60.60"
Key points:
- The primary DNS server maintains the original client's query while making its own recursive queries
- The firewall NAT address (20.20.20.20) is used for all external queries
- Each server in the chain responds with either an answer or a referral to the next server
- The source port (34567) used by the primary DNS server typically remains the same throughout its queries
- Port 53 is the standard DNS port used by all DNS servers