Blocking websites via /etc/hosts
Hi,
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 currently i am using iptables for this purpose, but this should also work. tanx, |
Maybe /etc/hosts is not being used. What does resolv.conf look like?
|
something like this:
Code:
# Generated by NetworkManager |
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
|
Quote:
|
...besides, using /etc/hosts to block sites is deprecated (better methods exist), inefficient (management) and incomplete (easy circumvention).
|
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 =)
|
Quote:
Quote:
|
if you really want to do that make sure in your /etc/nsswitch.conf files is listed before dns in the hosts section
|
Quote:
it is the /ets/resolv.conf file. |
Quote:
Code:
passwd: compat |
Quote:
|
So how do we block sites? I can't find anything on this subject except for the BlockSite Firefox Addon that doesn't work anymore.
|
Hi, guys!
I'm still have a trouble with /etc/hosts configuring... My /etc/hosts/ is: Quote:
ping localhost says: Quote:
|
Quote:
Quote:
|
All times are GMT -5. The time now is 05:17 AM. |