searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

Linux查看网卡系统名称的方法

2024-08-26 09:48:31
116
0

一、机器网卡配置

  • 1 四口GE网卡,型号:Intel Corporation I350
  • 1块双口25G网卡,型号:Mellanox CX6 Lx
  • 1块双口100G网卡,型号:Mellanox CX6 Dx
  • 1块单口400G网卡,型号:Mellanox CX7

从这个信息可以看出,机器上总共4块网卡,共9个网口。

二、Mellanox CX系列网卡

1.CX6 Lx

CX6 Lx, 英伟达官网全称为ConnectX-6 Lx 可提供 2 25Gb/s   1 50Gb/s 的端口。来自官网的截图:

 

2. CX6 Dx

CX6 Dx, 英伟达官网全称为ConnectX-6 Dx可提供2 100 Gb/s 1 200 Gb/s 端口。来自官网的截图:

 

3. CX7

CX7 英伟达官网全称为ConnectX-7,最高400Gb/s,可提供1个、2个或4个端口。来自官网的截图:

 

三、查看网卡系统名称

1. 目的

将标准linux命令ifconfig显示的网卡名称和实际的物理网卡对应起来。

2. 使用命令ifconfig查看

从下面的信息可以看出,使用linux命令查看的网口共有9个,与机器的网卡配置是一致的,但通过ifconfig查看到的网卡配置信息不能与实际的物理网卡一一对应。

 

# ifconfig

