Block and IP Address with iptables

I had a nasty hacker trying to get access to one of my Asterisk machines tonight so a quick reminder for myself on how to block a single IP address using iptables:

Block an IP:

iptables -I INPUT -s 111.222.333.444 -j DROP

Unblock an IP (if you typed the wrong address)

#substitute -D for -I
iptables -D INPUT -s 111.222.333.444 -j DROP

Show current rules:

iptables -n -L

Thanks to good folks at for the details on this:Asterisk Security: Use iptables to Block the Bad Guys

Related Content

This post was posted in , , , , by on