centos 7 网卡名称更改

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos 7 网卡名称更改相关的知识,希望对你有一定的参考价值。

Centos7安装完成后网卡名称默认为enoXXX,非常熟悉的ethX没有了,总是感觉怪怪的。如果最小化安装找不到ifconfig命令,请安装net-tools软件包.更改步骤如下:


  1. [[email protected] ~]#vi /etc/sysconfig/network-scripts/ifcfg-enoXXX

    HWADDR=00:0C:29:AF:BF:18
    TYPE=Ethernet
    BOOTPROTO=dhcp
    DEFROUTE=yes
    PEERDNS=yes
    PEERROUTES=yes
    NAME=enoXXX                   //此处将enoXXX更改为ethX
    UUID=17cdd976-0b81-4286-80cf-185ec95f5ae8
    ONBOOT=no                    //此处将no更改为yes      

  2.  [[email protected] ~]#cd /etc/sysconfig/network-scripts

     [[email protected] ~]#mv ifcfg-enoXXX ifcfg-eth0

  3. [[email protected] ~]# vi /etc/default/grub
    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="vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-sun16 net.ifnames=0 biosdevname=0 rhgb quiet"
    GRUB_DISABLE_RECOVERY="true"   //添加标记为红色的两个参数

  4. [[email protected] ~]# grub2-mkconfig -o /boot/grub2/grub     // 执行此命令,重新加载下grub配置
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
    Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
    Warning: Please don‘t use old title `CentOS Linux, with Linux 3.10.0-123.el7.x86_64‘ for GRUB_DEFAULT, use `Advanced options for CentOS Linux>CentOS Linux, with Linux 3.10.0-123.el7.x86_64‘ (for versions before 2.00) or `gnulinux-advanced-66b96693-051c-4021-85ef-5f7ef0f970e2>gnulinux-3.10.0-123.el7.x86_64-advanced-66b96693-051c-4021-85ef-5f7ef0f970e2‘ (for 2.00 or later)
    Found linux image: /boot/vmlinuz-0-rescue-b6f54d97b52944738996d2d9aeb3d59b
    Found initrd image: /boot/initramfs-0-rescue-b6f54d97b52944738996d2d9aeb3d59b.img
    done

  5. [[email protected] ~]# reboot

    重启操作系统,Centos7的网卡名称就更改完成了。


以上是关于centos 7 网卡名称更改的主要内容,如果未能解决你的问题,请参考以下文章

教你更改 RHEL7 或者 CentOS 7 的网卡名称

CentOS7更改网卡名称

CentOS7更改网卡名称

centos7更改网卡名称

CentOS更改网卡名称eth0

CentOS更改网卡名称eth0