2

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 2

3

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.

2

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 :)

2
  • how can I access the routing table?
    – John
    Dec 6, 2011 at 13:22
  • You can just try the command I posted if you are using GNU/Linux :)
    – Felix Yan
    Dec 6, 2011 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.