ovsブリッジを介して4つの名前空間を接続する

ovsブリッジを介して4つの名前空間を接続する

1つのホストで4つの名前空間を1つのovsブリッジに接続する方法を尋ねたいと思います。 4つの名前空間に対して2組のvethを試して、ブリッジに内部ポートを追加しましたが、vethの反対側でのみ名前空間をpingできます。

[root@centos7 ~]# ovs-vsctl show
689941bc-760e-451e-a91c-ddc33caf2396
Bridge brtest
    Port "test1"
        tag: 9
        Interface "test1"
            type: internal
    Port "test4"
        tag: 9
        Interface "test4"
            type: internal
    Port "test2"
        tag: 9
        Interface "test2"
            type: internal
    Port brtest
        Interface brtest
            type: internal
    Port "test3"
        tag: 9
        Interface "test3"
            type: internal
ovs_version: "2.7.0"

ip netns exec nstest1 ifconfig test1 promisc
ip netns exec nstest2 ifconfig test2 promisc
ip netns exec nstest3 ifconfig test3 promisc
ip netns exec nstest4 ifconfig test4 promisc

名前空間の veth の予定を開き、それぞれ 172.24.0.11 から 172.24.0.14 まで IP を割り当てました。ただし、nstest1のみがnstest2に接続でき、nstest3はnstest4に接続できます。 nstest1 と nstest2 は 1 対の veth で連結され、nstest3 と nstest4 は別の 1 対の veth で連結されるためです。

この4つの名前空間を完全に通過させることはできますか?

ベストアンサー1

答えを得ました。この 4 つの名前空間の veth ペアを作成し、一方の端を名前空間に割り当て、もう一方の端を仮想ブリッジのポートとして割り当てます。その後、これらの4つの名前空間はそのうちの1つで渡すことができます。

ip link set test1a netns nstest1
ip link set test2a netns nstest2
ip link set test3a netns nstest3
ip link set test4a netns nstest4
ovs-vsctl br-list
ovs-vsctl list-br
ovs-vsctl show
ovs-vsctl add-br br0
ovs-vsctl add-port br0 test1b
ovs-vsctl add-port br0 test2b
ovs-vsctl add-port br0 test3b
ovs-vsctl add-port br0 test4b
ip netns exec nstest1 ifconfig test1a 172.24.0.11/24 promisc up
ip netns exec nstest2 ifconfig test2a 172.24.0.12/24 promisc up
ip netns exec nstest3 ifconfig test3a 172.24.0.13/24 promisc up
ip netns exec nstest4 ifconfig test4a 172.24.0.14/24 promisc up

ip link set dev test2b up
ip link set dev test1b up
ip link set dev test3b up
ip link set dev test4b up

おすすめ記事