Centos changes the NIC name to eth0 and centoseth0.
The default Nic name is eno16777736.
1. modify the configuration file ifcfg-eno16777736
[root@localhost ~]# cd /etc/sysconfig/network-scripts/[root@localhost network-scripts]# vim ifcfg-eno16777736
Change NAME and DEVICE to eth0
TYPE=EthernetBOOTPROTO=dhcpDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noNAME=eth0UUID=0fea6de7-54d9-4a8d-bddc-3061678e8a0eDEVICE=eth0ONBOOT=yesPEERDNS=yesPEERROUTES=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yes
Rename this file
mv ifcfg-eno16777736 ifcfg-eth0
2. disable this predictable naming rule.
Add net. ifnames = 0 biosdevname = 0 to the grub_javasline_linux variable in the grup file.
[root@localhost network-scripts]# vim /etc/default/grubGRUB_TIMEOUT=5GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT="console"GRUB_CMDLINE_LINUX="crashkernel=auto net.ifnames=0 biosdevname=0 rhgb quiet"GRUB_DISABLE_RECOVERY="true"
Run the command to regenerate GRUB configuration and update kernel parameters.
[root@localhost network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfgGenerating grub configuration file ...Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.imgFound linux image: /boot/vmlinuz-0-rescue-692c580a413f41d8b51ddc4724500560Found initrd image: /boot/initramfs-0-rescue-692c580a413f41d8b51ddc4724500560.imgdone
3. restart the system
[root@localhost network-scripts]# reboot now
View Nic Information
[root@localhost network-scripts]# ifconfigeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.81.128 netmask 255.255.255.0 broadcast 192.168.81.255 inet6 fe80::20c:29ff:fe5b:1a46 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:5b:1a:46 txqueuelen 1000 (Ethernet) RX packets 474 bytes 41909 (40.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 266 bytes 45987 (44.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10