Change NIC name in AlmaLinux/RockyLinux/RHEL 9

In this article, we'll explore how to change the network interface name in RHEL 9 systems. The Linux kernel imposes a 15-character limit on interface names.

Renaming a network interface might be necessary if the default name is too long, such as enp129s0f1np0.

This can cause issues with cPanel, particularly when adding additional IP addresses, as cPanel appends four extra characters to the interface name (:cp1).

This results in a name like enp129s0f1np0:cp1, which exceeds the kernel's 15-character limit.

 

Example output of the command ip link show that shows the interface name enp129s0f0np0:

3: enp129s0f0np0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

 

We'll rename the interface enp129s0f0np0 to enp0

 


 

 

 

Prerequisites

  • The corresponding NetworkManager connection profile must be using the keyfile format.
  • You need to get the MAC address of the interface by using the command ip a.
    You'll find the MAC address in this line (copy the MAC address e0:c0:00:a0:0f:10):
    link/ether e0:c0:00:a0:0f:10 brd ff:ff:ff:ff:ff:ff​

 

Procedures 

  1. Go to the directory /etc/systemd/network/
  2. create the file 70-default0.link
  3. open the file with nano or your preferred editor
    nano /etc/systemd/network/70-default0.link​
  4. Add the following to the file
    [Match]
    MACAddress=e0:c0:00:a0:0f:10
    
    [Link]
    Name=enp0​
    Note: add your interface MAC Address after MACAddress=
    Note: add the new interface name after Name=


  5. Save and exit

  6. Rename the original interface config file from 
    /etc/NetworkManager/system-connections/enp129s0f0np0.nmconnection​
    to 
    /etc/NetworkManager/system-connections/enp0.nmconnection

     


    Use the following commands to copy the original file for backup and rename it:

    cp /etc/NetworkManager/system-connections/enp129s0f0np0.nmconnection​ /etc/NetworkManager/system-connections/enp129s0f0np0.nmconnection​.backup
    
    mv /etc/NetworkManager/system-connections/enp129s0f0np0.nmconnection​ /etc/NetworkManager/system-connections/enp0.nmconnection​

    Note: don't forget to replace the interface name enp129s0f1np0 in the file path with the actual name on your system.



  7. Open the renamed config file with nano or your preferred editor enp0.nmconnection

    nano /etc/NetworkManager/system-connections/enp0.nmconnection​

    and replace the old interface name with the new name in the following lines:
    id=enp129s0f0np0
    ...
    interface-name=enp129s0f0np0​

    Replace the above two lines with the following:

    id=enp0
    ...
    interface-name=enp0​


  8. Save and exit
  9. Reboot your server

 

After reboot, your network interface name will change.

Check the new name by using the command ip link show

Output:

3: enp0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

 

You can find more information on RHEL documentation.

 

  • RHEL, AlmaLinux, Network Interface, NIC
  • 687 Users Found This Useful
Was this answer helpful?

Related Articles

How to reinstall an OS on my server?

If you already have an OS installed on your server and want to change or reinstall it, you can do...

How to set rDNS records for my dedicated server IPs?

You can update rDNS records of your server IPs from Client Area (One Portal) Log in to your...

How to change SSH Port on CentOS 6

Open SSH connection to the server, then:1. Type: nano /etc/ssh/sshd_config 2. Press CTRL+W to...

Do you provide KVM/IPMI access?

Yes, we provide KVM access to all servers in all locations.KVM access is free of charge in all...

Can I install a custom OS?

Yes, you can install a custom OS (OS that is not listed on the server order page) by attaching...