首先使用 iptables -L -n 命令来查看已经创建的防火墙规则,
[root@webxn ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -- 173.231.17.71 0.0.0.0/0
DROP all -- 173.231.17.71 0.0.0.0/0
ACCEPT all -- 173.252.192.205 0.0.0.0/0
DROP all -- 173.252.192.205 0.0.0.0/0
DROP all -- 173.252.192.205 0.0.0.0/0
ACCEPT all -- 173.252.192.205 0.0.0.0/0
DROP all -- 173.252.192.205 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
我们可以看到我创建了很多规则. 然后我们可以使用命令:
iptables -D INPUT *
来删除制定规则, 比如我们删除第一行的规则, 那我们就可以执行:
iptables -D INPUT 1
就可以了.