Netplan: Rename a network interface

Published at 27 Jun 2025

To rename a network interface, first we should know the MAC address of the interface we want to rename.

ip a
1: lo:
    link/loopback

2: enxd83add39ce36:
    link/ether d8:3a:dd:39:ce:36

...

In my case, the MAC address is d8:3a:dd:39:ce:36.

Next, we should edit the netplan configuration.

vi /etc/netplan/50-cloud-init.yaml
network:
  version: 2
  ethernets:
    eth0:
      optional: true
      dhcp4: true
      match:
        macaddress: d8:3a:dd:39:ce:36
      set-name: eth0

Once we're ready, we apply the netplan changes.

netplan apply

Finally, if we check the network interfaces again, it should display the new name.

ip a
1: lo:
    link/loopback

2: eth0:
    link/ether d8:3a:dd:39:ce:36

...