Blocking Facebook with DNS

Facebook has repeatedly shown to be untrustworthy in their handling of privacy, their IPO was an over-inflated/over-hyped scam, and their business model is shady at best. I block all Facebook domains at the DNS level so they can’t get their grubby hands on any of my data, browsing habits, etc.

To block all Facebook domains, “Like” buttons, cookies, etc on the web, add the following to /etc/hosts:

# Block Facebook

Google’s probably the next-worst offender of “get/sell ALL the user data!”, but at least they’re providing services I use (search, mail, Android, docs, etc). Nothing in life is free, eh?

Update: Commenter Stephen Jakubiec points out that redirecting to is a more robust way of achieving the desired effect, as it doesn’t have the unwanted side effect of redirecting Facebook requests to your local webserver (if you have one running). In case you’re daft, here’s what you need to change:

# Block Facebook

Update: Also see this curated list which seems to be updated frequently:

11 thoughts on “Blocking Facebook with DNS

  1. Done, do I need to restart network services or anything? Added them and still saw sites showing me the ‘Like’ button… Its not supposed even to be there, yeah?

    1. You shouldn’t need to restart, but the DNS might be cached. I just had a look around on a few blogs and I didn’t see any “Like” buttons, so I think mine’s working.

    1. Yeah, it should be, but I haven’t tried blocking just Facebook on Android. I use the AdAway application from the Google Play Store to block all ad servers.

  2. I generally block with as it will give an immediate failure to load.
    Whereas will fill your error logs with 404s (among others) if you’re running LAMP (MAMP, etc).

    Just my two cents there Alan.

        1. Yep, a reader pointed this out… you should actually use if you’ve got a web server running locally. 🙂

        2. redirects to localhost, someone tried to fb with my machine and was redirected to localhost, Funny, works just fine

Comments are closed.