Linux network card changed from eth0 to eth1, how to repair (reprint)

Source: Internet
Author: User

Linux network card changed from eth0 to eth1, how to repair   use WMware installed Linux, after the successful installation, the use of the network card is eth0, no eth1. But after a period of time, do not know why eth0 can not be used, the system has automatically generated a ETH1 network card, which can be used to see the ifconfig command.  [[email protected] ~]$ ifconfigeth1      link encap:ethernet  hwaddr 00:0c:29:a9:22:9d & nbsp;          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 Dropp ed:0 overruns:0 frame:0          TX packets:182 errors:0 dropped:0 overruns:0 carrier:0  &nb Sp       collisions:0 txqueuelen:1000           RX bytes:67356 (65.7 KiB)   TX bytes:26612 (25.9 KiB)           interrupt:19 Base address:0x2000  lo     & nbsp  link EnCap: Local Loopback            inet addr:127.0.0.1  Mask:255.0.0.0      &NBS P   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)   using service network Restar T instruction to restart the network service, you will see a hint that the eth0 NIC does not exist.   After Baidu, learned some information, hereby recorded here, in case of forgetting.   Why Eth0 will become eth1?  many Linux distribution use Udev to dynamically manage device files and name them based on the device's information. Udev identifies the network card during system boot and records the MAC address and network card name in Udev's rules script. For a new virtual machine, VMware will automatically generate a MAC address for the virtual machine's network card, when you clone or reload the virtual machine software, because you are using the previous system virtual hard disk information, and the system has eth0 information, for this new network card, Udev will automatically name it eth1 (the cumulative principle), so after your system starts, you use Ifconfig to see the NIC named Eth1.   How to recover to eth0?  in Fedora, the script for Udev Records network rules is:/ETc/udev/rules.d/70-persistent-net.rules [[email protected] ~]$ vi/etc/udev/rules.d/70- persistent-net.rules # This file is automatically generated by the/lib/udev/write_net_rules# program run by the per Sistent-net-generator.rules rules file.## You can modify it, as long as you keep each rule on a single line.# PCI device 0 x1022: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, you will find that there is eth0,eth1 two network card information, But in fact you can only find eth1 a network card information when ifconfig, because Eth0 does not exist at all.   will be eth0 the information in the deletion, and the eth1 information in the device name to Eth0, restart the system, you see the network card is eth0, or delete all of the information restart System Udev will help you find new equipment.   There is also a startup script file/etc/sysconfig/network-scripts/ifcfg-eth0, the MAC address in the file is the physical address of the original eth0 NIC, and the virtual machine assigns a new physical address to eth1. Therefore, the information in the startup script does not match the actual information, the MAC address information modified to 70-persistent-net.rules in the Eth1 MAC address, restart the network again, fully restored to the status of the previous eth0 NIC.

Linux network card changed from eth0 to eth1, how to repair (reprint)

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.