Centos7.5 修改网卡名为eth0

1. 修改/etc/default/grub文件

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
改为:
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap net.ifnames=0 biosdevname=0 rhgb quiet"

2. 修改 /etc/sysconfig/network-scripts/ifcfg-ens33

1. cd /etc/sysconfig/network-scripts/
2. mv ifcfg-ens33 ifcfg-eth0
3. vim ifcfg-eth0
    NAME=ens33  --> NAME=eth0
    DEVICE=ens33  -->  DEVICE=eth0

3. 运行命令grub2-mkconfig -o /boot/grub2/grub.cfg 更新环境参数

[root@go_dev network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-637210975525494fa2bcd6a1e3330ddb
Found initrd image: /boot/initramfs-0-rescue-637210975525494fa2bcd6a1e3330ddb.img
done

4. 重启网卡

systemctl restart network
ifconfig 查看

如果重启网卡失败 --> 重启服务器

你可能感兴趣的:(Centos7.5 修改网卡名为eth0)