Block IP Linux Blackhole

I used to always write up iptables to block certain IP addresses, or use hosts.allow and hosts.deny entries, but Benjamin Cane showed me the light.

Blackhole that IP with a null route!

Add the route
ip route add blackhole IPADDRESSOFOFFENDER

Show the routes
ip route show

Remove the route
ip route del IPADDRESSOFOFFENDER
ip route show

Verify the null route
ssh: connect to host IP port 22: No route to host.

Leave a Reply

Your email address will not be published. Required fields are marked *