Windows – Chrome, Safari, IE not recognizing hosts file in Windows 7

hosts-filewindows 7

I have a new clean install of Windows 7. I've edited the hosts file and when I ping from the command line the correct settings are used — the ping goes to a local network server instead of out to the Internet. Firefox also recognizes the settings and goes to the correct local server.

Chrome, Safari, and IE will not recognize the new settings at all. I do not have any proxy set anywhere. I have restarted, "ipconfig/flushdns" -ed, stopped and started DNS service, flushed browser caches, waved my arms frantically, and done a fair amount of swearing.

What can I do to make those browsers recognize the new settings?

Best Answer

One of these things fixed it finally, if only I could get it down to Just ONE. instead here is a list, numbered so specific items can be referred to in comments (and tossed if need be) Any use of the hosts for me would be a pre-emptive action. This time I had already been to the locations I was going to block.

Start with the simpler stuff:

1) yes, the file is called HOSTS, is need ONLY be in C:\Windows\System32\drivers\etc for any 32bit or 64bit progams it does not matter. There are no "links" or redirections for this file or that folder location, unlike other files/folders in the system.

2) It has no extention, it is not HOSTS.txt (for all the people who think that needs to be explained again)

3) Inside the hosts with notepad, there is a space/linefeed at the end of the item list ?

4) The dns cache is flushed when the DNSclient service is running using ipconfig /flushdns in the command prompt.

On to the weird stuff

5) Claims that Hosts is sucked into the DNS cache , and only after it is Changed, and the date changes on the file? Which might require reboot.

6) HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\ServiceProvider is the location for the priority items for dns resolve. I have been messing with this, and windows 7 does use these priorties.

7) Claims that file Hosts needs to be thrown out, and remade from scratch, which fixed it for some people. (makes me wonder what really changed)

(7 and 5 are interesting, because while fooling around it did take me Time, and something triggered in the background during only one of the edits/changes)

And the really weird

8) Add NETWORK SERVICE as an item in the permissions and give it control ?

9) Set the file to Read Only. Oddly enough remaking the file and setting it readonly seemed to work again. (see 5 the file time changing)

10) To check the idea that "spyware blaster" might have messed with it, I did a Hosts Save and a hosts Return, only visable change was it set to read only. (this also re-writes it) Of course there can be many other AV type programs that would not allow change, or change things.

11) Clearing all internet temps files, specificly using the "Internet Options" "general" tab "Browsing History" "Delete" and selecting to remove everything .

12) turning DNS cache service on and off , flushing, retesting.

Then suddenly it worked.

Some of the above things may require admin access or elevations, that is left out because you get a notice for that. Most IP6 things are shut off in my machine, however that would make things different, I was mostly using IP4.

There are DNS resolves locked into the system itself, check out the file dnsapi.dll, they say these items are used in a higher priority? (another thing I have wondered about) So it is possible to resolve some addresses without Any DNS comming from the web or being in any cache.