首页 > 代码库 > centos7修改网卡名

centos7修改网卡名

[root@linux-node1 ~]# mv /etc/sysconfig/network-scripts/ifcfg-eno16777735 /etc/sysconfig/network-scripts/ifcfg-eth0 

[root@linux-node1 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

NAME=eth0
#DEVICE=eno16777735

[root@linux-node1 ~]# vim /etc/default/grub

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

重新生成grub配置文件和更新内核参数

[root@linux-node1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

查看有无网卡UDEV规则,有就修改,没有就VIM一个

[root@linux-node1 ~]# ls /etc/udev/rules.d/

修改UDEV规则,ATTR{address}:MAC地址和NAME:网卡名字

[root@linux-node1 ~]# vim /etc/udev/rules.d/70-persistent-net.rules   

SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:65:c1:99",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"

完成重启

[root@linux-node1 ~]# reboot 

 

centos7修改网卡名