Sunday, September 13, 2009

Block ad and other undesirable sites in linux


As root, edit the /etc/hosts file, add a line for each site to block, including subdomains, like this:

127.0.0.1 hosttoblock.com
127.0.0.1 www.hosttoblock.com
127.0.0.1 mail.hosttoblock.com

Then flush DNS cache:


# service nscd restart



# /etc/init.d/nscd restart



# /etc/init.d/dnsmasq restart


No comments:

Post a Comment