CSE 123bCSE 123bCommunications SoftwareCommunications SoftwareSpring 2004Spring 2004Lecture 10: Domain Name System (DNS)Lecture 10: Domain Name System (DNS)Stefan SavageStefan SavageSome slides courtesy David Wetherall& Srini SeshanMay 9, 2004 CSE 123b – Lecture 10 -- DNS 2Topic #1: HomeworkTopic #1: HomeworkBring your homeworkup frontMay 9, 2004 CSE 123b – Lecture 10 -- DNS 3Topic #2: MidtermTopic #2: MidtermQuick SurveyMay 9, 2004 CSE 123b – Lecture 10 -- DNS 4Topic #3: ProjectTopic #3: Projectz You have started right?z Unix network programming review◆ Cover somewhat in chapter #1 of the book◆ http://www.ecst.csuchico.edu/~beej/guide/net/html/ also not bad◆ Quick review – simple client-side APIs:» Socket data structure: just like a file descriptor» Create with int socket (int domain, int type, int protocol) domain = PF_INET (defined in sys/socket.h) type = SOCK_STREAM for TCP or SOCK_DGRAM for UDP protocol = IPPROTO_TCP for TCP or IPPROTO_UDP for UDP (can also just use 0 and let it pick)May 9, 2004 CSE 123b – Lecture 10 -- DNS 5More socket programmingMore socket programmingz If using TCP then ◆ Connect to other host using int connect(int socket, struct sockaddr *address, intaddr_len) -- only tricky part is address structure◆ Send and receive usingsend(int socket, char *buffer, int buf_len, int flags)recv(int socket, char *buffer, int buf_len, int flags)z If using UDP then send and receive using:◆ int sendto(int socket, char *buffer, int len, unsigned in flags, struct sockaddr *toaddr, int tolen)◆ int recvfrom(int socket, char *buffer, int len, unsigned intflags, struct sockaddr *fromaddr, int fromlen)May 9, 2004 CSE 123b – Lecture 10 -- DNS 6Overview for todayOverview for todayz What is naming about?z How Domain Naming System (DNS) works◆ Namespace◆ Data distribution◆ Request/response protocol◆ Caching◆ Bootstrapingz Experience with DNS and new DNS usesMay 9, 2004 CSE 123b – Lecture 10 -- DNS 7Names and AddressesNames and Addressesz Names are identifiers for objects/services (high level)z Addresses are locators for objects/services (low level)z Resolution is the process of mapping name to addressStefan SavageCSE Dept.University of California, San Diego35¢nameaddressMay 9, 2004 CSE 123b – Lecture 10 -- DNS 8Goals for a naming systemGoals for a naming systemz How do we locate resources?◆ Machine name -> IP address◆ IP address -> Machine namez How do we scale to the wide area?◆ Global scope◆ Robustness◆ Consistency: additions, deletions, modifications◆ Performance/overhead◆ Different administrative authoritiesMay 9, 2004 CSE 123b – Lecture 10 -- DNS 9Internet HostnamesInternet Hostnamesz Hostnames are human-readable identifiers for end-systems based on an administrative hierarchy◆ risk64.ucsd.edu is my desktop machinez IP addresses are a fixed-length binary encoding for end-systems based on their position in the network◆ 132.239.9.64 is risk64’s IP addressMay 9, 2004 CSE 123b – Lecture 10 -- DNS 10Original Hostname SystemOriginal Hostname Systemz When the Internet was really young …z Flat namespace◆ Simple (host, address) pairsz Centralized management◆ Updates via a single master file called HOSTS.TXT◆ Manually coordinated by the SRI’s Network Information Center (NIC)◆ You ftp’d the file over each dayz Resolution process◆ Look up hostname in the HOSTS.TXT fileMay 9, 2004 CSE 123b – Lecture 10 -- DNS 11Scaling ProblemsScaling Problemsz Coordination◆ Between all users to avoid conflictsz Inconsistencies◆ Between update and distribution of new versionz Reliability◆ Single point of failurez Performance◆ Competition for centralized resources◆ Size of HOSTS.TXTMay 9, 2004 CSE 123b – Lecture 10 -- DNS 12Domain Name System (DNS)Domain Name System (DNS)z Designed by Mockapetris and Dunlap in the mid 80s◆ Distributed databasez Namespace is hierarchical◆ Allows much better scaling of data structures◆ e.g., www.cs.ucsd.eduz Namespace is distributed◆ Decentralized administration and access◆ e.g. xxx.ucsd.edu is managed only by UCSDz Resolution is by query/response◆ With replicated servers for redundancy◆ With heavy use of caching for performanceMay 9, 2004 CSE 123b – Lecture 10 -- DNS 13DNS DesignDNS Designz Administrative hierarchy◆ “.” as separator◆ Zone = contiguous section of name space with its own database and administrative control» E.g., Complete tree, single node or subtreez Zones are created by convincing owner node to create/delegate a subzone◆ E.g. cs.ucsd.edu could be a zone under ucsd.eduMay 9, 2004 CSE 123b – Lecture 10 -- DNS 14DNS HierarchyDNS Hierarchyeducsucsdauorgmilcomee• “dot” is the root of the hierarchy• Top levels now controlled by ICANN (in theory)• Lower level control is delegated• Usage governed by conventions• FQDN = Fully Qualified Domain NameMay 9, 2004 CSE 123b – Lecture 10 -- DNS 15DNS RecordsDNS RecordsDNS: distributed db storing resource records (RR)z Type=A◆ name is hostname◆ value is IP addressz Type=NS◆ name is domain (e.g. foo.com)◆ value is IP address of authoritative name server for this domainRR format: (name, value, type, ttl)z Type=CNAME◆ name is an alias name for some “canonical” (the real) name◆ value is canonical namez Type=MX◆ value is hostname of mailserverassociated with nameMay 9, 2004 CSE 123b – Lecture 10 -- DNS 16DNS DistributionDNS Distributionz One or more nameservers manage each zone◆ Primary nameserver updated manaually◆ Secondary nameservers updated using zone transfers performed between nameservers (uses TCP)◆ Multiple nameservers provide redundancyz Client resolvers query nameservers for specified records◆ Multiple messages may be exchanged per DNS lookup to navigate the name hierarchyMay 9, 2004 CSE 123b – Lecture 10 -- DNS 17Servers/Servers/ResolversResolversz Each host has a resolver◆ Typically a library that applications can link to, sometimes in kernel (e.g. Windows XP)◆ Host resolvers hand-configured (e.g. /etc/resolv.conf) or frequently key information (e.g. IP address of local nameserver) is passed via DHCPz Name servers◆ Typically responsible for some zone (e.g. cs.ucsd.edu)◆ Local servers (also sometimes called caching servers)» Do lookup of distant host names for local hosts» Typically answer queries about local zoneMay 9, 2004 CSE 123b – Lecture 10 -- DNS 18Lookup MethodsLookup Methodsz Iterative◆ Server responds with as much as
View Full Document