About VMware Eth0 becomes eth1 problem resolution after replicating Linux system virtual machines

Source: Internet
Author: User

In a VMware virtual machine, when we clone or replicate a Linux system virtual machine, and then start the system, we will find that the system is no longer eth0, and become eth1

When we restart the network using /etc/init.d/network Restart , we are prompted to not find the device eth0, as shown in:

When we then use the ifconfig-a command to see all the network cards, we will find that eth0 has become eth1.

So why would the original eth0 become eth1?

Many Linux distribution use Udev to dynamically manage device files and name them based on the device's information. Udev will identify the network card during the system boot process,

The MAC address and the NIC name are recorded in the Udev rules script. For a new virtual machine, VMware automatically generates a MAC address for the virtual machine's NIC when you copy

Cloning or when you reload the virtual machine software, since you are using the previous system virtual hard disk information, and the system already has eth0 information, for this new network card, Udev will automatically

Name it for eth1 (cumulative principle), so after your system starts, the NIC you see with Ifconfig is named Eth1.

How do I change my name back to eth0? we can execute the following command sequentially, or write it to a script file and execute it directly, as follows:

#!/bin/Bash#eth0=/etc/sysconfig/network-scripts/ifcfg-eth0RM-rf/etc/udev/rules.d/ --persistent-Net.rulesEcho 'Device=eth0'>$eth 0Echo 'Onboot=yes'>>$eth 0Echo 'Bootproto=none'>>$eth 0Echo 'Nm_controlled=no'>>$eth 0Echohwaddr=$ (ifconfigeth1 |grepeth1 |awk '{print $}') >>$eth 0Echo 'type= "Ethernet"'>>$eth 0Echo 'ipaddr=192.168.100.2'>> $eth 0//IP is configured according to its own situationEcho 'netmask=255.255.255.0'>> $eth 0//masks are configured according to their own circumstancesEcho 'gateway=192.168.100.1'>> $eth 0//The gateway is configured according to its own situation/etc/init.d/Network Stop/etc/init.d/NetworkManager Stopifconfigeth1 downudevadm triggerudevadm Control--reload-Rulesservice Network Restartservice NetworkManager start

Method Two, the principle and a similar. Here's how:

1, first delete the /etc/udev/rules.d/70-persistent-net.rules file.

2, if the ETH0 network card configuration file has HWADDR option to delete it directly.

3. Restart the Linux system.

The above operating procedures and ideas are as shown in:

Summary: The above two methods, each has its advantages.

Method one does not need to restart, save time, method two clear ideas, simple and clear.

Therefore, the specific choice of the method, according to their actual situation is determined.

About VMware Eth0 becomes eth1 problem resolution after replicating Linux system virtual machines

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.