We now present a high-level overview of how DNS works. Our discussion will focus on the hostname-to-IP-address translation service.
Introduction – How DNS works
Suppose that some application running in a user’s host needs to translate a hostname to an IP address. The application will invoke the client side of DNS, specifying the hostname that needs to be translated. (On many UNIX-based machines, gethostbyname() is the function call that an application calls in order to perform the translation.) DNS in the user’s host then takes over, sending a query message into the network. All DNS query and reply messages are send within UDP datagrams to port 53. After a delay ranging from miliseconds to seconds.
DNS in the users host recieves a DNS reply message that provides the desired mapping. This mapping is then pass to the invoking application. Thus, from the perspective of the invoking application in the users host; DNS is black box providing a simple, straightforward translation service. But in fact the black box that impliments the service is complex; consisting of a large number of DNS servers distribut around the globe as well as; an application-layer protocol that specifies how the DNS servers and querying hosts communicate.
A simple design for DNS would have one DNS server that contains all the mappings. In this centralized design; clients simply direct all queries to the single DNS server, and the DNS server responds directly to the querying clients. Although the simplicity of design is attractive; it is a inappropriate for todays internet with its vast (and growing) number of hosts. The problems with centralized design include:
- A single point of failure. If the DNS server crashes so does the entire internet!
- Traffic volume. A single DNS server would have to handle all DNS queries.
In summary, a cetralized database in a single DNS server simply doesn’t scale. Consequently, the DNS is distributed by design. In fact, the DNS is a wonderful example of how a distributed database can be implemented in the internet.