在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 image: /boot/vmlinuz-3.19.0-25-generic
Found initrd image: /boot/initrd.img-3.19.0-25-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /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"