Help needed with blocking websites

Discussion in 'macOS' started by shoichi, Mar 1, 2010.

  1. shoichi, Mar 1, 2010
    Last edited: Jan 27, 2011
  2. r0k macrumors 68040

    r0k

    Joined:
    Mar 3, 2008
    Location:
    Detroit
    #2
    What you are doing is a brute force approach to blocking sites. You are editing your "/etc/hosts" file to add blacklisted sites to it.

    The syntax for the hosts file is as follows:
    ip_address hostname

    If you want to block www .gawker.com and gawker.com, you will need 2 entries on the same line:
    127.0.0.1 gawker.com www .gawker.com
    127.0.0.1 yahoo.com www .yahoo.com


    Note: I had to insert blanks between www and .whatever.com to prevent vbulletin from turning everything into links. :rolleyes:

    This isn't foolproof because somebody could always simply enter www2 .yahoo.com and get around your blacklist.

    Be very careful when editing /etc/hosts! Do not simply delete /etc/hosts to undo all your changes. You can render your machine incapable of connecting to the local network or the internet! I suggest you look for another approach to blacklisting web sites.

    For your reference, here is the default /etc/hosts in case you want to get back to the way it should be...

    Code:
    ##
    # 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
    
    A better blacklist method might be to use a dns based filtering service like opendns. Read everything carefully and be sure to follow all their directions. Also make a note of your current dns settings before chaning over to theirs in case you break something and need to go back. If you break something, you will need access to the net to get help fixing it so proceed methodically and slowly and write everything down so you can go back to where you were before you started. Opendns allows you to block sites by category, ie violence or adult content. You can also whitelist sites that you don't want blocked and blacklist sites you do want blocked.
     
  3. HenryAZ macrumors 6502

    HenryAZ

    Joined:
    Jan 9, 2010
    Location:
    South Congress AZ
    #3
    You might want to try GlimmerBlocker. It works as an http proxy attached to your network interfaces.
     
  4. lannister80 macrumors 6502

    lannister80

    Joined:
    Apr 7, 2009
    Location:
    Chicagoland
    #4
    Most routers today have a built-in site blocking mechanism.

    Then you can control which computers can access what (based on IP).
     

Share This Page