更改centos7的网卡名称为eth0
source link: https://blog.51cto.com/u_13753753/5656988
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
更改centos7的网卡名称为eth0
精选 原创1.首先查看当前虚拟机的网卡名称
2.修改网卡配置,对NAME和DEVICE进行修改,将ens18修改成eth0
3.更改网卡文件的名称
mv ifcfg-ens18 ifcfg-eth0
4.禁用可预测命名规则
编辑 /etc/default/grub 并加入以下参数来实现
CentOS 7 这种变化的原因,是由于systemd 和 udev 引入了一种新的网络设备命名方式–一致网络设备命名(CONSISTENT NETWORK DEVICE NAMING) 。可以根据固件、拓扑、位置信息来设置固定名字,带来的好处是命名自动化,名字完全可预测,在硬件坏了以后更换也不会影响设备的命名,这样可以让硬件的更换无缝化。带来的不利是新的设备名称比传统的名称难以阅读。比如名称是ens18.
5.重新生成GRUB配置并更新内核参数
此时查看网卡名称是否已经更改
发现网卡名称并没改变,此时还是需要重启虚拟机才可以生效
6.重启虚拟机使其生效
重启后再次查看
可以看到网卡名已经改成eth0
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK