简介
使用Udev和模块化网络驱动程序时,默认情况下,网络接口编号在重新启动后不会持续。这是由于并行加载驱动程序,因此网络设备会随机显示。
示例:在有两个由Intel和Realtek制造的网卡的计算机上,由Intel制造的网卡可能变为eth0
,而Realtek卡变成eth1
在某些情况下,在重新启动后,卡会以相反的方式重新编号。为避免这种情况,Udev附带了脚本和一些规则,以根据网卡的MAC地址为网卡分配稳定的名称
问题
Hyperflex存储控制器VM(SCVM)在重新启动后在VMX文件(例如uuid.bios参数)中进行更改后可能无法连接到网络,因为其MAC地址在文件70-persistent-net.rules中混乱
解决方案
步骤 1:将ATTR{address}字段与NAME字段映射
SSH到SCVM
键入cat /etc/udev/rules.d/70-persistent-net.rules
root@SpringpathControllerABCDE01234:~# cat /etc/udev/rules.d/70-persistent-net.rules
# This file has been auto-generated during Springpath controller deployment.
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="00:50:56:8b:af:33" ATTR{dev_id}=="0x0" ATTR{type}=="1" NAME="mgmt-if"
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="00:50:56:8b:ac:45" ATTR{dev_id}=="0x0" ATTR{type}=="1" NAME="data-if"
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="00:50:56:8b:cf:00" ATTR{dev_id}=="0x0" ATTR{type}=="1" NAME="repl-if"
步骤 2:输入SCVM VM设置
登录vCenter
找到SCVM
右键单击它,然后选择编辑设置……
步骤 3a:从vCenter设置中确定SCVM网络适配器MAC地址
在编辑设置窗口中,展开所有网络适配器并记录其MAC地址
步骤 3b:从SCVM外壳中确定SCVM网络适配器MAC地址。
从SCVM外壳发出“ifconfig -a”。eth0指向管理网络接口,eth1指向数据存储网络接口,eth1指向复制网络接口。记下这些MAC地址。
root@help:~# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:50:56:8b:ae:b7 <<<< mgmt-if
inet addr:10.197.252.81 Bcast:10.197.252.95 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2919331 errors:0 dropped:77 overruns:0 frame:0
TX packets:1186365 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:912923504 (912.9 MB) TX bytes:1169716469 (1.1 GB)
eth1 Link encap:Ethernet HWaddr 00:50:56:8b:bd:41 <<<< data-if
inet addr:10.197.252.100 Bcast:10.197.252.127 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:152529984 errors:0 dropped:416 overruns:0 frame:0
TX packets:132458793 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:242676663088 (242.6 GB) TX bytes:224531042730 (224.5 GB)
...
eth2 Link encap:Ethernet HWaddr 00:50:56:8b:cf:f3 <<< repl-if
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:1671340 errors:0 dropped:131 overruns:0 frame:0
TX packets:3340062 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:164403101 (164.4 MB) TX bytes:300665525 (300.6 MB)
...
步骤 4:使用上一步的MAC地址更新70-persistent-net.rules
键入vi /etc/udev/rules.d/70-persistent-net.rules
在ATTR{address}部分中输入上一步的MAC地址并保存更改
root@SpringpathControllerABCDE01234:~# vi /etc/udev/rules.d/70-persistent-net.rules
# This file has been auto-generated during Springpath controller deployment.
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="00:50:56:8b:ae:b7" ATTR{dev_id}=="0x0" ATTR{type}=="1" NAME="mgmt-if"
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="00:50:56:8b:bd:41" ATTR{dev_id}=="0x0" ATTR{type}=="1" NAME="data-if"
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="00:50:56:8b:cf:f3" ATTR{dev_id}=="0x0" ATTR{type}=="1" NAME="repl-if"
步骤 5:重新启动SCVM
键入reboot以重新启动SCVM
SCVM恢复运行后,应该能够正常连接到网络
root@SpringpathControllerABCDE01234:~# reboot