CentOS7修改网卡名称为eth

2020-07-21   1,207 次阅读


  • 记一次将网卡名称统一改为eth的过程。
    • 环境介绍:
    • OS:CentOS7.6

1.编辑grub配置文件

[root@localhost ~]$ vim /etc/sysconfig/grub
#在GRUB_CMDLINE_LINUX=行的末尾追加“net.ifnames=0 biosdevname=0”
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet net.ifnames=0 biosdevname=0 "
GRUB_DISABLE_RECOVERY="true"

2.重新加载grub配置文件

[root@localhost ~]$ grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.21.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.21.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.21.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.21.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-cf604a26bf094f2f94977a8a38132acd
Found initrd image: /boot/initramfs-0-rescue-cf604a26bf094f2f94977a8a38132acd.img
done

3.重启操作系统后查看网卡名称即可

[root@localhost ~]$ reboot

脑无理想 枉活一世