Centos网卡名称命名

时间:2019-09-20
本文章向大家介绍Centos网卡名称命名,主要包括Centos网卡名称命名使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

1. vim /etc/sysconfig/grub     编辑/etc/sysconfig/grub文件

    添加  net.ifnames=0 biosname=0

GRUB_TIMEOUT=5
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=cl/root rd.lvm.lv=cl/swap rhgb quiet net.ifnames=0 biosname=0"   #添加
GRUB_DISABLE_RECOVERY="true"

2. grub2-mkconfig -o /boot/grub2/grub.cfg      生成新的grub.cfg文件

[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-957.21.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.21.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.14.4.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.14.4.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.6.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.6.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.2.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.2.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-6a40cff497a2412d91bb000f9652139a
Found initrd image: /boot/initramfs-0-rescue-6a40cff497a2412d91bb000f9652139a.img
done

3.mv ifcfg-enp3s0 ifcfg-eth0          执行命令   并修改 ifcfg-eth0中DEVICE = enp3s0   为  DEVICE = eth0

4.shutdown -r 0                             重启服务验证网卡名称是否为eth0

原文地址:https://www.cnblogs.com/shayumeng/p/11558500.html