通过使用以下命令,我试图禁止Debian服务器上的各种IP子网:
iptables -A INPUT -s 222.128.0.0/10 -j DROP正确地接受了该命令,iptables -L -n命令如下所示:
root@server:~# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -- 43.229.53.41 0.0.0.0/0
DROP all -- 222.128.0.0/10 0.0.0.0/0
DROP all -- 222.186.21.236 0.0.0.0/0
DROP all -- 185.41.168.0/22 0.0.0.0/0但是,当我使用tcptrack查看打开的连接时,连接仍然是打开的(超过900个连接!)
我是否需要“重新加载”设置,但以任何方式加载到iptables中?我不想重新启动服务器。
来自iptables -L -n -v --line-numbers的输出
root@server:~# iptables -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 13283 packets, 9904K bytes)
num pkts bytes target prot opt in out source destina tion
1 18 1080 DROP all -- * * 43.229.53.41 0.0.0.0 /0
2 28 2628 DROP all -- * * 222.128.0.0/10 0.0.0.0 /0
3 0 0 DROP all -- * * 222.186.21.236 0.0.0.0 /0
4 5911 236K DROP all -- * * 185.41.168.0/22 0.0.0.0 /0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destina tion
Chain OUTPUT (policy ACCEPT 19416 packets, 11M bytes)
num pkts bytes target prot opt in out source destina tion发布于 2015-08-10 09:42:37
DROP规则是有效的,因为有对它们的数据包计数。我不知道tcptrack到底是如何工作的,但很可能它看到的是在您添加DROP规则之前设置的打开连接,但不会再传递通信(因为任何传入的数据包,无论是数据还是acks,都将落在地板上)。
https://serverfault.com/questions/713043
复制相似问题