0

I’m having an issue removing some local DNS settings on my Mac that’s running Mac OS X 10.10.2 (Yosemite).

I normally use the /etc/hosts file to direct requests from development sites to my guest Vagrant VM. Sometimes I use the live site’s URL in development to eliminate having to replace paths when I migrate my DB.

In this instance I had the following record:

192.168.50.4 example.com www.example.com

The above IP is my Vagrant VM’s IP.

I’ve migrated the site to production and I cannot get Chrome to connect to the live site on my server. When I use ping and traceroute that hostname, the Mac still resolves to the 192.168.50.4 Vagrant VM address that I have already removed.

When I visit the website on my mobile phone I’m getting the expected behavior.

So far I’ve done the following:

  1. Removed the record from my /etc/hosts file.
  2. Rebooted my Macintosh.
  3. Cleaned the local cache as described here.
  4. Flushed Chrome’s DNS cache by visiting here: chrome://net-internals/#dns.
  5. Rebooted my Macintosh again.
  6. Reloaded and re-provisioned my Vagrant VM.
  7. Rebooted.

I can’t seem to make my Macintosh connect to live site on the web. I’ve used this process for the last 10-15 projects I’ve developed.

Any ideas on how I might prevent my machine from looking up the domain on my Vagrant VM?

Update: running dscacheutil -q hostreveals the following entries:

name: example.net
alias: # VAGRANT: 53475745d1ed12f00441552188bfdd8b (default) / 0eb4854a-a516-4d34-ac43-397240944175
ip_address: 192.168.50.4

name: www.example.net
alias: # VAGRANT: 53475745d1ed12f00441552188bfdd8b (default) / 0eb4854a-a516-4d34-ac43-397240944175
ip_address: 192.168.50.4

Still not sure why I can't clear this using any of the commands recommended by Apple.

migrated from serverfault.com Mar 31 '15 at 3:27

This question came from our site for system and network administrators.

  • 1
    Are you 100% sure this is a DNS resolution issue? What happens when you ping the hostname in question? Or even use traceroute to that same hostname? Also, what command did you run to attempt to flush the DNS cache? sudo discoveryutil mdnsflushcache which is what is recommended for Mac OS X 10.10 or sudo killall -HUP mDNSResponder which is what is recommended for Mac OS X 10.7, 10.8 and 10.9. – JakeGould Mar 31 '15 at 3:38
  • I can access the site just fine from my droid. Circumstantial, yes, but good enough for me to declare that this is in fact a DNS issue. Thanks for the edits. – Ken Prince Mar 31 '15 at 3:53
  • But which command did you use to flush your DNS cache on your Mac OS X machine? Read my comment again? That is not clear in your question. – JakeGould Mar 31 '15 at 3:54
  • 2
    Yes, but did you even do a basic ping or a traceroute to see what the actual hostname resolves to? – JakeGould Mar 31 '15 at 4:41
  • 1
    Resolved. Issue was with my vagrant host updater plugin which kept persisting host records into my /etc/hosts file even after I removed them. – Ken Prince Mar 31 '15 at 18:40
0

Anyone running into this problem, there is a simple solution:

  1. Check your /etc/hosts file.
  2. Remove the necessary entry.
  3. Double check that the hosts file entries have been removed: dscacheutil -q host
  4. Clear your local cache, depending on your OS version (reference here).
  5. Check your Vagrantfile and make sure you're not using a plugin to update the hosts file during provisioning.
  6. Reload vagrant and provision vagrant reload --provision
  7. Check your hosts file again, go allll the way to the bottom.

I happen to be using a Vagrant plugin that caused the host file to be updated during provisioning, but hey I set this up months ago and forgot.

Godspeed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.