DNS
May 2026
DNS (Domain Name System) is a distributed implemented in a hierarchy of many name servers.
It is also an application layer protocol used to query those servers.
DNS services handle hostname-to-IP-address translation, mail server aliasing, load distribution and more.
A DNS query
Say a client wants to query the address for www.amazon.com
- client queries root server to find
.com - client queries
.comserver to getamazon.comserver - client queries
amazon.comserver to get the IP address forwww.amazon.com
TLD servers are responsible for top-level-domains (.com, .tech, etc)
Authoritative DNS servers are an organization’s own DNS server, providing authoritative hostname to IP mappings for organization’s named hosts
Iterated Query
A DNS server may return the address of another server to try querying if the server itself does not contain the address, can be done via a local DNS server which makes the subsequent requests itself instead of relying on the contacted name server.
Recursive Query
Puts the burdern of name resolution on the contacted name server, leads to heavy load at upper levels of the hierarchy
DNS caching
Most if not all name server implementations cache requested queries to improve response time, DNS caches expire for each entry after a TTL (time to live).
Cached entries may be out-of-date until all TTLs expire.
DNS Record Types
A
nameis hostnamevalueis IP address
NS
nameis domainvalueis hostname of authoritative name server for it
CNAME
nameis alias for a canonical namevalueis the canonical name
MX
valueis the name of the SMTP mail server associated withname
DNS Protocol Messages
Query and reply messages have the same format