我有两个命名空间 red 和 blue。Red 连接到 host1,blue 连接到 host2,但这两个主机无法互相 ping 通。下面是我输入的命令:
ip link add host1 type veth peer name virt1
ip link add host2 type veth peer name virt2
ip netns add red
ip link set virt1 netns red
ip netns add blue
ip link set virt2 netns blue
ip netns exec red ip addr add 10.1.2.3/24 dev virt1
ip netns exec red ip link set virt1 up
ip netns exec blue ip addr add 10.1.2.5/24 dev virt2
ip netns exec blue ip link set virt2 up
ovs-vsctl add-br vsbr0
ovs-vsctl add-port vsbr0 host1
ovs-vsctl add-port vsbr0 host2
ovs-ofctl del-flows vsbr0
ovs-ofctl dump-flows vsbr0
ovs-ofctl add-flow vsbr0 action=normal
ip netns exec blue ping 10.1.2.3
ip netns exec red ping 10.1.2.5
答案1
应打开主机和桥接器:
ip link set host1 up
ip link set host2 up
ip link set dev vsbr0 up