- 修改网卡配置文件
修改DEVICE、NAME配置项
vim /etc/sysconfig/network-scripts/ifcfg-ens192
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.1.2
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
- 重命名配置文件
mv ifcfg-ens192 ifcfg-eth0
- 编辑配置文件/etc/default/grub
GRUB_CMDLINE_LINUX配置项中新增 net.ifnames=0 biosdevname=0
vim /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"
- 生成新的GRUB配置并更新内核参数
grub2-mkconfig -o /boot/grub2/grub.cfg
- 重启生效