The method of modifying network card EM1 to eth0 by CentOS system

Time:2020-9-24

Question:

Some Dell servers found that the name of the network card changed to EM1 after installing Linux operating system.

terms of settlement:

Modify the name of the network card to eth0. Take CentOS operating system as an example.

1: Modify system grub

vi /boot/grub/grub.conf #Add after kernel parametersbiosdevname=0

kernel /vmlinuz-2.6.32-573.7.1.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM biosdevname=0 rhgb quiet

:wq! #Save exit

2、 Modify the configuration file of network card naming rules of udev

vi /etc/udev/rules.d/70-persistent-net.rules #Modification

The server has four network cards, and the name of the network card identified is:em1、em2、em3、em4The EM code starts with 1, there is no em0),

We need to put the topEM1 changed to eth0Em2 was modified to eth1, EM3 to eth2, and em4 to eth3

:wq! #Save exit

3、 Modify the name of the current network card profile

cd /etc/sysconfig/network-scripts/ #Enter the network card profile 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 network card configuration file and change em to eth

cd /etc/sysconfig/network-scripts/ #Enter the network card configuration file directory

vi ifcfg-eth0 #Change EM1 to eth0

vi ifcfg-eth1 #Modify em2 to eth1

vi ifcfg-eth2 #Modify EM3 to eth2

vi ifcfg-eth3 #Modify em4 to eth3

:wq! #After modification, save and exit

5、 Restart the system to make the above changes take effect

Shutdown – r now ා restart

At this point, the CentOS system modifies the network card EM1 to eth0.