Skip to main content
Question

Mavericks and editing /etc/hosts file

  • April 30, 2014
  • 4 replies
  • 6 views

Forum|alt.badge.img+10

It seems as though Mavericks is ignoring changes to the hosts file. I use:

sudo vi /etc/hosts

Make changes as necessary and then run

sudo killall -HUP mDNSResponder

and

sudo dscacheutil -flushcache (just in case)

But the changes to the hosts file are not taking. No matter what I do it does not seem to see the changes to the hosts file and still pings an incorrect address? Has anyone figured out a workaround?

4 replies

Forum|alt.badge.img+4
  • New Contributor
  • 8 replies
  • April 30, 2014

Forum|alt.badge.img+10
  • Author
  • Contributor
  • 126 replies
  • April 30, 2014

It's not the browser I need to direct to this address. Mail is trying to hit a DMZ address and not an external address, due to internal DNS and some vpn tunneling I need them to use the external public IP and not the DMZ IP.


Forum|alt.badge.img+12
  • Contributor
  • 529 replies
  • April 30, 2014

Does a reboot work after editing the file? If not, then restarting services isn't going to help and the problem lies elsewhere.


Forum|alt.badge.img+13
  • Contributor
  • 52 replies
  • May 8, 2014

May want to consider a "Resolver" file instead.
Check this out:

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/resolver.5.html
http://apple.stackexchange.com/questions/74639/do-etc-resolver-files-work-in-mountain-lion-for-dns-resolution

A bunch more stuff if you google search it.

Essentially, it's just a directory and a file at /etc/ called resolver/
In there you put a file (no . extension, just the file), called the domain you're trying to resolve to.

I gave the folder and file perms of 755 and owner 0:0.
This worked instantly once in place. No browser relaunch, no reboot necessary, no caches to clean. Tested on 10.6 - 10.9.2 w/out issue