Back in 2009 (last decade!!
), I wrote a blog post on how you can trick windows to route traffic destined to a particular IP address to a black-hole. In it, I mentioned the command to route traffic to /dev/null in Linux was
<code>route ADD IP_ADDRESS_OF_MAIL_SERVER MASK 255.255.255.255 127.0.0.1</code>
I ran into a need to try it today and looks like the trick doesn’t work
. So here is the right command if you want to route traffic to the loopback (or blackhole) destined to a particular IP address
sudo route add -host IP_ADDRESS_OF_HOST/NETWORK_MASK lo
For example if I want to black-hole traffic destined to 74.205.216.2, I would do the following
sudo route add -host 74.205.216.2/32 lo