HOSTS file being ignored

Solution 1:

Any chance you are using a proxy server for browsing? If so it might be that the proxy server is resolving the dns name for you.

And thats why you get different results in a commandline with ping as opposed to the browser.

Off chance traffic is intercepted and changed. Very off chance...

Solution 2:

Firewall Responding To Pings?
This is a long shot from the ip address you gave, but what happens when you ping the new ip directly, does that work?

The reason I ask, if happens to be a firewall that responds to the ping, it will say reply from that, even though you were pinging a different IP....

Big Hosts File?
Also, this got me and another IT person once, there were lots of blank lines in the window hosts files, and then entries way down below -- we didn't noticed the scroll bar :-)

Is the hosts file really the hosts file?
Lastly, look in the registry and make sure the host file is where you think it is, the following key specifies where the actual hosts file is:


Solution 3:

Try to flush your DNS Cache with Start -> Run...

 ipconfig /flushdns

Also try to deactivate NetBIOS and LMHOSTS for your Network Adapter. You can change the settings in the TCP/IP Properties of the used Network Connection, under Advanced -> WINS.

Solution 4:

Turns out that my corporate DNS was being hit before my hosts file. So I:

  1. Opened my TCP/IP Properties (Control Panel > Network Connections > Local Area Connection > Properties > (scroll down) Internet Protocol (TCP/IP) > Properties.
  2. Clicked "Use the following DNS server addresses:" (Instead of Obtain DNS server address automatically)
  3. entered "" and "" (and clicked ok)

Now my hosts file works just fine... From the command line. However, if I put an entry in for that points to, when I ping it from the command line, it returns from the IP address I specified in the hosts file. But if I hit it from the browser, it still shows me Google instead of my local site. But if I put an entry in for "fredspc" that points to and hit that from the browser, it takes me to

I figured this out because if I entered "tedspc" in my hosts file (i.e. something that would never resolve) and gave it an IP address and pinged it, it would resolve to that IP address. The problem was that and anything else I was entering into my hosts file had an entry in my corporate DNS server, which was causing it to resolve, which meant it never looked at my hosts file (because the corporate DNS server gets looked at first before the hosts file). So I've cut the corporate DNS out of the command prompt loop, but not out of the browser loop I guess... Any ideas?

Solution 5:

According to it could be in your local NETBIOS name cache. You can use nbtstat ( to query/purge this cache.