Solve the problem that the CentOS virtual machine cannot access the Internet after cloning (the NIC information is inconsistent ).
I. Problem Description
After the VM is cloned, the network card information is inconsistent, leading to the failure of accessing the Internet or executing the "sercice network restart" command.
[Root @ lyy desktop] # ifconfig // view the current Nic information [root @ lyy desktop] # cd/etc/sysconfig/network-scripts // enter the NIC configuration file directory [root @ lyy network-scripts] # ls // view the NIC information in the NIC configuration file
Ii. Cause Analysis
Because of the cloned system, the system only modifies the Virtual Machine name and MAC, and adds a line of device name eth1 to the/etc/udev/rules. d/70-persistent-net.rules file.
Iii. Solution
1. Modify the file/etc/udev/rules. d/70-persistent-net.rules and/etc/sysconfig/network-scripts/ifcfg-eth0 to match the device name and MAC address in the two files
[Root @ lyy ~] # Gedit/etc/udev/rules. d/70-persistent-net.rules/etc/sysconfig/network-scripts/ifcfg-eth0
2. Save the changes, restart the VM, and view the NIC information again.