Solve the problem that eth0 disappears after the CentOS system is cloned by VM and eth1 is displayed.
After cloning the CentOS system, run the ifconfig-a command to find that only the eth1 Nic is available, and the eth0 Nic disappears. However, the/etc/sysconfig/network-scripts/directory contains only the eth0 file, but the eth1 configuration file does not exist.
Next we will solve this problem
1. Record the HWADDR and IP address of eth1
Run the ifconfig-a command to view the HWaddr and IP address of eth1.
192.168.0.113
HWADDR = 00: 0C: 29: D1: 28: 06
2. Record the UUID of eth1
Run the nmcli con command to view the UUID of eth1.
Bf40e6d1-8367-4906-b8be-21de49a44c51
NOTE: Refer to my previous article: how to view the UUID of the NIC in Linux
3. modify the configuration file 70-persistent-net.rules.
Vim/etc/udev/rules. d/70-persistent-net.rules // comment out eth0 and change eth1 to eth0
For example:
4. Modify the ifcfg-eth0 configuration file
Vim/etc/sysconfig/network-scripts/ifcfg-eth0 // modify the following content
DEVICE = eth0
HWADDR = 00: 0C: 29: D1: 28: 06
TYPE = Ethernet
UUID = bf40e6d1-8367-4906-b8be-21de49a44c51
ONBOOT = yes
NM_CONTROLLED = yes
BOOTPROTO = static
IPADDR = 192.168.0.113
NETMASK = 255.255.255.0
GATEWAY = 192.168.0.1
DNS1 = 192.168.0.1
DNS2 = 8.8.8.8
5. restart the system
Init 6
Note: If you only restart the network service, the IP address can be changed, but the modification of the network interface name does not take effect. So we need to restart the system to make it take effect. After the restart, run the ifconfig-a command to view the network configuration. You can find that eth1 is changed to eth0 and the IP address is the configured IP address.