CentOS7 change the NIC name to eth0
Preface
Both RHEL 7 and CentOS 7 are used.NetworkManager.serviceFor network management, of coursenetworkThe service can still be used, but it will also be a residue in the transitional period.
In other versionsThe Udev file has been modified fromifcfg-eth0Changedifcfg-eno16777736. In addition, when creating a 7 VM in VMWare, the NIC device is clearly added, but cannot be found in the system. This article mainly records howifcfg-eno16777736Changeifcfg-eth0And the NIC device is added to VMWare.
In CentOS 7, why is Nic named like this?RHEL7 uses the dmidecode collection naming scheme to obtain the motherboard information.
The NIC name can be permanently unique, And the RHEL6 Nic name will change as needed rather than unique and fixed.
Ethernet: enX (X can be of the following three types)
Wireless Network: wlX
Cable: wwX
- O motherboard board Nic
- P independent NIC, PCI Nic
- S hot swapping Nic, usb and so on
Xxxx (number) indicates that the MAC address + motherboard information is used to calculate a unique sequence.
Use RHEL6 Nic naming rules in RHEL7If you are not used to the dmidecode collection name of RHEL7, you can modify the configuration to restore it to the RHEL6 naming scheme.
Modify the Grub configuration file
(PASS Parameters to the kernel when the system is started, and disable dmidecode collection on the motherboard)
Vim/etc/sysconfig/grub
# Add net. ifnames = 0 biosdevname = 0 in GRUB \ _ CMDLINE_LINUX configuration item # disable BIOSDEV Configuration
Reload Grub Configuration
grub2-mkconfig -o /boot/grub2/grub.cfg
Generate the RHEL6 Nic configuration file
cd /etc/sysconfig/network-scriptsmv ifcfg-enxxxxxx ifcfg-eth0
Configure Nic vim ifcfg-eth0
NAME="eth0"ONBOOT=yes
Restart the system to take effect
systemctl reboot
Add Nic device for CentOS7 in VMWareVMWare has a small BUG. When we specify multiple NICs while creating a virtual machine, additional NICS will not be discovered, in this case, we need to remove the undiscovered Nic In the virtual machine settings, and then add a new Nic, VMWare will refresh the VM and then useifconfigA new Nic device appears.ifcfg-eth0Copyifcfg-eth1Then you can use it.Note: When the MAC Address and nic configuration file of the NIC DeviceHDADDRAn LSB error occurs when the configuration file is inconsistent.HDADDR. The real MAC Address of the NIC device.ifconfigTo view