Pulsars
0 %
Log inSign up

From the domain name to the TCP connection

DNS: name resolution

A domain name like www.example.com is made for humans; machines, on the other hand, communicate with IP addresses. The DNS (Domain Name System) is the distributed directory that translates between the two. Without it, you would have to remember IP addresses instead of site names.

The DNS is organised as a hierarchy, like an inverted tree. Right at the top, the root servers (written ".") do not know the address of example.com, but know who manages the ".com" extension. The servers of the TLD zone (Top Level Domain, like ".com" or ".fr") in turn know which authoritative server manages exactly "example.com". It is this last server that holds the final answer: the exact IP address of www.example.com.

When you type an address in your browser, your computer queries a DNS resolver (often that of your internet provider, or a public service like 1.1.1.1). This resolver does the work of descending the hierarchy for you, question after question - this is called a recursive resolution.

1) PC              -> Resolver          : what is the IP of www.example.com?
2) Resolver        -> Root (.)          : who manages the .com extension?
3) Root (.)        -> Resolver          : here is the .com TLD server
4) Resolver        -> TLD (.com)        : who manages the domain example.com?
5) TLD (.com)      -> Resolver          : here is the authoritative server of example.com
6) Resolver        -> Authoritative     : what is the IP of www.example.com?
7) Authoritative   -> Resolver          : 93.184.216.34
8) Resolver        -> PC                : 93.184.216.34   (answer cached)

Common pitfall: believing that each DNS lookup starts from scratch every time. In reality, the answers are cached (at each level: browser, operating system, resolver) for a duration set by the TTL field of the DNS record itself. As long as this delay has not elapsed, the answer is reused without re-querying the whole chain.

Another pitfall: confusing the domain name and the IP address returned. A single domain name can correspond to several different IP addresses (load balancing across several servers), and a single IP address can host several different domain names (shared hosting).