CentOS 7.x系统中网卡命名规则被重新定义,可能会是 “ens33” 等,生产环境中,我们常常需要把网卡名称修改成 “eth0”
~]# cd /etc/sysconfig/network-scripts/
network-scripts]# mv ifcfg-ens33 ifcfg-eth0
network-scripts]# network-scripts]# sed -i ‘s@ens33@eth0@g‘ ifcfg-eth0
新增 net.ifnames=0 biosdevname=0
~]# vim /etc/sysconfig/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 rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true
重新生成grub配置文件
~]# grub2-mkconfig -o /boot/grub2/grub.cfg
~]# cd /etc/udev/rules.d
rules.d]# vim 70-persistent-net.rules
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:c3:fc:0b",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"
~]# shutdown -r now #或reboot重启系统
~]# ifconfig #或ip addr l
原文:https://www.cnblogs.com/imirsh/p/13295837.html