![iptables 没有写规则](https://linux22.com/image/515184/iptables%20%E6%B2%A1%E6%9C%89%E5%86%99%E8%A7%84%E5%88%99.png)
我以 root 身份运行这两条规则,但是执行 iptables -L 时它没有显示任何规则,有人知道问题出在哪里吗?
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 --source 84.244.145.135 -j REDIRECT --to-port 1222
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 --source 243.134.97.194 -j REDIRECT --to-port 1222
duno@Virtual-Box:/home/glennwiz# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
答案1
您将它们添加到 nat talbe 中,默认情况下 iptables 会列出过滤表。要查看您添加的内容,请运行:
iptables -t nat -nL