4.7. VLAN 提供商网络数据包流的工作方式?


本节介绍了流量如何流进具有 VLAN 供应商网络配置的实例。

VLAN 提供商网络中的传出流量流

下图显示了离开实例的流量的数据包流,并直接到达 VLAN 提供程序外部网络。本例使用连接到两个 VLAN 网络(171 和 172)的两个实例。配置 br-ex 后,向其添加一个物理接口,并将实例生成到 Compute 节点后,生成的接口和网桥配置类似于下图中的配置:

VLAN 提供商网络中的网络流量 - 传出
  1. 离开实例的 eth0 接口的数据包会到达连接到实例的 linux 网桥 qbr-xx
  2. qbr-xx 使用 veth 对 qvbxx <→ qvoxxx 连接到 br-int
  3. qvbxx 连接到 linux 网桥 qbr-xxqvoxx 连接到 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"

  • qvoxx 使用与 VLAN 提供商网络关联的内部 VLAN 标签标记。在本例中,内部 VLAN 标签 2 与 VLAN 提供商网络 provider-171 关联,VLAN 标签 3 与 VLAN 提供商网络 provider-172 关联。当数据包到达 qvoxx 时,此 VLAN 标签将添加到数据包标头中。
  • 数据包然后被移到 br-ex OVS 网桥,使用 patch-peer int-br-ex <→ phy-br-exbr-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 上的补丁对等点配置示例:

    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 层处理。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.