Centos 7修改网卡名称为eth0

\\调整网卡配置名称

cd /etc/sysconfig/network-scripts/      #进入网卡文件目录

mv ifcfg-eno16777736 ifcfg-eth0     #重命名网卡名称

\\调整网卡的配置信息

cat ifcfg-eth0     #修改后的结果如下

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
NAME=eth0          #修改为eth0
UUID=3e8d1581-84bd-44e8-ae70-467fa29e2585
DEVICE=eth0        #修改为eth0
ONBOOT=yes
DNS1=10.0.0.2
IPADDR=10.0.0.201
PREFIX=24
GATEWAY=10.0.0.2

\\修改并生成grub配置修改后的结果如下,也可以在安装系统或开机启动时进行调整

cat /etc/sysconfig/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="crashkernel=128M rhgb net.ifnames=0 biosdevname=0 quiet"
GRUB_DISABLE_RECOVERY="true"

grub2-mkconfig -o /boot/grub2/grub.cfg     #生成grub启动菜单

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image:/boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image:/boot/vmlinuz-0-rescue-1100f7e6c97d4afaad2e396403ba7f61
Found initrd image:/boot/initramfs-0-rescue-1100f7e6c97d4afaad2e396403ba7f61.img
Done

\\验证是否修改结果

reboot     #必须重启系统

ifconfig     #再次查看网卡信息

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet10.0.0.201  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6fe80::20c:29ff:feae:ef19  prefixlen64  scopeid 0x20<link>
        ether00:0c:29:ae:ef:19  txqueuelen 1000  (Ethernet)
        RX packets36248  bytes 2319009 (2.2 MiB)
        RXerrors 0  dropped 0  overruns 0 frame 0
        TXpackets 43090  bytes 67555745 (64.4 MiB)
        TXerrors 0  dropped 0 overruns 0  carrier 0 collisions 0