PDA

View Full Version : The hosts file, host deny file and pesky ads. . .


krp
07-04-2006, 05:34 PM
I just recently read here (http://www.grc.com/sn/notes-045.htm) and here (http://en.wikipedia.org/wiki/Hosts_file) that one can use the hosts file to basically block unwanted url's from being ... admitted to your browser (ad filtering).

This is accomplished by either using the localhost IP (127.0.0.1) followed by the domain (ad.doubleclick.net) or the null IP (0.0.0) followed by the domain (ad.doubleclick.net).

This is cool for me. However, my one question is can we use the hosts deny file to accomplish the same thing instead of the hosts file?

Edit:

Well the hosts.deny file made no difference at all. Neither did using null IP (0.0.0) followed by a domain name in the hosts file.

*But*, using the local host IP (127.0.0.1) followed by a domain name (doubleclick.net [for instance]) in the hosts file made all the difference in the world.

I now surf the news with nary an ad.

Here is what my hosts file (blocked sites only) looks like:

# start blocked sites
127.0.0.1 media.fastclick.net
127.0.0.1 fastclick.net
127.0.0.1 tribalfusion.com
127.0.0.1 a.tribalfusion.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 googlesyndication.com
127.0.0.1 an.tacoda.net
127.0.0.1 tacoda.net
127.0.0.1 geo.precisionclick.com
127.0.0.1 servedby.precisionclick.com
127.0.0.1 precisionclick.com
127.0.0.1 bannerfarm.ace.advertising.com
127.0.0.1 ace.advertising.com
127.0.0.1 advertising.com
127.0.0.1 ads.cnn.com
127.0.0.1 ad.doubleclick.net
127.0.0.1 doubleclick.net
127.0.0.1 servedby.advertising.com
127.0.0.1 bs.serving-sys.com
127.0.0.1 serving-sys.com
127.0.0.1 oascentral.sfgate.com
# end blocked sites

krp

tom_servo
07-05-2006, 05:32 AM
...
This is cool for me. However, my one question is can we use the hosts deny file to accomplish the same thing instead of the hosts file?

...

krp

The hosts.deny works the other way around, it is supposed to list computers not permitted access to your computer. So for example you could set this file (and the hosts.allow) to permit only one of the other computers on your local network to access your computer through ssh. If I remember correctly this only works for daemons managed through inetd, so it is no replacement for a good firewall.


Alain