ブリッジングとiptablesポストルーティング

ブリッジングとiptablesポストルーティング

私は3つのNICと2つのNICの間にブリッジ(eth1およびブリッジ)を持つLinux 3.14 PCを持っています。eth2

私の質問

POSTROUTINGルールを通過するトラフィックがないのはなぜですか?ちなみに、橋を通過(伝達)する交通状況ではすべてが大丈夫です。誰もが動作するようにアドバイスをすることができますか?

ifconfig eth1 down
ifconfig eth2 down

ifconfig eth1 up
ifconfig eth1 0.0.0.0

ifconfig eth2 up
ifconfig eth2 0.0.0.0

brctl addbr sm0
brctl addif sm0 eth1
brctl addif sm0 eth2

ifconfig sm0 up

iptables -t mangle -A POSTROUTING -o eth1 -p all  -j CLASSIFY --set-class 1:99

iptables -t mangle -A POSTROUTING -o eth2 -p all  -j CLASSIFY --set-class 2:99

ルール

o iptables -t mangle -nvL
Chain PREROUTING (policy ACCEPT 38914 packets, 2954K bytes)
 pkts bytes target     prot opt in    out     source         destination

Chain INPUT (policy ACCEPT 38210 packets, 2791K 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 38072 packets, 2844K bytes)
 pkts bytes target     prot opt in    out     source         destination

Chain POSTROUTING (policy ACCEPT 38072 packets, 2844K bytes)
 pkts bytes target     prot opt in    out     source         destination
    0     0 CLASSIFY   all  --  *     eth1    0.0.0.0/0      0.0.0.0/0      CLASSIFY set 1:99
    0     0 CLASSIFY   all  --  *     eth2    0.0.0.0/0      0.0.0.0/0      CLASSIFY set 2:99

システム構成ファイル

net.ipv4.ip_forward=1

次の値を0または1に設定してもiptablesには影響しません。

net.bridge.bridge-nf-call-arptables=1
net.bridge.bridge-nf-call-ipv6tables=1
net.bridge.bridge-nf-call-ipv4tables=1

ベストアンサー1

橋は交通経路を指定しないため、規則に従う必要はありませんPOSTROUTING

ネットフィルタのドキュメントを参照してくださいブリッジネットワークフィルタ詳細とこの設定を変更する方法(カーネル3.2.0):

modprobe bridge    # Enable bridge-netfilter
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables

おすすめ記事