How to rename a network interface in Ubuntu 18.04

In this post I will show you how to rename a Network Interface in Ubuntu 18.04. 

Note your MAC Address.

ip addr

Create 70-persistent-net.rules.

nano /etc/udev/rules.d/70-persistent-net.rules

Add the following rule to 70-persistent-net.rules and replace the red text with your MAC Address and Interface name.

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:yy:xx:yy:xx:yy", NAME="INTERFACENAME"

Rename your network interface name in /etc/netplan/filename.yaml

  ethernets:
    INTERFACENAME:

Open the GRUB configuration file.

nano /etc/default/grub

From:

GRUB_CMDLINE_LINUX=""

To:

GRUB_CMDLINE_LINUX="net.ifnames=1 biosdevname=0"

Update the bootloader

update-grub

(Optional) update-initram:

update-initramfs -u

Reboot and done!

3 thoughts on “How to rename a network interface in Ubuntu 18.04

  1. Leroy Tennison

    Thank you, this worked. However, as a consequence, netplan appears to have to be re-written since the original NIC names disappear.

    Reply
    1. Tom van Brienen Post author

      Hello Leroy,

      Thanks for your reply.

      ‘Rename your network interface name in /etc/netplan/filename.yaml’ is indeed important.

      Tom

      Reply

Leave a Reply

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