Centos修改默认网卡为eth0

  1. 修改网卡配置文件中的 DEVICE= 参数的关于 eth0
    TYPE=Ethernet
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=static
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=eth0
    DEVICE=eth0
    ONBOOT=yes
    IPADDR=192.168.100.43
    NETMASK=255.255.255.0
    GATEWAY=192.168.100.1
    DNS1=114.114.114.114
    ~               
  2. 修改网卡文件名 mv ifcfg-eno16777728 ifcfg-eth0
    因 CentOS7 采用 grub2 引导,还需要对 grub2 进行修改,编辑 /etc/default/grub 配置文件,在 GRUB_CMDLINE_LINUX 这个参数后面加入 net.ifnames=0 biosdevname=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=centos/root rd.lvm.lv=centos/swap
    rhgb quiet net.ifnames=0 biosdevname=0"
    GRUB_DISABLE_RECOVERY="true"
  3. 用 grub2-mkconfig 命令重新生成GRUB配置并更新内核
    [root@localhost ~]# 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.img
    Found linux image: /boot/vmlinuz-0-rescue-4dd6b54f74c94bff9e92c61d669fc195
    Found initrd image: /boot/initramfs-0-rescue-4dd6b54f74c94bff9e92c61d669fc195.img
    done
  4. 重启 init 6

新闻标题:Centos修改默认网卡为eth0
链接分享:http://myzitong.com/article/jgjhpg.html