戴尔服务器安装centos7修改网卡名称


1.修改配置

[root@controller ~]# vi /etc/default/grub
GRUB_CMDLINE_LINUX 加上 net.ifnames=0 biosdevname=0

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"


2.重新加载配置
grub2-mkconfig -o /boot/grub2/grub.cfg

[root@controller ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.5.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.5.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.28.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.28.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-0ff0e879cd2f443cb90ec9afa4d66dfb
Found initrd image: /boot/initramfs-0-rescue-0ff0e879cd2f443cb90ec9afa4d66dfb.img
done

 

3.修改网卡名称

[root@controller ~]# cd /etc/sysconfig/network-scripts/
[root@controller network-scripts]# vi ifcfg-em1

修改为
NAME=eth0
DEVICE=eth0

HWADDR=你的MAC地址

[root@controller network-scripts]# mv ifcfg-em1 ifcfg-eth0
同样另外一张网卡改为eth1

进入目录 /etc/udev/rules.d/
[root@controller ~]# cd /etc/udev/rules.d/70-persistent-ipoib.rules

增加:

SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{type}=="1",ATTR{address}=="?*你的MAC",KERNEL=="eth*",NAME="eth0"
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{type}=="1",ATTR{address}=="?*你的MAC",KERNEL=="eth*",NAME="eth1"
4、重启计算机
5、查看IP ADDR
6、如果网卡启动失败:请关闭NetworkManager