ens105np0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 5500

        inet 100.97.0.1  netmask 255.255.255.192  broadcast 100.97.0.63

        inet6 fe80::a288:c2ff:fe79:5100  prefixlen 64  scopeid 0x20<link>

        ether a0:88:c2:79:51:00  txqueuelen 1000  (Ethernet)

        RX packets 59293  bytes 13520496 (12.8 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 38105  bytes 6415457 (6.1 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ens12f0np0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 9000

        ether b8:3f:d2:be:63:96  txqueuelen 1000  (Ethernet)

        RX packets 660  bytes 39600 (38.6 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 7259  bytes 1173915 (1.1 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ens12f1np1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 9000

        ether b8:3f:d2:be:63:96  txqueuelen 1000  (Ethernet)

        RX packets 68  bytes 4080 (3.9 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ens16f0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500

        ether 9c:c2:c4:6b:cc:d0  txqueuelen 1000  (Ethernet)

        RX packets 45745531  bytes 2780552122 (2.5 GiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 259291  bytes 97874890 (93.3 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xb2b00000-b2bfffff 

 

ens16f1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500

        ether 9c:c2:c4:6b:cc:d1  txqueuelen 1000  (Ethernet)

        RX packets 45667636  bytes 2749603770 (2.5 GiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 182711  bytes 22635574 (21.5 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xb2a00000-b2afffff 

 

ens16f2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 9c:c2:c4:6b:cc:d2  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xb2900000-b29fffff 

 

ens16f3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 9c:c2:c4:6b:cc:d3  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xb2800000-b28fffff 

 

ens20f0np0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 5500

        ether 9c:63:c0:99:9f:1a  txqueuelen 1000  (Ethernet)

        RX packets 1665  bytes 99900 (97.5 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 1716  bytes 103606 (101.1 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ens20f1np1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 5500

        ether 9c:63:c0:99:9f:1a  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

3. 使用命令lspci查看网卡信息

 

# lspci |grep "Ethernet"

// 1块单口400G网卡,型号:Mellanox CX7,对应的BDF号为11:00.0

11:00.0 Ethernet controller: Mellanox Technologies MT2910 Family [ConnectX-7]

 

// 1块双口25G网卡,型号:Mellanox CX6 Lx,对应的BDF号为1f:00.01f:00.1

1f:00.0 Ethernet controller: Mellanox Technologies MT2894 Family [ConnectX-6 Lx]

1f:00.1 Ethernet controller: Mellanox Technologies MT2894 Family [ConnectX-6 Lx]

 

// 1 四口GE网卡,型号:Intel Corporation I350,对应的BDF号为32:00.0

32:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)

32:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)

32:00.2 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)

32:00.3 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)

 

// 1块双口100G网卡,型号:Mellanox CX6 Dx,对应的BDF号为98:00.098:00.1

98:00.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]

98:00.1 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]

 

4. 使用命令lshw查看

lshwls hardware)是一个提取机器硬件配置详细信息的工具

  • -C network,仅显示网卡,不指定该项话会把所有的硬件配置都显示出来。
  • -businfo,输出总线信息,网卡都是PCIE总线,所有关注后面的BDF号,如描述为“MT2910 Family [ConnectX-7]”的BDF号为pci@0000:11:00.0,与lspci显示的网卡“Mellanox Technologies MT2910 Family [ConnectX-7]”的BDF号是一一对应的。

 

# lshw -C network -businfo

Bus info          Device        Class          Description

==========================================================

pci@0000:11:00.0  ens105np0     network        MT2910 Family [ConnectX-7]

pci@0000:1f:00.0  ens12f0np0    network        MT2894 Family [ConnectX-6 Lx]

pci@0000:1f:00.1  ens12f1np1    network        MT2894 Family [ConnectX-6 Lx]

pci@0000:32:00.0  ens16f0       network        I350 Gigabit Network Connection

pci@0000:32:00.1  ens16f1       network        I350 Gigabit Network Connection

pci@0000:32:00.2  ens16f2       network        I350 Gigabit Network Connection

pci@0000:32:00.3  ens16f3       network        I350 Gigabit Network Connection

pci@0000:98:00.0  ens20f0np0    network        MT2892 Family [ConnectX-6 Dx]

pci@0000:98:00.1  ens20f1np1    network        MT2892 Family [ConnectX-6 Dx]

 

5. 网卡与系统名称的对应关系

通过命令lspci, lshw的配合,可以把网卡和系统名称一一对应。

网卡

系统名称

ConnectX-6 Lx

网口1ens12f0np0

网口2ens12f1np1

ConnectX-6 Dx

网口1ens12f0np0

网口2ens12f1np1

ConnectX-7

网口1ens105np0

 I350

网口1ens16f0

网口2ens16f1

网口3ens16f2

网口4ens16f3

 

可以使用ethtool命令查看网口的速率。如CX6 Lx的网口1 ens12f0np0速率的查看方法:

# ethtool ens12f0np0  |grep Speed        

        Speed: 25000Mb/s

 

0条评论
0 / 1000
j****n
5文章数
0粉丝数
j****n
5 文章 | 0 粉丝
原创

Linux查看网卡系统名称的方法

2024-08-26 09:48:31
116
0

一、机器网卡配置

  • 1 四口GE网卡,型号:Intel Corporation I350
  • 1块双口25G网卡,型号:Mellanox CX6 Lx
  • 1块双口100G网卡,型号:Mellanox CX6 Dx
  • 1块单口400G网卡,型号:Mellanox CX7

从这个信息可以看出,机器上总共4块网卡,共9个网口。

二、Mellanox CX系列网卡

1.CX6 Lx

CX6 Lx, 英伟达官网全称为ConnectX-6 Lx 可提供 2 25Gb/s   1 50Gb/s 的端口。来自官网的截图:

 

2. CX6 Dx

CX6 Dx, 英伟达官网全称为ConnectX-6 Dx可提供2 100 Gb/s 1 200 Gb/s 端口。来自官网的截图:

 

3. CX7

CX7 英伟达官网全称为ConnectX-7,最高400Gb/s,可提供1个、2个或4个端口。来自官网的截图:

 

三、查看网卡系统名称

1. 目的

将标准linux命令ifconfig显示的网卡名称和实际的物理网卡对应起来。

2. 使用命令ifconfig查看

从下面的信息可以看出,使用linux命令查看的网口共有9个,与机器的网卡配置是一致的,但通过ifconfig查看到的网卡配置信息不能与实际的物理网卡一一对应。

 

# ifconfig

ens105np0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 5500

        inet 100.97.0.1  netmask 255.255.255.192  broadcast 100.97.0.63

        inet6 fe80::a288:c2ff:fe79:5100  prefixlen 64  scopeid 0x20<link>

        ether a0:88:c2:79:51:00  txqueuelen 1000  (Ethernet)

        RX packets 59293  bytes 13520496 (12.8 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 38105  bytes 6415457 (6.1 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ens12f0np0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 9000

        ether b8:3f:d2:be:63:96  txqueuelen 1000  (Ethernet)

        RX packets 660  bytes 39600 (38.6 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 7259  bytes 1173915 (1.1 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ens12f1np1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 9000

        ether b8:3f:d2:be:63:96  txqueuelen 1000  (Ethernet)

        RX packets 68  bytes 4080 (3.9 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ens16f0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500

        ether 9c:c2:c4:6b:cc:d0  txqueuelen 1000  (Ethernet)

        RX packets 45745531  bytes 2780552122 (2.5 GiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 259291  bytes 97874890 (93.3 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xb2b00000-b2bfffff 

 

ens16f1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500

        ether 9c:c2:c4:6b:cc:d1  txqueuelen 1000  (Ethernet)

        RX packets 45667636  bytes 2749603770 (2.5 GiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 182711  bytes 22635574 (21.5 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xb2a00000-b2afffff 

 

ens16f2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 9c:c2:c4:6b:cc:d2  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xb2900000-b29fffff 

 

ens16f3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 9c:c2:c4:6b:cc:d3  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xb2800000-b28fffff 

 

ens20f0np0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 5500

        ether 9c:63:c0:99:9f:1a  txqueuelen 1000  (Ethernet)

        RX packets 1665  bytes 99900 (97.5 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 1716  bytes 103606 (101.1 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ens20f1np1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 5500

        ether 9c:63:c0:99:9f:1a  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

3. 使用命令lspci查看网卡信息

 

# lspci |grep "Ethernet"

// 1块单口400G网卡,型号:Mellanox CX7,对应的BDF号为11:00.0

11:00.0 Ethernet controller: Mellanox Technologies MT2910 Family [ConnectX-7]

 

// 1块双口25G网卡,型号:Mellanox CX6 Lx,对应的BDF号为1f:00.01f:00.1

1f:00.0 Ethernet controller: Mellanox Technologies MT2894 Family [ConnectX-6 Lx]

1f:00.1 Ethernet controller: Mellanox Technologies MT2894 Family [ConnectX-6 Lx]

 

// 1 四口GE网卡,型号:Intel Corporation I350,对应的BDF号为32:00.0

32:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)

32:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)

32:00.2 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)

32:00.3 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)

 

// 1块双口100G网卡,型号:Mellanox CX6 Dx,对应的BDF号为98:00.098:00.1

98:00.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]

98:00.1 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]

 

4. 使用命令lshw查看

lshwls hardware)是一个提取机器硬件配置详细信息的工具

  • -C network,仅显示网卡,不指定该项话会把所有的硬件配置都显示出来。
  • -businfo,输出总线信息,网卡都是PCIE总线,所有关注后面的BDF号,如描述为“MT2910 Family [ConnectX-7]”的BDF号为pci@0000:11:00.0,与lspci显示的网卡“Mellanox Technologies MT2910 Family [ConnectX-7]”的BDF号是一一对应的。

 

# lshw -C network -businfo

Bus info          Device        Class          Description

==========================================================

pci@0000:11:00.0  ens105np0     network        MT2910 Family [ConnectX-7]

pci@0000:1f:00.0  ens12f0np0    network        MT2894 Family [ConnectX-6 Lx]

pci@0000:1f:00.1  ens12f1np1    network        MT2894 Family [ConnectX-6 Lx]

pci@0000:32:00.0  ens16f0       network        I350 Gigabit Network Connection

pci@0000:32:00.1  ens16f1       network        I350 Gigabit Network Connection

pci@0000:32:00.2  ens16f2       network        I350 Gigabit Network Connection

pci@0000:32:00.3  ens16f3       network        I350 Gigabit Network Connection

pci@0000:98:00.0  ens20f0np0    network        MT2892 Family [ConnectX-6 Dx]

pci@0000:98:00.1  ens20f1np1    network        MT2892 Family [ConnectX-6 Dx]

 

5. 网卡与系统名称的对应关系

通过命令lspci, lshw的配合,可以把网卡和系统名称一一对应。

网卡

系统名称

ConnectX-6 Lx

网口1ens12f0np0

网口2ens12f1np1

ConnectX-6 Dx

网口1ens12f0np0

网口2ens12f1np1

ConnectX-7

网口1ens105np0

 I350

网口1ens16f0

网口2ens16f1

网口3ens16f2

网口4ens16f3

 

可以使用ethtool命令查看网口的速率。如CX6 Lx的网口1 ens12f0np0速率的查看方法:

# ethtool ens12f0np0  |grep Speed        

        Speed: 25000Mb/s

 

文章来自个人专栏
linux-驱动-pcie
5 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
0
0