Table of Contents
Step 2: Obtain the MAC address of each network card" >Step 2: Obtain the MAC address of each network card
Step 3: Bind the MAC and network card name. " >Step 3: Bind the MAC and network card name.
Home Computer Tutorials Computer Knowledge Binding method of linux network card identification sequence

Binding method of linux network card identification sequence

Mar 08, 2024 pm 07:07 PM
network card Driver Installation NIC driver name eth

When using a Linux system, network card drift may occur after installing specific network card drivers or related programs.

Binding method of linux network card identification sequence

Possible representations are:

After installing a certain network card driver, the order of the network cards may be reversed. For example, the network port connected by the network cable was eth0 before, but it may be changed to eth1 or other names after the driver is installed.

(2) The name of the network card changes. This situation is not a change from eth0 to eth1, but a very strange change. For example, eth0 cannot be found, and there is an additional network card named __tmp3183921382193__

This situation is indeed annoying. Because some people may need to use the ifconfig | grep eth command to obtain information for development work. If the network card name is confusing, there will definitely be errors in the program.

(3) The order of the optical port network card and the electrical port network card is out of order, or they overlap.

In short, our goal is to be able to specify the name of a certain network card as the physical device we want. Here’s how to do it:

The first step is to identify the network card information

To use a network card, you first need to know which name corresponds to which physical device. The method is as follows: pull a network cable from the switch and connect it to the network card one by one from top to bottom. Note that you can only connect one network card at a time. Then use the ethtool command to check whether the network cable is connected, such as

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

[root@bunian ~]# ethtool eth0

Settings for eth0:

Supported ports: [ MII ]

Supported link modes: 10baseT/Half 10baseT/Full

 100baseT/Half 100baseT/Full

 1000baseT/Full

Supports auto-negotiation: Yes

Advertised link modes:10baseT/Half 10baseT/Full

 100baseT/Half 100baseT/Full

 1000baseT/Full

Advertised auto-negotiation: Yes

Speed: 100Mb/s

Duplex: Full

Port: MII

PHYAD: 2

Transceiver: external

Auto-negotiation: on

Supports Wake-on: g

Wake-on: d

Link detected: yes

Copy after login

I saw that the status of eth0 is connected to the network cable. If Linked detected:no, it means that the network cable is not connected.

In this way, distinguish the name of which device and mark it well.

Step 2: Obtain the MAC address of each network card

ifconfig -a can see all network devices. Get the MAC address of each device via ifconfig -a | grep HWaddr.

for example:

1

2

3

4

5

[root@bunian ~]# ifconfig-a | grep HWaddr

eth0Link encap:EthernetHWaddr 00:30:48:7F:B5:CA

eth1Link encap:EthernetHWaddr 00:30:48:7F:B5:CB

eth2Link encap:EthernetHWaddr 00:04:23:A6:81:E0

eth3Link encap:EthernetHWaddr 00:04:23:A6:81:E1

Copy after login

Got the MAC address of each network card.

Step 3: Bind the MAC and network card name.

We all know that for RedHat systems, the configuration file of the network card is:

Stored in

/etc/sysconfig/network-scripts/ifcfg-ethX, X=0, 1, 2. . .

for example:

1

2

3

4

5

6

7

8

9

10

11

[root@bunian]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

# nVidia Corporation MCP55 Ethernet

DEVICE=eth0

ONBOOT=yes

HWADDR=00:30:48:7f:b5:ca

TYPE=Ethernet

NETMASK=255.255.255.0

IPADDR=192.168.42.231

GATEWAY=192.168.42.1

BOOTPROTO=static

#NAMESERVER=202.106.0.20

Copy after login

This file is the configuration file for initializing the network card. For example, if we want to specify the device name of the network card MAC address MAC1 as ethn, then modify the file

/etc/sysconfig/network-scripts/ifcfg-ethn

Add the configuration information of MAC address binding and name inside

