Eth0 Nic becomes eth1 nic after virtual machine cloning and IP address disappear problem resolved

Source: Internet
Author: User

1, the problem situation

After cloning a virtual machine in VMware, the new virtual machine network can not be used, and the original operating system Nic Eth0 in the cloned new system, the network card number becomes eth1, and the IP address is lost, the network is not normal use.

2. Environmental conditions

Original machine Name

Target host after cloning

Machine name

Alias

Machine name

Alias

Ol6-single

A machine

Ol6_weblogic_1

B Machine

3. Cloning process

Turn a machine off, on the VMware console, right-click on the virtual machine a machine (ol6-single), click "Clone"-"Next", follow the prompts to complete the cloning process, the machine name after the drop is named: ol6_weblogic_1

4. Comparison of network configuration difference between original system and clone system 4.1, Ifconfig network interface output comparison

(1) The configuration of the original machine (ol6-single) network interface:

[email protected] ~]# ifconfig-a

Eth0 Link encap:ethernet HWaddr 00:0c:29:5e:35:00

inet addr:192.168.1.150 bcast:192.168.1.255 mask:255.255.255.0

Inet6 ADDR:FE80::20C:29FF:FE5E:3500/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:114 errors:0 dropped:0 overruns:0 frame:0

TX packets:81 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:12918 (12.6 KiB) TX bytes:15700 (15.3 KiB)

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Inet6 addr::: 1/128 scope:host

Up LOOPBACK RUNNING mtu:16436 metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0  (0.0 b) TX bytes:0 (0.0 b)

(2) configuration of the host (ol6_weblogic_1) network interface after cloning

[Email protected]_weblogic_1 ~]# ifconfig-a

eth1 Link encap:ethernet HWaddr 00:0c:29:3a:f2:8e

inet addr:192.168.91.133 bcast:192.168.91.255 mask:255.255.255.0

Inet6 ADDR:FE80::20C:29FF:FE3A:F28E/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:114 errors:0 dropped:0 overruns:0 frame:0

TX packets:22 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:1784 (1.7 KiB) TX bytes:4139 (4.0 KiB)

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Inet6 addr::: 1/128 scope:host

Up LOOPBACK RUNNING mtu:16436 metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

After cloning, the original eth0 became the Eth1,ip address was also lost, and the value of HWADDR changed.

4.2. Comparison of network interface configuration files

A machine (original machine)

B Machine (after cloning machine)

Cd/etc/sysconfig/network-scripts

Cd/etc/sysconfig/network-scripts

[[email protected] network-scripts]# ls ifcfg-eth*

Ifcfg-eth0

[Email protected]_1 network-scripts]# ls ifcfg-eth*

Ifcfg-eth0

From the above comparison results, although the cloned B machine from Ifconfig–a see the original eth0 disappeared, became eth1, but, in/etc/sysconfig/network-scripts See, B Machine network card profile name is still called eth0

4.3, network device binding file 70-persistent-net.rules content comparison

A machine

(original machine)

# This file is automatically generated by the/li B/udev/write_net_rules

# program, run by the Persistent-net-generator.rules rules file.

#

# can modify it, as long as you keep each rule to a single

# line, and change is only the value of the Name= key.

 

# PCI Device 0x8086:0x100f (e1000)

subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c:29:5e:35:00", attr{type}== "1", kernel== " eth* ", name=" eth0 "

B Machine

(after cloning machine)

# This file is automatically generated by the/lib/udev/write_net_rules

# program, run by the Persistent-net-generator.rules rules file.

#

# can modify it, as long as you keep each rule to a single

# line, and change is only the value of the Name= key.

# PCI Device 0x8086:0x100f (e1000)

subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c:29:5e:35:00", attr{type}== "1", kernel== "eth*" , name= "Eth0"

subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c:29:3a:f2:8e", attr{type}== "1", kernel== "eth*" , name= "Eth1"

From the above comparison, the cloned machine,/etc/udev/rules.d/70-persistent-net.rules more out of a line of configuration, see the above labeled red content, its name= "eth1", Mac has changed, the original name= "Eth0" A line of content is still in, and the MAC address is the same.

5, Solution 5.1, modified after cloning machine (b machine) 70-persistent-net.rules file contents

Two-step modification of the post-clone machine (b-Machine)/etc/udev/rules.d/70-persistent-net.rules file:

(1) Comment on the contents of the original name= "eth0" line

(2) Modify "Eth1" in the Name= "eth1" line to "eth0"

The following modifications are completed:

# This file is automatically generated by the/lib/udev/write_net_rules

# program, run by the Persistent-net-generator.rules rules file.

#

# can modify it, as long as you keep each rule to a single

# line, and change is only the value of the Name= key.

# PCI Device 0x8086:0x100f (e1000)

# subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c:29:5e:35:00", attr{type}== "1", kernel== "eth*" , name= "Eth0"

subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c:29:3a:f2:8e", attr{type}== "1", kernel== "eth*" , name= "eth0"

5.2. Modify the MAC address and IP address of the machine (b machine) after cloning

[Email protected]_weblogic_1 network-scripts]# Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Device= "Eth0"

Hwaddr= "00:0c:29:3a:f2:8e"

Nm_controlled= "Yes"

onboot= "Yes"

ipaddr=192.168.1.230

network=192.168.1.0

netmast=255.255.255.0

Type= "Ethernet"

Uuid= "b1b9ac33-19ad-4bb3-ac6c-06d5a3fa7c5b"

Special attention:

The modified MAC address can only be the same address as the attr{address} in the 70-persistent-net.rules file

5.3. Restart the operating system to take effect

The IP address can change over the network Service (service network restart) mode, but the network interface name modification does not take effect.

6. Verification

[Email protected]_weblogic_1 ~]# ifconfig–a

Eth0 Link encap:ethernet HWaddr 00:0c:29:3a:f2:8e

inet addr:192.168.1.230 bcast:192.168.1.255 mask:255.255.255.0

Inet6 ADDR:FE80::20C:29FF:FE3A:F28E/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:380 errors:0 dropped:0 overruns:0 frame:0

TX packets:402 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:35506 (34.6 KiB) TX bytes:54463 (53.1 KiB)

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Inet6 addr::: 1/128 scope:host

Up LOOPBACK RUNNING mtu:16436 metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0  (0.0 b) TX bytes:0 (0.0 b)

Result: Eth1 changed back to Eth0, and the IP address is the IP address set, the network can be used normally



This article Li Junjie (Network Name: casing), engaged in "system architecture, operating systems, storage devices, databases, middleware, applications" six levels of systematic performance optimization work

Welcome to the System performance Optimization Professional group, to discuss performance optimization technology together. Group number: 258187244


Eth0 Nic becomes eth1 nic after virtual machine cloning and IP address disappear problem resolved

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.