Tuesday, November 25, 2008

How Computer resolves hostname

On a TCP/IP network, name resolution has to occur whenever the host name such as www.canon.com.sg is used to connect to a computer and not the IP addresses. This has to occur so that the IP address can be resolved to the hardware address for TCP/IP based communication to occur. Basically there are several different name resolution mechanisms, however, the following two are the two methods are generally used in today's network environment.

1. DNS (Domain Name System)
2. Hosts file

DNS is a distributed, hierarchical naming system that is used on the network to resolve fully qualified domain names (FQDNs) to IP addresses. In the case of resolving host name with a DNS server, devices on the network are configured such that it will enquire DNS server for host name resolution.

As all information are maintained in the centralized DNS server, any modification to this information will be updated to all devices on the network pointing to it for host name resolution. However, this information is not replicated to all devices immediately. However, if a device is required to have the latest update immediately, a reboot of devices may be useful.

The second method of host name resolution is to configure the host name and IP address information in the local hosts file. The hosts file is a text file used to store information on where to find a node on a computer network. It contains IP addresses separated by at least a space and then a domain name, with each entry on its own line. This will map host names to IP addresses. This file is located in C:\Windows\System32\drivers\etc in Windows environment. It is normally located in /etc/hosts if it is a Unix system – like Linux. As this is a local hosts file, other computer will not be able to use this information. If a host name is changed, host file in all computers are required to be modified.


The advantage of using a Hosts file is that users can customize it for themselves. The hosts file is under the control of the local computer’s administrator. Local computer administrator can easily modify information in this file to assign host name to some of the computers which does not have user friendly name.

No comments:

Post a Comment