I have added several hosts to my /etc/hosts file in Snow Leopard. In Leopard (10.5), once I saved the /etc/hosts file, the hosts were available and usable. In Snow Leopard, it's like this file is never read or used. I cannot get Snow Leopard to use these entries at all in Terminal. I use this "local DNS" style feature every day at work to connect to computer systems on the corporate LAN.
In past releases, you had to import these entries into NetInfo; however, as of Leopard, my understanding is that NetInfo is gone (or, at least, niload is).
Am I missing a new step in Snow Leopard? I have tried logging out and back in, and I've restarted the computer many times since the entries were made.
Any help would be much appreciated.
MacBook Pro Core 2 Duo, 2.66GHz, 4GB RAM, 320GB HDD,
Mac OS X (10.6.1)
/etc/hosts works fine in snow leopard. make sure you use the correct syntax when editing it and also make sure that it has correct permissions. it should be owned by the system and have 644 permissions.
/etc/hosts works fine in snow leopard. make sure you use the correct syntax when editing it and also make sure that it has correct permissions. it should be owned by the system and have 644 permissions.
V.K. wrote:
/etc/hosts works fine in snow leopard. make sure you use the correct syntax when editing it and also make sure that it has correct permissions. it should be owned by the system and have 644 permissions.
Well, don't I feel stupid... I had switched the order of the entries to "name<tab>IP address" rather than "IP address<tab>name". 😟
Thanks for making me double-check. I only work in Unix every day... 🙂
V.K. wrote:
/etc/hosts works fine in snow leopard. make sure you use the correct syntax when editing it and also make sure that it has correct permissions. it should be owned by the system and have 644 permissions.
Well, don't I feel stupid... I had switched the order of the entries to "name<tab>IP address" rather than "IP address<tab>name". 😟
don't feel too bad. I for one also have to double-check the order of the fields in /etc/hosts every time I edit it (which is not very often).
Thanks for making me double-check. I only work in Unix every day... 🙂
Hello,
well I have the same problem even with the correct syntax. I put this inside:
127.0.0.1 facebook.com
but the name still gets resolved
~ $ host facebook.com
facebook.com has address 69.63.184.142
facebook.com has address 69.63.176.140
facebook.com mail is handled by 10 mx.sf2p.tfbnw.net.
facebook.com mail is handled by 10 mx.snc1.tfbnw.net.
~ $ sudo dscacheutil -flushcache
~ $ host facebook.com
facebook.com has address 69.63.176.140
facebook.com has address 69.63.184.142
facebook.com mail is handled by 10 mx.sf2p.tfbnw.net.
facebook.com mail is handled by 10 mx.snc1.tfbnw.net.
Sorry, I didn't notice you were using the
host command.
Utilities that directly use the DNS resolver like
dig,
host and
nslookup never use local files.
But if you try to visit facebook.com with Safari, you won't be able to get there.
For example, try this after placing your entry in
/etc/hosts:
dscacheutil -q host -a name facebook.com
From the man page for host(1):
Mac OS X NOTICE The host command does not use the host name and address resolution or
the DNS query routing mechanisms used by other processes running on Mac
OS X. The results of name or address queries printed by host may
differ from those found by other processes that use the Mac OS X native
name and address resolution mechanisms. The results of DNS queries may
also differ from queries that use the Mac OS X DNS routing library.
I'm having the exact same issue as Tex-Twil, but I'm kinda new to this so I'm not that great with the terminology. I've done pretty much everything you've said so far, but no luck. Oh, and this is on an Intel Mac Mini running 10.5.8.
Don't think this issue is resolved...I'm having the same issues after adding to the host file. Safari seems to be able to resolve anything I put in that file. However, in FF the host file works.
Okay, so here's the odd part -> if I make the domain I'm trying to fool 127.0.0.1, it works as advertised. As soon as I try to make it some other address, it fails.