具有多个隧道ID的OvS VXLAN隧道仅适用于一个隧道ID

问题描述 投票:0回答:1

我想在不同VM上的Linux网络接口之间建立VXLAN隧道。更准确地说,拓扑结构如下。我有两个安装了OvS 2.5.5的Ubuntu 16.04 Vagrant盒子。在每个VM上,我创建了一个名为kos的OvS网桥,并且每个网桥都添加了一个带有以下命令的vxlan端口/接口:

ovs-vsctl add-port kos vtep -- set interface vtep type=vxlan option:remote_ip=flow option:key=flow

然后我在每台机器上创建了两个Linux网络接口。同一台机器上的接口具有相同的IP地址但MAC地址不同。我希望将四个接口拆分为两个单独的VXLAN(分别为ID 1和2),并使用OvS VXLAN隧道来启用不同VM上的接口之间但在同一VXLAN中的通信。用于创建接口并将它们连接到OvS的命令是:

VM1:

ovs-vsctl add-port kos kos11 -- set interface kos11 type=internal mac="02\:00\:00\:00\:00\:11" && ip addr add 10.0.0.1/8 scope link dev kos11 && ip link set kos11 up
ovs-vsctl add-port kos kos21 -- set interface kos21 type=internal mac="02\:00\:00\:00\:00\:21" && ip addr add 10.0.0.1/8 scope link dev kos21 && ip link set kos21 up

VM2:

ovs-vsctl add-port kos kos12 -- set interface kos12 type=internal mac="02\:00\:00\:00\:00\:12" && ip addr add 10.0.0.2/8 scope link dev kos12 && ip link set kos12 up
ovs-vsctl add-port kos kos22 -- set interface kos22 type=internal mac="02\:00\:00\:00\:00\:22" && ip addr add 10.0.0.2/8 scope link dev kos22 && ip link set kos22 up

每个接口名称是通过连接“kos”后跟两个数字构建的,第一个是接口的VNI,第二个是它所属的VM的编号。

最后,我检索了每个接口的openflow端口(两个VM上的vtep,kos11,kos21,kos12,kos22),并添加了以下OpenFlow流:

VM1:

table=0,in_port=2,actions=set_field:1->tun_id,resubmit(,1)
table=0,in_port=3,actions=set_field:2->tun_id,resubmit(,1)
table=0,actions=resubmit(,1)

table=1,tun_id=1,arp,arp_tpa=10.0.0.1,actions=output:2
table=1,tun_id=1,dl_dst=02:00:00:00:00:11,actions=output:2

table=1,tun_id=2,arp,arp_tpa=10.0.0.1,actions=output:3
table=1,tun_id=2,dl_dst=02:00:00:00:00:21,actions=output:3

table=1,tun_id=1,arp,arp_tpa=10.0.0.2,actions=set_field:172.28.128.5->tun_dst,output:1
table=1,tun_id=1,dl_dst=02:00:00:00:00:12,actions=set_field:172.28.128.5->tun_dst,output:1

table=1,tun_id=2,arp,arp_tpa=10.0.0.2,actions=set_field:172.28.128.5->tun_dst,output:1
table=1,tun_id=2,dl_dst=02:00:00:00:00:22,actions=set_field:172.28.128.5->tun_dst,output:1

table=1,actions=drop

VM2:

table=0,in_port=2,actions=set_field:1->tun_id,resubmit(,1)
table=0,in_port=3,actions=set_field:2->tun_id,resubmit(,1)
table=0,actions=resubmit(,1)

table=1,tun_id=1,arp,arp_tpa=10.0.0.2,actions=output:2
table=1,tun_id=1,dl_dst=02:00:00:00:00:12,actions=output:2

table=1,tun_id=2,arp,arp_tpa=10.0.0.2,actions=output:3
table=1,tun_id=2,dl_dst=02:00:00:00:00:22,actions=output:3

table=1,tun_id=1,arp,arp_tpa=10.0.0.1,actions=set_field:172.28.128.4->tun_dst,output:1
table=1,tun_id=1,dl_dst=02:00:00:00:00:11,actions=set_field:172.28.128.4->tun_dst,output:1

table=1,tun_id=2,arp,arp_tpa=10.0.0.1,actions=set_field:172.28.128.4->tun_dst,output:1
table=1,tun_id=2,dl_dst=02:00:00:00:00:21,actions=set_field:172.28.128.4->tun_dst,output:1

table=1,actions=drop

1是与两个VM上的接口vtep相关联的开放流端口。

在VM1 2和3上分别是与接口kos11和kos21相关联的开放流端口。

在VM2 2和3上分别是与接口kos12和kos22相关联的开放流端口。

1是VXLAN kos11和kos12属于的VNI,2是VXLAN kos21和kos22属于的VNI。

172.28.128.4和172.28.128.5是两个虚拟机可以互相ping通的网络接口的IP地址(AKA是隧道端点的IP)。

在执行上述步骤之后,kos11可以ping kos12,反之亦然(也就是VXLAN与VNI 1的隧道工作),而从kos21 ping kos22,反之亦然,导致目标主机不可达。我在kos22上运行tcpdump,同时从kos21 ping它,这就是我得到的:

ARP, Request who-has 10.0.0.2 tell 10.0.0.1, length 28
ARP, Request who-has 10.0.0.2 tell 10.0.0.1, length 28
ARP, Request who-has 10.0.0.2 tell 10.0.0.1, length 28

我究竟做错了什么?我该如何解决?

vagrant sdn tunnel openflow openvswitch
1个回答
0
投票

它无法工作的原因是您不能在同一子网中拥有多个接口。我找到的解决方法是将每个接口放在一个单独的Linux网络命名空间中。

© www.soinside.com 2019 - 2024. All rights reserved.