Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
so i wanted to block some certain sites from opening on my computer, i googled and found that i can use /etc/hosts file for this purpose. so i added something like this in the file:
Code:
127.0.0.1 www.facebook.com
but it didn't work. any one knows why?
currently i am using iptables for this purpose, but this should also work.
I think you might have misread something /etc/hosts is just a ip <-> name resolution file. Maybe you were looking at tcpwrappers and want to do stuff with /etc/hosts.allow and /etc/hosts.deny
it is, but it works fine if this computer is a proxy server, the only one plugged into internet and the proxy server doesn't support blocking sites/urls. also by pointing facebook.com to 127.0.0.1 you may create a web server on port 80 and write some message =)
Depends. In Opera you would add the site to Preferences > Content > Blocked content, in Firefox you could use an add-on like Adblock and in a system-wide context you'd use a proxy like Privoxy (p.p > current configuration > Edit privoxy/user.action > { +block\n-handle-as-image }\n.site.name\n) or Polipo (echo $site >> polipo/forbidden) or Squid (acl blocked_sites url_regex filename; http_access deny blocked_sites). Using null routes or /etc/hosts is cumbersome, circumventable and incomplete. Who would consider using it when more practical, better performing and complete solutions exist?..
Quote:
Originally Posted by pluckypigeon
I can't find anything on this subject except
Depends on what terms you search for. Just being curious what did you use?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.