15-441 Computer Networking Lecture 13-DNS
15-441 Computer Networking Lecture 13 – DNS
Outline DNS Design DNS Today Lecture13:10-10-2006
Lecture 13: 10-10-2006 2 Outline • DNS Design • DNS Today
Naming How do we efficiently locate resources? DNs:name→| P address Challenge How do we scale these to the wide area? Lecture13:10-10-2006 3
Lecture 13: 10-10-2006 3 Naming • How do we efficiently locate resources? • DNS: name → IP address • Challenge • How do we scale these to the wide area?
Obvious Solutions (1) Why not centralize dNs? Single point of failure · Traffic volume Distant centralized database Single point of update Doesnt scale Lecture13:10-10-2006
Lecture 13: 10-10-2006 4 Obvious Solutions (1) Why not centralize DNS? • Single point of failure • Traffic volume • Distant centralized database • Single point of update • Doesn’t scale!
Obvious Solutions (2) Why not use /etc/hosts? Original Name to Address Mapping Flat namespace letc/hosts SRI kept main copy Downloaded regularly Count of hosts was increasing machine per domain machine per user Many more downloads Many more updates Lecture13:10-10-2006 5
Lecture 13: 10-10-2006 5 Obvious Solutions (2) Why not use /etc/hosts? • Original Name to Address Mapping • Flat namespace • /etc/hosts • SRI kept main copy • Downloaded regularly • Count of hosts was increasing: machine per domain → machine per user • Many more downloads • Many more updates
Domain Name System Goals Basically a wide-area distributed database Scalability Decentralized maintenance Robustness Global scope Names mean the same thing everywhere · Dont need Atomicity Strong consistency Lecture13:10-10-2006
Lecture 13: 10-10-2006 6 Domain Name System Goals • Basically a wide-area distributed database • Scalability • Decentralized maintenance • Robustness • Global scope • Names mean the same thing everywhere • Don’t need • Atomicity • Strong consistency
Programmers View of DNS Conceptually, programmers can view the dNS database as a collection of millions of host entry structures / DNS host entry structure * struct hostent t char *h name r official domain name of host * char **h aliases: null-terminated array of domain names*/ int h addrtype; host address type(AF INET)*/ n length; / length of an address, in bytes char **h addr list. null-terminated array of in addr structs * } in addr is a struct consisting of 4-byte IP address Functions for retrieving host entries from DNS gethostbyname: query key is a dNS host name gethosthyaddr: query key is an IP address Lecture13:10-10-2006
Lecture 13: 10-10-2006 7 Programmer’s View of DNS • Conceptually, 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 address • Functions 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 */ };
DNS Message Format Identification Flags 12 bytes No. of Questions No, of answer rrs No of Authority RRs No, of Additional rrs Name, type fields for a query Questions (variable number of answers RRs in response to query Answers(variable number of resource records) Records for authoritative Authority(variable number of resource records) - servers Additional Additional Info (variable number of resource records) helpful info that may be used Lecture13:10-10-2006
Lecture 13: 10-10-2006 8 DNS Message Format Identification No. of Questions No. of Authority RRs Questions (variable number of answers) Answers (variable number of resource records) Authority (variable number of resource records) Additional Info (variable number of resource records) Flags No. of Answer RRs No. of Additional RRs Name, type fields for a query RRs in response to query Records for authoritative servers Additional “helpful info that may be used 12 bytes
DNS Header fields ·| dentification Used to match up request/response Flags 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 resolution Lecture13:10-10-2006
Lecture 13: 10-10-2006 9 DNS Header Fields • Identification • Used to match up request/response • Flags • 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 resolution
DNS Records RR 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 type FOR IN class. Type=A Type=CNAME · name is hostname name is an alias name for some value is iP address canonical(the real)name Type=NS value is canonical name name is domain(e.g. foo. com) pe=MX value is name of authoritative name value is hostname of mailserver server for this domain associated with name Lecture13:10-10-2006
Lecture 13: 10-10-2006 10 DNS Records RR 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 type FOR IN class: • Type=A • name is hostname • value is IP address • 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 name