Jump to content
Sign in to follow this  
PodWorld

blocking websites

Recommended Posts

It's easy to block selected sites using the /etc/hosts file if you have some familiarity with the Terminal and some Unix-like text editor (e.g, vi, emacs, nano, ed...). Just add the websites you wish to block to the /etc/hosts file (point them to localhost, e.g., 127.0.0.1). Changes take effect after restarting lookupd, issuing a lookupd -flushcache, or rebooting.

 

This is often used to block ads or cookie-tracking sites, but it can be used to block any website. Here's a MacOSXHints article on the hosts file.

 

Anyone knowledgable with a remote proxy account or access to an Admin account on the Mac can bypass this. So, it depends on what you are trying to do.

 

For example, here's part of my /etc/hosts file:

~ root# cat /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 

#
# Reject ads from obnoxious cookie-tracking sites by defining them as local so connects fail.
#

127.0.0.1	  ad.ca.doubleclick.net  ad.de.doubleclick.net  ad.doubleclick.net  ad.fr.doubleclick.net 
127.0.0.1	  ad.jp.doubleclick.net  ad.nl.doubleclick.net  ad.no.doubleclick.net ln.doubleclick.net
127.0.0.1	  m.doubleclick.net www.doubleclick.net doubleclick.net

# Block spyware web-bug tracker:
127.0.0.1	   www.danasoft.com danasoft.com

Edited by car1son

Share this post


Link to post
Share on other sites

I use the null IP address(0.0.0.0, or simply 0), instead of local host (127.0.0.1). That is less typing and just as effective. The null IP address simply means "do nothing".

Share this post


Link to post
Share on other sites
Danasoft is annoying, but it's not that bad!

Well, that's just the comment I put in the hosts file for my own memory,... and yeah, AFAIK, danasoft isn't malicious. (In fact, since they call attention to themselves, maybe they do a public service.) Since I truncated the file for posting, the next entry under that heading is rs6.net (used by constantcontact.com), which I do find truly pernicious and worth every word of the description.

 

I don't block a lot of places in my hosts file. (E.g., I usually prefer to view ads, since they support a lot of websites, as long as they don't get annoying or engage in tracking.) But some practices annoy me.

Edited by car1son

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing

    No registered users viewing this page.

  • Who's Online (See full list)

    There are no registered users currently online

×