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 addresse0:c0:00:a0:0f:10
):
link/ether e0:c0:00:a0:0f:10 brd ff:ff:ff:ff:ff:ff
Procedures
- Go to the directory
/etc/systemd/network/
- create the file
70-default0.link
- open the file with
nano
or your preferred editor
nano /etc/systemd/network/70-default0.link
- Add the following to the file
Note: add your interface MAC Address after[Match] MACAddress=e0:c0:00:a0:0f:10 [Link] Name=enp0
MACAddress=
Note: add the new interface name afterName=
- Save and exit
- Rename the original interface config file from
to/etc/NetworkManager/system-connections/enp129s0f0np0.nmconnection
/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.
- Open the renamed config file with
nano
or your preferred editorenp0.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
- Save and exit
- 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.