What does Ifcfg's device refer to in CentOS?

Source: Internet
Author: User
Tags node server
#cat ifcfg-eth0
device=eth0
...

Reason: There is a multi-node server migration room, afraid of broken, the first hard drive down, the results put back when the wrong order, causing the boot
Nic is not right, the original eth01 into eth23, know how to engage.

Analysis:

Solution for eth0 device not found under CentOS

After Baidu, understand some information, hereby record here, in case to forget. Why would eth0 turn into eth1? A lot of Linux
Distribution uses Udev to dynamically manage device files and to name them according to the device's information. Udev will identify the NIC during system boot and match the MAC address to the name of the network card in the Udev rule script. And for the 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 already has eth0 information, for this new network card, Udev will automatically name it eth1 (additive principle), so after your system starts, you use Ifconfig to see the network card named Eth1.

The eth0 here is defined in/etc/udev/rules.d/70-persistent-net.rules.

# This file is automatically generated by The/lib/udev/write_net_rules
# and run by the Persistent-net-generato R.rules rules file.
# You
can modify it, as long as your keep each rule in a single
# line, and change only the value of the Name= ke Y.

# PCI Device 0x8086:0x100f (e1000)
subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "Xx:xx:xx:xx:xx" : xx ", attr{type}==" 1 ", kernel==" eth* ", name=" eth0 "

Solve:
Why would eth0 turn into eth1?

How do I get back to eth0?
Udev the script for recording network rules is:/etc/udev/rules.d/70-persistent-net.rules
[User@localhost ~]$ 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 Persistent-net-generator . Rules rules file.
# You
can modify it, as long as your 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"  

Solution for eth0 device not found under CentOS
Open the file, you will find that there are eth0,eth1 two network card information, but in fact, you ifconfig can only find eth1 a network card information, then because Eth0 does not exist.
Delete the information in the eth0, and change the device name in the eth1 information to eth0, reboot 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 network card, and the virtual machine assigns a new physical address to the eth1. Therefore, when the information in the startup script does not match with the actual information, the MAC address information is modified to the MAC address of the eth1 in 70-persistent-net.rules, and then the network is restored to the former eth0 Nic completely.

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.