DNS (Domain Name System) translates human-readable domain names (like www.google.com) into IP addresses (e.g., 216.58.204.68) that are understandable to computers. A picture is worth a thousand words; please see the two diagrams below, which show the most crucial steps, numbered and described.
- Enter www.google.com into the web browser. The computer queries the DNS cache file for entries related to google.com. If found, it returns the IP address to the web browser and displays the website.
- If NOT found, proceed to the next step.
- Step 3 is similar to step 1 but occurs on the ISP side. It is worth mentioning that this scenario is possible only if the router is configured as shown below, where DNS points to the default gateway. If the ISP’s cache file contains the requested address, it returns it to the web browser.
- If the address is still unresolved, proceed to the next step.
5. Step 5 redirects our query to the DNS Resolver, which has three main tasks to complete:
A) Checking Local Cahe – If the address is found in the cache, it is returned immediately, speeding up the process.
B) Querying DNS Servers – if the address is not in the cache, the resolver begins a series of queries to find it.
C) Returning the IP Address – Step 12
From steps 6 to 11, the DNS Resolver starts a series of queries to determine the IP address. Details are provided below the diagram.
[Step 6]: The DNS Resolver sends a query to a root DNS server to find the authoritative DNS server for the top-level domain (TLD) (for example .com). The root server does not know the IP address but can direct the resolver [Step 7] to a TLD name server.
[Step 8]: The DNS Resolver now sends a query to the TLD name server obtained in the previous step, asking for the authoritative name server of the google.com.
[Step 9]: The TLD name server responds to the resolver with the IP address of the authoritative name server for the google.com.
[Step 10]: The DNS Resolver sends the last query to the authoritative name server, asking for the IP address associated with the google.com.
[Step 11]: Finally, the authoritative name server responds with the IP address corresponding to the google.com, and the DNS Resolver can return it to the client.
Key points regarding DNS:
- DNS works mainly on UDP (User Datagram Protocol) port 53. If the request is greater than a single packet, DNS switches to TCP.
- 13 main DNS root servers – https://root-servers.org/
- The most popular DNS resolvers:
Provider: | Primary DNS | Secondary DNS |
8.8.8.8 | 8.8.4.4 | |
Cloudflare | 1.1.1.1 | 1.0.0.1 |
- Using both primary and secondary servers for the same zone is good practice in case of a DNS failure.
- DNS Records:
A | Maps a domain to an IPv4 address |
AAAA | Maps a domain to an IPv6 address |
CNAME | Maps an alias to the canonical domain name |
MX | Specifies the mail server for email |
TXT | Provides text information for external sources |
SRV | Defines server locations for specific services |
- FQDN (Fully Qualified Domain Name) it is a complete domain address that points the web server / computer on the Internet. Example: