Use ifconfig eth0 up to turn on the network card, then you can see eth0 under ifconfig, but the displayed ip address and gateway are wrong, not correctly identified, this time vi /etc/sysconfig/network-scripts/ifcfg -eth0 shows
DEVICE=eth0
ONBOOT=no
BOOTPROTO=static
IPADDR=192.168.1.8
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
HWADDR=00:0C:29:96:38:F8
Note that ONBOOT=no is changed to yes , the network card is activated, and service network restart is restarted.
Test ifconfig again
After cloning centos in vmware, it is found that there is only eth1 in the system, and only ifcfg-eth0 file under /etc/sysconfig/network-scripts/
ifconfig eth0
eth1: error fetching interface information: Device not found
Solution: Edit vi /etc/udev/rules.d/70-persistent-net.rules
Delete eth0, which is cloned
The mac address of the network card of the new virtual machine after cloning is the mac address corresponding to eth1
Here you need to change eth1 to eth0. Then change the mac address to the mac address of eth1 in /etc/sysconfig/network-scripts/ifcfg-eth0.
reboot reboot