How to Rename enX0 to eth0 on Ubuntu/Debian?

Apr 26, 2024


The interface name in the latest Ubuntu/Debian versions is determined by the hypervisor.

Photo by Lukas on Unsplash

For example, an Ubuntu instance running on Xen will have an interface similar to enX0. The interface name on other hypervisors may be something like ens5.

You can rename the interface name like this:

sed -i 's/enX0/eth0/g' /etc/netplan/50-cloud-init.yaml

After that, run this command:

netplan apply

or reboot the server.