增加两个Namespace
ip netns add ns1
ip netns add ns2
增加网桥
ovs-vsctl add-br br0
创建内部端口
ovs-vsctl add-port br0 tap1 -- set Interface tap1 type=internal
ovs-vsctl add-port br0 tap2 -- set Interface tap2 type=internal
设置命令空间
ip link set tap1 netns ns1
ip link set tap2 netns ns2
配置
ip netns exec ns1 ip addr add 192.168.0.100/24 dev tap1
ip netns exec ns1 ip link set tap1 up
ip netns exec ns1 ip link set lo up
ip netns exec ns1 ping 192.168.0.100
ip netns exec ns2 ip addr add 192.168.0.101/24 dev tap2
ip netns exec ns2 ip link set tap2 up
ip netns exec ns2 ip link set lo up
ip netns exec ns2 ping 192.168.0.101
测试
ip netns exec ns1 ping 192.168.0.101
ip netns exec ns2 ping 192.168.0.100