* in no particular order
DNS:Â Domain Name System
DNS is a system that translates human-readable domain names into IP addresses.
📖 It's like a phonebook for the internet.
Although it's started as a system to convert names to IP addresses, it's now a distributed system of servers that store and serve DNS records.
DNS records are the data that DNS servers store and serve.
There are different types of DNS records, each with a different purpose.
The most common types of DNS records are A, AAAA, CNAME, MX, and TXT.
| Type | Description |
|---|---|
| A | IPv4 address |
| AAAA | IPv6 address |
| CNAME | Canonical name |
| MX | Mail exchange |
| TXT | Text record |
* there are a lot more types of DNS records, but these are the most common.
It's a distributed sytem of servers that store and serve DNS records.
www.example.com
translates to
www.example.com.
www.example.com.
The domain name is broken down into parts:
| Part | Description |
|---|---|
| . | The root domain |
| com | The top-level domain (TLD) |
| example | The domain (apex domain) |
| www | The subdomain |
generally the domain name resolution is not done by the end user device, but by the recursive resolver.
the recursive resolver is responsible for resolving the domain name part by part.
The recursive resolver caches the results for a certain period of time.
The recursive resolver then returns the result to the end user device.
The end user device then uses the result to access the website.
Practical Examples
Stub Resolvers
Stub Resolvers just aggrigate and forward the requests to the recursive resolvers.
also serves local dns records like /etc/hosts, C:/Windows/System32/drivers/etc/hosts etc.
example stub resolvers
| Stub Resolver | OS | Description |
|---|---|---|
| systemd-resolved | Linux | The default resolver on most Linux distributions. |
| dnsmasq | Linux, MacOS | Highly configurable DNS, DHCP, and TFTP server. |
| coredns | Linux, MacOS, Windows | Highly configurable DNS server. Common in Kubernetes clusters. |
| mDNSResponder | MacOS | Apple's native DNS server. Used for Bonjour and AirPlay. |
Recursive Resolvers
Recursive Resolvers are the servers that resolve the domain names.
these actually query the DNS servers part by part and cache the result and return the result to the stub resolver.
DNSSEC validation happens at Recursive Resolver level.
Free recursive resolver services:
Paid recursive resolver services:
Recursive Resolver softwares:
Notable DNS forwarders:
My Previous DNS Setup at home
all devices were connected to tailscale overlay network.
all devices were using tailscale's DNS configuration.
Tailscale is configured to use AdGuard Home server hosted on my home server.
Demo
AdGuard Home is a DNS server that can be used to block ads, trackers, and other unwanted content.
Root Servers & Root Zone
Root Servers are the top-level servers that store and serve the root zone.
https://www.iana.org/domains/root/serversroot hints
root hints are the DNS records that point to the root servers.
these are hardcoded in recursive resolvers.
these are updated periodically by IANA, and most of the recursive resolvers are configured to use the latest root hints.
https://www.internic.net/domain/named.rootTLDs and TLD servers
TLDs are the top-level domains like .com, .org, .net, .in, .co.in, etc.
TLD servers are the servers that store and serve the TLD zone which contains list of all registered domains of that TLD.
Types of TLDs
DNS Governance
DNS is governed by IANA, which is a division of ICANN.
TLD server infrastructure
Story about .local TLD in my home network
Interesting Tools
https://dns.coffee/Authoritative Servers
Authoritative Servers are the servers that store and serve the zone files for the domains.
Deligating subdomains to other servers is possible and is a common practice.
commercial authoritative hosting services
self hosing software
My DNS setup for rka.xyz
I'm using CoreDNS as my authoritative server.
I have redundant servers in different regions and clouds for high availability.
Anycast vs Unicast DNS Servers
https://rka.xyz/blog/anycast-dns/DNS Caching
DNS Caching is the process of storing the results of DNS queries in a cache.
DNS caching is done by the recursive resolvers and the stub resolvers.
How TTL works?
TTL is the time to live for the DNS record.
TTL is the time for which the DNS record is cached.
TTL is the maximum time for which the DNS record is cached including all levels of caching.