有时候安装系统后网卡名称是ens33,此时为了使用方便修改为eth0:修改方法如下:
1、查看网卡信息,并将其修改为eth0.
2、首先我们把网卡配置文件和网卡名称分别修改为eth0:如下:
[root@localhost network-scripts]# mv ifcfg-ens33 ifcfg-eth0
把配置文件:DEVICE=ens33 修改为 DEVICE=eth0
[root@localhost network-scripts]# cat ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
NAME=ens33
UUID=74fe3ba7-db98-4bae-a952-646d692f85dd
DEVICE=eth0
ONBOOT=yes
3、编辑/etc/default/grub并加入“net.ifnames=0 biosdevname=0 ”是保存并退出:
4、运行命令grub2-mkconfig -o /boot/grub2/grub.cfg 来重新生成GRUB配置并更新内核参数:
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-512467fa81be4e4788da51947ce2be20
Found initrd image: /boot/initramfs-0-rescue-512467fa81be4e4788da51947ce2be20.img
done
5、重启Centos,此时发现网卡名称已经变成eth0:如图: