After the VM is cloned, The eth0 Nic becomes the eth1 Nic and the IP address disappears. Solution

Source: Internet
Author: User

After the VM is cloned, The eth0 Nic becomes the eth1 Nic and the IP address disappears. Solution
1. Problem

After a virtual machine is created in vmware, the network of the new virtual machine cannot be used, and the network card number is changed to eth1 In the cloned new system with the network card eth0 in the original operating system, the IP address is also lost and the network cannot be used normally.

2. Environment

Original machine name

Target host after cloning

Machine name

Alias

Machine name

Alias

Ol6-single

Machine

Ol6_weblogic_1

Machine B

3. Clone Process

Shut down machine A, right-click machine A (ol6-single) on the Vmware console, click "clone"-"Next", follow the prompts to complete the clone process step by step, after the drop-down, the machine name is named ol6_weblogic_1.

4. Comparison between the original system and the cloned system network configurations 4.1. Comparison of ifconfig Network Interface output

(1) The original machine (ol6-single) Network Interface Configuration:

[Root @ ol6-single ~] # Ifconfig-

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 FIG: 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) network interface configuration of the cloned host (ol6_weblogic_1)

 

[Root @ ol6_weblogic_1 ~] # Ifconfig-

Eth1 Link encap: Ethernet HWaddr 00: 0C: 29: 3A: F2: 8E

Inet addr: 192.168.91.20.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 FIG: 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 becomes eth1, the IP address is also lost, and the value of HWaddr is changed.

4.2 comparison of network interface configuration files

Machine A (original machine)

Machine B (cloned machine)

Cd/etc/sysconfig/network-scripts

Cd/etc/sysconfig/network-scripts

[Root @ ol6-single network-scripts] # ls ifcfg-eth *

Ifcfg-eth0

[Root @ ol6-weblogic_1 network-scripts] # ls ifcfg-eth *

Ifcfg-eth0

From the above comparison results, although the cloned B server saw that the original eth0 was gone from ifconfig-a and changed to eth1, in/etc/sysconfig/network-scripts, the NIC configuration file name of machine B is still called eth0.

4.3 network device binding file 70-persistent-net.rules Content Comparison

Machine

(Original machine)

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

# Program, run by the persistent-net-generator.rules rules file.

#

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

# Line, and change 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"

Machine B

(Cloned machine)

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

# Program, run by the persistent-net-generator.rules rules file.

#

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

# Line, and change 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 has an extra configuration line. See the red content above. Its NAME = "eth1", the MAC has changed, and the original NAME = "eth0" line content is still in, and the MAC address is the same.

5. Solution 5.1: Modify the cloned host (B) 70-persistent-net.rules file.

Modify the cloned machine (machine B)/etc/udev/rules. d/70-persistent-net.rules file in two steps:

(1) comment out the original NAME = "eth0" Line Content

(2) Change "eth1" in the NAME = "eth1" line to "eth0"

The modified content is as follows:

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

# Program, run by the persistent-net-generator.rules rules file.

#

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

# Line, and change 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 cloned machine (machine B ).

[Root @ ol6_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"

Note:

The modified MAC address must be the same as ATTR {address} in the 70-persistent-net.rules file.

5.3 restart the operating system to take effect

It has been verified that the IP address of the service network restart can be changed, but the modification of the network interface name does not take effect.

6. Verification

[Root @ ol6_weblogic_1 ~] # Ifconfig-

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 FIG: 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 is changed back to eth0 and the IP address is the configured IP address. The network is ready for use.

 

Author: LI Junjie (Network Name: Step-by-Step), engaged in "system architecture, operating system, storage device, database, middleware, application" six levels of systematic performance optimization work

Join the system performance optimization professional group to discuss performance optimization technologies. GROUP: 258187244


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.