How to switch ON/OFF a blacklisted address globally ?


PowerGod

Forum Addict!
Joined
Jun 20, 2011
Messages
4,462
I want to blacklist globally all facebook related addresses when I'm connected using my phone (even on simple sites those links slow down A LOT the surfing), but I want them enabled when I'm using the ADSL...


Where can I put those addresses to make every program aware to ignore them ? And how can I enable again them easily ?
 
Last edited by a moderator:
Edit /etc/hosts


and put 127.0.0.1 <nameofsite.com> for each domain that needs to be blocked.
 
but is there a way to "tag" them as a group of the same type or something like this ? To identify all of them without knowing the exact addresses ?


(I'm just thinking that this can be useful also for other sites)


EDIT: looking at hosts documentation I found this example



Code:
127.0.0.1	 localhost

192.168.1.10 foo.mydomain.org	 foo

192.168.1.13 bar.mydomain.org	 bar

216.234.231.5 master.debian.org	 master

205.230.163.103 www.opensource.org



But what is the purpose of the alias ?



Can be a problem if used like this ?





Code:
127.0.0.1	 localhost

192.168.1.10 foo.mydomain.org	 group1

192.168.1.13 bar.mydomain.org	 group1

216.234.231.5 master.debian.org	 group2

205.230.163.103 www.opensource.org


In this case I can be able to delete every line related to group1 in a single move... is this making sense ?
 
Last edited by a moderator:
You can delete all the non 127.0.0.1 lines. All you need is



Code:
127.0.0.1 facebookcrap.facebook.com

127.0.0.1 morefacebookcrap.facebook.com

etc.
 
I asked cause I'm thinking to make something to manage this, that can be able to interact with hosts file without make collateral damage if there are already manual addictions to not be touched
 
You could do something where



Code:
127.0.0.1 website.com #thiswasaddedbyamanager

where #thiswasaddedbyamanager is treated as a comment. The manager could read that string to determine whether it was the manager or something else that added the line.
 
Back
Top