Resolve Ubuntu or Fedora virtual machine Restart network times error problem

Source: Internet
Author: User
Tags modify

How to troubleshoot "No such device eth0" or "Job failed" errors that occur when an Ubuntu or Fedora computer restarts the network.

First of all: Here are the questions that appear below Ubuntu and fedora, and if other virtual machines have such problems, see these solutions as well.

1. False symptoms

(1) Under Ubuntu

The following error occurred using the command service networking restart reboot network or ifconfig eth0 up reboot Nic:

Eth0:error while getting interface flags:no such device

(2) under Fedora

The following error occurred while restarting the network with the command systemctl restart Network.service:

Job failed. The system journal and ' systemctl status ' for details.

2. Explore the causes

After a local virtual machine is created for Linux with VMware, there may be two reasons why the NIC startup is not valid, displaying the error above:

(1) Create a new clone mirror and copy the virtual machine to another machine for use

(2) Your local machine later reload the host system (this is the case for me)

What's the reason?

In fact, the reason is: the new clone or reload the host system after the virtual machine image of the network card MAC address has changed.

Open the. vmx file for the virtual machine, and the Ethernet0.generatedaddress entry records the MAC address of the virtual machine.

(1) Under Ubuntu

With IFCONFIG-A View all adapter information, found that the original eth0 has been Gone (some), Ubuntu has renamed the new network card Eth7 (also may be named other), no wonder that "No such device eth0" error, eth0 is indeed no longer there. How to solve? First we need to know where the configuration files are related to the MAC address.

A. Ubuntu's configuration file to save the MAC address and device name of the NIC

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

B. Network configuration file for Nic everyone knows that in

/etc/network/interfaces

The configuration file has only the original eth0 configuration information.

The three solutions are given in the reference document:

Solution 1-Move/delete rules file

sudo mv/etc/udev/rules.d/70-persistent-net.rules/etc/udev/rules.d/70-persistent-net.rules.bak

After reboot, Ubuntu creates a new rules file, identifies the new Nic as Eth0, and follows the original eth0 network configuration. If your network configuration is automatically getting IP, you do not need to make additional modifications.

Solution 2-Modify the Rules file

sudo vi/etc/udev/rules.d/70-persistent-net.rules

The original contents are as follows:

# PCI Device 0x1022:0x2000 (Pcnet32)

subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c:29:36:xx:xx", attr{type}== "1", name= "Eth7"

Modify ETH7 configuration, change it to eth0, if there is already eth0, delete eth7 configuration, replace Eth7 MAC address with Eth0 MAC address.

# PCI Device 0x1022:0x2000 (Pcnet32)

subsystem== "NET", action== "Add", drivers== "? *",

attr{address}== "00:0c:29:36:xx:xx", attr{type}== "1", name= "eth0"

After reboot, Ubuntu will also identify the new network card as eth0, following the original eth0 network configuration. If your network configuration is automatically getting IP, you do not need to make additional modifications.

Solution 3-Modify the interfaces file

sudo vi/etc/network/interfaces

Replace all eth0 with Eth7. If it is a static address, modify the setting at the same time.

(2) under Fedora

Based on the error message, we can see what the specific error hint is?

Cat/var/log/messages | grep Network

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.