I know how to edit my hosts file on osx, how can I block the range 78.31.8.0/22? What do I put in the hosts file?
2 Answers
You cannot.
/etc/hosts
is not for blocking – it is for translating domain names to addresses (when other methods are unavailable) – more specifically, an exact name to a single address. If a program tries to access the address directly, the system won't even touch /etc/hosts
, because there will be nothing to look up.
Use a proper firewall, such as ipfw
.
A simple way to null a range of ip is:
route add 78.31.8.0/22 lo
Use the routing table to do it :)
-
-
You can just try the command I posted if you are using GNU/Linux :) Dec 6, 2011 at 14:48