Create a gist now

Instantly share code, notes, and snippets.

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.

Show comment Hide comment
@aijazkhan81

aijazkhan81 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?

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.

Show comment Hide comment
@byron21

byron21 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

byron21 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.

Show comment Hide comment
@mccrack1985

mccrack1985 Jan 17, 2018

How do you find these addresses?

How do you find these addresses?

@natuschaos

This comment has been minimized.

Show comment Hide comment
@natuschaos

natuschaos Feb 9, 2018

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

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.

Show comment Hide comment
@Mattjs87

Mattjs87 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?

Mattjs87 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.

Show comment Hide comment
@gap579137

gap579137 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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment