Centos7更改网卡名称eth0
一、执行vim /etc/default/grub代码
vim /etc/default/grub
在GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet后面加上 net.ifnames=0 biosdevname=0
GRUB_TIMEOUT=6 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0" GRUB_DISABLE_RECOVERY="true"
:wq退出
二、执行:
grub2-mkconfig -o /boot/grub2/grub.cfg
即可
[root@svr7 ~]# 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-31502ed81031436b81c924d30614f41f Found initrd image: /boot/initramfs-0-rescue-31502ed81031436b81c924d30614f41f.img done
三、reboot生效
注意事项,必须重启才能生效