TIP Block an IP
出自Gentoo Linux Wiki
| 终端/Shell • 网络 • X 窗口系统 • Portage • 系统 • 文件系统 • 内核 • 其它 |
iptables -I INPUT -s 146.83.34.32 -j DROP
查看封禁IP列表和其他iptables命令:
iptables -L -n
[编辑] 封禁多个IP
如下方法简单直接,在我的防火墙上运行良好
脚本:
#!/bin/sh for i in $(cat bad_hosts.lst) ; do iptables -I INPUT -i eth1 -s "$i" -j DROP ; done
bad_hosts.lst:
192.168.2.1 192.168.2.2 ...
