0

I have a baffling problem. Browsers on my system (10.10.3 Yosemite) don't respect overrides included in my hosts file. This includes Chrome, Safari, and Firefox. I have tried rebooting, clearing history, clearing Chrome's DNS cache with

chrome://net-internals/#dns

and OSX/Safari's with

sudo discoveryutil mdnsflushcache

Chrome sometimes respect it for about 5 minutes at a time after clearing its DNS cache, but then miraculously stops again! And this is not reliable.

Ping through the terminal always respects the changes as it should.

I am completely out of ideas. Anyone?

1

There are similar problems (i.e. https://superuser.com/questions/648133/why-is-chrome-ignoring-etc-hosts-on-os-x) here on the network.

One answer is to follow this bug which must be solved eventually.

People also mention the plugin HostAdmin to workaround this issue.

  • Thanks for the response... this is definitely an OS-level issue, not just Chrome. HostAdmin seemed very buggy and did not work for me, but another extension called Virtual Hosts is getting the job done OK. chrome.google.com/webstore/detail/virtual-hosts/… – intelli78 May 27 '15 at 22:15
  • If you are familiar with network packet inspectors like Wireshark or tcpdump you can use these to see what is going on with DNS queries. – Overbryd May 27 '15 at 22:17
  • @Overbyrd - sure enough, Wireshark shows no DNS lookup activity when I ping a site that's overridden to 127.0.0.1 in the hosts file, but as soon as I load it up in a browser, there is a lookup. Not sure how to proceed from here. – intelli78 May 28 '15 at 0:39
  • Update: While searching Google I found a 2013 post that says to put overrides at the top of the hosts file instead of the bottom. I did this, and suddenly Chrome started obeying. Safari and Firefox did not. But then after about 30 minutes, Chrome just randomly stopped again. Makes NO SENSE. – intelli78 May 28 '15 at 1:20
  • So from a theoretical point of view no application is obliged to respect /etc/hosts. It was the system used before DNS came around, and now on *nix platforms is considered as an override or fallback to DNS. So I think the modern applications on a modern *nix like Mac OSX might just completely ignore /etc/hosts. Have you looked into setting up a local DNS resolver that you can point to? If that would be in your control, you would have a win. Another hint would be thoroughly checking your DNS configuration on each network interface you are using. – Overbryd May 28 '15 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .