15-441 Lecture 715-441 Lecture 7DNSC i ht © S th G ld t i 2008Lecture 13 15-441 © 2008Copyright © Seth Goldstein, 2008Based on slides from previous 441 lectures1Outline•DNS DesignDNS DesignDN d•DNS Today(Extra credit, remind me at end)15-441 © 2008 2Lecture 13What is DNS?• DNS (Domain Name Service) is primarily used to translate human readable names into machine translate human readable names nto mach ne usable addresses, e.g., IP addresses.•DNS goal:–Efficiently locate resources. Efficiently locate resources. E.g., Map name Æ IP address–Scale to many users over a large areayg– Scale to many updates15-441 © 2008 3Lecture 13How resolve name Æ IP addr?Lecture 13 15-441 © 2008 4Obvious Solutions (1)Why not centralize DNS?•Single point of failureSingle point of failure•Traffic volume•Distant centralized database•Distant centralized database•Single point of update•Doesn’t scale!15-441 © 2008 5Lecture 13Obvious Solutions (2)Why not use /etc/hosts?•Original Name to Address MappingOr g nal Name to ddress Mapp ng–Flat namespace– /etc/hosts – SRI kept main copy– Downloaded regularlygy•Mid 80’s this became untenable. Why?•Count of hosts was increasing: machine per di hi domain Æ machine per user– Many more downloadsM dt/etc/hosts still exists15-441 © 2008 6–Many more updates/etc/hosts still exists.Lecture 13Domain Name System Goalsy•Basically a wide-area distributed database(The biggest in the world!)( he b ggest n the world!)•Scalability•Decentralized maintenanceDecentralized maintenance•Robustness•Global scope Global scope – Names mean the same thing everywhere•Don’t need all of ACID•Don t need all of ACID– AtomicityStrong consistency15-441 © 2008 7–Strong consistency•Do need: distributed update/query & PerformanceLecture 13Programmer’s View of DNS• Conceptually, programmers can view the DNS database as a collection of millions of host entry structures:structures:/* DNS host entry structure */ struct hostent { char *h name; /* official domain name of host */ _; / /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-termed array of in addr structs */ – in_addr is a struct consisting of 4-byte IP addr__y_}; • Functions for retrieving host entries from DNS:–gethostbyname: query key is a DNS host name. k dd15-441 © 2008 8–gethostbyaddr: query key is an IP address.Lecture 13DNS Message FormatIdentificationFlagsIdentificationNo. of QuestionsNo of Authority RRsFlagsNo. of Answer RRsNo of Additional RRs12 bytesNo. of Authority RRsQuestions (variable number of answers)No. of Additional RRsName, type fields for a queryAnswers (variable number of resource records)RRs in response to queryAuthority (variable number of resource records)Additional Info (variable number of resource records)Records for authoritative serversAdditional15-441 © 2008 9Additional Info (variable number of resource records)Additional “helpful info that may be usedLecture 13DNS Header Fields•Identification–Used to match up request/responseUsed to match up request/response•Flags–1bit to mark query or response–1-bit to mark query or response– 1-bit to mark authoritative or not1bit to request recursive resolution–1-bit to request recursive resolution– 1-bit to indicate support for recursive resolutionresolution15-441 © 2008 10Lecture 13DNS 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 typeEach class defines value associated with typeFor “IN” class:•Type=A•Type=CNAMEType A– name is hostname– value is IP addressTNSType CNAME• name is an alias name for some “canonical” name•valueis canonical name•Type=NS– name is domain (e.g. foo.com)– value is name of authoritative •valueis canonical name• Type=MX• value is hostname of 15-441 © 2008 11name server for this domainmailserver associated with nameLecture 13Properties of DNS Host EntriesDifferent kinds of mappings are possible:•11 mapping between domain name and IP addr:•1-1 mapping between domain name and IP addr:provolone.crcl.cs.cmu.edu maps to 128.2.218.81•Multiple domain names maps to the same IP addr:•Multiple domain names maps to the same IP addr:www.scs.cmu.edu and www.cs.cmu.edu both map to 128.2.203.164•Single domain name maps to multiple IP addresses:aol.com and www.aol.com map to multiple IP addrs.•Some valid domain names don’t map to any IP addr:crcl.cs.cmu.edu doesn’t have a host15-441 © 2008 12Lecture 13DNS Design: Hierarchy Definitionsroot• Each node in hierarchy stores a list of names that end with same suffix•Suffix = path up treeedunetorg ukcomSuffix path up tree• E.g., given this tree, where would following be stored:•Fred comgwu ucb cmu bumitcsece•Fred.com•Fred.edu• Fred.cmu.educrcl• Fred.crcl.cs.cmu.edu• Fred.cs.mit.edu15-441 © 2008 13Lecture 13DNS Design: Zone Definitions• Zone = contiguous section of name spacerootp• E.g., Complete tree, single node or subtree•A zone has an associated A zone has an associated set of name servers• Must store list of d t li kedunetorg ukcoml dSubtreenames and tree linksgwu ucb cmu bumitcseceSingle nodeComplete Treecrcl15-441 © 2008 14TreeLecture 13DNS Design: Cont.•Zones are created by convincing owner node to create/delegate a subzoneg– Records within zone stored in multiple redundant name serversPi / d d ll–Primary/master name server updated manually– Secondary/redundant servers updated by zone transfer of name spacetransfer of name space• Zone transfer is a bulk transfer of the “configuration” of a DNS server – uses TCP to ensure reliability•Example:– CS.CMU.EDU created by CMU.EDU admins15-441 © 2008 15– Who creates CMU.EDU or .EDU?Lecture 13DNS: Root Name Servers•Responsible for “root” zonep• 13 root name servers– Currentlyy{a-m}.root-servers.net• Local name servers contact h h root servers when they cannot resolve a nameWh 13?•Why 13?15-441 © 2008 16Lecture 13Not really 13!Lecture 13 15-441 © 2008 1710/08, from www.root-servers.orgCheck out anycast)So Far•Database structure–Hierarchy of labels x y zHierarchy of labels x.y.z–
View Full Document