How Does DNS (Domain Name System) work?
IP and Domains
When a computer's web browser accesses the web pages of a web site, underneath it does not actually establish a connection with the web server using the web site's domain name, but instead connects using the web server's IP (Internet Protocol) address. As the name suggests, IP is the underlying method of establishing communication across the Internet.
Format of an IP Address
The IP address is a unique number, presented in decimal in four blocks of numbers, each block going from 0 to 255. For example, the web site at www.bbc.co.uk resolves to an IP address of 212.58.224.123 .
Why use Domain Names
We've already established the use of the Internet Protocol for communication across the internet, but obviously there needs to be some correlation between an IP address of a web server, and the web servers Uniform Resource Locator such as http://www.mywonderfulcompany.com .
If every time we wished to connect to the Internet, we had to remember the IP address of the company's web server we wished to reach, then the internet would soon lose a lot of its appeal. So the Domain Name Service came about to provide a mapping between human readable names and unique IP address's that could be used by one computer to locate the other.
A Domain name identifies a grouping of machines visible on the internet. The host part comes before the domain name in a URL, thus 'www' in 'www.mywonderfulcompany.com' refers to the web server host machine, and 'mywonderfulcompany.com' refers to the overall Domain name. There might typically be a number of other machines named such as 'ftp.mywonderfulcompany,com' - a host providing File Transfer Protocol facilities, 'smtp.mywonderfulcompany.com' providing outgoing mail facilities and 'pop3.mywonderfulcompany.com' providing mailbox facilities for clients.
In order for a client computer to be able to determine the actual IP address from the URL, it uses the Domain Name Server system (DNS).
DNS Servers
Every service provider has at least one DNS server, and usually provides many more. Medium sized businesses and organisations maintain their own email systems and other major services etc. will also typically have at least one DNS server for their network.
DNS servers accept requests from programs and other domain name servers to provide mapping between domain names and IP addresses. When a request from a computer is made to resolve a URL to an IP address (And vice versa) a DNS server can do one of the following:
- It can answer the request with an IP address because it already knows the IP address for the requested domain. It gets this information from a resolution table that it constantly updates containing mappings of host domain names to IP addresses.
- If it doesn't have the mapping, it can contact another DNS server and try to find the IP address for the name requested. Depending on the DNS configuration, it may have to do this multiple times in a hierarchal fashion eventually accessing the main DNS servers on the internet at the top of the 'tree'.
- It may reply with the IP address of a more 'distant' DNS server that contains more table information relating to the requested URL and domain name, the requesting computer then using the more distant DNS server to query the address.
- It can return an error message because the requested domain name is invalid or does not exist, this typically being carried out as the DNS requests for information are reaching higher up the 'tree'.
When a DNS server resolves a request, it caches the IP address it receives into a resolution table. For example, when a DNS server has made a request to a root DNS server for any .biz domain, it knows the IP address for a DNS server handling the .biz domain, so it doesn't have to enquire to the root DNS servers again for that information and this then reduces traffic and request load.
Registration of Domains
A number of organisations oversee the registration of Domain Names, some particular domain name endings having certain restrictions - such as 'ac.uk' for pure educational usage. From registering a new Domain name, or altering/redirecting an existing Domain name to a new IP address (Such as when changing Web hosting companies) the process of propagation may take approximately 24 hours, before each higher level DNS server has updated itself with the new information. DNS servers regularly update resolution tables with each other in a hierarchical manner and also remove 'stale' entries after a period of time.
