Feed iptables with a file

From banana_wiki
Jump to: navigation, search
#!/bin/bash
_input=./shit
#IPT=/sbin/iptables
#$IPT -N droplist
while IFS= read -r ip
do
    iptables -I INPUT -s $ip -j DROP
done < "$_input"

http://www.cyberciti.biz/faq/iptables-read-and-block-ips-subnets-from-text-file/ http://www.cyberciti.biz/tips/linux-iptables-how-to-flush-all-rules.html