ZTC
作者ZTC·2022-08-30 16:04
售前技术支持·浪潮商用机器有限公司

PowerVM中使用SR-IOV时如何避免重复的网络包

字数 2809阅读 2999评论 0赞 1

随着近些年来 SR-IOV 技术的成熟,以及其接近物理网卡的性能表现,越来越多的客户选择在 PowerVM 虚拟化环境中使用 SR-IOV 技术提升虚拟网络的性能。使用 SR-IOV 的 VM 也可以通过大家熟悉的 Etherchannel 配置网络高可用。这里给大家介绍一下在使用 SR-IOV 的 VM 通过 Etherchannel 配置主备模式( NIB ) 时需要注意的地方。
在某些使用 SR-IOV 和 vNIC 客户端的复杂网络环境中,当单播流量到达由 SR-IOV 或 vNIC 虚拟网卡组成的 NIB 逻辑网络端口中的活动( active )端口和空闲( idle )端口时,我们可能会从网络交换机端看到重复的数据包。这里有几个先决条件:
1 ) NIB 逻辑网络端口采用一主一备方式配置,且主备网口都是来自 SR-IOV 或 vNIC 的虚拟网卡
2 )传输的是网络包为单播 unicast
造成这个现象的原因是:默认情况下,当通过 Etherchannel 完成 NIB 模式的逻辑端口配置后,生成的 NIB 逻辑网络端口以及备用端口的 MAC 地址均会被设置成与主端口的 MAC 地址一致。例如:在一个 LPAR 中,包含了两个基于 SR-IOV 技术生成的虚拟网络接口, ent0, ent1 ,每个虚拟网络接口都有自己的 MAC 地址: ent0(MAC0), ent1 ( MAC1 )。当通过 Etherchannel 生成了一个主备方式的逻辑端口 ent2 后,则 ent2 的 MAC 地址会取用 ent0 的 MAC 地址,即时 MAC0 ,同时 ent1 也会被赋予与 ent0 相同的 MAC 地址 MAC0 。在当发生主备网卡切换时,备用端口变为 Active 状态,主端口会变为 idle 状态的,但所有网络端口 MAC 地址依旧为 MAC0 。

图 1: 未启用 MAC_swap 功能

默认情况下, EtherChannel 驱动程序允许 idle 状态的网络接口接收单播流量,但是如果在整个网络环境中存在多个网络端口具备相同的 MAC 地址,就有可能会存在大量重复的网络包在网络中传输,给整个网络环境带来较大的额外负担,如下图所示:

图 2: 未启用 MAC_swap 功能的网络包走向

从 LPAR1 发送的网络包会通过两个通道送达 LPAR2 ,为了应对这种情况的发生,我们在为基于 SR-IOV 的网络端口配置 NIB 时,建议开启 MAC_swap 功能。

MAC_swap 启用后,备份适配器保留它的原始 MAC 地址,而不是分配给主适配器的 MAC 地址。 NIB 逻辑端口被分配主适配器的 MAC 地址。例如:在一个 LPAR 中,包含了两个基于 SR-IOV 技术生成的虚拟网络接口, ent0, ent1 ,每个虚拟网络接口都有自己的 MAC 地址: ent0(MAC0), ent1 ( MAC1 )。当通过 Etherchannel 生成了一个主备方式的逻辑端口 ent2 ,且启用了 MAC_swap ,此时 ent2 的 MAC 地址会取用 ent0 的 MAC 地址,即时 MAC0 ,而 ent1 的 MAC 地址不变,仍然为 MAC1 。在当发生主备网卡切换时,备用端口 ent1 变为 Active 状态,此时 ent1 的 MAC 地址会被赋予 MAC0 ,而主端口 ent0 会变为 idle 状态的,其 MAC 地址会被赋予 MAC1 。

图 3: 启用 MAC_swap 功能

开启 MAC_swap 后,当网络包到达 vSwitch 时就会被丢弃,因为它知道它将流量发送到 MAC2 ,而不是 MAC3 。因此,避免了重复的数据包问题。

图 4: 启用 MAC_swap 功能的网络包走向

MAC_swap 功能开启方式很简单,只需要在通过 smit 菜单配置 Etherchannel 时,将 MAC swap 选择成 yes 即可:

•    MAC swap: Select yes if you want to enable the MAC swap field. Enabling MAC swap field is allowed only on an EtherChannel in Network Interface Backup mode (one primary adapter and one backup adapter). Enabling the mac_swap option allows the backup adapter to retain its MAC address and then if failover occurs, this MAC address is swapped to the primary adapter and the MAC address of the primary adapter is swapped to the backup adapter. The default value of the mac_swap option is no. This default value is applicable for the MAC address of the primary adapter that must be assigned to the backup adapter. In certain network configurations, such as a virtual Network Interface Controllers (vNIC) and Single Root I/O Virtualization (SR-IOV) EtherChannel setup, the MAC swap operation might send duplicate packets to an inactive primary adapter after a failover. Enabling the mac_swap option avoids this situation. You must not configure an EtherChannel with the mac_swap option enabled unless a single primary adapter and a single backup adapter are configured.

参考链接:

https://www.ibm.com/docs/en/aix/7.2?topic=teaming-configuring-etherchannel

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

1

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广