Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wanting to block a list of specific hosts, specifically so my server has no access to them at all. I tried using host2ip and entering the result into IP tables , but the IPs don't seem to lead to the site and I can still access the domains clearly.

How can I block say, '' like I can on Windows with the HOSTS file?

share|improve this question
up vote 2 down vote accepted

I assume you're on some kind of *nix since you mention IPTables. You can use the /etc/hosts file in a similar fashion to the windows hosts file.

However, adding a proxy like squid is another option that may make managing block lists easier.

share|improve this answer
May sound weird, but I think I love you! Thank you. – John d. Sep 5 '10 at 7:26
Great, you can show me the love with an upvote and by checking answer! ;) – nedm Sep 5 '10 at 7:28
Had to wait 10 minutes to accept, hehe. There's your points. – John d. Sep 5 '10 at 7:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.