DEVICE=ethn

HWADDR=MAC1 (for example 00:30:48:7f:b5:ca)

Other configuration information is not affected. After binding all network cards, reboot the system and it should be fine.

Another thing to note is the file that drives the corresponding relationship:

/etc/modprobe.conf

To modify in this file, make sure that a certain device uses the driver corresponding to it, such as:

1

2

3

4

5

6

7

8

cat /etc/modprobe.conf

alias eth0 forcedeth

alias eth1 forcedeth

alias scsi_hostadapter aic79xx

alias scsi_hostadapter1 sata_nv

alias scsi_hostadapter2 usb-storage

alias eth2 e1000

alias eth3 e1000

Copy after login

Explain that eth0 and eth1 use the forcedeth driver, and eth2 and eth3 use the e1000 driver.

Special case

After the server replaces the network card, the MAC address will change. At this time, after starting the Linux system, the original eth0 and eth1 are no longer the configuration files of the current network card, and a prompt will be displayed that device eth0 does not seem to be present.

Solution:

Just delete /etc/udev/rules.d/70-persistent-net.rules and then restart the machine, because this file saves the identification information of the network card at the bottom of the system, including the correspondence between ethX and MAC. Delete and Restart and let the operating system re-recognize the existing network card and then it will return to normal.

In addition, if the original eth0 and eth1 configuration files have HWADDR fields, they also need to be deleted.

The above is the detailed content of Binding method of linux network card identification sequence. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Huawei mobile phone USB sharing network to computer Huawei mobile phone USB sharing network to computer May 08, 2024 am 08:25 AM

How to connect a Huawei phone to a computer via USB to access the Internet. First, we open the phone settings and search for "HDB". Then we click to open "Mobile Network Sharing" in More. Then we can click to open "USB Sharing Network" in the pop-up window. Summary First, connect the Huawei mobile phone to the computer through the data cable. Open "Settings" on your phone and enter the settings interface. Click "Personal Hotspot", select "USB tethering" and click the switch button at the back to turn it on. First click "Settings About Phone", then click "Version Number" 7 times in succession. You will be prompted to enter developer mode. Then return to the "Settings" list, "Developer Options" will appear, then click to enter "Developer Options", turn on the "USB Debugging" switch, and click

The laptop is extremely slow when connected to wifi (the laptop is extremely slow when connected to wifi) The laptop is extremely slow when connected to wifi (the laptop is extremely slow when connected to wifi) Apr 27, 2024 pm 01:07 PM

Laptop WiFi slowness is usually caused by poor network signal quality or computer wireless network card driver issues. Network signal quality: The quality of the network connected to your laptop and mobile phone is not necessarily the same. The first reason is that your broadband line is old or the router is damaged. The second reason is that if your computer shares a network cable with other computers, your computer may be attacked by the ARP virus. The third reason is that there is a program secretly running in the background. A large amount of bandwidth, such as virus Trojans, p2p software (Thunder QQ Tornado, etc.). The signal of the wireless router is poor, causing the computer to be unable to search for wireless networks. The wireless router is faulty or the wireless router settings are not normal. Solution: It is recommended to change the wireless router, but you can also try to restore the router.

What are the reasons for blue screen in computer assembly? What are the reasons for blue screen in computer assembly? May 05, 2024 pm 12:49 PM

What are the reasons for blue screen in computer assembly? There are hardware and software reasons. 1. Hardware reasons 1. Memory failure: If there is a problem with the memory, such as damage or failure, the computer will have a blue screen problem. You can use a memory test program (such as Memtest86) to test whether the memory is stable. 2. Hard disk problem: When there is a problem with the hard disk, such as a damaged sector or a problem with the magnetic head, it will also cause a blue screen problem. If you see hard disk error messages (such as harddiskfailure) on the blue screen interface, you need to replace the hard disk. 3.CPU overheating: When the CPU overheats, the computer will automatically shut down to protect the hardware from damage. If your computer frequently displays blue screens due to overheating, then

