Domain Name System (DNS) Professor Hui ZhangNames, Addresses, MappingDNS: Mapping between Name and AddressObvious Solutions (1)Obvious Solutions (2)Domain Name System GoalsProgrammer’s View of DNSProperties of DNS Host EntriesDNS RecordsDNS Message FormatDNS Design: Hierarchy DefinitionsServers/ResolversRecursive DNS Name ResolutionIterative DNS Name ResolutionTypical ResolutionSlide 16PrefetchingCachingSlide 19Subsequent Lookup ExampleReliabilityTracing Hierarchy (1)Tracing Hierarchy (2)Tracing Hierarchy (3 & 4)Reverse DNS.arpa Name Server HierarchyKey ConceptsDNS (Summary)DNS Header Fields1Domain Name System (DNS)Professor Hui Zhang2Hui ZhangNames, Addresses, MappingBinding Names to ObjectsARP: mapping between layer 2 address and IP addressDHCP: getting a new IP addressHow to implement?3Hui ZhangDNS: Mapping between Name and AddressWhy do we names?How do we efficiently locate resources?DNS: name IP addressChallengeHow do we scale these to the wide area?4Hui ZhangObvious Solutions (1)Why not centralize DNS?Single point of failureTraffic volumeDistant centralized databaseSingle point of updateDoesn’t scale!5Hui ZhangObvious Solutions (2)Why not use /etc/hosts?Original Name to Address MappingFlat namespace/etc/hosts SRI kept main copyDownloaded regularlyCount of hosts was increasing: machine per domain machine per userMany more downloadsMany more updates6Hui ZhangDomain Name System GoalsBasically a wide-area distributed databaseScalabilityDecentralized maintenanceRobustnessGlobal scope Names mean the same thing everywhereDon’t needAtomicityStrong consistency7Hui ZhangProgrammer’s View of DNSConceptually, programmers can view the DNS database as a collection of millions of host entry structures:in_addr is a struct consisting of 4-byte IP addressFunctions for retrieving host entries from DNS:gethostbyname: query key is a DNS host name.gethostbyaddr: query key is an IP address./* 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-terminated array of in_addr structs */ };8Hui ZhangProperties of DNS Host EntriesDifferent kinds of mappings are possible:Simple case: 1-1 mapping between domain name and IP addr:–kittyhawk.cmcl.cs.cmu.edu maps to 128.2.194.242Multiple domain names maps to the same IP address:–eecs.mit.edu and cs.mit.edu both map to 18.62.1.6Single 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 address:–for example: cmcl.cs.cmu.edu9Hui ZhangDNS 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 typeFOR IN class:Type=Aname is hostnamevalue is IP addressType=NSname is domain (e.g. foo.com)value is name of authoritative name server for this domainType=CNAMEname is an alias name for some “canonical” (the real) namevalue is canonical nameType=MXvalue is hostname of mailserver associated with name10Hui ZhangDNS Message FormatIdentificationNo. of QuestionsNo. of Authority RRsQuestions (variable number of answers)Answers (variable number of resource records)Authority (variable number of resource records)Additional Info (variable number of resource records)FlagsNo. of Answer RRsNo. of Additional RRsName, type fields for a queryRRs in response to queryRecords for authoritative serversAdditional “helpful info that may be used12 bytes11Hui ZhangDNS Design: Hierarchy Definitionsrootedunetorgukcomgwu ucb cmu bumitcsececmcl•Each node in hierarchy stores a list of names that end with same suffix•Suffix = path up tree•E.g., given this tree, where would following be stored:•Fred.com•Fred.edu•Fred.cmu.edu•Fred.cmcl.cs.cmu.edu•Fred.cs.mit.edu12Hui ZhangServers/Resolvers Each host has a resolverTypically a library that applications can link toLocal name servers hand-configured (e.g. /etc/resolv.conf)Name serversEither responsible for some zone or…Local servers–Do lookup of distant host names for local hosts–Typically answer queries about local zone13Hui ZhangRecursive DNS Name ResolutionNonlocal LookupRecursively from root server downwardResults passed upCachingResults stored in caches along each hopCan shortcircuit lookup when cached entry presentedu comcmucskittyhawk128.2.194.242cmclunnamed rootsomeplacewww208.216.181.15RootServer.eduServerCMUServerCMU CSServerLocalServer.comServer1234567891014Hui ZhangIterative DNS Name ResolutionNonlocal LookupAt each step, server returns name of next server downLocal server directly queries each successive serverCachingLocal server builds up cache of intermediate translationsHelps in resolving names xxx.cs.cmu.edu, yy.cmu.edu, and z.eduedu comcmucskittyhawk128.2.194.242cmclunnamed rootsomeplacewww208.216.181.15RootServer.eduServerCMUServerCMU CSServerLocalServer.comServer1249675831015Hui ZhangTypical ResolutionClientLocal DNS serverroot & edu DNS serverns1.cmu.edu DNS serverwww.cs.cmu.eduNS ns1.cmu.eduwww.cs.cmu.eduNS ns1.cs.cmu.eduA www=IPaddrns1.cs.cmu.eduDNSserver16Hui ZhangTypical ResolutionSteps for resolving www.cmu.eduApplication calls gethostbyname() (RESOLVER)Resolver contacts local name server (S1)S1 queries root server (S2) for (www.cmu.edu)S2 returns NS record for cmu.edu (S3)What about A record for S3?–This is what the additional information section is for (PREFETCHING)S1 queries S3 for www.cmu.eduS3 returns A record for www.cmu.eduCan return multiple A records what does this mean?17Hui ZhangPrefetchingName servers can add additional data to responseTypically used for prefetchingCNAME/MX/NS typically point to another host nameResponses include address of host referred to in “additional section”18Hui ZhangCachingDNS responses are cached Quick response for repeated translationsOther queries may reuse some parts of lookup–NS records for domains DNS negative queries are cachedDon’t have to repeat past mistakesE.g.
View Full Document