Computer Communications
& Networks
CSNC-2413
Lec: 10
• Domain Name System (DNS) Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
Chapter 2: outline
2.1 Principles of network applications
2.2 Web and HTTP
2.3 FTP
2.4 Electronic mail
SMTP, POP3
2.5 DNS
2.6 P2P applications
2.7 Socket programming with UDP and TCP
2
DNS: domain name system
Internet hosts, routers: Domain Name System:
IP address (32 bit), distributed database:
used for addressing in implemented in hierarchy of
datagrams many name servers
hard to remember application-layer protocol:
“name”, allows hosts to query name
e.g, www.yahoo.com, servers to resolve names
used by humans (address/name translation)
Q: how to map between IP
Note
address and name, and
vice versa ? DNS protocol : UDP port 53
Used by applications e.g HTTP,
FTP,
3
DNS: resolving hostname
Example: When browser on a host requests a URL, the host
obtains IP address of destination using DNS:-
host runs client side of DNS application
browser gets hostname from URL and passes to DNS client
DNS client sends DNS Query for hostname to DNS Server
DNS client eventually receives DNS Reply, containing IP address
for the hostname
browser can now initiate TCP connection to HTTP server
On Unix, applications call gethostbyname()
to invoke DNS
4
DNS services
DNS services why not centralize DNS?
Hostname to IP address translation single point of failure
Host aliasing:
traffic volume
simple alias names for difficult
distant centralized database
canonical (real) hostnames updation
www.ibm.com is an alias for
servereast.backup2.ibm.com A: doesn’t scale!
Mail Server aliasing:
keeps email addresses simple
hotmail.com is an alias for relay1.west-coast.hotmail.com
Load distribution:
replicated Web servers: many IP addresses correspond to one name
5
The DNS Name Space
Hostnames assigned to machines from a Name Space
Internet Domain Name Space is hierarchical
each name comprises parts – (domains, sub-domains)
names stored on DNS servers
A portion of the Internet Domain Name Space…
6
Domain & Hostname
Hostname for a machine
named “challenger”
connected to domains
as shown
7
Distributed, Hierarchical Database
DNS uses a large number of servers
organized hierarchically & distributed around the world
Mappings distributed across DNS servers…
Root, Top Level Domain (TLD) & Authoritative DNS servers
8
Distributed, Hierarchical Database
Example: IP address needed for www.amazon.com
Root server queried to find TLD server for com Domain
TLD server for com domain queried to find Authoritative server for
amazon.com
Authoritative server for amazon.com queried to get IP address for
host www.amazon.com
9
Root name servers
contacted by Local name server that can not resolve name
Root name server:
contacts TLD name server if name mapping not known
gets mapping
returns mapping to Local name server
c. Cogent, Herndon, VA (5 other sites)
d. U Maryland College Park, MD k. RIPE London (17 other sites)
h. ARL Aberdeen, MD
j. Verisign, Dulles VA (69 other sites ) i. Netnod, Stockholm (37 other sites)
m. WIDE Tokyo
e. NASA Mt View, CA (5 other sites)
f. Internet Software C.
Palo Alto, CA (and 48 other sites)
a. Verisign, Los Angeles CA
13 root name
(5 other sites)
b. USC-ISI Marina del Rey, CA “servers”
l. ICANN Los Angeles, CA
(41 other sites) worldwide
g. US DoD Columbus,
OH (5 other sites)
10
TLD, Authoritative servers
Top-level domain (TLD) servers:
responsible for top-level domains, e.g, com, org, net, edu, gov;
and all country top-level domains, e.g, uk, fr, ca, jp
Network Solutions maintains TLD servers for com TLD
Educause for edu TLD
Authoritative DNS servers:
organization’s DNS server(s), provide authoritative hostname to
IP mappings for organization’s named hosts
can be maintained by organization or service provider
primary & secondary Authoritative DNS servers
11
Local DNS name server
Does not strictly belong to DNS hierarchy; lies closest to host
Each ISP (residential ISP, company, university) has one
ISP provides host with IP address of local DNS server;
(typically thru DHCP)
also called “ default name server”
DNS query from host, sent to Local DNS server
has local cache of recent name-to-address translation pairs
(but may be out of date..!)
acts as proxy, forwards query into DNS hierarchy
provides DNS reply
12
DNS name root DNS server
resolution example
2 3
host at cis.poly.edu 7
6
wants IP address for TLD DNS
gaia.cs.umass.edu server
Recursive Query: local DNS server
dns.poly.edu 5 4
puts burden of name 1 8
resolution on contacted
name server authoritative DNS server
dns.cs.umass.edu
heavy load at upper requesting host
levels of hierarchy..? cis.poly.edu
gaia.cs.umass.edu
13
DNS name root DNS server
resolution example
2
3
Iterated Query:
4
TLD DNS
contacted server replies server
5
with name of server to
contact local DNS server
dns.poly.edu
“I don’t know this name, 7 6
but ask this server” 1 8
authoritative DNS server
dns.cs.umass.edu
requesting host
cis.poly.edu
Are all queries shown Iterated..? gaia.cs.umass.edu
14
DNS: caching, updating records
Once (any) name server learns mapping, it is cached
TLD servers typically cached in local name servers
thus Root name servers not often visited
cache entries timeout after some time (often 2 days)
DNS server having a cached entry can reply DNS query
even if not Authoritative for the hostname
Cached entries may be out-of-date...!
Update/notify mechanisms proposed in IETF standard
RFC 2136
15
DNS records
DNS servers store resource records (RR)
Each DNS Reply carries one/more RRs
RR format: (name, value, type, ttl)
Type=A Type=CNAME
name is hostname name is alias name for some
value is IP address “ canonical” name
www.ibm.com is really
Type=NS servereast.backup2.ibm.com
name is domain (e.g., value is canonical name
foo.com)
value is hostname of Type=MX
Authoritative name server for value is name of mailserver
this domain associated with name
16
DNS protocol, messages
Query & Reply messages, both with same message format
2 bytes 2 bytes
Msg header
identification flags
Identification:
# questions # answer RRs
16 bit # for query,
reply to query uses same # # authority RRs # additional RRs
1 bit flags: questions (variable # of questions)
query or reply
answers (variable # of RRs)
reply is Authoritative
recursion desired authority (variable # of RRs)
recursion available
additional info (variable # of RRs)
17
DNS protocol, messages
2 bytes 2 bytes
identification flags
Data Sections
# questions # answer RRs
# authority RRs # additional RRs
name, type fields
questions (variable # of questions)
for a query
RRs in response answers (variable # of RRs)
to query
records for authority (variable # of RRs)
authoritative servers
additional “ helpful” additional info (variable # of RRs)
info that may be used
18
Inserting records into DNS
Example: new startup “ Network Utopia”
Register domain name networkutopia.com at DNS Registrar
(e.g., Network Solutions)
provide names, IP addresses of Authoritative name server
(primary and secondary)
Registrar inserts two RRs into com TLD server:
(networkutopia.com, dns1.networkutopia.com, NS)
(dns1.networkutopia.com, 212.212.212.1, A)
Create following RRs in your Authoritative DNS servers
type A for web server, www.networkutopia.com
type MX for mail server, mail.networkutopia.com
19