170 likes | 305 Views
Name Service (DNS). Outline Terminology Domain Naming System. Why A Name Service?. Fundamental property of name: identify object Fundamental property of an address: locate object
E N D
Name Service (DNS) Outline Terminology Domain Naming System CS 332
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 CS 332
Name Properties • Location transparent or location-dependent • Flat or hierarchical • Global versus local • Absolute versus relative CS 332
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 CS 332
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 CS 332
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 CS 332
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) CS 332
User 1 2 user @ cs.princeton.edu cs.princeton.edu Name Mail server program 4 192.12.69.5 192.12.69.5 3 TCP 192.12.69.5 5 IP Example CS 332
DNS Implementation • Partition hierarchy into zones edu com gov mil org net uk fr … … … … … princeton mit cisco yahoo nasa nsf arpa navy acm ieee cs ee physics ux01 ux04 • 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) CS 332
Root name server … Princeton Cisco name server name server … CS EE name server name server 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 CS 332
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) CS 332
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) … CS 332
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) CS 332
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) CS 332
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 CS 332
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 CS 332
Root 2 name server cicada.cs.princeton.edu 3 princeton.edu, 128.196.128.233 4 1 Local Princeton cicada.cs.princeton.edu cicada.cs.princeton.edu name name Client server server cs.princeton.edu, 192.12.69.5 192.12.69.60 8 5 cicada.cs.princeton.edu 192.12.69.60 cicada.cs.princeton.edu, 6 CS name server 7 Example CS 332