- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
on 10-27-2023 04:50 PM
This Nominated Discussion Article is based on the post "Basic Question about DNS Query " by @perumalj and answered by @reaper .
Scenario : In an organization, a client machine doesn't know IP address of example.com. So it sends DNS query to its local DNS server. Even the local DNS server doesn't know about example.com. Hence, the local DNS server sends DNS query to DNS forwarder. DNS forwarder too doesn't have information about example.com.
However , DNS forwarder is able to do external DNS lookup. Hence, It contacts root DNS server at first.
secondly , It contacts TLD server and later Name server of example.com to get the IP address.
I hope this is how DNS query works for external websites. Please correct me if I am wrong
Question 1: I would like to know if IP address of example.com and IP address of its name server will be same or different.
Question 2 : I would also like to know When DNS forwarder contacts name server of example.com asking for IP address of example.com, it will send normal DNS query as how client machine has sent DNS query for example.com to its local DNS server or it will be different
Response:
Question 1: I would like to know if IP address of example.com and IP address of its name server will be same or different.
- the IP of the nameserver (NS) will most likely be different from the A record pointing to example.com (it's not impossible, just not very common to have the nameserver as the target for an A record). Typically an organization will have an NS record for example.com that points to the dedicated DNS server, and an A record that points to the web frontend, here's an example
% dig any example.com
;; Truncated, retrying in TCP mode.
; <<>> DiG 9.10.6 <<>> any example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40873
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 14, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;example.com. IN ANY
;; ANSWER SECTION:
example.com. 7405 IN NS b.iana-servers.net <- this tells everyone which DNS server is responsible for this record
example.com. 9667 IN A 93.184.216.34 <- this tells every webbrowser which webserver to connect to
Question 2 : I would also like to know When DNS forwarder contacts name server of example.com asking for IP address of example.com, it will send normal DNS query as how client machine has sent DNS query for example.com to its local DNS server or it will be different
- eventually, yes. the final forwarded will go through the hierarchy of dns (root, TLD, and so on) to find out who is the final responsible for a record, until it reaches the 'owner' of a record and then queries it for the A record (as a normal query)
hope this helps