一 背景概述 1.1 网口乱序 某些特殊情况下,如重新装机、更换网卡等,会导致HCI一体机服务器的网口识别异常,从而导致网口乱序,因此需要将网口顺序按我们需求/规划进行调整。 提示:本指南,不适合SN号为9H、F*H的服务器。
二 调整步骤 2.1 确认设备 确认当前设备为我司设备,当前网口顺序调整是通过脚本实现,仅支持我司设备调整。 - Sangfor:aSV/host-b4055dece536 ~ # dmidecode -t 1
- # dmidecode 3.1
- Getting SMBIOS data from sysfs.
- SMBIOS 3.2.1 present.
- # SMBIOS implementations newer than version 3.1.1 are not
- # fully supported by this version of dmidecode.
- Handle 0x0001, DMI type 1, 27 bytes
- System Information
- Manufacturer: SANGFOR
- Product Name: INSPUR
- Version: 01
- Serial Number: 822528771
- UUID: 29964e27-35e5-03e2-11ec-b5c54ff61eb6
- Wake-up Type: Power Switch
- SKU Number: 01110-ktru0-9j5cc-ft5iz-f940a727
- Family: INSPUR_C620_ASERVER-R-2205
复制代码
Manufactorer:即设备的产商,必须为 SANGFOR、Sangfor或sangfor; Product Name:即设备的产品名,可以是其他的产品名; Family:即设备所属的产品系列名,可以是其他的产品系列名。 注意:上述的三项设备信息必须齐全,作为设备的完整标识信息,由上Manufacturer: SANGFOR字段可知,当前设备支持使用此方式进行调节。 2.2 确认期望序号 为便于理解和区分,网口序号引入两个概念: 期望序号:为最终我们期望的正确的网口序号,建议采用服务器背板网口标记的网口序号,以便于统一; 错误序号:为当前将期望序号识别为错误的网口序号,可通过插拔来确定当前错误的序号,以便于后期修正。
提示:必须依据从左到右,从上到下的顺序记录,便于后续修正顺序。
如上所示背板所示,按照规则记录下期望的序号: 期望序号:eth8 eth9 eth4 eth10 eth5 eth11 eth6 eth7 eth0 eth1 eth2 eth3
2.3 确认错误序号 进入服务器后台,依次插拔每一个期望序号的网口,通过ethtool命令确认错误序号。 如本实验插拔期望序号的eth0,后台依次down/up的端口的eth3,插拔期望序号的eth1,后台依次down/up的端口的eth2,依次类推。 - Sangfor:aSV/host-b4055dece536 ~ # ethtool eth3
- Settings for eth3:
- Supported ports: [ TP ]
- Supported link modes: 1000baseT/Full
- Supported pause frame use: Symmetric
- Supports auto-negotiation: Yes
- Supported FEC modes: Not reported
- Advertised link modes: 1000baseT/Full
- Advertised pause frame use: No
- Advertised auto-negotiation: Yes
- Advertised FEC modes: Not reported
- Speed: 1000Mb/s
- Duplex: Full
- Port: Twisted Pair
- PHYAD: 0
- Transceiver: internal
- Auto-negotiation: on
- MDI-X: Unknown
- Supports Wake-on: g
- Wake-on: g
- Current message level: 0x0000000f (15)
- drv probe link timer
- Link detected: yes
复制代码
依次类推,确认出所有对应关系,并按照规则记录下序号对比:: 期望序号:eth8 eth9 eth4 eth10 eth5 eth11 eth6 eth7 eth0 eth1 eth2 eth3 错误序号:eth4 eth5 eth11 eth6 eth10 eth7 eth9 eth8 eth3 eth2 eth1 eth0
2.4 创建配置文件 在当前设备后台,进入网口顺序调整的脚本所在目录。 - Sangfor:aSV/host-b4055dece536 ~ # cd /usr/sbin/nic_reorder_tool
- Sangfor:aSV/host-b4055dece536 /usr/sbin/nic_reorder_tool # ll
- total 96
- -rwxr-xr-x 1 root root 19057 Mar 31 15:15 nic_order.cfg*
- -rwxr-xr-x 1 root root 10597 Apr 1 04:22 nic_reorder_tool.sh*
复制代码
查看已有配置文件的示例配置: - Sangfor:aSV/host-b4055dece536 /usr/sbin/nic_reorder_tool # cat nic_order.cfg
复制代码
建议参考已有配置文件新建一个独立配置文件,便于维护和管理。 参考2.3记录的序号对比,其中错误序号位于第一行,期望序号位于第二行。 - Sangfor:aSV/host-b4055dece536 /usr/sbin/nic_reorder_tool # vim newport.cfg
- # Family: INSPUR_C620_ASERVER-R-2205
- INSPUR INSPUR_C620_ASERVER-R-2205
- eth4 eth5 eth11 eth6 eth10 eth7 eth9 eth8 eth3 eth2 eth1 eth0
- eth8 eth9 eth4 eth10 eth5 eth11 eth6 eth7 eth0 eth1 eth2 eth3
复制代码
2.5 运行修复脚本 参考如下运行调整网口序号脚本。 ./nic_reorder_tool.sh -s [产品系列名] [配置文件] - Sangfor:aSV/host-b4055dece536 /usr/sbin/nic_reorder_tool # ./nic_reorder_tool.sh -s INSPUR_C620_ASERVER-R-2205 ./newport.cfg
复制代码
2.6 清理多余网口(可选) 若环境中除了网卡序号混乱,还出现了/识别出了多余的网卡,可通过如下方式清理。 如本环境只有11个网口,除了网口序号错误,还识别成了多余的eth12~eth17网口。 - Sangfor:aSV/host-b4055dece536 ~ # cd /sf/cfg/if.d
- Sangfor:aSV/host-b4055dece536 /sf/cfg/if.d # rm -rf eth{12..17}
- Sangfor:aSV/host-b4055dece536 /sf/cfg/if.d # cp /sf/cfg/if.d/interfaces /sf/cfg/if.d/interfaces.bak
- Sangfor:aSV/host-b4055dece536 /sf/cfg/if.d # vi /sf/cfg/if.d/interfaces #删除eth12~eth·7的网口信息
- Sangfor:aSV/host-b4055dece536 /sf/cfg/if.d # /sf/etc/init.d/mgmt-node-agent-api restart #重启node-agent服务
- Sangfor:aSV/host-b4055dece536 /sf/cfg/if.d # /sf/etc/init.d/sdncfg.sh restart #重启sdn服务,所有虚拟机的网络都会断
复制代码
2.7 重启验证 为便于重新刷新网口序号,建议重命名当前网口net规则。 - Sangfor:aSV/host-b4055dece536 /usr/sbin/nic_reorder_tool # mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.bak
- Sangfor:aSV/host-b4055dece536 /usr/sbin/nic_reorder_tool # reboot
- Sangfor:aSV/host-b4055dece536 /usr/sbin/nic_reorder_tool # ifconfig | more
复制代码 |