From CentOSRHEL7, the foreseeable naming rules have changed to default. In this rule, the interface name is automatically determined based on the firmware, topology, and location information. Now, even if you add or remove a network device, the interface name remains fixed without reenumeration, and can be replaced seamlessly with the broken hardware.
Change the NIC name to eth0. The CentOS operating system is used as an example.
1. Modify the grub System
Vi/boot/grub. conf # Add biosdevname = 0 to the Kernel Parameter
Kernel/vmlinuz-2.6.32-573.7.1.el6.x86_64 ro root =/dev/mapper/VolGroup-lv_root kernel LANG = en_US.UTF-8 rd_NO_MD kernel = VolGroup/lv_swap SYSFONT = latarcyrheb-sun16 crashkernel = auto kernel = VolGroup/lv_root KEYBOARDTYPE = pc KEYTABLE = us rd_NO_DM biosdevname = 0 rhgb quiet
: Wq! # Save and exit
2. Modify the NIC naming rule configuration file of udev
Vi/etc/udev/rules. d/70-persistent-net.rules # modify
This server has four NICs. The identified NICs are: em1, em2, em3, and em4 (the em code starts from 1 and does not have em0 ),
Modify em1 to eth0, em2 to eth1, em3 to eth2, and em4 to eth3.
: Wq! # Save and exit
3. Modify the name of the current Nic configuration file
Cd/etc/sysconfig/network-scripts/# enter the NIC configuration file directory
Mv ifcfg-em1 ifcfg-eth0 # rename
Mv ifcfg-em2 ifcfg-eth1
Mv ifcfg-em3 ifcfg-eth2
Mv ifcfg-em4 ifcfg-eth3
4. modify the content of the NIC configuration file and change em to eth.
Cd/etc/sysconfig/network-scripts/# enter the NIC configuration file directory
Vi ifcfg-eth0 # modify em1 inside to eth0
Vi ifcfg-eth1 # modify em2 inside to eth1
Vi ifcfg-eth2 # modify em3 inside to eth2
Vi ifcfg-eth3 # modify em4 inside to eth3
: Wq! # Save and exit after modification
5. restart the system to make the above changes take effect.
Shutdown-r now # restart
So far, the CentOS system has completed modifying the network card em1 to eth0.