使用多网卡最大化 Amazon EC2 实例上的网络带宽
许多支持 EFA 的实例类型也有多个网卡。有关更多信息,请参阅 网卡。如果您计划将 EFA 用于其中一种实例类型,建议使用以下基本配置:
-
对于主网络接口(网卡索引
0
、设备索引0
),创建一个 EFA(带 ENA 的 EFA)接口。您不能使用仅限 EFA 的网络接口作为主网络接口。 -
对于每个额外的网络接口,请使用下一个未使用的网卡索引、设备索引
1
以及 EFA(带 ENA 的 EFA)或仅限 EFA 的网络接口,具体取决于您的使用案例,例如 ENA 带宽要求或 IP 地址空间。有关示例使用案例,请参阅 P5、P5e 和 P5en 实例的 EFA 配置。
注意
P5 实例需要以特定方式配置网络接口,以实现最大化网络带宽。有关更多信息,请参阅 P5、P5e 和 P5en 实例的 EFA 配置。
以下示例显示如何根据这些建议启动实例。
P5、P5e 和 P5en 实例的 EFA 配置
p5.48xlarge
、p5e.48xlarge
和 p5en.48xlarge
实例的总网络带宽容量为 3200 Gbps,其中高达 800 Gbps 可用于 IP 网络流量。由于 EFA 和 IP 网络流量共享相同的底层资源,因此一方使用的带宽会减少另一方可用的带宽。这意味着,只要总带宽不超过 3,200 Gbps 且 IP 带宽不超过 800 Gbps,就可以按任意组合在 EFA 流量和 IP 流量之间分配网络带宽。例如,如果您使用 400 Gbps 的 IP 带宽,则可以同时获得高达 2800 Gbps 的 EFA 带宽。
使用案例 1:保存 IP 地址并避免潜在的 Linux IP 问题
此配置通过一个私有 IP 地址提供高达 3,200 Gbps 的 EFA 网络带宽和高达 100 Gbps 的 IP 联网带宽。此配置还有助于避免潜在的 Linux IP 问题,例如不允许自动分配公有 IP 地址和 IP 路由挑战(主机名到 IP 地址的映射问题和源 IP 地址不匹配),如果实例有多个网络接口,则可能会出现这些问题。
-
对于主网络接口(网卡索引 0、设备索引 0),使用 EFA(带 ENA 的 EFA)网络接口。
-
对于其余的网络接口(网卡索引 1-31、设备索引 1),使用仅限 EFA 的网络接口。
使用案例 2:最大 EFA 和 IP 网络带宽
此配置通过 8 个私有 IP 地址提供高达 3,200 Gbps 的 EFA 网络带宽和高达 800 Gbps 的 IP 联网带宽。您无法使用此配置自动分配公有 IP 地址。但是,您可以在启动后将弹性 IP 地址连接到主网络接口(网卡索引 0、设备索引 0)以实现互联网连接。
-
对于主网络接口(网卡索引 0、设备索引 0),使用 EFA(带 ENA 的 EFA)网络接口。
-
对于其余接口,执行以下操作:
-
在网卡索引 1、2 和 3 上指定仅限 EFA 的网络接口,并使用设备索引 1。
-
在以下每个网卡索引子集中指定一个 EFA(带 ENA 的 EFA)网络接口和三个仅限 EFA 的网络接口,并对所有网络接口均使用设备索引 1:
-
[4、5、6、7]
-
[8、9、10、11]
-
[12、13、14、15]
-
[16、17、18、19]
-
[20、21、22、23]
-
[24、25、26、27]
-
[28、29、30、31]
-
-
下面的示例对此配置进行说明:
$ aws --region $REGION ec2 run-instances \ --instance-type p5.48xlarge \ --count 1 \ --key-name key_pair_name \ --image-id ami_id \ --network-interfaces "NetworkCardIndex=0,DeviceIndex=0,Groups=
security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=1,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=2,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=3,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=4,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=5,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=6,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=7,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=8,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=9,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=10,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=11,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=12,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=13,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=14,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=15,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=16,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=17,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=18,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=19,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=20,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=21,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=22,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=23,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=24,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=25,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=26,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=27,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=28,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=29,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=30,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=31,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" ...
P6-B200 实例的 EFA 配置
P6-B200 实例的总网络带宽容量为 3200 Gbps,其中高达 1600 Gbps 可用于 ENA。这些实例有 8 个 GPU 和 8 个网卡,其中每个网卡支持高达 400 Gbps 的 EFA 带宽和 200 Gbps 的 ENA 带宽。由于 EFA 和 ENA 流量共享相同的底层资源,因此一方使用的带宽会减少另一方可用的带宽。
使用案例 1:保存 IP 地址
此配置每个实例至少消耗一个私有 IP 地址并支持高达 3200 Gbps 的 EFA 带宽和高达 200 Gbps 的 ENA 带宽。
-
对于主网络接口(网卡索引 0、设备索引 0),使用 EFA(带 ENA 的 EFA)网络接口。
-
对于其余 7 个网卡(网卡索引 1-7,设备索引 1),使用仅限 EFA 的网络接口。
使用案例 2:最大 EFA 和 ENA 带宽
此配置每个实例至少消耗 8 个私有 IP 地址并支持高达 3200 Gbps 的 EFA 带宽和高达 1600 Gbps 的 ENA 带宽。
-
对于主网络接口(网卡索引 0,设备索引 0)和其余 7 个网卡(网卡索引 1-7,设备索引 1),请使用 EFA(带 ENA 的 EFA)网络接口。
P6e-GB200 实例的 EFA 配置
P6e-GB200 实例最多可以配置 17 个网卡。下图显示 P6e-GB200 实例的物理网络接口卡(NIC)布局以及网卡索引(NCI)的映射。

