iptables

List active rules

iptables -L -n

source: http://forums.serverbeach.com/showthread.php?t=2241

 

Block single IP address

As root run this command:

iptables -I INPUT -s <IP2BLOCK> -j DROP

To undo this:

iptables -D INPUT -s <IP2BLOCK> -j DROP

source: http://forums.serverbeach.com/showthread.php?t=2241

Example usage:

for FILE in /var/log/httpd/access_log*; do
grep /phpGedView/familybook.php $FILE | awk '{FS=" ";print $1}' | sort -u > /tmp/ips
done

for IP in `cat /tmp/ips`
do
iptables -I INPUT -s $IP -j DROP
done

and on http://elliottback.com/wp/iptables-bash-shell-cleanup-script/ is a script that removes duplicate entries.