To change the network interface name in CentOS 7.x

一.modify GRUB

1.Edit the GRUB configuration file by running the command: `vi /etc/default/grub`.

 

 

2.And add "net.ifnames=0 biosdevname=0"

 

 

3.After making the modifications, save and exit by typing ":wq!" or use "ZZ" to exit.

4.Run the command "grub2-mkconfig -o /boot/grub2/grub.cfg" to regenerate the GRUB configuration and update the kernel parameters.

 

 

二.Rename the current network interface configuration file.

 

1.First, use the command "ip a" to check the current network interface names. Make sure not to modify any names that are already in use. 

 


2.cd /etc/sysconfig/network-scripts/  #Enter the network interface configuration file directory.

 


mv ifcfg-eno1 ifcfg-eth0                  #Rename the interface in "eth" format.

sed -i 's/eno1/eth0/g' ifcfg-eth0      #Modify "eno1" to "eth0" inside the file, and adjust the command according to the specific name.

 


三.Reboot the system to apply the above changes.
reboot 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to switch to a different repository for CentOS 8 EOL

 CentOS 8 reached its end of life at the end of 2021. When using yum repositories for...

To modify the hostname on CentOS

Method One:   1.Open a terminal or SSH into the Linux system. 2.Log in to the system with...

An incorrect configuration in the /etc/fstab file on the Linux system is causing login issues

Encountering communication issues with the machine, I checked the system error messages through...

How to use the atop monitoring tool in Linux

Atop is a monitoring tool used to monitor resources and processes in Linux systems. It...

How to enable/disable ping on Linux system

To prevent others from discovering and potentially attacking your machine through network ping...