CentOS7 changes the nic name to eth0 and adds the multi nic configuration to VMWare

  • 2020-05-27 07:58:30
  • OfStack

preface

Both RHEL 7 and CentOS 7 use NetworkManager.service for network management. Of course, the network service can still be used, but it will be a relic of the transition period.

In addition, the Udev file named after the network card in version 7 has been changed from ifcfg-eth0 of version 6 to ifcfg-eno16777736. What's more, when creating the virtual machine of 7 in VMWare, the network card device was obviously added, but it was not found in the system. This paper mainly records how to change ifcfg-eno16777736 into ifcfg-eth0, and successfully add network card devices in VMWare.

Why are network CARDS so named in CentOS 7

RHEL7 USES the dmidecode naming scheme to obtain the information of the motherboard.

The network card name can be permanently uniformed to 1, RHEL6 get the network card name will be changed according to the situation rather than only 1 and fixed.

Ethernet: enX(X can be of the following three types)

Wireless: wlX

Cable: wwX

The o motherboard carries network CARDS p standalone network card, PCI network card s hot plug and unplug network CARDS, usb and so on

xxxx(numerical) means: MAC address + motherboard information to calculate only 1 sequence

RHEL6's network card naming rules are used in RHEL7

If you are not used to the dmidecode collection naming of RHEL7, you can restore the naming scheme of RHEL6 by modifying the configuration.

Modify the Grub configuration file

(power on and pass parameters to kernel, close the motherboard and name the collection of dmidecode)

vim /etc/sysconfig/grub


# in GRUB\_CMDLINE_LINUX Add to the configuration item 
net.ifnames=0 biosdevname=0     # Is not enabled BIOSDEV The configuration of the 

Reload the Grub configuration


grub2-mkconfig -o /boot/grub2/grub.cfg

Generate the network card configuration file for RHEL6


cd /etc/sysconfig/network-scripts
mv ifcfg-enxxxxxx ifcfg-eth0

The LAN

vim ifcfg-eth0


NAME="eth0"
ONBOOT=yes

Restart system in effect


systemctl reboot

Add network card devices for CentOS7 in VMWare

VMWare have 1 small BUG, when we create a virtual machine and specify the Ethernet card, more additional network card will not be found, now we need to card found in the virtual machine Settings will not be removed, to add a new card, 1 VMWare will refresh the virtual machine, then use the ifconfig can appear new nic device, then ifcfg - eth0 Copy ifcfg - eth1 after can use.

Note: the LSB error occurs when the MAC Address of the network card device is different from the HDADDR of the network card configuration file, so be sure to modify the HDADDR option during the Copy configuration file. The real MAC Address network card device can be viewed through ifconfig


Related articles: