Solve the problem that eth0 disappears after the CentOS system is cloned by VM and eth1 is displayed.

Source: Internet
Author: User

Solve the problem that eth0 disappears after the CentOS system is cloned by VM and eth1 is displayed.

After cloning the CentOS system, run the ifconfig-a command to find that only the eth1 Nic is available, and the eth0 Nic disappears. However, the/etc/sysconfig/network-scripts/directory contains only the eth0 file, but the eth1 configuration file does not exist.

Next we will solve this problem

1. Record the HWADDR and IP address of eth1

Run the ifconfig-a command to view the HWaddr and IP address of eth1.

192.168.0.113

HWADDR = 00: 0C: 29: D1: 28: 06


2. Record the UUID of eth1

Run the nmcli con command to view the UUID of eth1.

Bf40e6d1-8367-4906-b8be-21de49a44c51

NOTE: Refer to my previous article: how to view the UUID of the NIC in Linux

3. modify the configuration file 70-persistent-net.rules.

Vim/etc/udev/rules. d/70-persistent-net.rules // comment out eth0 and change eth1 to eth0

For example:

4. Modify the ifcfg-eth0 configuration file

Vim/etc/sysconfig/network-scripts/ifcfg-eth0 // modify the following content

DEVICE = eth0

HWADDR = 00: 0C: 29: D1: 28: 06

TYPE = Ethernet

UUID = bf40e6d1-8367-4906-b8be-21de49a44c51

ONBOOT = yes

NM_CONTROLLED = yes

BOOTPROTO = static

IPADDR = 192.168.0.113

NETMASK = 255.255.255.0

GATEWAY = 192.168.0.1

DNS1 = 192.168.0.1

DNS2 = 8.8.8.8

5. restart the system

Init 6

Note: If you only restart the network service, the IP address can be changed, but the modification of the network interface name does not take effect. So we need to restart the system to make it take effect. After the restart, run the ifconfig-a command to view the network configuration. You can find that eth1 is changed to eth0 and the IP address is the configured IP address.

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.