1
CS 168, Spring 2026 @ UC Berkeley
Slides credit: Sylvia Ratnasamy, Rob Shakir, Peyrin Kao, Nicholas Ngai, Nicholas Weaver
DNS
Lecture 14 (Applications 1)
What is DNS For?
Lecture 14, CS 168, Spring 2026
DNS
Application Layer
Lots of applications are built on the Internet infrastructure we've seen.
We'll focus on some common ones:
Physical
Data Link
Network
Transport
Application
7
4
3
2
1
(DNS, HTTP)
(TCP, UDP)
(IP)
(Ethernet)
(Optical fiber, copper)
Domain Names
Recall: Computers are addressed by IP address.
Alternative addressing system: Human-readable domain names.
DNS: Definition
DNS (Domain Name System): An Internet protocol for translating human-readable domain names to IP addresses.
Usage:
74.125.25.99
www.google.com
DNS
Brief History of DNS
On the Internet and ARPANET (its predecessor), three main applications.
Remote terminal (telnet 34.8.12.0):
File transfer (ftp 74.1.254.1):
Email (mail alice@88.1.24.0):
Remembering the remote host address is difficult for humans.
Brief History of DNS
Original design: Computers had a hosts.txt file that mapped names to IP addresses.
Originally maintained by Elizabeth Jocelyn "Jake" Feinler.
Brief History of DNS
Originally, hosts.txt was human-readable.
"I remembered that back then we simply xeroxed the hosts.txt file and put it into the Arpanet Directory, so I copied that." –Elizabeth Feiner
Brief History of DNS
Problems with hosts.txt:
It seems about time to put an end to the absurd situation where each site on the network must maintain a different, generally out-of-date, host list.
Brief History of DNS
First step: Make the file machine-readable.
Scaling is still an issue as the Internet grew.
Check out RFC608 and this 1983 hosts file.
NET : 44.0.0.0 : AMPRNET :
NET : 45.0.0.0 : C3-PR :
NET : 46.0.0.0 : UCB-ETHER :
NET : 47.0.0.0 : SAC-PR-TEMP :
HOST : 46.0.0.4 : UCBARPA : VAX-11/780 : UNIX : TCP/TELNET,TCP/FTP,UDP :
HOST : 46.0.0.5 : UCBCAD : VAX-11/780 : UNIX : TCP/TELNET,TCP/FTP,UDP :
HOST : 46.0.0.6 : UCBERNIE : VAX-11/780 : UNIX : TCP/TELNET,TCP/FTP,UDP :
HOST : 46.0.0.7 : UCBMONET : VAX-11/750 : UNIX : TCP/TELNET,TCP/FTP,UDP :
HOST : 46.0.0.9 : UCBESVAX : VAX-11/780 : UNIX : TCP/TELNET,TCP/FTP,UDP :
HOST : 46.0.0.10 : UCBVAX : VAX-11/780 : UNIX : TCP/TELNET,TCP/FTP,UDP :
Brief History of DNS
DNS was first proposed in RFC882 (1983).
We use this system (with some modifications – but not many) today.
There's a huge amount of DNS history here at UC Berkeley!
The Berkeley Internet Name Domain Server | ||
Douglas B. Terry, Mark Painter, David W. Riggle, Songnian Zhou (UC Berkeley) | 1984 | |
Goals of DNS
DNS must be scalable.
DNS must be highly available.
DNS must be lightweight and fast.
74.125.25.99
www.google.com
DNS
DNS Design
Lecture 14, CS 168, Spring 2026
DNS
DNS Name Servers
Name server: A server on the Internet responsible for answering DNS requests.
DNS is a client-server, request-response protocol.
Issues:
DNS Name Server Hierarchy
Idea #1: If one name server doesn't know the answer to your query, the name server can direct you to another name server.
Idea #2: Arrange the name servers in a tree hierarchy.
. (root)
.edu
.org
.com
google.com
piazza.com
cs161.org
mit.edu
berkeley.edu
DNS Name Server Hierarchy
Each box is a name server. The label represents which queries the name server is responsible for answering.
. (root)
.edu
.org
.com
google.com
piazza.com
cs161.org
mit.edu
berkeley.edu
This name server is responsible for .edu queries like eecs.berkeley.edu, but not a query like mail.google.com.
Steps of a DNS Lookup
Let's walk through a DNS query for the IP address of eecs.berkeley.edu.
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
You
Steps of a DNS Lookup
First, you check your cache to see if you already know the answer to your query.
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
You
Hmm, I don't remember previously seeing the IP address of eecs.berkeley.edu.
Steps of a DNS Lookup
DNS queries always start with a request to the root name server, which is responsible for all requests.
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
You
1
"What is the IP address of eecs.berkeley.edu?"
Steps of a DNS Lookup
The root name server responds by directing you to the correct child name server (in this case, the .edu name server).
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
You
1
"I don't know, but I have delegated authority to the .edu name server."
2
Steps of a DNS Lookup
Next, you ask the same question, but now to the .edu name server.
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
You
1
2
3
"What is the IP address of eecs.berkeley.edu?"
Steps of a DNS Lookup
The .edu name server redirects you to the berkeley.edu name server.
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
You
1
2
3
4
"I don't know. But I have delegated authority to the berkeley.edu name server."
Steps of a DNS Lookup
Next, you ask the same question, but now to the berkeley.edu name server.
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
You
1
2
3
"What is the IP address of eecs.berkeley.edu?"
4
5
Steps of a DNS Lookup
The berkeley.edu name server responds with the answer.
You can cache the answer to avoid having to ask again later.
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
You
1
2
3
"The IP address of eecs.berkeley.edu is 23.185.0.1."
4
5
6
Store this in your cache for the next 24 hours so you don't bother me again with the same request.
Stub Resolvers and Recursive Resolvers
In practice, your computer usually tells another resolver to perform the query for you.
Stub resolver: The resolver on your computer.
Recursive resolver: The resolver that makes the actual DNS queries.
Steps of a DNS Lookup (With Recursive Resolver)
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
Stub Resolver
1
Recursive Resolver
The stub resolver sends the query to the recursive resolver.
Steps of a DNS Lookup (With Recursive Resolver)
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
Stub Resolver
Recursive Resolver
1
6
7
4
5
3
2
The recursive resolver contacts all the name servers to answer the query, as we saw earlier.
Steps of a DNS Lookup (With Recursive Resolver)
. (root)
.edu
.org
cs161.org
mit.edu
berkeley.edu
Stub Resolver
Recursive Resolver
1
8
6
7
4
5
3
2
The recursive resolver returns the final answer to the stub resolver.
Recursive Resolvers
How do we know where the recursive resolver is?
Why are recursive resolvers useful?
Recursive resolvers usually run by ISPs or application providers (Google, Cloudflare).
Recursive Resolver Failures
What happens if a resolver breaks?
Resolvers can be a single point of failure!
DNS Implementation
Lecture 14, CS 168, Spring 2026
DNS
APIs for Developers
What does DNS look like from a developer perspective?
Relatively simple, common APIs that are available in almost all languages.
Example API in C:
Functions usually just make requests to the OS's configured resolving DNS server.
DNS Uses UDP
Recall UDP vs. TCP:
DNS should be lightweight and fast, so it uses UDP.
DNS Uses UDP
What if a packet is dropped?
What if a message doesn't fit in a UDP packet?
Recent advances in DNS use a secure transport protocol, with encryption.
DNS Packet Format: UDP Header
Source port (16 bits): Chosen by the client.
Destination port (16 bits): Usually 53.
Checksum on UDP payload.
Length of UDP payload.
Source Port | Destination Port |
Checksum | Length |
ID number | Flags |
Question count | Answer count |
Authority count | Additional count |
Question Records | |
Answer Records | |
Authority Records | |
Additional Records | |
UDP Payload
UDP Header
DNS Packet Format: DNS Header
ID number (16 bits): Used to associate queries with responses.
Source Port | Destination Port |
Checksum | Length |
ID number | Flags |
Question count | Answer count |
Authority count | Additional count |
Question Records | |
Answer Records | |
Authority Records | |
Additional Records | |
DNS Payload
UDP Header
DNS Header
DNS Packet Format: DNS Header
Flags:
Counts: The number of records of each type in the DNS payload.
Source Port | Destination Port |
Checksum | Length |
ID number | Flags |
Question count | Answer count |
Authority count | Additional count |
Question Records | |
Answer Records | |
Authority Records | |
Additional Records | |
DNS Payload
UDP Header
DNS Header
DNS Packet Format: DNS Payload
The DNS payload contains a variable number of resource records (RRs).
Each RR is a name-value pair.
RRs are sorted into four sections:
Source Port | Destination Port |
Checksum | Length |
ID number | Flags |
Question count | Answer count |
Authority count | Additional count |
Question Records | |
Answer Records | |
Authority Records | |
Additional Records | |
DNS Payload
UDP Header
DNS Header
DNS Record Format
Each record is a name-value pair with a type.
Each record also contains some metadata.
DNS Record Sections
Question section: What is being asked.
Answer section: A direct response to the question.
DNS Record Sections
Authority section: A delegation of authority for the question.
Additional section: Additional information to help with the response, sometimes called glue records.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
You can try this at home! Use the dig utility in your terminal, and remember to set the +norecurse flag so you can traverse the name server hierarchy yourself.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
We are performing a DNS lookup for the IP address of eecs.berkeley.edu.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
DNS queries always start with a request to the root name server. The IP address of the root name server is usually hard-coded into recursive resolvers.
Operators can also configure a root hints file with the root addresses, like this: https://www.internic.net/domain/named.root
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
Here's the DNS response from the root name server.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
Here's the DNS header.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
Here's the 16-bit ID number in the DNS header.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
Here are the flags in the DNS header.
Here are the record counts in the DNS header.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
Here's the DNS payload. It's a collection of resource records (one per line), sorted into four sections.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
Here's the question section. The name is eecs.berkeley.edu, the type is A, and the value is blank. It shows that we are looking for the IP address of eecs.berkeley.edu.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
The answer section is blank, because the root name server did not return the answer we're looking for.
We can confirm this by checking the header, which says there are 0 records in the answer section.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
The authority and additional sections tell the resolver where to look next.
Note that there are multiple .edu name servers for redundancy.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
For redundancy, there are usually several name servers for each zone. Any of them will usually work. Let's pick the first one.
This NS record says that a.edu-servers.net is a .edu name server.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @198.41.0.4
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26114
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS b.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
...
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
b.edu-servers.net. 172800 IN A 192.33.14.30
c.edu-servers.net. 172800 IN A 192.26.92.30
...
This A record helpfully tells us the IP address of the next name server we mean to contact.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @192.5.6.30
Next, we query the .edu name server. We know the IP address of the .edu name server because the root name server gave the information to us.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @192.5.6.30
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36257
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 3, ADDITIONAL: 5
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; AUTHORITY SECTION:
berkeley.edu. 172800 IN NS adns1.berkeley.edu.
berkeley.edu. 172800 IN NS adns2.berkeley.edu.
berkeley.edu. 172800 IN NS adns3.berkeley.edu.
;; ADDITIONAL SECTION:
adns1.berkeley.edu. 172800 IN A 128.32.136.3
adns2.berkeley.edu. 172800 IN A 128.32.136.14
adns3.berkeley.edu. 172800 IN A 192.107.102.142
...
The answer section is blank again. The authority and additional section tell us to query a berkeley.edu name server, and provide us with the IP address of the next name server.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @128.32.136.3
Next, we query the berkeley.edu name server for the IP address of eecs.berkeley.edu. We know the IP address of the berkeley.edu name server because the root name server gave the information to us.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @128.32.136.3
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52788
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; ANSWER SECTION:
eecs.berkeley.edu. 86400 IN A 23.185.0.1
The answer section has one A type record. It tells us that the IP address of eecs.berkeley.edu is 23.185.0.1.
DNS Lookup Walkthrough
$ dig +norecurse eecs.berkeley.edu @128.32.136.3
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52788
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;eecs.berkeley.edu. IN A
;; ANSWER SECTION:
eecs.berkeley.edu. 86400 IN A 23.185.0.1
Here's the time-to-live (TTL) field in the record. It tells us that we can cache this answer for 86,400 seconds (24 hours).
We finished our original query!
Let's try a few other queries.
DNS Lookup Walkthrough
$ dig +norecurse repo.eecs.berkeley.edu @128.32.136.3
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25192
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;repo.eecs.berkeley.edu. IN A
;; ANSWER SECTION:
repo.eecs.berkeley.edu. 21600 IN CNAME repo-2.eecs.berkeley.edu
repo-2.eecs.berkeley.edu 21600 IN A 128.32.138.46
New record type: CNAME tells us that repo.eecs.berkeley.edu is actually an alias (alternate name) for repo-2.eecs.berkeley.edu.
Let's try asking for a different domain.
Then, the A record tells us the IP address for the true name, repo-2.eecs.berkeley.edu.
DNS Lookup Walkthrough
$ dig +norecurse repo.eecs.berkeley.edu AAAA @128.32.136.3
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25192
;; flags: qr aa; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;repo.eecs.berkeley.edu. IN AAAA
;; AUTHORITY SECTION:
eecs.berkeley.edu. 1971 IN SOA ns.eecs.berkeley.edu, dns.eecs.berkeley.edu, 100012225 10887 3600 604800 86400
Let's try specifically requesting the IPv6 address.
The answer section is blank, because this domain does not have an IPv6 address.
We got some information about who's operating the zone.
Scaling DNS
Lecture 14, CS 168, Spring 2026
DNS
DNS Hierarchy
The DNS tree represents 3 forms of hierarchy.
Names are hierarchical. This is why our domain names are words separated by dots.
ischool
berkeley
math
eecs
rise
repo
pink
edu
. (root)
pink.ischool.berkeley.edu.
rise.eecs.berkeley.edu.
DNS Hierarchy
Authority is hierarchical. Each organization manages a zone, and can delegate parts of the zone to other organizations.
ischool
berkeley
math
eecs
rise
repo
pink
edu
. (root)
UC Berkeley owns the berkeley.edu zone.
UC Berkeley gives the eecs.berkeley.edu zone to the EECS department.
DNS Hierarchy
Infrastructure is hierarchical. Each name server only needs to know about a subset of domains.
ischool
berkeley
math
eecs
rise
repo
pink
edu
. (root)
I have to answer all berkeley.edu queries.
For eecs.berkeley.edu queries, I can redirect users to that name server.
DNS Hierarchy
Each node in the tree represents a zone of domains.
An organization managing a zone can delegate part of its zone to somebody else.
Each zone has an authoritative name server that knows about the domains in that zone.
The berkeley.edu zone
Owned by: UC Berkeley
Name server: adns1.berkeley.edu
Manages:
www.berkeley.edu
calcentral.berkeley.edu
systemstatus.berkeley.edu
...
The ischool.berkeley.edu zone
Owned by: School of Information
Name server: is-dns.berkeley.edu
Manages:
pink.ischool.berkeley.edu
blue.ischool.berkeley.edu
...
The eecs.berkeley.edu zone
Owned by: EECS Department
Name server: cs-dns.berkeley.edu
Manages:
repo.eecs.berkeley.edu
rise.eecs.berkeley.edu
...
DNS Hierarchy
A zone corresponds to an administrative authority response for some part of the hierarchy.
Zones help DNS scale.
Administrative Authorities
The DNS root is controlled by ICANN.
. (root)
uk
org
edu
com
jp
fr
...
...
co
ac
amazon
Administrative Authorities
Top-level domains (TLDs) are the zones directly below root.
. (root)
uk
org
edu
com
jp
fr
...
...
co
ac
amazon
TLDs
Administrative Authorities
Second-level domains, third-level domains, etc. are below TLDs.
. (root)
uk
org
edu
com
jp
fr
...
...
co
ac
amazon
TLDs
Second-level domains
Third-level domains
Administrative Authorities
Users can lease specific domains from domain registries (e.g. Verisign).
Organizations (e.g. Google, Amazon) can operate their own zones, with their own name servers.
Zone Availability
Recall: Each zone has several name servers for redundancy.
Zones "must" have two authoritative name servers.
The name servers work in a primary/secondary model.
"Must" = it's standard practice, and many registrars require it.
Root Zone Availability with Anycast
It would be really bad if the root servers were unavailable.
Root servers use a trick called anycast to ensure high availability.
Anycast: Use the same IP address for many servers on the Internet.
Anycast can also be used for other highly-available services (e.g. the 8.8.8.8 resolver).
Root Zone Availability with Anycast
Which instance am I actually using?
$ dig +short +norec @k.root-servers.net hostname.bind chaos txt
"ns1.us-mia.k.ripe.net"
"us-mia" is probably Miami, Florida.
All of these servers are advertising themselves as k.root-servers.net, with IP 193.0.14.129.
Lots of cooperation between network operators to keep root servers highly available.
Other Uses of DNS
Lecture 14, CS 168, Spring 2026
DNS
Other Uses of DNS: Email
DNS can store and serve more than just domain-to-IP mappings. Example: Email.
$ dig eecs.berkeley.edu MX
;; ANSWER SECTION:
eecs.berkeley.edu 10549 IN MX 1 aspmx.l.google.com
eecs.berkeley.edu 10549 IN MX 5 alt1.aspmx.l.google.com
eecs.berkeley.edu 10549 IN MX 5 alt2.aspmx.l.google.com
eecs.berkeley.edu 10549 IN MX 10 alt4.aspmx.l.google.com
eecs.berkeley.edu 10549 IN MX 10 alt3.aspmx.l.google.com
Gmail mail servers.
Priorities.
DNS for Load-Balancing
Multiple servers with different IP addresses can all host the same application.
;; ANSWER SECTION:
microsoft.com. 1999 IN A 20.112.250.133
microsoft.com. 1999 IN A 20.231.239.246
microsoft.com. 1999 IN A 20.76.201.171
microsoft.com. 1999 IN A 20.70.246.20
microsoft.com. 1999 IN A 20.236.44.162
DNS for Load-Balancing
The name server can give different responses based on where the query came from.
How do we determine which response to give?
$ dig google.com +short
142.251.46.238
$ dig google.com +short
74.125.135.113
From California:
From Oregon:
DNS for Load-Balancing
Challenges with geographical load-balancing:
DNS for Load-Balancing
Load-balancing experiment:
Another load-balancing experiment:
Mapping logic gave us a way to map a client to a better-performing server.
$ host 2607:f8b0:4005:80d::200e
e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.d.0.8.0.5.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa domain
name pointer sfo03s25-in-x0e.1e100.net.
Doing a "reverse" DNS lookup from IP address to hostname:
Summary: DNS