What is a DNS server
A DNS server stores information about domain names and answers questions about them. When you open a website, a DNS server tells your device the IP address of the site.
Types of DNS servers
Recursive DNS servers
They receive your question and find the answer by asking other servers. They keep answers in a cache, so the next request is fast. Your internet provider, Google (8.8.8.8) and Cloudflare (1.1.1.1) run recursive servers.
Authoritative DNS servers
They hold the actual records of a domain and give the final answer. A domain's name servers (ns1.example.com) are authoritative.
Root DNS servers
They sit at the top of DNS. They know which servers handle each top-level domain such as .com or .org. There are 13 root server addresses, each served by many machines around the world.
TLD DNS servers
They handle one top-level domain, such as .com, .net or country codes like .uk. They tell the resolver which authoritative servers belong to a domain.
Forwarding DNS servers
They do not look up the answer themselves. They pass the questions to another DNS server (a forwarder) and return the result. They are common in company networks and routers.
Stealth (hidden) DNS servers
They are authoritative servers that are not listed in the public NS records. They keep the zone data and send it to the public secondary servers. Attackers cannot target them directly.
Roles of DNS servers
- Name resolution. Turning names into IP addresses (and back, with reverse DNS).
- Load distribution. Giving different addresses to spread traffic.
- Mail routing. Telling which servers get the email of a domain (MX records).
- Caching. Keeping answers for a time (TTL) to speed up lookups.
- Redundancy. Several servers for the same domain keep it online if one fails.
Functions of DNS servers
Name servers
The servers that answer DNS questions for a domain. A domain should have at least two for safety.
Authoritative name servers
They hold the zone and give answers that are not from a cache.
Recursive name servers
They search the DNS tree for the user and cache the answers.
DNS records
The data in the zone: A, AAAA, CNAME, MX, TXT, NS, SOA, SRV and others.
Check which servers a domain uses
dig NS example.com +short
Conclusion
DNS works because each type of server has its own role: resolvers search, authoritative servers answer, and the root and TLD servers point the way. Good DNS gives you fast, reliable access to your site and email.
Quick recap
- Recursive servers ask, authoritative servers answer.
- Root and TLD servers direct the search.