Does the newly assembled computer keyboard light not light up? Does the newly assembled computer keyboard light not light up? May 07, 2024 pm 04:40 PM

Does the newly assembled computer keyboard light not light up? The motherboard model should be UEFIbios. First find a keyboard with PS2 port, enter bios, turn off UEFI boot, and change to Legacy mode. If there is fast boot, turn off options like FastBoot, UEFI boot, turn on fast boot, and enter the system. USB interface detection may be turned off before, and USB devices can be used to assemble the computer after entering the system. The mouse and keyboard lights do not light up when the computer is turned on? If the keyboard light does not come on, there is a high possibility of memory failure, or it may be caused by static electricity on the motherboard or the motherboard is faulty. Use an eraser to wipe the gold finger of the memory graphics card, and remove and insert the memory several times. The problem remains. There are dual memory sticks and a single memory stick is used for testing. The problem persists. Re-plug the various cables inside and outside the chassis, and then unplug the connector on the motherboard.

How to set up wireless network printing on the printer (convenient) How to set up wireless network printing on the printer (convenient) May 02, 2024 pm 06:04 PM

Wireless printing has become an indispensable part of the modern office environment, with the continuous development of technology. It can also connect to various devices quickly and easily. Setting up wireless network printing on the printer can not only improve work efficiency. This article will introduce in detail how to achieve a wireless printing experience and convenience through simple settings. 1. Confirm the printer model and network support (printer model) and support the wireless network type used. Before setting up wireless network printing, make sure the printer has wireless printing function. First, you need to confirm the printer model and network support. 2. Connect the printer and computer (connection method) to ensure that the two can communicate normally, physically connect the printer to the computer, use a USB cable or connect through a LAN. 3. Open the printer setting interface (Settings

Universal graphics card driver win7 Universal graphics card driver win7 Apr 29, 2024 am 08:04 AM

How to solve the problem that the graphics card driver crashes in Win7 system after installing it? 1. When choosing the driver, it is recommended to install a driver that has passed Microsoft signature certification, which will be more compatible with the Win7 system. Some non-public versions of drivers will automatically overclock the graphics card. If the graphics card itself is not in good health and cannot run in an overclocking environment, it will continue to restart or the graphics card will overheat and restart. 2. Click on the Win10 official version desktop to find the "This PC" icon, right-click and select the "Properties" item from the pop-up right-click menu. The "Control" window will open. Find the "Advanced System Settings" button on the left and click to enter the detailed settings interface. 3. The graphics card or wireless network card hardware is faulty. Solution: Try to bring up the task manager in the current interface and end the driver installation (one

How does the driver CEO set the default settings for the PE driver installation in the PE environment? Driver CEO sets the default settings for the PE driver installation in the PE environment. Tutorial How does the driver CEO set the default settings for the PE driver installation in the PE environment? Driver CEO sets the default settings for the PE driver installation in the PE environment. Tutorial May 06, 2024 pm 04:19 PM

1. First install the driver, and then click the shortcut key on the desktop to start it after the installation is complete. 2. Then enter the homepage and click the [three] icon in the upper right corner of the interface. 3. A small window will pop up, then click [Settings] in the small window. 4. Then a page pops up, check [Install driver for PE by default in PE environment]. 5. After the final settings are completed, click [OK] below.

Ethereum (ETH) and Shiba Inu (SHIB) Prepare the Ground for a Fresh Surge of Optimistic Activity before the Year is Out Ethereum (ETH) and Shiba Inu (SHIB) Prepare the Ground for a Fresh Surge of Optimistic Activity before the Year is Out Nov 11, 2024 pm 01:30 PM

As Ethereum (ETH) and Shiba Inu (SHIB) continue to pique investor interest, both altcoins are showing hopeful signs of a future breakthrough.

See all articles