> CentOS > CentOS入门 >

CentOS7修改eth0网卡的名字

  1. vi  /etc/sysconfig/network-scripts/ifcfg-enp0s3

    name="eth0"

  2. mv  /etc/sysconfig/network-scripts/ifcfg-enp0s3  /etc/sysconfig/network-scripts/ifcfg-eth0

  3. vi  /etc/default/grun

    GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
    GRUB_DEFAULT=saved
    GRUB_DISABLE_SUBMENU=true
    GRUB_TERMINAL_OUTPUT="console"
    GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us rhgb quiet"
    GRUB_DISABLE_RECOVERY="true

    在rhgb quiet中添加:net.ifnames=0 biosdevname=0

  4. 重新建立grub文件

    grub2-mkconfig -o /boot/grub2/grub.cfg

  5. 重新启动服务器

(责任编辑:IT)