After VMware clones a Linux virtual machine, how does the cloned virtual machine change the NIC eth1 to eth0?

Source: Internet
Author: User
Tags uuid

Experimental system version:


CentOS 6.8



Problem Description:

After you have installed a virtual machine A with VMware, a virtual machine B is cloned.

Running the "ifconfig" command at this point will reveal that the network card display name is "eth1" rather than "eth0". This error occurs in virtual machine B when you run service network restart "Bringing up interface Eth0:Error:No suitable device found:no device found for Connection ' System eth0 ' ".


According to the general idea, look at the clone of VM B's/etc/sysconfig/network-scripts/ifcfg-eth0 This configuration file, found that the configuration file is actually useless.



Problem Analysis:

Many Linux operating systems use Udev to dynamically manage device files and to persist names based on the device's information. Udev identifies the network card during system boot and records the MAC address and network card name in Udev's rules script. And for the new virtual machine b,vmware will automatically generate a MAC address for the virtual machine's network card, when you clone, because you are using the previous system virtual hard disk information, so the cloned system has eth0 information, for this new network card, Udev will automatically name it as eth1 (cumulative principle) , so after your cloned system starts, you use Ifconfig to see the NIC named Eth1.


Problem solving:

Method One:

1)

#ifconfig


To obtain the MAC address information for eth1:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/82/2E/wKiom1dNZlDxwtvLAAArKaTJ4EA730.png "title=" New MAC address. png "alt=" Wkiom1dnzldxwtvlaaarkatj4ea730.png "/>


2)

#nmcli Con

Get UUID information for eth1

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/82/2C/wKioL1dNZ3Kx6d5BAAAX4SILW1k016.png "title=" New Uuid.png "alt=" Wkiol1dnz3kx6d5baaax4silw1k016.png "/>

3) Edit the virtual machine's/etc/sysconfig/network-scripts/ifcfg-eth0 This file, modify the MAC address, the UUID is consistent with the 2 information obtained above



After modification, reboot the system.


Method Two:

1)

Vim/etc/udev/rules.d/70-persistent-net.rules

Delete all of the eth0 information, keep only eth1 related information, and modify "eth1" to "eth0".

2) Change the value of "attr{address}" reserved in the previous step (that is, the HWADDR value) to/etc/sysconfig/network-scripts/ifcfg-eth0 this file, so that the MAC addresses in the two files are consistent.


After modification, reboot the system.


Tip: In the above two methods of the solution, the method one modifies the UUID, method two does not modify the UUID, does not affect the network normal.

This article is from the "Stephen" blog, so be sure to keep this source http://stephenzhao.blog.51cto.com/2515860/1784969

After VMware clones a Linux virtual machine, how does the cloned virtual machine change the NIC eth1 to eth0?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.