|
|
Won't work
That's what you'd do on many Unixes, but Mac OS X gets all its hosts info from the NetInfo database, bypassing the /etc/hosts file. On my machine, the file has the following comment: "By default, lookupd gets information from NetInfo, so this file will not be consulted unless you have changed lookupd's configuration."
Eh, sure it does.
Hmm...on OS X 10.3, that statement is misleading. I've been using the hosts file ever since installation of Panther to block ads, etc, and it's worked fine. I believe in prior system versions you had to run some terminal magic to detach hosts from NetInfo, but now it's definitely a part of the check sequence.
Eh, sure it does.
Hm. Even after I "lookupd -flushcache", "host" still resolves to a real IP. Do I need to do something else to get the /etc/hosts config loaded? I seem to recall something about NetInfo too--maybe not applicable to Pantherl, but in any case it's not working.
other option? re: Eh, sure it does.
try adding to
'/etc/hosts.deny'I read this comment previously but gave it little attention as I keep 'load images' off anyway. However, using Webmin and playing around with PortSentry I excluded my test machine with the rule I had and ended up doing a web search to find where I was getting blocked. PortSentry with the config I chose (FreeBSD/Mac OS X) had added the IP to the 'hosts.deny' file and it did block all but file sharing and web access (not sure why those worked). This is the command to Kill the host from PortSentry KILL_ROUTE="route add -net $TARGET$ -netmask 255.255.255.255 127.0.0.1 -blackhole"However, please use only at your own risk NOT as recommendation.
Won't work
I disagree with the way that this works. I routinely put information in to my /etc/hosts file and use it to access internal machines that are not configured with a DNS Name. I have also blocked sites by routing their DNS name to localhost.
Default lookup order
The comments within the /etc/hosts file are more than likely incorrect and have been since 10.2. They should largely be ignored, but I suppose it's all in how you installed your operating system. If yours is an upgrade installation, you may not have the same lookup order as those who have done cleans installs of Panther or Jaguar.
To check your current lookup order, simply execute this command:
By default under Panther, the lookup order is as follows:
So, flat files (FF) are searched before DNS, meaning that by default the /etc/hosts file should be consulted before name-to-IP-address resolution is ever attempted.
These articles do a good job showing the default lookup orders of 10.1, 10.2, and 10.3:
Default lookup order
My machine has run through the upgrade sequence from 10.1--10.3.3. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.08 seconds |
|