spring 2006cs 3321 name service (dns) outline terminology domain naming system
TRANSCRIPT
Spring 2006 CS 332 1
Name Service (DNS)
OutlineTerminology Domain Naming System
Spring 2006 CS 332 2
Why A Name Service?
• Fundamental property of name: identify object
• Fundamental property of an address: locate object
• Using name service allows us to decouple these two different functions (though often times naming conventions can help with location, and vice versa)– Name can help locate objects, define membership in a group,
specify a role, etc.
• Differences (related to Internet):– Names more user friendly than IP addresses
– Names can have variable length
Spring 2006 CS 332 3
Name Properties
• Location transparent or location-dependent • Flat or hierarchical • Global versus local • Absolute versus relative
Spring 2006 CS 332 4
Terminology
• Name space: defines set of possible names– Flat: names not divisible into components– Hierarchical (e.g. Unix file names, Internet domain names)
• Naming system maintains a collection of bindings of names to values– Value can be anything we want naming system to return
when presented with a name
• Resolution mechanism: a procedure that, when invoked with a name, returns the corresponding value
• Name server: specific implementation of a resolution mechanism that can be queried via a network
Spring 2006 CS 332 5
In The Beginning…
• Network Information Center (NIC) maintained a flat table of name-to-address bindings (called hosts.txt)
• To add host to Internet, email NIC with new name/address pair, which NIC manually added to table
• Modified table was mailed to every site every few days; sysadmins installed hosts.txt on every host
Spring 2006 CS 332 6
Domain Name System (DNS)• Went online in mid 1980s• Hierarchical name space
– Names processed from right to left (though humans read them from left to right) with periods as field separators
– Ex. cleopatra.richmond.edu
edu com
princeton … mit
cs ee
ux01 ux04
physics
cisco … yahoo nasa … nsf arpa … navy acm … ieee
gov mil org net uk fr
Spring 2006 CS 332 7
Domain Name System (DNS)• Distributed database of domain name bindings
– Each site (university department, campus, company, etc.) maintains its own part of database, along with a server
– Mapping is not necessarily host name to address
• Apps presented with host names query DNS to find address– Accessed through a resolver, which in Unix is primarily
reached via gethostbyname() and gethostbyaddress()
– resolver opens UDP connection to pass name service packets (IP address of server(s) in /etc/resolve.conf)
– resolver is not part of TCP implementation (or kernel)
Spring 2006 CS 332 8
Example
Nameserver
Mailprogram
User
TCP
IP
2cs.princeton.edu
192.12.69.53
user @ cs.princeton.edu1
192.12.69.5 4
192.12.69.5 5
Spring 2006 CS 332 9
DNS Implementation• Partition hierarchy into zones
edu com
princeton … mit
cs ee
ux01 ux04
physics
cisco … yahoo nasa … nsf arpa … navy acm … ieee
gov mil org net uk fr
• Zones correspond to administrative authority (NIC gets top)– Each zone implemented by two or more name servers
• Primary: get its info from disk files• Secondary: get their info from the primary (called a zone-transfer)
Spring 2006 CS 332 10
DNS Implementation (cont.)
• DNS is really a hierarchy of name servers, rather than hierarchy of domains
• Servers respond either with info
requested or with IP address of
another name server• All primary servers must
know IP addresses of
all root servers
Rootname server
Princetonname server
Cisconame server
CSname server
EEname server
…
…
Spring 2006 CS 332 11
Resource Records • Each name server maintains a collection of resource records
(Name, Value, Type, Class, TTL)
• Name/Value: not necessarily host names to IP addresses• Type: tells how value should be interpreted
– A: Value is an IP address (gives the name-to-address mapping)– NS: Value gives domain name for host running name server that knows
how to resolve names within specified domain.– CNAME: Value gives canonical name for a particular host; used to
define aliases (e.g. indirection for web server).– MX: Value gives domain name for host running mail server that accepts
messages for specified domain.
• Class: allow other entities to define types (Internet class is IN)• TTL: how long the resource record is valid (when TTL expires,
this record must be removed from cache)
Spring 2006 CS 332 12
Root Server
(princeton.edu, cit.princeton.edu, NS, IN)
(cit.princeton.edu, 128.196.128.233, A, IN)
(cisco.com, thumper.cisco.com, NS, IN)
(thumper.ciscoe.com, 128.96.32.20, A, IN)
…
Spring 2006 CS 332 13
Princeton Server
(cs.princeton.edu, optima.cs.princeton.edu, NS, IN)
(optima.cs.princeton.edu, 192.12.69.5, A, IN)
(ee.princeton.edu, helios.ee.princeton.edu, NS, IN)
(helios.ee.princeton.edu, 128.196.28.166, A, IN)
(jupiter.physics.princeton.edu, 128.196.4.1, A, IN)
(saturn.physics.princeton.edu, 128.196.4.2, A, IN)
(mars.physics.princeton.edu, 128.196.4.3, A, IN)
(venus.physics.princeton.edu, 128.196.4.4, A, IN)
Spring 2006 CS 332 14
CS Server
(cs.princeton.edu, optima.cs.princeton.edu, MX, IN)
(cheltenham.cs.princeton.edu, 192.12.69.60, A, IN)
(che.cs.princeton.edu, cheltenham.cs.princeton.edu, CNAME, IN)
(optima.cs.princeton.edu, 192.12.69.5, A, IN)
(www.cs.princeton.edu, optima.cs.princeton.edu, CNAME, IN)
(baskerville.cs.princeton.edu, 192.12.69.35, A, IN)
(bas.cs.princeton.edu, baskerville.cs.princeton.edu, CNAME, IN)
Spring 2006 CS 332 15
Name Resolution• Client sends request to a root server for cleopatra.mathcs.richmond.edu
• Root server returns the best info it has, which includes all information relating to richmond.edu (which should contain the name and address of a richmond.edu name server)
• Client queries richmond.edu name server, which returns name and address of mathcs.richmond.edu name server
• Client queries mathcs.richmond.edu name server and gets IP address of cleopatra.mathcs.richmond.edu
Spring 2006 CS 332 16
How It Really Works• Client queries local name server, and name server
goes through resolution process on client’s behalf– Hosts must be configured with address of local name
server– Only local name server needs to know addresses of root
server(s)– Local server sees all DNS responses, and can thus
cache these (removing record when TTL expires)
• Partial names (e.g. cleopatra): client program is configured with local domain and appends this to incomplete names before query
Spring 2006 CS 332 17
Example
Rootnameserver
Princetonnameserver
CSnameserver
Localnameserver
Client
1cicada.cs.princeton.edu
192.12.69.608
cicada.cs.princeton.edu
princeton.edu, 128.196.128.233
cicada.cs.princeton.edu
cicada.cs.princeton.edu,
192.12.69.60
cicada.cs.princeton.edu
cs.princeton.edu, 192.12.69.5
2
3
4
5
6
7