iptables、NATの問題

iptables、NATの問題

sudo iptables -t nat -L -n -vによって報告された次の規則を実装するiptablesコマンドは何ですか?

Chain POSTROUTING (policy ACCEPT 133 packets, 10675 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   74  4322 MASQUERADE  all  --  *      *       10.42.0.0/24        !10.42.0.0/24        

ベストアンサー1

LL3のプロンプトによると、上記のオプションの1つは次のとおりです。

sudo iptables -A POSTROUTING -s 192.168.42.0/24 ! -d 192.168.42.0/24 -j MASQUERADE

私が使用しているnatテーブルへの別の暗黙的な参照は次のとおりです。

sudo iptables --table nat -A POSTROUTING -s 192.168.42.0/24 ! -d 192.168.42.0/24 -j MASQUERADE

おすすめ記事