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)
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
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