#!/bin/bash
for ip in `cat ipp.txt`
do
if [[ $ip =~ "192" ]] || [[ $ip =~ "127" ]]; then
echo "$ip is ok"
else
echo "$ip is not ok"
iptables -I INPUT -ptcp -s $ip -j DROP
fi
done
执行之后的效果