Linux virtual machine replication Nic does not start or use

Source: Internet
Author: User

Many times, when we use the virtual machine, we will install a virtual machine as model, the need to build a test environment will be copied by the model to achieve, so convenient and fast, and then in the replication of the new System network card check can not be used directly, this is because the MAC address of the network card is unique, Copy of the new system, will generate a new MAC address, and the Ifcfg-eth0 configuration file inside the MAC address is still original, so you need to manually modify into a new MAC address.

After cloning the Linux system, the clone version cannot start the network card, prompting the error:

Device eth0 does not seem to be present,delaying initialization

Cause Analysis: Linux uses Udev to dynamically manage device files. VMware automatically generates the MAC address of the virtual machine. Thus, since the cloned Linux has recorded the original Linux network card MAC address corresponds to the NIC Eth0, in the cloned Linux due to the MAC address changes, Udev will automatically correspond to the MAC network card eth1, and so on. In fact, the kernel only recognized a network card, and the NIC name related to the configuration has not changed any.

Solution:

Udev saves Mac and Nic name correspondence in/etc/udev/rules.d/70-persistent-net.rules


Record the new Nic MAC address and name.

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


# PCI Device 0x8086:0x100f (e1000)------The address before the copy is commented out

subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0C:29:5F:88:BD", attr{type}== "1", kernel== "eth*" , name= "Eth0"

# PCI Device 0x8086:0x100f (e1000)-----The new address generated after copying, name= "eth1" is modified to Name= "eth0" and attr{address}== "00:0c:29:b6:87:5 6 "Value copied on Ifcfg-eth0

subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c:29:b6:87:56", attr{type}== "1", kernel== "eth*" , name= "Eth1"

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth1 #修改为新的eth1.

hwaddr=00:0c:29:b6:87:56 #用新的MAC替换 00:0c:29:b6:87:56

Type=ethernet

Uuid=fa6bcd84-01ab-4b2d-9dd6-8d4a3a1961ac

Onboot=yes

Nm_controlled=yes

Bootproto=static

ipaddr=192.168.1.56 #修改IP (can not be modified if the original virtual machine is not running at the same time)

netmask=255.255.255.0

gateway=192.168.1.1

To restart the network card:


This article is from the "Silent Dialogue" blog, please be sure to keep this source http://chbinmile.blog.51cto.com/6085145/1879388

Linux virtual machine replication Nic does not start or use

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.