When learning ZK pseudo-distributed cluster pairs, the first time to notice the cloning of virtual machine after modifying the IP address of the ETH, found that IP is not their own modified IP, and then found in the inquiry, when we first login to view our cloned virtual machine IP: We see the IP is not eth0 IP, but eth1 IP. The reason is because after cloning the network card MAC address and the original system MAC address, there will be a conflict in the LAN, then we need to change the cloned MAC address. Explain: In fact, after the clone system has two Nic Eth0 and eth1, the actual effect is eth1,eth0 from the previous cloning, eth1 is what we need. The clone system will regenerate a MAC address because the system will change to eth1 in eth0 plus 1, causing us to modify the file when we use the virtual machine in Karon:/etc/udev/rules.d/70-persistent-net.rulesHere, according to the filename, this is a routing file:Vim/etc/udev/rules.d/70-persistent-net.rulesThere are two ways to change the command here, and the second is more simple and rude. Here's how:The first way:First step: View the cloned IP:ifconfig
Open the contents of the file as follows:
Here's a comparison of this file for a normal non-cloned virtual machine:
Obviously, there is more than one configuration, so we just need to comment out the redundant configuration to OK. Shownin front of the first NIC plus # comment out the first network card, change the 2nd network card for eth0, edit complete, Esc key exit, enter: Wq save exit. It is important to note that the MAC address of the attr needs to be duplicated here. Then look at the eth0 file:Vim/etc/sysconfig/network-scripts/ifcfg-eth0
This time will see the IP here is the clone of the virtual machine's IP, change this IP to the IP you want to configure, and then modify Hwaddr mac address paste, edit complete, Esc key exit, enter: Wq save exit. Restart the network service or restart the virtual machineService Network Restart/rebootUse Ifconfig to view the network: After performing the above steps, if the IP you are viewing at this time is the right, but the network card information is eth1, you can delete/etc/udev/rules.d/70-persistent-net.rules (I use the first method, When you finish editing eth0, check the NIC or eth1, so you have, follow up)This file is deleted, automatically generated after rebooting the system, can be safely deleted. (Newly cloned virtual machine delete)Execute command:rm/etc/udev/rules.d/70-persistent-net.rules :Execution: reboot reboot and check again, OK.
Use vim/etc/udev/rules.d/70-persistent-net.rules to view that the file has been regenerated.
The second way: First step: View the IP address of the virtual machine after cloning, executeifconfigCommand effect: Copy: Hwaddr MAC address Step two: Modify the eth0 File Execution command:Vim/etc/sysconfig/network-scripts/ifcfg-eth0Modify the Hwaddr MAC address, paste the above copied content, after modifying the IP address, edit complete, Esc key exit, enter: Wq save exit.Restart :reboot Re-view: ExecuteifconfigExample: By the way, see if the file exists:Vim/etc/udev/rules.d/70-persistent-net.rulesOk! Beginners always climb pits
VMware virtual machine Cloning CentOS6.5 after modifying the NIC