Skip to content

用 patch port 连接两个 OVS 网桥

Published: at 00:00
说明
环境根据 [用 Open vSwitch 的内部端口连接两个 Namespace]: http://yhz.me/blog/Connect-Namespace.html
创建br1
ovs-vsctl add-br br1
创建内部端口
ovs-vsctl add-port br1 tap3 -- set Interface tap3 type=internal
设置命令空间
ip link set tap2 netns ns3
配置
ip netns exec ns3 ip addr add 192.168.0.102/24 dev tap3
ip netns exec ns3 ip link set tap3 up
ip netns exec ns3 ip link set lo up
ip netns exec ns3 ping 192.168.0.102
创建patch port
ovs-vsctl add-port br0 patch-ovs-1 -- set Interface patch-ovs-1 type=patch -- set Interface patch-ovs-1 options:peer=patch-ovs-2

ovs-vsctl add-port br1 patch-ovs-2 -- set Interface patch-ovs-2 type=patch -- set Interface patch-ovs-2 options:peer=patch-ovs-1
测试
ip netns exec ns3 ping 192.168.0.100
ip netns exec ns3 ping 192.168.0.101
ip netns exec ns1 ping 192.168.0.102
ip netns exec ns2 ping 192.168.0.102