我刚刚在运行 CentOS 6.7 的服务器上安装了 Mellanox ConnectX-2 10gbe PCIe x8 卡。启动时,dmesg 显示mlx4_core
驱动程序正在自动加载,但我没有看到eth1卡对应的设备。 ifconfig -a
仅显示eth0,这是我的板载/主板千兆网络接口。
于是我删除/etc/udev/rules.d/70-persistent-net.rules
并重启。它重新创建了,70-persistent-net.rules
但只包含板载/主板千兆网卡,没有 Mellanox 10gbe 卡的条目。
输出/etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:30:67:aa:bb:cc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
好消息是,lspci
显示 Mellanox 卡。输出lspci | grep -i ether
02:00.0 Ethernet controller: Mellanox Technologies MT26448 [ConnectX EN 10GigE, PCIe 2.0 5GT/s] (rev b0)
05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 03)
相关输出来自dmesg
:
mlx4_core: Mellanox ConnectX core driver v2.2-1 (Feb, 2014)
mlx4_core: Initializing 0000:02:00.0
mlx4_core 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
mlx4_core 0000:02:00.0: setting latency timer to 64
alloc irq_desc for 26 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 26 for MSI/MSI-X
alloc irq_desc for 27 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 27 for MSI/MSI-X
alloc irq_desc for 28 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 28 for MSI/MSI-X
alloc irq_desc for 29 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 29 for MSI/MSI-X
alloc irq_desc for 30 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 30 for MSI/MSI-X
alloc irq_desc for 31 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 31 for MSI/MSI-X
alloc irq_desc for 32 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 32 for MSI/MSI-X
alloc irq_desc for 33 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 33 for MSI/MSI-X
alloc irq_desc for 34 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 34 for MSI/MSI-X
alloc irq_desc for 35 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 35 for MSI/MSI-X
alloc irq_desc for 36 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 36 for MSI/MSI-X
alloc irq_desc for 37 on node -1
alloc kstat_irqs on node -1
mlx4_core 0000:02:00.0: irq 37 for MSI/MSI-X
知道为什么我的 Mellanox ConnectX-2 没有显示为eth1设备?
答案1
这张卡应该无需任何更改即可在本机运行。只需删除70-persistent-net.rules
/reboot 和/或检查dmesg
输出即可。
您可能在 /etc/sysconfig/network-scripts/ifcfg-ethX 文件中遇到 UUID 或 MAC 问题。
如果上述情况均不符合要求,请从 Mellanox 下载驱动程序或生命值。
# modinfo mlx4_en
filename: /lib/modules/2.6.32-573.22.1.el6.x86_64/weak-updates/mlnx-en/drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko
version: 2.3-2.0.1 (Dec 7 2014)
license: Dual BSD/GPL
description: Mellanox ConnectX HCA Ethernet driver
author: Liran Liss, Yevgeny Petrilin
srcversion: 86DD1A5FE5CF17268AFBB0D
depends: mlx4_core,compat,ptp
vermagic: 2.6.32-504.el6.x86_64 SMP mod_unload modversions
parm: inline_thold:threshold for using inline data (uint)
parm: udp_rss:Enable RSS for incoming UDP traffic (uint)
parm: num_lro:Dummy module parameter to prevent loading issues (uint)
parm: pfctx:Priority based Flow Control policy on TX[7:0]. Per priority bit mask (uint)
parm: pfcrx:Priority based Flow Control policy on RX[7:0]. Per priority bit mask (uint)
答案2
我找到了解决方案。我所要做的就是输入两个命令来激活 CentOS 6 中的网卡:
sudo modprobe mlx4_core
sudo modprobe mlx4_en
现在我已经eth1
进入ifconfig -a
并可以配置它(IP 地址、网络掩码等)
为了使其在重启后永久生效,我添加了一个新文件/etc/sysconfig/modules/mellanox.modules
并将其权限(chmod)设置为 755,所有者/组为 root:
#!/bin/sh
/sbin/modprobe mlx4_core
/sbin/modprobe mlx4_en
这会在启动时自动加载 CentOS 内置的 Mellanox 内核模块,然后激活 /etc/sysconfig/network-scripts 中指定的 eth0/eth1 配置
现在它就像任何其他网络接口一样工作。