DNS turns names people can remember into addresses routers can process. It does that job for almost every other application, and neither they nor you ever talk to it directly.
Words you will meet
- DNS — Domain Name System: the Internet’s directory service.
- Hostname — the readable name of a host, such as
www.example.edu. - Host aliasing — giving one machine a short easy name as well as its long official one.
- Canonical hostname — a machine’s one real, official name.
- Alias hostname — a short nickname that stands for it.
- Load distribution — spreading visitors over several identical servers.
Why this matters
Everything in section 2.2 assumed the browser already knew the server’s address. It did not. Something had to find it first, and that something runs before the clock on every measurement in that section started.
DNS (Domain Name System) Domain Name System Translates a human-friendly name such as www.ietf.org into a network address. introduced in ch. 1 is also the best example in this chapter of a distributed database, and section 2.4.2 is worth the effort for that reason alone. Almost nothing else you will study is designed to be run by hundreds of thousands of separate organisations that do not trust each other.
Two ways to name the same host
People can be identified in many ways: the name on a birth certificate, a national identity number, a driver’s licence number. Each works, but within a given context one is more appropriate than another. Tax computers prefer fixed-length numbers. Ordinary people prefer names.
Everyday picture
Imagine introducing yourself by your identity number: “Hi. My name is 132-67-9875. Please meet my husband, 178-87-1146.”
The number is perfectly good for a computer that has to sort a million records. It is useless for a human being who has to remember one.
Where the picture breaks: your identity number does not tell anyone where you live. An IP (Internet Protocol) Internet Protocol The network-layer protocol that defines the datagram format and addressing every Internet device must use. introduced in ch. 1 address does say roughly where a host sits in the Internet, and that is the whole reason routers can work with it. So the two identifiers differ in more than readability.
Internet hosts are the same. One identifier is the
hostname hostname Simple The readable name of a host, such as www.example.edu. Precise A mnemonic identifier for a host, made of variable-length alphanumeric characters. Hostnames are appreciated by humans but give little information about where the host sits in the Internet, and their variable length makes them difficult for routers to process. This is why hosts are also identified by IP addresses.
introduced in ch. 2 — open in glossary
— www.facebook.com, www.google.com,
gaia.cs.umass.edu. These are mnemonic and therefore appreciated by humans.
But hostnames have two problems for machines:
- They provide little information about location. A hostname ending
.frsuggests France, but says nothing more. - They consist of variable-length alphanumeric characters, which would be difficult for routers to process.
For these reasons hosts are also identified by IP (Internet Protocol) Internet Protocol The network-layer protocol that defines the datagram format and addressing every Internet device must use. introduced in ch. 1 addresses.
An IP address consists of four bytes and has a rigid hierarchical structure.
It looks like 121.7.106.83, where each period separates one byte written in
decimal from 0 to 255. It is hierarchical because scanning it from left to
right gives more and more specific information about where the host sits: within
which network, in the network of networks. Chapter 4 covers this in detail.
What DNS provides
People prefer the mnemonic name. Routers prefer the fixed-length, hierarchically structured address. To reconcile the two we need a directory service that translates one into the other.
DNS is two things at once
The domain name system domain name system Simple The Internet’s directory: it turns names like www.example.edu into IP addresses. Precise The DNS is (1) a distributed database implemented in a hierarchy of DNS servers and (2) an application-layer protocol that allows hosts to query that database. Its main task is translating hostnames to IP addresses. The protocol runs over UDP on port 53. DNS servers often run the Berkeley Internet Name Domain software. Unlike the Web or e-mail, users never interact with DNS directly. introduced in ch. 2 — open in glossary is:
- a distributed database implemented in a hierarchy of DNS servers, and
- an application-layer protocol that allows hosts to query that database.
DNS servers are often UNIX machines running the Berkeley Internet Name Domain software ( BIND (Berkeley Internet Name Domain) Berkeley Internet Name Domain The software most DNS servers run. introduced in ch. 2 ). The DNS protocol runs over UDP (User Datagram Protocol) User Datagram Protocol A simple transport protocol with no reliability, no flow control and no congestion control. introduced in ch. 1 and uses port 53.
Why UDP, and not TCP (Transmission Control Protocol) Transmission Control Protocol The Internet transport protocol that delivers data reliably and in order, with flow control and congestion control. introduced in ch. 1 ?
Section 2.1.4 said TCP costs a handshake before any data moves. A DNS exchange is usually one small query and one small reply. Paying a full connection setup for two messages would more than double the cost.
Chapter 3 returns to this trade-off properly. For now, notice that the protocol almost every other application depends on chose the one with no guarantees.
A lookup, step by step
DNS is commonly employed by other application-layer protocols — including HTTP (HyperText Transfer Protocol) HyperText Transfer Protocol The application-layer protocol that requests and transfers Web documents.
introduced in ch. 1
and SMTP (Simple Mail Transfer Protocol) Simple Mail Transfer Protocol The application-layer protocol that transfers e-mail messages.
introduced in ch. 1 — to translate user-supplied hostnames to IP addresses.
Here is what happens when a browser requests
www.someschool.edu/index.html.
There is no separate program to install and no service to subscribe to. The client side of the DNS application runs on the very machine that needs the answer, alongside the browser.
Five steps, and the browser cannot skip any of them. Step forward and watch what the browser knows at each point.
Read all steps as text
- 1 — The same machine runs a DNS client — There is no separate program to install and no service to subscribe to. The client side of the DNS application runs on the very machine that needs the answer, alongside the browser.
- 2 — The browser extracts the hostname — From the URL http://www.example.edu/index.html the browser takes just the hostname part, www.example.edu, and passes it to the DNS client. The path name /index.html is not DNS’s business.
- 3 — The DNS client sends a query — A query containing the hostname goes to a DNS server. All DNS query and reply messages travel inside UDP datagrams, to port 53.
- 4 — A reply comes back with the IP address — After a delay ranging from milliseconds to seconds, the reply arrives. From the browser’s point of view DNS is a black box that turned a name into an address. Section 2.4.2 opens that box, and it is far from simple inside.
- 5 — Only now can TCP begin — With the IP address in hand, the browser initiates a TCP connection to the HTTP server process at port 80 at that address. Everything §2.2.2 measured starts here — the DNS lookup happened before the clock in that section started.
Click any arrow to see what that message says and why it is sent.
The same page load as §2.2.2, with the lookup that has to happen first. Click the last arrow for the arithmetic.
Read this diagram as text
- Lin’s laptop sends DNS query: www.example.edu to Local DNS server (5 ms). The local DNS server sits inside Lin’s access ISP, a few kilometres away, so this hop is short. It is carried in a UDP datagram — no connection is established first, which matters when the whole exchange is two messages.
- Local DNS server sends DNS reply: 198.51.100.7 to Lin’s laptop (5 ms). This assumes the answer was already cached at the local DNS server, which §2.4.2 shows is the common case. If it was not, this server must walk the hierarchy first, and the reply takes far longer.
- Lin’s laptop sends SYN to www.example.edu (90 ms).
- www.example.edu sends SYN, ACK to Lin’s laptop (90 ms).
- Lin’s laptop sends ACK + GET /index.html to www.example.edu (90 ms).
- www.example.edu sends index.html, then the rest of the page to Lin’s laptop (90 ms). Section 2.2.2 measured this page at 569.8 ms — 3 RTT plus 29.76 ms of transmission. The cached DNS lookup adds about 10 ms on top, so the real total is roughly 580 ms. An uncached lookup can add far more, which is why §2.4.2 spends so long on caching.
Lifelines, left to right: Lin’s laptop (host), Local DNS server (server), www.example.edu (server).
DNS adds delay to everything
From the invoking application’s point of view, DNS is a black box providing a simple translation service. But the box costs time, and that time is added to every application that uses it.
In the ladder above the lookup takes about 10 ms, because the answer was already cached at the local DNS server. That is the common case, and section 2.4.2 explains why. When it is not cached, the delay can be far larger — the book says it ranges from milliseconds to seconds.
Notice where this leaves the arithmetic of section 2.2.2. Lin’s page took 569.8 ms there. With a cached lookup the honest figure is about 580 ms, and the extra was never mentioned because the clock in that section started after the address was already known.
The other three services
Translating hostnames is DNS’s main task, but not its only one. It provides three more, and each is worth naming.
Host aliasing host aliasing Simple Giving one machine a short easy name as well as its long official one. Precise A DNS service in which a host with a complicated hostname can have one or more alias names. DNS can be invoked by an application to obtain the canonical hostname for a supplied alias hostname, as well as the IP address of the host. introduced in ch. 2 — open in glossary lets a host with a complicated name also answer to simpler ones. The complicated one is its canonical hostname canonical hostname Simple A machine’s one real, official name. Precise The true hostname of a host, behind which alias hostnames may stand. For example relay1.west-coast.enterprise.com may be the canonical hostname for the aliases enterprise.com and www.enterprise.com. introduced in ch. 2 — open in glossary .
Each simpler name is an alias hostname alias hostname Simple A short nickname that stands for a machine’s real name. Precise A more mnemonic name for a host whose canonical hostname is longer or less memorable. A CNAME record maps an alias hostname to its canonical hostname, and an MX record does the same for a mail server. This is why a company’s Web server and mail server can share one aliased name. introduced in ch. 2 — open in glossary , and aliases are typically more mnemonic. Mail server aliasing does the same for e-mail, which is why nobody has to type a mail server’s real name.
And load distribution load distribution Simple Spreading visitors over several identical servers by rotating the order of the addresses. Precise A DNS service in which a set of IP addresses is associated with one alias hostname. The server responds with the entire set but rotates the ordering of the addresses within each reply. Because a client typically sends its request to the address listed first, DNS rotation distributes traffic among the replicated servers. It is used for mail servers as well as Web servers. introduced in ch. 2 — open in glossary spreads visitors across a set of replicated servers.
| What it lets you do | How | |
|---|---|---|
| The MX record lets a company’s mail server and web server have the same aliased name — enterprise.com for both. A client asks for MX to reach the mail server, and CNAME to reach the other. The record type is part of the question. | ||
Cells marked ⓘ have an explanation — click to read it. Sortable columns have a ↕ in the heading.
Three more services. Click a ⓘ for the example the book gives.
In plain words
All three extra services are the same trick: let one name stand for something else, and let the questioner say which kind of answer it wants.
That single idea buys a great deal. A company can publish one short name for both its website and its mail. A site can be replicated across a dozen machines without anyone noticing. And section 2.6.3 will show content distribution companies such as Akamai using it to steer you to a nearby server. They do that without changing a single link on the page you clicked.
Principles in practice — a core function, built at the edge
Like HTTP, FTP (File Transfer Protocol) File Transfer Protocol An application-layer protocol for transferring files between two hosts. introduced in ch. 1 and SMTP, DNS is an application-layer protocol. It runs between communicating end systems using the client-server paradigm, and it relies on an underlying transport protocol to carry its messages.
But its role is different from the Web, file transfer and e-mail. DNS is not an application a user interacts with. It provides a core Internet function — the translation of hostnames to addresses — for user applications and other software.
Section 1.2 noted that much of the complexity in the Internet architecture is located at the edges of the network. DNS, which implements this critical translation using clients and servers at the edge, is another example of that design philosophy.
DNS is specified in RFC (Request For Comments) Request For Comments The name of an IETF standards document. There are currently nearly 9000 of them. introduced in ch. 1 1034 and RFC 1035, updated by several further RFCs. It is a complex system, and this chapter touches only the key aspects of its operation.
Check yourself
Check yourself
0 of 6 answered1.Hosts have two kinds of identifier. Why keep both instead of settling on one?
2.What are the two things DNS actually is?
3.predictLin's browser is told to load http://www.example.edu/index.html. In the ladder above, what has to finish before the very first TCP segment can be sent?
4.A company's web server and mail server are both reachable as `enterprise.com`. How can one name mean two different machines?
5.A busy site is replicated over several servers with different IP addresses. How does DNS spread visitors across them?
6.The Principles in Practice box calls DNS an example of a design philosophy from chapter 1. Which one, and why does DNS illustrate it?
What to remember
- A host has two identifiers: a hostname for people and an IP address for routers. Names are variable-length and say little about location; addresses are four bytes and hierarchical.
- DNS is two things: a distributed database in a hierarchy of servers, and an application-layer protocol for querying it.
- A browser must complete the lookup before it can open a TCP connection. DNS delay is added to every application that uses it.