On computer and home networks when you type an Internet address into a web browser the web browser needs to convert that web address into an IP address.
To do that it uses the the name resolution processes provided by the host machine.
There are several ways that the host machine can resolve a domain name. The main ones are:
- hosts file lookup
- DNS lookup
Generally a host will try multiple methods until it succeeds or runs out of methods to try,and then it fails.
The order in which it tries this method is a host parameter that can be changed.
In Linux this is done in the /etc/nsswitch.conf file.
Name resolution and Host Type
There are three operating systems in common use on home and corporate networks. They are
- Microsoft Windows
- Apple OSes
Early Windows networks used the Netbeui (NetBIOS) protocol which had its own name resolution methods.
Likewise Apple also had their own networking protocols and name resolution methods.
The Internet was built on Linux (Unix) and TCP/IP which used the hosts file and DNS as the main name resolution methods.
Microsoft and Apple moved from their proprietary networking protocols and standardized on TCP/IP, and in doing so adopted the hosts file and DNS resolution methods.
However they also kept their old methods, and modified them to work over TCP/IP.
Windows And Apple Name Resolution Methods
Windows specific name resolution methods are:
- NetBIOS name cache
Apple specific name resolution methods are:
- NBP (network binding protocol)
Name Resolution Order and Application
The name resolution order can also be affected by the type of application making the request.
On Windows machines, traditional NetBIOS application use NetBIOS name resolution methods before they use the hosts file and DNS. See here
However SMTP, FTP and other traditional Internet protocols and application use hosts and DNS. See here
Viewing and Clearing the DNS Cache- Windows
On Windows machines you can see the contents of the DNS cache and clear it using the ipconfig command.
To clear the cache use:
Note: The cache isn’t cleared automatically on Windows which is unusual for a cache.
To view the cache use:
Viewing the NetBIOS Name Cache
To View the NetBIOS Name Cache use the nbtstat command nbtstat -c
See this Technet article for a more detailed look at nbtstat.
Common Questions and Answers
Q- Is there a DNS cache on Linux?
A- Not normally. See this stackoverflow q and a
Q- What is the LMhosts File and where is it stored?
A- The LMhosts file is found on Windows machines and is used for NetBIOS name to IP address mapping similar to the hosts File. It is found in the same folder as the hosts file which on windows XP,windows 7 it is located in c:\windows\system32\drivers\etc\,
Q- What is WINS?
A- Just as LMhosts is the Windows equivalent to hosts, Wins is the Windows equivalent to DNS. I don’t believe it is used anymore.
Q- Can I tell which method resolved the host name?
Related Tutorials and Resources: