web-dev-qa-db-ja.com

iptablesは私が作成したルールをリストしません

このガイド を使用して、2台のPC間の共有インターネット接続をセットアップしています。

ステップ8で、コマンドを実行する必要があると言っています:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/etc/rc.d/iptables save
/etc/rc.d/iptables start

これを実行しても、iptables -nvLを実行した場合、iptableのルールには影響がないようです。出力は次のとおりです。

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

それは正しいですか、それとも私は何か間違っていますか?

19
Stefan

コマンド iptables -nvLfilterテーブルの内容を表示しています。追加するルールはnatテーブルにあります。追加 -t natnatテーブルを確認するには:

iptables -t nat -nvL
31
camh

iptables-saveを実行することもできます。すべてを見たいだけの場合は、すべての内容が画面にダンプされます。私は怠惰だと感じたときにすべてをそのように見るのは簡単だと思います。

1
John Mitchell