DNS overrides not working in Yosimite

I use my MBP for a lot of web development. I have always overridden DNS by adding entries to /etc/hosts (as you would on any normal linux system or even windows).


I have just upgraded to Yosimite and this no longer works and I cannot work. Googling for this issue doesn't throw up much apart from solutions for people who experienced this issue during the beta stages.


See http://forums.macrumors.com/showthread.php?t=1741422


http://azchipka.thechipkahouse.com/dns-overrides-yosemite-10-10-etchosts/10473/


These solutions do not seem to work with the official release. I am now stuck, anyone have any ideas?


Thanks


And what happened to "If it ain't broke don't fix it?"

MacBook Pro with Retina display, OS X Yosemite (10.10)

Posted on Oct 31, 2014 5:40 AM

Reply
11 replies

Nov 1, 2014 8:15 AM in response to Linc Davis

Currently its this:

MacBook-Pro:~$ /etc/hosts

##

# Host Database

#

# localhost is used to configure the loopback interface

# when the system is booting. Do not change this entry.

##


127.0.0.1 localhost

255.255.255.255 broadcasthost

::1 localhost

192.168.1.60 test.devserver.local

On my network, I have an internal DNS setup with an A record for test.devserver.local pointing to 192.168.1.25

A ping or any type of connection to test.devserver.local still tries to resolve to 192.168.1.25 on my Yosemite system regardless of the host file entry.

On my mavericks system, I have the same host file configuration and it overrides test.devserver.local and resolves to 192.168.1.60 correctly.

Nov 16, 2014 5:30 AM in response to pbatts

So my original host file looked like this:



127.0.0.1 localhost

255.255.255.255 broadcasthost

::1 localhost

192.168.1.60 test.devserver.local


In my local dns setup I changed my "A" record for "test.devserver.local" to "test.devserver.dev", then all started to work when i changed my hosts file to this:



127.0.0.1 localhost

255.255.255.255 broadcasthost

::1 localhost

192.168.1.60 test.devserver.dev

Theres also another gotcha I experienced. If in your hosts file, you specify multiple hostnames on the same line for a single IP address, host overrides for that entry also seem to fail.

Hope this helps.

Feb 8, 2015 8:47 PM in response to phillyone

Hi! I'm trying (for the first time) to do this as well, but I simply want to preview the impending new location for a website, which (since it will be at the same URL as currently) I'm supposed to be able to reach only by its IP address right now. (Both current and future site are hosted at GoDaddy.) I thought if I add this type of line to my hosts file:


40.50.255.7 www.domain-name.com


...that when I type "www.domain-name.com" into my browser, my Mac will take me to 40.50.255.7, instead of the current live www.domain-name.com site.


But I've confirmed that I go to the live site no matter what.


When I type in the 40.50.255.7 (well, actually the real IP address), I am indeed taken somewhere else. So why wouldn't my revision to the hosts file achieve the same thing?


Thanks,

adam

Mar 23, 2015 12:40 AM in response to cosmocanuck

I am very keen to know the answer to this too as this is what I used a lot in my web development - but since upgrading to Yosemite - anything I put into /etc/hosts to override is ignored 😟


For example if the A record for the domain yosemitepains.com is 108.200.16.123


And I have a dev server set up on 108.154.89.123 and I want my browser to point to my dev server for that domain - I used to be able to just type:


108.154.89.123 yosemitepains.com


into the /etc/hosts file and with a bit of 'dscache -flushcache' - I would be able to see my server (108.154.89.123) - rather than the public DNS resolved server of 108.200.16.123


I feel I must be missing something. I have a clean install of Yosemite.


P.S. All ip addresses and domain names are fictional and any likeness to real ip addresses and domain names is purely co-incidental. 😉

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

DNS overrides not working in Yosimite

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.