在chinacache工作时,遇到了东方网力的客户,需要安装使用ubuntu系统,每个服务器有4个网口,在做bond时,发现部分网卡漂移,为了解决这个,搜索了大量的文档,汇总一下。
1 编辑grub文件如下:
#cat /etc/default/grub
GRUB_CMDLINE_LINUX="biosdevname=0"
或者 GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=0 biosdevname=0"
2 从新生成grub文件
# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux p_w_picpath: /boot/vmlinuz-3.19.0-25-generic
Found initrd p_w_picpath: /boot/initrd.img-3.19.0-25-generic
Found memtest86+ p_w_picpath: /boot/memtest86+.elf
Found memtest86+ p_w_picpath: /boot/memtest86+.bin
done
3 下面这部可以不用操作,直接reboot尝试,如果不行再尝试使用udev绑定。
# cat /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e2:ba:93:83:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="18:c5:8a:15:bc:57", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="18:c5:8a:15:bc:56", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e2:ba:93:83:57", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
转载于:https://blog.51cto.com/lizan27/1700887
在遇到Ubuntu服务器中网卡名称随机变化的问题时,可以通过编辑grub配置文件和使用udev规则来解决。具体步骤包括将`biosdevname=0`或`net.ifnames=0 biosdevname=0`添加到GRUB_CMDLINE_LINUX,默认重启后生效;若仍存在问题,可进一步编写udev规则以确保网卡名的固定。这是一个针对Ubuntu系统中网卡命名漂移问题的解决方案。
698

被折叠的 条评论
为什么被折叠?



