centos 7 网卡名称更改

前端之家收集整理的这篇文章主要介绍了centos 7 网卡名称更改前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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


  1. [root@server1 ~]#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. [root@server1 ~]#cd /etc/sysconfig/network-scripts

    [root@server1 ~]#mv ifcfg-enoXXX ifcfg-eth0

  3. [root@server1 ~]# 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. [root@server1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg // 执行此命令,重新加载下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. [root@server1 ~]# reboot

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

原文链接:https://www.f2er.com/centos/380819.html

猜你在找的CentOS相关文章