Ubuntu 20.04 Change Network interface name

Ok, so this was painful for me to find when I first googled. I tried a few different settings but this is the one that worked for me.

The reason I needed this was so that I could change my network interface name to use Tuya-Convert however i later found out this was not actually required and a wild goose chase, however since I know it works I will also not it for future reference.

To make this work we will be modifying the netplan configuration file stored in the /etc/netplan directory.

in the file you will need to find the yaml file, in my case it was 01-network-manager-all.yaml

you can easily find your folder by running the command:

ls /etc/netplan

Before making any changes it is always recommend to backup the original file in case you stuff something up, change your file name to the file found above.

sudo cp /etc/netplan/01-network-manager-all.yaml 01-network-manager-all.yaml.bak

before we edit the file we want to find the mac address of the device we want to rename, todo this we can type:

ip a

Find the mac address associated with the network adaptor you want to rename and take a note of it.

now we can edit our file, If you open it in nano:

sudo nano /etc/netplan/01-network-manager-all.yaml

then add the information below adjusting interface name, IP address, Gateway and DNS to match your network needs. I removed the IP address line to use DHCP.

version: 2
renderer: NetworkManager
 [ens33-Change line to desired name]:
  macaddress: aa:bb:cc:ff:ff:ff
  dhcp4: no
   addresses: [,]

Save changes in nano (ctrl+x)

Test your config using the below command:

sudo netplan try

If the changes are valid and a success message is returned you can apply the changes:

sudo netplan apply

If for some reason it did not change restart your system.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.