I do it differently by adding lines like this in /etc/hosts :
127.0.0.1 facebook.net
127.0.0.1 facebook.com
127.0.0.1 fbcdn.net
127.0.0.1 fbcdn.com
127.0.0.1 fbsv.net
127.0.0.1 tfbnw.net
127.0.0.1 doubleclick.net
β¦
Your way:
- Is much more complex, but goes much more deeper and is much more complete
- automatic update getting new IPs linked to new domain names, but then depend on a third party
For ease of use, you could add the setuid bit to your scripts:
chown root blockfacebook allowfacebook
chmod u+s blockfacebook allowfacebook
so you wonβt have to sudo every time you want to block or allow the company
if you do this, put the full path for all piped programs in your scripts, or unalias
my 2 cents 