iptables 没有列出我创建的规则

Ste*_*fan 20 iptables

我正在使用本指南在两台 PC 之间设置共享 Internet 连接。

第 8 步,它说我应该运行以下命令:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/etc/rc.d/iptables save
/etc/rc.d/iptables start
Run Code Online (Sandbox Code Playgroud)

这样做似乎对 iptable 的规则没有影响,如果我运行iptables -nvL我的输出是:

Chain INPUT (policy ACCEPT 2223 packets, 2330K bytes)
 pkts bytes target     prot opt in     out     source         destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
  pkts bytes target     prot opt in     out     source        destination

Chain OUTPUT (policy ACCEPT 2272 packets, 277K bytes)
  pkts bytes target     prot opt in     out     source        destination
Run Code Online (Sandbox Code Playgroud)

这是正确的还是我做错了什么?

cam*_*amh 34

该命令iptables -nvL正在显示filter表的内容。您要添加的规则在nat表中。添加-t natnat表:

iptables -t nat -nvL
Run Code Online (Sandbox Code Playgroud)