Linux Nic changed from eth0 to eth1. how can this problem be solved?

Source: Internet
Author: User
The Linux Nic is changed from eth0 to eth1. how can I fix the problem of installing linux using wmware? after the installation is successful, the NIC is eth0 without eth1. However, after a period of time, you do not know why eth0 cannot be used, but the system automatically generates the eth1 Nic. you can use the ifconfig command to view it... the Linux Nic is changed from eth0 to eth1. how can I fix the problem of installing linux using wmware? after the installation is successful, the NIC is eth0 without eth1. However, after a period of time, you do not know why eth0 cannot be used, but the system automatically generates the eth1 NIC, which can be seen through the ifconfig command. [User @ localhost ~] $ Ifconfigeth1 Link encap: Ethernet HWaddr 00: 0C: 29: A9: 22: 9D inet addr: 192.168.1.108 Bcast: 192.168.1.255 Mask: 255.255.255.0 inet6 addr: fe80: 20c: 29ff: fea9: 229d/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 313 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 182 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 RX bytes: 67356 (65.7 KiB) TX bytes: 26612 (25.9 KiB) Interrupt: 19 Base address: 0x2000 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: 1788 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 1788 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 89560 (87.4 KiB) TX bytes: 89560 (87.4 KiB) use the service network restart command to restart the network The error message indicating that eth0 Nic does not exist is displayed. I have learned some information through Baidu. I would like to record it here for my memo. Why does eth0 change to eth1? Many Linux distribution uses udev to dynamically manage device files and name them based on device information. Udev identifies the Nic during system boot, and records the mac address and Nic name in the udev rule script. For new virtual machines, VMware will automatically generate a MAC address for the virtual machine's Nic. when you clone or reinstall the virtual machine software, because you used the previous system virtual hard disk information, the system already has eth0 information. for this new Nic, udev will automatically name it eth1 (accumulation principle), so after your system starts, the network card name you see in ifconfig is eth1. How to restore to eth0? In fedora, the udev network rule recording script is:/etc/udev/rules. d/70-persistent-net.rules [user @ localhost ~] $ Vi/etc/udev/rules. d/70-persistent-net.rules # 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. # PCI device 0x1022: 0x2000 (pcnet32) SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 00: 0c: 29: 5a: 6c: 73 ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth0" SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 00: 0c: 29: a9: 22: 9d ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth1" open the file, and you will find that there are information about eth0 and eth1 NICs, but in fact, you can only find the information of one eth1 Nic in ifconfig, because eth0 does not exist at all. Delete the eth0 information, change the device name in eth1 to eth0, and restart the system. The network card you see is eth0, or delete all the information and restart the system udev to help you find the new device. There is also a startup script file/etc/sysconfig/network-scripts/ifcfg-eth0, the mac address in this file is the physical address of the original eth0 Nic, and the virtual machine for eth1 to assign a new physical address, therefore, if the information in the startup script does not match the actual information, change the MAC address to the MAC address of eth1 in 70-persistent-net.rules and restart the network again, it is completely restored to the previous eth0 NIC status.
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.