很多同学在装完centos7,发现网卡接口名字变了, 不再是eth*或者em*了,而是ens*,但是这样统一维护起来就比较麻烦,那么怎么修改呢,请看下文:
1. 拷贝网卡接口配置文件
Ruby Code复制内容到剪贴板 # cd /etc/sysconfig/network-scripts/# cp ifcfg-ens32 ifcfg-eth0
编辑ifcfg-eth0, 将文件中的ens32改为eth0
Ruby Code复制内容到剪贴板 # cd /etc/sysconfig/network-scripts/# cp ifcfg-ens32 ifcfg-eth0
编辑ifcfg-eth0, 将文件中的ens32改为eth0
2. 修改grub
Ruby Code复制内容到剪贴板 # vim /etc/default/grub修改GRUB_CMDLINE_LINUX 行内容,在后面加上 net.ifnames=0 biosdevname=0,如下:
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"# vim /etc/default/grub
修改GRUB_CMDLINE_LINUX 行内容,在后面加上 net.ifnames=0 biosdevname=0,如下:GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"
3. 重新生成grub.cfg文件
Python
Ruby Code复制内容到剪贴板 # grub2-mkconfig -o /boot/grub2/grub.cfgGenerating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-cbe15acd3ca347f4a373c8f4adaf2619Found initrd image: /boot/initramfs-0-rescue-cbe15acd3ca347f4a373c8f4adaf2619.img
done# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.imgFound linux image: /boot/vmlinuz-0-rescue-cbe15acd3ca347f4a373c8f4adaf2619
Found initrd image: /boot/initramfs-0-rescue-cbe15acd3ca347f4a373c8f4adaf2619.imgdone
4. reboot 重启
以上所述是小编给大家介绍的centos7修改网卡名字的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对软件开发网网站的支持!