How to change the network card name to eth0 in Linux

WBOY
Release: 2022-04-07 18:15:32
Original
6561 people have browsed it

Method: 1. Rename the network card configuration file name to eth0; 2. Use the vi command to change the NAME parameter in the network card file to eth0; 3. Disable the network card naming rule; 4. Add udev network card rules; 5. Use the "grub2-mkconfig" command to update the grub configuration parameters; 6. Restart the system.

How to change the network card name to eth0 in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to change the network card name to eth0 in Linux

Method/steps:

1. First rename the network card configuration file name to eth0:

cd /etc/sysconfig/network-scripts/
mv ifcfg-eno1677736 ifcfg-eth0
Copy after login

2. Secondly edit the modified network card file: vi ifcfg-eth0

Change the NAME parameter to the same name as the network card file: NAME=eth0

3. Next disable the network card naming rule.

This function is controlled through the /etc/default/grub file. To disable this function, add "net.ifnames=0 biosdevname=0" to the file.

vim /etc/default/grub;
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root crashkernel=auto  rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us net.ifnames=0 biosdevname=0 rhgb quiet"
Copy after login

4. Add udev network card rules

Create a network card rule 70-persistent-net.rules file in the /etc/udev/rules.d directory.

vim /etc/udev/rules.d/70-persistent-net.rules;
Copy after login

Write the following parameters in the file:

SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="需要修改名称的网卡MAC地址",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"
Copy after login

5. Execute grub2-mkconfig -o /boot/grub2/grub.cfg command to generate updated grub configuration parameters.

6. Reboot restarts the system and the verification is successful

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to change the network card name to eth0 in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!