08 – DNS: the Domain Name System
Course: ICT Basic course · Level: introductory Book: Kurose & Ross, 9th ed., chapter 2.4 (DNS – the Internet's directory service)
Learning goals
After this article you can:
- explain why we need DNS and which services it provides;
- describe the DNS hierarchy: root, TLD and authoritative servers, and the local resolver;
- explain the difference between iterative and recursive queries, and the role of caching and TTL;
- recognise the most important resource records (A, AAAA, CNAME, NS, MX, TXT, PTR, SOA);
- use
dig,nslookupandhostto query DNS; - explain DNS threats and protections: spoofing/cache poisoning, DNSSEC, DoH/DoT.
1. Why DNS?
- People like names:
www.hva.nl. - Computers and routers need IP addresses:
145.18.x.x(IPv4) or2001:610:...(IPv6).
DNS translates between the two. It is:
- a distributed, hierarchical database spread over millions of servers;
- an application-layer protocol (mostly over UDP port 53; TCP 53 for large answers and zone transfers).
It's a core Internet function, but it runs at the edge as an application, not inside routers.
DNS services
| Service | Example |
|---|---|
| Name → IP address | www.hva.nl → A/AAAA record |
| Host aliasing | www.example.com is an alias (CNAME) for example.cdn-provider.net |
| Mail server aliasing | MX record: mail for @hva.nl goes to Microsoft 365 |
| Load distribution | one name returns several IP addresses, or different answers depending on where you are (CDNs) |
| Other information | TXT (SPF/DKIM/DMARC, domain verification), CAA, HTTPS/SVCB records |
Why not one central DNS server?
It would be a single point of failure, have to handle an enormous traffic volume, be far away for most users, and be impossible to maintain. So DNS is distributed.
2. The DNS hierarchy
1 2 3 4 5 6 7 | |
| Server type | Role | Examples |
|---|---|---|
| Root servers | know the TLD servers | 13 root server identities (a.root-servers.net … m.root-servers.net), operated by 12 organisations, with more than 2,000 instances worldwide using anycast (one IP address, many locations). One of them, k-root, is run by RIPE NCC in Amsterdam |
| TLD servers | know the authoritative servers for every domain under their TLD | generic: .com, .org, .net, .app; country-code: .nl (run by SIDN in Arnhem), .de, .uk; Verisign runs .com |
| Authoritative servers | give the official answer for a domain | run by the organisation itself or by a DNS provider (Cloudflare, AWS Route 53, TransIP...) |
| Local DNS server / recursive resolver | not part of the hierarchy; does the lookup work for clients and caches answers | your ISP's resolver, the company resolver, or public resolvers: 1.1.1.1 (Cloudflare), 8.8.8.8 (Google), 9.9.9.9 (Quad9) |
Updated: older slides show a map of 13 root "servers" with a few locations each. Today there are more than 2,000 root instances (see root-servers.org), so there's almost always one close to you.
3. Resolving a name
Your laptop asks its local resolver. The resolver then walks the hierarchy:
1 2 3 4 5 6 7 | |
- Recursive query (laptop → resolver): "please give me the final answer".
- Iterative queries (resolver → root/TLD/authoritative): "I don't know, but ask that server".
Caching and TTL
Every answer has a TTL (Time To Live) in seconds. Resolvers (and your OS/browser) cache answers until the TTL expires. - Fast: most lookups are answered from cache in a few ms. - The root servers are rarely asked, because TLD information is cached for a long time (TTL of 2 days). - Downside: after you change a record, old answers can remain for up to the TTL ("DNS propagation").
4. Resource records
Format: name TTL class type value
| Type | Meaning | Example |
|---|---|---|
| A | IPv4 address of a host | www.example.nl. 3600 IN A 93.184.215.14 |
| AAAA | IPv6 address of a host | www.example.nl. 3600 IN AAAA 2606:2800:21f:cb07:6820:80da:af6b:8b2c |
| CNAME | alias → canonical name | www.example.nl. IN CNAME example.nl. |
| NS | authoritative name server for a domain | example.nl. IN NS ns1.provider.nl. |
| MX | mail server for a domain (with priority) | example.nl. IN MX 10 mail.example.nl. |
| TXT | free text: SPF, DKIM, DMARC, verification codes | example.nl. IN TXT "v=spf1 -all" |
| PTR | reverse lookup: IP → name | 14.215.184.93.in-addr.arpa. IN PTR www.example.nl. |
| SOA | start of authority: zone information (serial, timers) | |
| CAA | which certificate authorities may issue certificates for the domain | example.nl. IN CAA 0 issue "letsencrypt.org" |
| HTTPS / SVCB | service information: supported protocols (e.g. HTTP/3), alternative endpoints | example.nl. IN HTTPS 1 . alpn="h3,h2" |
5. Try it yourself
Tools: on Debian:
sudo apt install dnsutils(fordig/nslookup). Windows hasnslookupand the PowerShell commandResolve-DnsName.
1 2 3 4 5 6 7 8 9 | |
Questions:
1. What is the TTL of www.hva.nl? Run dig twice on the same resolver. Does the TTL go down?
2. With dig +trace: which root server and which .nl server answered?
3. Does hva.nl have a CAA record? An HTTPS record?
4. Capture a DNS lookup in Wireshark (filter: dns). Which transport protocol and port are used? Find the query ID.
5. Visual explanation: read the comic at https://howdns.works/.
Check your understanding
- Name four services that DNS provides.
- Why is DNS not centralised?
- What is the difference between a recursive and an iterative query?
- What does the TTL of a record do?
- Which record types do you need for a website with IPv4 and IPv6, and for mail?
References
Book
- Kurose & Ross, 9th ed., chapter 2.4
Videos
- PowerCert – How a DNS Server (Domain Name System) works https://www.youtube.com/watch?v=mpQZVYPuDGU
- PowerCert – DNS Records Explained https://www.youtube.com/watch?v=HnUDtycXSNE
- Fireship – DNS Explained in 100 Seconds https://www.youtube.com/watch?v=UVR9lhUGAyU
- ByteByteGo – Everything You Need to Know About DNS https://www.youtube.com/watch?v=27r4Bzuj5NQ
- Code.org – The Internet: IP Addresses & DNS https://www.youtube.com/watch?v=5o8CwafCxnU
Articles and tools
- How DNS works (comic) – https://howdns.works/
- Root server overview and map – https://root-servers.org/
- SIDN (.nl registry) – https://www.sidn.nl/
- RFC 1034 / RFC 1035 – the original DNS specifications – https://www.rfc-editor.org/rfc/rfc1034 · https://www.rfc-editor.org/rfc/rfc1035
Cyber Security
Why is this important for cyber security?
DNS is the "phone book" of the Internet. If DNS lies, you go to the wrong place, even when you type the right address.
| Threat | What happens |
|---|---|
| DNS spoofing / cache poisoning | an attacker sends fake answers to a resolver; the resolver caches them and sends all users to the attacker's server (the Kaminsky attack, 2008, showed how easy this was) |
| DNS hijacking | changing DNS settings on a router or device (malware), or taking over a domain's account at the registrar, so all traffic is redirected |
| Eavesdropping | classic DNS is unencrypted: your ISP, the Wi-Fi owner or an attacker can see every site you visit |
| DNS amplification (DDoS) | attackers send small queries with a spoofed source address; large answers flood the victim |
| DDoS on DNS providers | the 2016 attack on Dyn (Mirai botnet) made Twitter, Netflix and others unreachable |
| Typosquatting / look-alike domains | hva-nl.com, rnicrosoft.com for phishing |
| Subdomain takeover | a CNAME points to a cloud resource that no longer exists; an attacker claims it |
| DNS tunnelling | malware hides data in DNS queries to get past firewalls |
What can you do to make it safe?
- DNSSEC – the owner digitally signs DNS records; validating resolvers check the signatures, so forged answers are rejected. The signatures form a chain of trust from the root down. The .nl domain is one of the most DNSSEC-signed domains in the world (SIDN gave registrars an incentive for it). DNSSEC provides integrity and authenticity, not confidentiality. (Older slides said the reply has a "certificate signed by a Certificate Authority". That's not accurate: DNSSEC uses its own key hierarchy in DNS (DNSKEY/RRSIG/DS records), not CA certificates.)
- Encrypted DNS – protects confidentiality:
- DoT – DNS over TLS (TCP 853)
- DoH – DNS over HTTPS (TCP/UDP 443): built into Firefox, Chrome, Edge, Windows 11, Android, iOS
- DoQ – DNS over QUIC
- Use a trusted, validating resolver, e.g. Quad9 (9.9.9.9), which also blocks known malicious domains. Many companies use protective DNS for this.
- Domain hygiene: turn on registrar lock and MFA at your registrar, remove old (dangling) DNS records, and use CAA records.
- Configure resolvers safely: no open resolvers on the Internet; limit recursion to your own network.
- Monitor DNS logs: many malware infections and data leaks are visible in DNS traffic.
Extra references
- RFC 4033 – DNSSEC introduction – https://www.rfc-editor.org/rfc/rfc4033
- RFC 8484 – DNS over HTTPS – https://www.rfc-editor.org/rfc/rfc8484 · RFC 7858 – DNS over TLS – https://www.rfc-editor.org/rfc/rfc7858
- Internet.nl – check DNSSEC for your domain – https://www.internet.nl/
- Quad9 – https://www.quad9.net/
- SIDN – DNSSEC information – https://www.sidn.nl/