一、添加eth0配置文件
[[email protected] ~]# cd /etc/sysconfig/network-scripts/
[[email protected] network-scripts]# cp ifcfg-eno16777736 ifcfg-eth0
[[email protected] network-scripts]# vi ifcfg-eth0
NAME=eth0
#NAME=eno16777736
DEVICE=eth0
#DEVICE=eno16777736
二、修改grub配置文件
[[email protected] network-scripts]# vi /etc/sysconfig/grub 增加net.ifnames=0 biosdevname=0
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto net.ifnames=0 biosdevname=0 rhgb quiet"
#GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
三、重新生成grub配置并更新内核参数
[[email protected] network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg
四、重启系统,即可看到效果
[[email protected] ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:4a:98:1c brd ff:ff:ff:ff:ff:ff
inet 192.168.3.170/24 brd 192.168.3.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe4a:981c/64 scope link
valid_lft forever preferred_lft forever