在创建一个简单的脚本来获取 IP 地址的黑名单并阻止它们时,我遇到了这个问题:
## Function giving greif
function _droplist (){
while read line; do
$IPT -A droplist -i eth1 -s $line -j LOG --log-prefix "IP BlockList "
$IPT -A droplist -i eth1 -s $line -j DROP
done < $badlist ##IPT is /sbin/iptables
}
通过这个函数的几次迭代,我得到了错误:
Try `iptables -h' or 'iptables --help' for more information.
' not found.4.12: host/network `SO.ME.IPH.ERE
在 IP 中使用硬编码运行相同的脚本可以正常工作,它与 $line 或 iptables 的 m 实现有关。
欢呼——困惑。