{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

chapter11 - Chapter 11: Name and Address Conversions...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 11: Name and Address Conversions DNS: Domain Name System People: many identifiers: Domain Name System: •  distributed database implemented in hierarchy of Internet hosts, routers: many name servers –  IP address (32 bit) - used •  application-layer protocol for addressing datagrams host, routers, name servers to –  name , e.g., communicate to resolve names ww.yahoo.com - used by (address/name translation) humans –  note: core Internet Q: map between IP function, implemented as application-layer protocol addresses and name ? –  complexity at network s edge –  SSN, name, passport # 2: Application Layer 2 DNS DNS services •  hostname to IP address translation •  host aliasing –  Canonical, alias names •  mail server aliasing •  load distribution –  replicated Web servers: set of IP addresses for one canonical name Why not centralize DNS? •  single point of failure •  traffic volume •  distant centralized database •  maintenance doesn t scale! 2: Application Layer 3 DNS records DNS: distributed db storing resource records (RR) RR format: ❒  Type=A     name is hostname value is IP address •  Type=NS (name, value, type, ttl) ❒  Type=CNAME   name is alias name for some canonical (the real) name www.ibm.com is really servereast.backup2.ibm.com   value is canonical name –  name is domain (e.g. foo.com) –  value is hostname of authoritative name server ❒  Type=MX   value is name of mailserver for this domain associated with name 2: Application Layer 4 Distributed, Hierarchical Database Root DNS Servers com DNS servers yahoo.com amazon.com DNS servers DNS servers org DNS servers pbs.org DNS servers edu DNS servers poly.edu umass.edu DNS serversDNS servers Client wants IP for www.amazon.com; 1st approx: •  client queries a root server to find com DNS server •  client queries com DNS server to get amazon.com DNS server •  client queries amazon.com DNS server to get IP address for www.amazon.com 2: Application Layer 5 Local Name Server •  does not strictly belong to hierarchy •  each ISP (residential ISP, company, university) has one. –  also called default name server •  when host makes DNS query, query is sent to its local DNS server –  acts as proxy, forwards query into hierarchy 2: Application Layer 6 Figure 11.1: Typical arrangement of clients, resolvers, and name servers #include <netdb.h> struct hostent *gethostbyname(const char *hostname); Returns non ­null pointer if OK NULL on error with h_errno set struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; } Figure 11.2: hostent structure and the informaWon it contains. Figure 11.3: Call gethostbyname and print returned informaWon. #include <netdb.h> struct hostent *gethostbyaddr(const char *addr, socklen_t len, int family); Returns non ­null pointer if OK NULL on error with h_errno set #include <netdb.h> struct servent *getservbyname(const char *servname, const char *protoname); struct servent *getservbyport(int port, const char *protoname); struct servent { char *s_name; char **s_aliases; int s_port; char *s_porto; } Figure 11.4: Our dayWme client that uses gethostbyname and getservbyname. Figure 11.4: Our dayWme client that uses gethostbyname and getservbyname. ...
View Full Document

{[ snackBarMessage ]}