Quick question about the DNS protocol, which I didn't really understand. Let's take a website, say google.com. I type the address in my browser.
The DNS resolver will check the root servers, the GTLD servers. Which will say, if I understand well, "hey, check nsX.google.com to get your answer".
But in that case, how does the resolver know the IP for nsX.google.com, if the answer is held by the nsX.google.com servers themselves ?
disco:~ Disco$ dig +trace ns1.google.com
; <<>> DiG 9.6.0-APPLE-P2 <<>> +trace ns1.google.com
;; global options: +cmd
. 50181 IN NS j.root-servers.net.
[...]
. 50181 IN NS a.root-servers.net.
;; Received 449 bytes from 192.168.1.1#53(192.168.1.1) in 55 ms
com. 172800 IN NS a.gtld-servers.net.
[...]
com. 172800 IN NS m.gtld-servers.net.
;; Received 495 bytes from 199.7.83.42#53(l.root-servers.net) in 165 ms
google.com. 172800 IN NS ns2.google.com.
google.com. 172800 IN NS ns1.google.com.
google.com. 172800 IN NS ns3.google.com.
google.com. 172800 IN NS ns4.google.com.
;; Received 164 bytes from 192.31.80.30#53(d.gtld-servers.net) in 219 ms
ns1.google.com. 345600 IN A 216.239.32.10
;; Received 48 bytes from 216.239.32.10#53(ns1.google.com) in 70 ms
Thanks.
You have authoritative servers (on which the zones are defined) but root servers know which domains are registered on which servers.
In short, you get the "where is ns1.google.com" from a.gtld-servers.net:
This apparent cyclic dependency is resolved by using what are known as "glue" records.
See this answer.