主 NCI(索引 0)支持高达 100 Gbps 的 ENA 带宽。具有以下索引的 NCI 支持仅限 EFA 的网络接口和 400 Gbps 的 EFA 带宽:[1、3、5、7、9、11、13、15]。具有以下索引的 NCI 支持高达 200 Gbps 的 ENA 或 EFA 带宽:[2、4、6、8、10、12、14、16]。
以下组中的 NCI 共享主机上的底层物理 NIC:
-
[1 和 2]
-
[3 和 4]
-
[5 和 6]
-
[7 和 8]
-
[9 和 10]
-
[11 和 12]
-
[13 和 14]
-
[15 和 16]
每个物理 NIC 支持高达 400 Gbps 的带宽。由于这些组中的 NCI 共享相同的底层物理 NIC,因此一个 NCI 使用的带宽会减少另一个 NCI 可用的带宽。例如,如果 NCI 2 使用 200 Gbps 的 ENA 带宽,则 NCI 1 可以同时使用高达 200 Gbps 的 EFA 带宽。
主机上的每个底层 GPU 都可以通过以下几对 NCI 直接发送流量:
-
[1 和 3]
-
[5 和 7]
-
[9 和 11]
-
[13 和 15]
每个 GPU 支持高达 400 Gbps 的 EFA 带宽。由于这些组中的网卡共享相同的 GPU,因此一个网卡使用的带宽会减少另一个网卡可用的带宽。例如,如果 NCI 1 使用 200 Gbps 的 EFA 带宽,则 NCI 3 可以同时使用高达 200 Gbps 的 EFA 带宽。因此,为了实现最高 EFA 性能,我们建议您执行以下操作之一,以实现总计 1600 Gbps 的 EFA 带宽:
-
在每个组中仅向一个 NCI 添加仅限 EFA 的网络接口,以实现每个网络接口 400 Gbps(4 个 EFA 网络接口 x 400 Gbps)。
-
向每个组中的每个 NCI 添加仅限 EFA 的网络接口,以实现每个网络接口 200 Gbps(8 个 EFA 网络接口 x 200 Gbps)。
例如,以下配置使用每个 NCI 组中一个仅限 EFA 的网络接口提供高达 1600 Gbps 的 EFA 带宽,并仅使用主 NCI(索引 0)提供高达 100 Gbps 的 ENA 网络带宽。
-
对于主 NCI(网卡索引 0、设备索引 0),使用 EFA 网络接口。
-
将仅限 EFA 的网络接口添加到以下位置:
-
NCI 1,设备索引 0
-
NCI 5,设备索引 0
-
NCI 9,设备索引 0
-
NCI 13,设备索引 0
-