I know how to block certain website, like if I want to block google I can use this line in the host
0.0.0.0 www.google.com.hk
www.google.com.hk
But my question is how can I block certain IP address? Like how can I block certain IP address like 17.154.66.79?
Best Answer
Technically, OS X can make use of
/etc/hosts.allow
and/etc/hosts.deny
files that will work with standard resolvable hostnames. For blocking IP addresses, usingiptables
is the usual method but apparently Apple deprecated its use beginning with Lion and switched topf
for this function. Check and read the links in this thread on SuperUser for info on usingpf
and perhaps a GUI front-end for it.