phillyone

Q: 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

Close

Q: DNS overrides not working in Yosimite

  • All replies
  • Helpful answers

  • by Linc Davis,

    Linc Davis Linc Davis Oct 31, 2014 4:15 PM in response to phillyone
    Level 10 (208,059 points)
    Applications
    Oct 31, 2014 4:15 PM in response to phillyone

    What do you get from this:

     

    file -b /etc/hosts
    
  • by phillyone,

    phillyone phillyone Nov 1, 2014 1:03 AM in response to Linc Davis
    Level 1 (4 points)
    Nov 1, 2014 1:03 AM in response to Linc Davis

    Linc Davis wrote:

     

    What do you get from this:

     

    1. file -b /etc/hosts 

    Hi, this gives me back: ASCII English text

  • by Linc Davis,

    Linc Davis Linc Davis Nov 1, 2014 7:44 AM in response to phillyone
    Level 10 (208,059 points)
    Applications
    Nov 1, 2014 7:44 AM in response to phillyone

    Please post the contents of the hosts file, with any private information anonymized.

  • by phillyone,

    phillyone phillyone Nov 1, 2014 8:15 AM in response to Linc Davis
    Level 1 (4 points)
    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.


  • by Linc Davis,Solvedanswer

    Linc Davis Linc Davis Nov 1, 2014 9:25 AM in response to phillyone
    Level 10 (208,059 points)
    Applications
    Nov 1, 2014 9:25 AM in response to phillyone

    The "local" TLD is reserved for Bonjour and shouldn't be used for unicast DNS. It seems that Yosemite enforces that restriction where earlier versions of OS X did not. Also, you're missing a line from the hosts file:

    fe80::1%lo0                    localhost
  • by phillyone,

    phillyone phillyone Nov 3, 2014 4:15 AM in response to Linc Davis
    Level 1 (4 points)
    Nov 3, 2014 4:15 AM in response to Linc Davis

    Ok thanks a lot, changing the TLD seemed to do the trick

  • by pbatts,

    pbatts pbatts Nov 16, 2014 4:54 AM in response to phillyone
    Level 1 (0 points)
    Nov 16, 2014 4:54 AM in response to phillyone

    I am having the exact same trouble. Sorry for being a dummy but how do you change the TLD?

     

    Thanks

  • by phillyone,

    phillyone phillyone Nov 16, 2014 5:30 AM in response to pbatts
    Level 1 (4 points)
    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.

  • by pbatts,

    pbatts pbatts Nov 19, 2014 5:01 AM in response to phillyone
    Level 1 (0 points)
    Nov 19, 2014 5:01 AM in response to phillyone

    Got it!

     

    Thanks for your help.

  • by cosmocanuck,

    cosmocanuck cosmocanuck Feb 8, 2015 8:47 PM in response to phillyone
    Level 1 (11 points)
    Photos for Mac
    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

  • by instil,

    instil instil Mar 23, 2015 12:40 AM in response to cosmocanuck
    Level 1 (0 points)
    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.