3

I am running MacOS Mojave. I am wondering if there is an easy way to block an IP address.

For example, I can ping 8.8.8.8 and telnet 8.8.8.8 53. Now, I want to block all access to 8.8.8.8. so ping and telnet should both fail.

Btw, I’m not looking to use dns to this host. I can block it easily in /etc/hosts file but not all apps and services respect dns and hosts override. I’m looking for a non DNS block to implement.

7

Finally, I found a solution by using PF.

(1) edit PF configuration

sudo vim /etc/pf.conf

Append the following line to the file:

block drop from any to <IP Address>

For example: block drop from any to 8.8.8.8

(2) Load the config by running

sudo pfctl -f /etc/pf.conf

(3) Enable PF by running:

sudo pfctl -e

(*) If you want to disable PF, run:

sudo pfctl -d
|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .