2/23/2008115-441 Computer NetworkingLecture 13 – DNS1Peter SteenkisteDepartments of Computer Science andElectrical and Computer Engineering15-441 Networking, Spring 2008http://www.cs.cmu.edu/~dga/15-441/S08Outlinez DNS Design2zDNS TodayNamingz How do we efficiently locate resources?» DNS: name Æ IP address3z Challenge» How do we scale these to the wide area?z Is this an application?» Kind ofObvious Solutions (1)Why not centralize DNS?z Single point of failurez Traffic volume4zDistant centralized databasez Single point of updatez Does not scale!Obvious Solutions (2)Why not use /etc/hosts, i.e. fully distributed?z Original Name to Address Mapping» Flat namespace»/etc/hosts5»/etc/hosts » SRI kept main copy» Downloaded regularlyz Count of hosts was increasing: machine per domain Æ machine per user» Many more downloads» Many more updatesz Does not scale!Domain Name System Goalsz Basically a wide-area distributed databasez Scalabilityz Decentralized maintenanceRb6zRobustnessz Global scope » Names mean the same thing everywherez Do not need» Atomicity» Strong consistency» Simplifies management2/23/20082Programmer’s View of DNSz Conceptually, programmers can view the DNS database as a collection of millions of host entry structures:/* DNS host entry structure */ struct hostent { char *h_name; /* official domain name of host */ h**hli/* lltitd fd i */7» in_addr is a struct consisting of 4-byte IP addressz Functions for retrieving host entries from DNS:» gethostbyname: query key is a DNS host name.» gethostbyaddr: query key is an IP address.char **h_aliases; /* null-terminated array of domain names */ int h_addrtype; /* host address type (AF_INET) */ int h_length; /* length of an address, in bytes */ char **h_addr_list; /* null-terminated array of in_addr structs */ }; DNS Message FormatIdentificationNo. of QuestionsNo. of Authority RRsFlagsNo. of Answer RRsNo. of Additional RRsName, type fields12 bytes8Questions (variable number of answers)Answers (variable number of resource records)Authority (variable number of resource records)Additional Info (variable number of resource records)Name, type fields for a queryRRs in response to queryRecords for authoritative serversAdditional “helpful info that may be usedDNS Header Fieldsz Identification»Used to match up request/responsez Flags9»1-bit to mark query or response»1-bit to mark authoritative or not»1-bit to request recursive resolution»1-bit to indicate support for recursive resolutionDNS RecordsRR format: (class, name, value, type, ttl)• DB contains tuples called resource records (RRs)• Classes = Internet (IN), Chaosnet (CH), etc.• Each class defines value associated with type10FOR IN class:z Type=A» name is hostname» value is IP addressz Type=NS» name is domain (e.g. foo.com)» value is name of authoritative name server for this domain• Type=CNAME• name is an alias name for some “canonical” (the real) name• value is canonical name• Type=MX• value is hostname of mailserver associated with nameDifferent Mappings are Possiblez Simple case: 1-1 mapping between domain name and IP addr:» kittyhawk.cmcl.cs.cmu.edu maps to 128.2.194.242z Multiple domain names maps to the same IP address:»eecs mit eduandcs mit eduboth map to11»eecs.mit.edu andcs.mit.edu both map to18.62.1.6z Single domain name maps to multiple IP addresses:» aol.com and www.aol.com map to multiple IP addrs.z Some valid domain names don’t map to any IP address:» for example: cmcl.cs.cmu.eduDNS Design: Hierarchy Definitionsrootedunetorgukcom• Each node in hierarchy stores a list of names that end with same suffix• Suffix = path up tree•E.g., given this tree, where12gwu ucb cmu bumitcsececmclE.g., given this tree, where would following be stored:• Fred.com• Fred.edu• Fred.cmu.edu• Fred.cmcl.cs.cmu.edu• Fred.cs.mit.edu2/23/20083DNS Design: Zone Definitionsrootedunetorgukcomca• Zone = contiguous section of name space• E.g., Complete tree, single node or subtree• A zone has an associated 13gwu ucb cmu bumitcsececmclSingle nodeSubtreeComplete Treeset of name servers• Must store list of names and tree linksDNS Design: Cont.z Zones are created by convincing owner node to create/delegate a subzone» Records within zone stored multiple redundant name servers» Primary/master name server updated manuallyS/14»Secondary/redundant servers updated by zone transfer of name space– Zone transfer is a bulk transfer of the “configuration” of a DNS server – uses TCP to ensure reliabilityz Example:» CS.CMU.EDU created by CMU.EDU administrators» Who creates CMU.EDU or .EDU?DNS: Root Name Serversz Responsible for “root” zonez Approx. 13 root name servers worldwide» Currently {a-m}.root-servers net15servers.netz Local name servers contact root servers when they cannot resolve a name» Configured with well-known root servers» Newer picture Æwww.root-servers.orgServers/Resolvers z Each host has a resolver» Typically a library that applications can link to» Local name servers hand-configured (e.g. /etc/resolv.conf)16/etc/resolv.conf)z Name servers» Either responsible for some zone or…» Local servers– Do lookup of distant host names for local hosts– Typically answer queries about local zoneTypical Resolutionroot & edu DNS serverwww.cs.cmu.edu17ClientLocal DNS serverns1.cmu.edu DNS serverns1.cs.cmu.eduDNSserverTypical Resolutionz Steps for resolving www.cmu.edu» Application calls gethostbyname() (RESOLVER)» Resolver contacts local name server (S1)» S1queries root server (S2) for (www.cmu.edu)18Lecture 13: 10-10-2006 18» S2returns NS record for cmu.edu (S3)» What about A record for S3?– This is what the additional information section is for (PREFETCHING)» S1queries S3for www.cmu.edu» S3returns A record for www.cmu.eduz Can return multiple A records Æ what does this mean?2/23/20084Lookup MethodsRecursive query:z Server goes out and searches for more info (recursive)z Only returns final answer or “not found”Iterative query:root name server234iterated query19qyz Server responds with as much as it knows (iterative)z “I don’t know this name, but ask this server”Workload impact on choice?z Local server typically does recursivez Root/distant server does iterativerequesting hostsurf.eurecom.frgaia.cs.umass.edulocal name serverdns.eurecom.fr156authoritative name serverdns.cs.umass.eduintermediate name serverdns.umass.edu78Workload and Cachingz Are all
View Full Document