Posted 17.10.2005 | Updated 23.05.2006 | Contributed by Andy Mallett
Experienced players will know that DNS stands for Domain Name System (Server, Service - depending on the context) and it is a way to resolve host names to IP Addresses.
Host names of course, are those with the domain name after the computer name, such as goth.it.net, www.microsoft.com, etc.
Computers talk to other computers using IP Addresses on a TCP/IP network, and the hostname is just a way of getting to the IP Address.
There are two main ways to resolve these host names to the relevant IP Addresses.
|
|
The usual way is through a DNS Server. However if a DNS Server is not available, then these mappings can be recorded in a clear text file on the system itself.
Windows XP stores such mappings in the file C:\windows\system32\drivers\etc\hosts and BSD stores them in /etc/hosts. On some systems like the celebrated 4-in-1 network boot disk, the file is called lmhosts. Here's an example hosts file..
#Andy's HOSTS file (Unix or Windows)
10.0.0.10 goth
10.0.0.10 goth.it.net
10.0.0.13 banshee
10.0.0.13 banshee.it.net
172.16.0.2 gatsby
172.16.0.2 gatsby.it.net
172.16.0.2 gatsby.tafeitltn.com.au
172.16.0.3 cybil
172.16.0.3 cybil.it.net
172.16.0.3 cybil.tafeitltn.com.au
172.16.0.4 polly
172.16.0.4 polly.it.net
172.16.0.4 polly.tafeitltn.com.au
Quite simply, hosts is a list of IP Addresses and the host names which they apply to. The two fields are separated by spaces. If you ping goth.it.net, then your system will look up the hostname to find the IP Address. There is a specific order to which the system will look for the IP. Again the Windows system first..
TCP/IP Host Name Resolution Order
- The client checks to see if the name queried is its own
- The client then searches a local Hosts file
- Domain Name System (DNS) servers are queried
- If the name is still not resolved, NetBIOS name resolution sequence is used as a backup. This order can be changed by configuring the NetBIOS node type of the client
Unix uses a similar system, except the order is different. When installing MySQL, we have found that if BSD finds a DNS Server, it will not bother to query the hosts file, dammit!
BSD will first look into a file called /etc/resolv.conf for the IP Address of the nearest DNS Server. If it finds a DNS Server then it will forward DNS queries to this IP. If it does not find a DNS Server entry, then it will query the /etc/hosts file.
|
|