转载https://vcpu.me/openvswitch/
ovs-vsctl add-br br0 ovs-vsctl add-br br1 ip link add br0_tap0 type veth peer name br1_tap0 ip link add br0_tap1 type veth peer name br1_tap1 ip link set br0_tap0 up ip link set br0_tap1 up ip link set br1_tap0 up ip link set br1_tap1 up ovs-vsctl add-bond br0 bond0 br0_tap0 br0_tap1 ovs-vsctl add-bond br1 bond1 br1_tap0 br1_tap1 ip netns add ns1 ip netns add ns2 ovs-vsctl add-port br0 tap1 -- set Interface tap1 type=internal ip link set tap1 netns ns1 ip netns exec ns1 ip link set dev tap1 up ip netns exec ns1 ip addr add 192.168.1.101/24 dev tap1 ovs-vsctl add-port br1 tap2 -- set Interface tap2 type=internal ip link set tap2 netns ns2 ip netns exec ns2 ip link set dev tap2 up ip netns exec ns2 ip addr add 192.168.1.102/24 dev tap2 ovs-vsctl set Port bond0 lacp=active ovs-vsctl set Port bond1 lacp=active
[root@bogon ~]# ovs-vsctl show 153bc919-e549-4c26-bc18-8ebc22b32581 Bridge "br0" Port "tap1" Interface "tap1" type: internal Port "bond0" Interface "br0_tap0" Interface "br0_tap1" Port "br0" Interface "br0" type: internal Bridge "br1" Port "bond1" Interface "br1_tap1" Interface "br1_tap0" Port "br1" Interface "br1" type: internal Port "tap2" Interface "tap2" type: internal ovs_version: "2.12.0" [root@bogon ~]# ovs-appctl bond/show ---- bond1 ---- bond_mode: active-backup bond may use recirculation: no, Recirc-ID : -1 bond-hash-basis: 0 updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false active slave mac: ba:86:db:6d:8f:d3(br1_tap1) slave br1_tap0: enabled may_enable: true slave br1_tap1: enabled active slave may_enable: true ---- bond0 ---- bond_mode: active-backup bond may use recirculation: no, Recirc-ID : -1 bond-hash-basis: 0 updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false active slave mac: 82:76:a8:97:09:91(br0_tap0) slave br0_tap0: enabled active slave may_enable: true slave br0_tap1: enabled may_enable: true [root@bogon ~]# ip a show br0_tap0 16: br0_tap0@br1_tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master ovs-system state UP group default qlen 1000 link/ether 82:76:a8:97:09:91 brd ff:ff:ff:ff:ff:ff inet6 fe80::8076:a8ff:fe97:991/64 scope link valid_lft forever preferred_lft forever