Windows – HOSTS file not overriding DNS

hostswindows

I have a Server 2012 R2 machine and I have added a hosts file entry for a hostname to point to an IP.

However, when doing an nslookup, the HOSTS file does not override the result (from DNS). I can't ping the server, does this matter?

Everything else in the HOSTS file seems to look correct.

Any ideas?

Best Answer

From what you wrote, everything seems OK.

nslookup is a "low level" program in a sense that it does not use the libraries that are used by other programs in the system in order to do DNS resolution. nslookup creates and sends raw DNS packets on its own and it also receives and analyzes raw DNS replies.

If you want to check your settings, use ping command on the hostname. It does not matter if you blocked ICMP or not, ping command does DNS resolution using standard libraries (that use HOSTS file), so you will see in its output, if the resolution was done as you wanted or not.

DNS resolution and using HOSTS file is not related to ICMP firewall settings, so do not worry about your inability to ping that server.