CentOS 7/8更改网卡名eth0和配置网卡
一、编辑 grub 配置文件
增加 net.ifnames=0 biosdevname=0 在GRUB_CMDLINE_LI
[root@centos7mini ~]#vim /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"
二、用 grub2-mkconfig 命令重新生成GRUB配置并更新内核
[root@centos7mini ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done
三、修改网卡配置文件
将原来网卡配置文件名称为 ifcfg-ens33修改为 eth0 ,并调整网卡配置文件
[root@centos7mini ~]#cd /etc/sysconfig/network-scripts/
[root@centos7mini network-scripts]#mv ifcfg-ens33 ifcfg-eth0
[root@centos7mini network-scripts]#vi ifcfg-eth0
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
四、重启系统查看
[root@centos7mini network-scripts]#reboot