ターゲットホストがすでに指定されたインターフェイスに接続されている場合、-oと-iは意味がありますか?

ターゲットホストがすでに指定されたインターフェイスに接続されている場合、-oと-iは意味がありますか?
iptables -A FORWARD -s 192.168.20.7 -d 10.10.48.3 -p tcp --dport 25 -o eth1 -j ACCEPT
iptables -A FORWARD -s 10.10.48.3 -d 192.168.20.7 -p tcp --sport 25 -i eth1 -j ACCEPT

私たちの組織のファイアウォールを調整している間、私は混乱した2行を見つけました。インターフェイスは10.10.xxネットワークに接続されているので、...と既に暗示されているとifをそれぞれ置くのは合理的ですかeth1-o eth1-i eth1-d 10.10.48.3-s 10.10.48.3

ベストアンサー1

マニュアルページに基づいて、iptables私はまたあなたの評価に同意する傾向があります。

   [!] -i, --in-interface name
        Name of an interface via which a packet was received (only for 
        packets entering the INPUT, FORWARD and PREROUTING chains).  When 
        the "!" argument is used before the interface name, the sense is 
        inverted.  If the interface name ends in  a  "+",  then  any  
        interface which begins with this name will match.  If this option
        is omitted, any interface name will match.

   [!] -o, --out-interface name
        Name of an interface via which a packet is going to be sent (for 
        packets entering the FORWARD, OUTPUT and POSTROUTING chains).  When
        the "!" argument is used before the interface name, the sense is 
        inverted.  If the interface name ends in a "+", then any  interface
        which begins with this name will match.  If this option is omitted, 
        any interface name will match.

この説明の最後の文は、実際に注目すべき唯一のポイントです。ボックスに別のインターフェイスがある場合、このルールはまたは-oオプション-iを省略してトラフィックがそれを使用できるようにすることができます。これはすべて、ルーティングなどがこれを許可するように設定されていると仮定します。

おすすめ記事