Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
    
how can I access the routing table? –  John Dec 6 '11 at 13:22
    
You can just try the command I posted if you are using GNU/Linux :) –  Felix Yan Dec 6 '11 at 14:48
add comment

Your Answer

 
discard

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

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