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
- Linux
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
- LMhosts
- Wins
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:
command ipconfig/flushdns
Note: The cache isn’t cleared automatically on Windows which is unusual for a cache.
To view the cache use:
command ipconfig/displaydns
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?
A- No
Related Tutorials and Resources:
According to https://support.microsoft.com/en-us/help/172218/microsoft-tcp-ip-host-name-resolution-order, current Windows uses NetBIOS as a fallback for DNS resolution. It will query the local hosts file and DNS server before it falls back to NetBIOS. So the resolution order in your article is misleading.
Can you point out the specific line as I’ve reread it and looked at the article and don’t see where it is misleading
Hi,
I need to resolve my local web server name but i have no domain controller. i use host file to resolve thename.com .
Is there a way i can tell DNS server to resolve thename.com?
In short no unless you install your own local DNS server. Local networks use MDNS (MultiCast DNS ). Your local network may already be using it try using ping servername.local and see if it works. .local is reserved for mdns.
Are you on a mixed windows/linux/mac network?
rgds
Steve