Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Block Twitter/Facebook in your /etc/hosts
# Block Facebook IPv4
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 login.facebook.com
127.0.0.1 www.login.facebook.com
127.0.0.1 fbcdn.net
127.0.0.1 www.fbcdn.net
127.0.0.1 fbcdn.com
127.0.0.1 www.fbcdn.com
127.0.0.1 static.ak.fbcdn.net
127.0.0.1 static.ak.connect.facebook.com
127.0.0.1 connect.facebook.net
127.0.0.1 www.connect.facebook.net
# Block Twitter
127.0.0.1 www.twitter.com
127.0.0.1 twitter.com
127.0.0.1 apps.facebook.com
# Block Facebook IPv6
fe80::1%lo0 facebook.com
fe80::1%lo0 login.facebook.com
fe80::1%lo0 www.login.facebook.com
fe80::1%lo0 fbcdn.net
fe80::1%lo0 www.fbcdn.net
fe80::1%lo0 fbcdn.com
fe80::1%lo0 www.fbcdn.com
fe80::1%lo0 static.ak.fbcdn.net
fe80::1%lo0 static.ak.connect.facebook.com
fe80::1%lo0 connect.facebook.net
fe80::1%lo0 www.connect.facebook.net
fe80::1%lo0 apps.facebook.com
@aijazkhan81

This comment has been minimized.

Copy link

commented Jan 17, 2017

Hi. Tried adding this on my android's host file. It still works perfectly. I even added the mobile URLs, but it never blocks it. Do you know any workaround?

@byron21

This comment has been minimized.

Copy link

commented Jan 17, 2018

To be more precise, we also need to add
127.0.0.1 m.facebook.com
and
fe80::1%lo0 m.facebook.com

@mccrack1985

This comment has been minimized.

Copy link

commented Jan 17, 2018

How do you find these addresses?

@ghost

This comment has been minimized.

Copy link

commented Feb 9, 2018

On android with root you can use Adaway to capture via tcpdump all dns requests of apps, on windows use Wireshark.

@Mattjs87

This comment has been minimized.

Copy link

commented Apr 7, 2018

I've tried this for blocking twitter on xp
127.0.0.1 www.twitter.com
127.0.0.1 https://twitter.com
127.0.0.1 twitter.com
It's not working. Advice?

@gap579137

This comment has been minimized.

Copy link

commented Apr 19, 2018

We have a list dedicated to blocking FB, don't have a twitter one yet but we are working on it.

We have compiled a huge list and broken them down into categories for just this purpose.

Block List Link: https://qkly.xyz/tspprs
Direct Link: https://tspprs.com

@daebenji

This comment has been minimized.

Copy link

commented Jan 14, 2019

@Mattjs87

ried this for blocking twitter on xp
127.0.0.1 www.twitter.com
127.0.0.1 https://twitter.com
127.0.0.1 twitter.com
It's not working. Advice?

because you have to select domain or sub-domain names instaed of urls! https://etc.etc is no a domain name!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.