CentOS7更改网卡名称为eth0
一、查看现有网卡名称
![](https://images2017.cnblogs.com/blog/1218689/201708/1218689-20170821155404386-285222937.png)
二、更改网卡配置
[root@docker-demo50 ~]# cd /etc/sysconfig/network-scripts/
[root@docker-demo50 network-scripts]# mv ifcfg-ens160 ifcfg-eth0
[root@docker-demo50 network-scripts]# sed -i 's/ens160/eth0/g' /etc/sysconfig/network-scripts/ifcfg-eth0
三、修改grub配置文件
[root@localhost 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_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配置并更新内核参数
[root@docker-demo50 network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg
五、重启系统,即可看到效果
![](https://images2017.cnblogs.com/blog/1218689/201708/1218689-20170821160526558-44461429.png)
博主小学未毕业,请勿口喷!