09 Dns
09 Dns
Spring 2018
Tyler Bletsch
Duke University
2
Dynamic Host Configuration Protocol (DHCP)
• DHCP: Allow hosts to enter a network and ask “what IP should I use
for myself?”
• How it works:
1. Client sends an IP broadcast “DISCOVERY” request
(destination 255.255.255.255 UDP port 67)
2. DHCP server on network sends an “OFFER” with
IP address and other config (gateway router,
DNS servers, maybe other stuff)
• Note: multiple offers might be provided by multiple
DHCP servers (but usually it’s just one)
3. Client sends a broadcast REQUEST for one of the offers
4. DHCP server sends ACKNOWLEDGE back
5. Client now has an IP address and basic config info
• DHCP can also be used to start network-boot (PXE), commonly used
for diskless clusters, OS auto-install, etc.
3
Domain Name System (DNS)
(Many slides)
4
Purpose of DNS
• Map an easy-to-remember name to an IP address
• IP Address
IPv4: four numbers separated by decimals, e.g. 120.74.53.1
• Each number called an 'octet' with a value of 0-255
• Some are reserved as special, e.g. 127.0.0.1 = localhost
IPv6: eight hex numbers separated by colons
• Implications
Without DNS, to send IP packet, must remember IP addresses manually!
...and they could change!
With DNS, we can use the name directly:
• www.google.com or www.cnn.com
• DNS also provides inverse look-up that maps IP address to name
5
Design Goals of DNS
• Primary goal is a consistent namespace used to refer to resources
Consistent: same names should refer to same resources
Resources: IP addresses, mail servers
• Enable distributed management
Size of the name database will be large
Updates (changes, additions, removals) will be frequent
• Design goals determine its structure
Hierarchical name space
Distributed directory service
6
Before there was DNS...
• There was the HOSTS.TXT file (or what about /etc/hosts now)
• Maintained at SRI Network Information Center (NIC)
• Before DNS (1985), the name-to-IP address was done by
downloading this single file from a central server with FTP
No hierarchical structure to the file
Still works on most OSes; can be used to define local names
7
DNS Architecture Components
• Domain namespace and resource records
• Name servers
• Name resolution
8
Domain Namespace
.(root)
Top-level domains
org edu com gov
duke mit
ece cs
www smtp
9
Domain Namespace
.(root)
Top-level domains
org edu com gov
duke mit
ece cs
www smtp
10
Domain Names
• Names of hosts can be assigned independent of host locations on a
link layer network or IP network
This means the host name can remain the same
Even if IP address of the host changes (e.g. DHCP)
11
Fully Qualified Domain Names
.(root)
Top-level domains
org edu com gov
duke mit
ece cs
www smtp
12
Top-Level Domains
• Three types of top-level domains:
Generic Top Level Domains (gTLD)
• 3 char code indicates the function of the organization
• Use primarily within the US (e.g. gov, mil, edu, org, com, net)
Country Code Top Level Domain (ccTLD)
• 2 char country or region code (e.g. us, jp, uk)
Reverse Domain
• Special domain used for IP address-to-name mapping
• in-addr.arpa
• More than 200 top-level domains
13
DNS Architecture
• Domain name space and resource records (RRs)
Domain namespace is a hierarchical tree structure
A domain can be delegated to an organization
We'll discuss resource records shortly
• Name servers
Domain name hierarchy exists only in the abstract
A host's name servers are specified in /etc/resolv.conf
• Name resolution
14
Hierarchy of Name Servers
• Resolution of the hierarchical root server
namespace is done by
hierarchy of name servers
• Namespace is partitioned into
zones. A zone is a contiguous
portion of the DNS namespace
com server
• Each server is responsible org server edu server gov server
cs.virginia.edu
server
15
DNS Domains and Zones
• Each zone is anchored at a specific domain node
• A DNS domain is a subtree of the namespace
• A zone is a portion of the DNS namespace
Generally stored in a file
Could consist of multiple nodes
• A server can divide part of its zone and delegate it to other servers
• A name server implements the zone information as a collection of
resource records (RRs)
16
Name Servers
• Each zone has a primary and secondary name server
For reliability
Primary server maintains a zone file with zone info
• Updates made to the primary server
Secondary server copies data stored at the primary server
• Adding a new host:
When new host is added (e.g. “newmachine.ece.duke.edu”)
Administrator adds the IP info on the host (IP address, name) to a
configuration file on the primary server
17
Root Name Servers
• Root name servers know how to find authoritative name servers for
all top-level zones
• There are 13 (virtual) root name servers
• Root servers are critical for proper functioning of name resolution
18
Resource Records
• A zone file includes a collection of Resource Records (RRs)
• (Name, Value, Type, Class, TTL)
Name and Value
Type specifies how the “Value” should be interpreted
• e.g. “NS” means name is a domain and value is name of authoritative
name server for this domain
• e.g. “A” means a machine name and IP address
Class: allows other entities to define record types (“IN” for Internet is most
widely used currently)
TTL: how long should the RR be cached (more on this later)
19
Resource Records
query to the name server of the host HTTP IP address (128.143.71.21) Resolver
IP address (128.143.71.21)
authorized to answer the query.
(neon.tcpip-lab.edu)
Hostname
If yes, it responds.
Otherwise, it will query other name
servers, starting at the root tree
21
Inverse Query
.(root)
duke mit
in-addr
ece cs
www smtp
150.45.38.128
22
Caching
• To reduce DNS traffic, name servers cache info
e.g. Domain name / IP address mappings
• When entry for a query is cached, the server does not contact other
servers
• Note: if an entry is sent from a cache, the reply from the server is
marked as “unauthoritative”
• Caching-only servers
Only purpose is to cache results
Do not contain zone info or a zone database file
23
Negative Caching
• Two kinds of negative responses
Name in question does not exist
Name in record exists, but requested data does not
• Negative responses will be cached too
24
Modern follow-ons
• DNS with DHCP integration
When a new host uses DHCP to get on the network, the DHCP server can tell
the DNS server about it, then the DNS server can answer requests for that
host by name
• Multicast DNS (mDNS) and Link-Local Multicast Name Resolution
(LLMNR)
Resolve hostnames when there’s no local DNS server
Allows “automagic” host discovery on individual networks
Zero configuration – they’re self-organizing protocols
25