4.7. VLAN 提供商网络数据包流的工作方式?
本节论述了如何将流量流流和来自 VLAN 供应商网络配置的实例的流量。
VLAN 提供商网络中传出流量流
下图描述了离开实例的流量的数据包流,并直接指向 VLAN 提供商网络。本例使用附加到两个 VLAN 网络(171 和 172)的两个实例。配置 br-ex 后,向其添加一个物理接口,并将实例生成给 Compute 节点,生成的接口和网桥配置类似于下图中的配置:
- 离开实例的 eth0 接口的数据包会到达连接到实例的 linux 网桥 qbr-xx。
- evince-xx 连接到 br-int,它利用 veth 对 <→HQxxx。
- slirpxx 连接到 linux 网桥 xx-xx,stratxxx 连接到 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"
-
Tailoringxx
使用与 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 上补丁 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 (action=mod_vlan_vid:171,
the the),并将数据包转发到物理接口。命令还显示到达 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
)。 -
流
操作(action=mod_vlan_vid:3,
the the VLAN tag 172 替换为内部 VLAN 标签 3,并使用正常第 2 层处理将数据包转发到实例。