4.7. VLAN 提供商网络数据包流如何工作?
本节详细介绍了流量如何处理带有 VLAN 提供商网络配置的实例。
VLAN 提供商网络中传出流量流
下图显示了离开实例和直接到达 VLAN 提供商网络的流量的数据包流。本例使用与两个 VLAN 网络(171 和 172)连接的两个实例。配置 br-ex 后,在其中添加物理接口,并生成一个实例到 Compute 节点,生成的接口和网桥配置类似下图中的配置:

- 离开实例的 eth0 接口的数据包到达连接到实例的 linux 网桥 qbr-xx。
- qbr-xx 使用 veth 对qxx < →qxxx 连接至 br-int。
- qvbxx 连接到 linux 网桥 qbr-xx,qvoxx 连接到 Open vSwitch 网桥 br-int。
Linux 网桥上的 qbr-xx 示例配置。
这个示例有两个实例以及两个对应的 linux 网桥:
# brctl show bridge name bridge id STP enabled interfaces qbr84878b78-63 8000.e6b3df9451e0 no qvb84878b78-63 tap84878b78-63 qbr86257b61-5d 8000.3a3c888eeae6 no qvb86257b61-5d tap86257b61-5d
br-int 上的 qvoxx 配置:
options: {peer=phy-br-ex}
Port "qvo86257b61-5d"
tag: 3
Interface "qvo86257b61-5d"
Port "qvo84878b78-63"
tag: 2
Interface "qvo84878b78-63"
-
rpcxx标记了与 VLAN 提供商网络关联的内部 VLAN 标签。在本例中,内部 VLAN 标签 2 与 VLAN 提供商网络provider-171和 VLAN 标签 3 关联,与 VLAN 提供商网络provider-172关联。当数据包到达 qvoxx 时,此 VLAN 标签会添加到数据包标头中。 -
数据包然后被移到 br-ex OVS 网桥,使用 patch-peer
int-br-ex<→phy-br-ex。br-int 上的 patch-peer 示例:
Bridge br-int
fail_mode: secure
Port int-br-ex
Interface int-br-ex
type: patch
options: {peer=phy-br-ex}在 br-ex 上配置了 patch peer 的示例:
Bridge br-ex
Port phy-br-ex
Interface phy-br-ex
type: patch
options: {peer=int-br-ex}
Port br-ex
Interface br-ex
type: internal- 当此数据包到达 br-ex 上的 phy - br-ex 时,br-ex 中的 OVS 流将内部 VLAN 标签替换为与 VLAN 提供商网络关联的实际 VLAN 标签。
以下命令输出显示 phy-br-ex 的端口号为 4 :
# ovs-ofctl show br-ex
4(phy-br-ex): addr:32:e7:a1:6b:90:3e
config: 0
state: 0
speed: 0 Mbps now, 0 Mbps max
以下命令显示到达 phy-br-ex(in_port=4)的任何数据包,其具有 VLAN 标签 2(dl_vlan=2)。Open vSwitch 将 VLAN 标签替换为 171(actions=mod_vlan_vid:171,NORMAL),并将数据包转发到物理接口。命令还会显示到达 phy-br-ex(in_port=4)的任何数据包,其具有 VLAN 标签 3(dl_vlan=3)。Open vSwitch 将 VLAN 标签替换为 172(actions=mod_vlan_vid:172,NORMAL),并将数据包转发到物理接口。neutron-openvswitch-agent 添加这些规则。
# ovs-ofctl dump-flows br-ex NXST_FLOW reply (xid=0x4): NXST_FLOW reply (xid=0x4): cookie=0x0, duration=6527.527s, table=0, n_packets=29211, n_bytes=2725576, idle_age=0, priority=1 actions=NORMAL cookie=0x0, duration=2939.172s, table=0, n_packets=117, n_bytes=8296, idle_age=58, priority=4,in_port=4,dl_vlan=3 actions=mod_vlan_vid:172,NORMAL cookie=0x0, duration=6111.389s, table=0, n_packets=145, n_bytes=9368, idle_age=98, priority=4,in_port=4,dl_vlan=2 actions=mod_vlan_vid:171,NORMAL cookie=0x0, duration=6526.675s, table=0, n_packets=82, n_bytes=6700, idle_age=2462, priority=2,in_port=4 actions=drop
- 然后,此数据包转发到物理接口 eth1。
VLAN 提供商网络中传入流量的流
以下示例流在 Compute 节点上测试,使用 VLAN 标签 2 作为提供商网络 provider-171,以及 VLAN tag 3 用于提供商网络 provider-172.流使用集成网桥 br-int 上的端口 18。
您的 VLAN 提供商网络可能需要不同的配置。另外,网络的配置要求在两个不同的 Compute 节点之间有所不同。
以下命令输出显示 int-br-ex 端口号为 18:
# ovs-ofctl show br-int
18(int-br-ex): addr:fe:b7:cb:03:c5:c1
config: 0
state: 0
speed: 0 Mbps now, 0 Mbps max以下命令输出显示 br-int 上的流规则。
# ovs-ofctl dump-flows br-int NXST_FLOW reply (xid=0x4): cookie=0x0, duration=6770.572s, table=0, n_packets=1239, n_bytes=127795, idle_age=106, priority=1 actions=NORMAL cookie=0x0, duration=3181.679s, table=0, n_packets=2605, n_bytes=246456, idle_age=0, priority=3,in_port=18,dl_vlan=172 actions=mod_vlan_vid:3,NORMAL cookie=0x0, duration=6353.898s, table=0, n_packets=5077, n_bytes=482582, idle_age=0, priority=3,in_port=18,dl_vlan=171 actions=mod_vlan_vid:2,NORMAL cookie=0x0, duration=6769.391s, table=0, n_packets=22301, n_bytes=2013101, idle_age=0, priority=2,in_port=18 actions=drop cookie=0x0, duration=6770.463s, table=23, n_packets=0, n_bytes=0, idle_age=6770, priority=0 actions=drop
传入流量示例
本例演示了以下 br-int OVS 流:
cookie=0x0, duration=3181.679s, table=0, n_packets=2605, n_bytes=246456, idle_age=0, priority=3,in_port=18,dl_vlan=172 actions=mod_vlan_vid:3,NORMAL
- 来自外部网络的 VLAN 标签 172 的数据包通过物理节点上的 eth1 到达 br-ex 网桥。
-
数据包通过 patch-peer
phy-br-ex <-> int-br-ex移到 br-int。 -
数据包与流标准(
in_port=18,dl_vlan=172)匹配。 -
流操作(
actions=mod_vlan_vid:3,NORMAL)将 VLAN 标签 172 替换为内部 VLAN 标签 3,并使用普通第 2 层处理将数据包转发到实例。