View Single Post
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2004-09-28, 19:01

Yeah, editing the hosts file is a LOT easier.

There's a file at /etc/hosts (etc is an invisible folder) that looks like this:

##
# 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

This file is owned by root and is not writeable by normal users; so, you may have to authenticate or use terminal trickery to modify it.

You can add entries to this file to redirect domain names to different IP addresses. By redirecting them to 127.0.0.1 or 0.0.0.0, you redirect them to your local computer and effectively annihilate anything that tries to access those domains.

My hosts file is filled with hundreds upon hundreds of known ad servers. Here's a snippet:

0.0.0.0 oz.valueclick.com
0.0.0.0 doubleclick.net
0.0.0.0 ads.doubleclick.net
0.0.0.0 ad2.doubleclick.net
0.0.0.0 ad3.doubleclick.net
0.0.0.0 ad4.doubleclick.net

Use that format. IP address, space, domain name, newline. Any line that starts with the # symbol is ignored (use these for comments).

An important note:

As of Mac OS X 10.3, the DNS cache isn't cleared when you modify this file. SO, you'll need to do two things after making changes. First, quit any web browsers or other applications you want affected. Then, run the terminal command "lookupd -flushcache". This, as it says, flushes the lookup cache.

Now you can launch your web browser and surf the net while blocking various servers via the hosts file!

Hope this helps!

The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting.
  quote