I'm using a headless Ubuntu 16.04 LTS Server with two physical network cards, which are named enp5s0f0 and enp5s0f1.

I would like to rename these interfaces, and followed this example. I therefore created the file /lib/systemd/network/70-myinterface.link (the original source does not seem to work) like this (I set the correct mac address):



and rebooted the server. Unfortunately the interface did not get renamed, even though udevadm shows that my configuration file is used:

$ udevadm info /sys/class/net/enp5s0f1
P: /devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:02.0/0000:05:00.1/net/enp5s0f1
E: DEVPATH=/devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:02.0/0000:05:00.1/net/enp5s0f1
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=80003ES2LAN Gigabit Ethernet Controller (Copper)
E: ID_MODEL_ID=0x1096
E: ID_NET_LINK_FILE=/lib/systemd/network/70-myinterface.link  <-- my file
E: ID_NET_NAME_MAC=enx123456789abc
E: ID_NET_NAME_PATH=enp5s0f1
E: ID_OUI_FROM_DATABASE=Intel Corporation
E: ID_PATH=pci-0000:05:00.1
E: ID_PATH_TAG=pci-0000_05_00_1
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_VENDOR_ID=0x8086
E: INTERFACE=enp5s0f1
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/enp5s0f1
E: TAGS=:systemd:

Do you have any idea why the renaming did not work?

  • 2
    I would of thought /etc/systemd/network would be the best location to create this file.
    – NGRhodes
    Sep 3, 2016 at 19:43
  • @NGRhodes I was assuming a typo based on the example cited, but who knows?
    – Elder Geek
    Sep 3, 2016 at 19:49
  • Also, check networkmanager is not running, superuser.com/a/948996/127393 suggests networkmanager having priority
    – NGRhodes
    Sep 3, 2016 at 20:18
  • After I had placed the bounty I noticed that there is a new udev rule file in 16.04 that always forces the MAC address type naming for USB adapters before networkd is consulted (/lib/udev/rules.d/73-usb-net-by-mac.rules). This doesn't feel right at all... I had to disable its rule completely, which made the .link file work again. I am not sure if it is the most correct option, though.' Sep 3, 2016 at 20:49
  • Using MACAddress= [Match] doesn't work for me in link files as well, so I ended up using Path= instead. You should try too. Also you may check which link file matches your device with udevadm test-builtin net_setup_link /sys/class/net/enp5s0f1 command Sep 4, 2016 at 15:22

5 Answers 5


This may or may not help .. I would check /etc/udev/rules.d and see if you have 70-persistent-net.rules. You should be able to rename them using that file

Mine looks like this:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="e0:cb:ee:d7:ff:9a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

If you have the entries for your cards in this file you can change the name to what ever you want by changing the "NAME=TheNameYouWant"

  • Right on. I was about to post an answer in which I mentioned that interestingly, there are a few people using Ubuntu who have said that @muffel 's method for changing their network name didn't work. This was what I was going to suggest... +1
    – anonymous2
    Jun 6, 2016 at 11:32
  • Here should the bounty go.
    – EKons
    Sep 2, 2016 at 17:57
  • I created the 70-persistent-net.rules as told and saved back my eth0 and wlan0 successfully. Jun 8, 2020 at 11:07

An option that doesn't require udev rules (an alternative to systemd-networkd .link files) that works with Ubuntu 16.04 as well as many other Linux versions is


ifconfig peth0 down  
ip link set peth0 name eth0  
ifconfig eth0 up 

In the example above peth0 is the original interface name and eth0 is the desired name. Plug in the name you currently have where peth0 is and the name you want where eth0 is. No reboot is required or suggested. Repeat the process for the second interface card

Tested on Ubuntu 16.04 with kernel 4.4.0-36-generic #55-Ubuntu

Edit: If you are looking for a persistent solution that survives reboot see Changing Network Interfaces name Ubuntu 16.04

Sources: https://www.freedesktop.org/software/systemd/man/systemd.link.html



Note: since @antti-haapala method worked before and suddenly stopped you might be interested to know that "As a special case, an empty file (file size 0) or symlink with the same name pointing to /dev/null disables the configuration file entirely (it is "masked")". <-Source

  • I have been very useful your response, thank you + 1 @ElderGeek
    – user641576
    Jan 26, 2017 at 9:48
  • 1
    @Alberto I'm glad it helped!
    – Elder Geek
    Jan 26, 2017 at 15:17
  • sadly enough it is not persistent but still + 1
    – delfiler
    May 18, 2018 at 14:15
  • @delfiler Thank you for your comment. If I'm understanding you correctly you are looking for a solution that survives a reboot. Am I clear on that?
    – Elder Geek
    May 18, 2018 at 16:23
  • @delfiler see askubuntu.com/questions/767786/…
    – Elder Geek
    May 18, 2018 at 16:33
  • All the three custom naming methods, explained systemd: Predictable Network Interface Names, are related to udev rules.

    systemd .link's & udev rules have folder priority. /etc overrides /run overrides /lib.

    So check the current setup.

    # links
    ls -l /*/systemd/network/
    # rule that read links
    ls -l /*/udev/rules.d/80-net-setup-link.rules
    # rule that check for /etc/.../80-net-setup-link.rules & net.ifnames
    ls -l /*/udev/rules.d/73-usb-net-by-mac.rules

    After any change in these udev rules (adding/removing override files) to be effective, The boot RAM disk should be updated:

    sudo update-initramfs -u

    By default, these are the only files you may find

    ~$ ls -l /*/systemd/network/
    total 0
    total 12
    -rw-r--r-- 1 root root 404 Jul 12 17:28 80-container-host0.network ##(virtual-interface)
    -rw-r--r-- 1 root root 482 Jul 12 17:28 80-container-ve.network ##(virtual-interface)
    -rw-r--r-- 1 root root  80 Jul 12 17:28 99-default.link
    ~$ ls -l /*/udev/rules.d/80-net-setup-link.rules
    -rw-r--r-- 1 root root 292 Jul 12 17:28 /lib/udev/rules.d/80-net-setup-link.rules
    ~$ ls -l /*/udev/rules.d/73-usb-net-by-mac.rules
    -rw-r--r-- 1 root root 551 Jul 12 16:37 /lib/udev/rules.d/73-usb-net-by-mac.rules

    I have tested all of them in VBox fresh 16.04 install as documented in below link, all methods works as expected:

    Ubuntu 16.04 Complicated Interface Names

  • /etc/udev/rules.d/70-persistent-net-rules is from older releases replaced by systemd .link's (but they are not auto created), I added it here to check its existence for specific problems but not for AnttiHaapala's case.


You need to update your initrd with something like update-initramfs -k all -c, since udev applies those configs already while running initrd.

Ubuntu 16.04 doesn't have 70-persistent-net-rules file anymore.

  • 1
    That's odd, this 16.04 systems does. Ahh but it's an upgraded system. You are correct that it's not present in a fresh install.
    – Elder Geek
    Sep 3, 2016 at 19:09

I don't have enough reputation to comment, but just to add to the marked answer, clean installations of Ubuntu 16.04 won't have the /etc/udev/rules.d/70-persistent-net.rules file present. However, if you create it manually, you can add a line as shown in the answer here and it should work just like it did in older versions, with one notable difference - the KERNEL parameter should be specified as the name that was assigned to the interface by default. For example, if the system named the interface as "ens160" and you want to change it to "eth0", the line might look like:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="ens160", NAME="eth0"

This tells the rule to only match on an interface matching the MAC specified (in the ATTR{address} parameter) and with a kernel name matching the KERNEL parameter. Alternatively you could probably omit the KERNEL parameter altogether and that should work as well.

EDIT: And as already mentioned, if you want to use the .link file method then you will need to update initramfs for it to take effect. Also note the custom .link file should be created in /etc/systemd/network and not in /lib/systemd/network (either will work but best practice is to use /etc/systemd/network since that's what its there for - to allow for custom .link files that override the defaults in /lib/systemd/network).

  • Removing the KERNEL parameter solved my issue. Thanks! Feb 19, 2021 at 2:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.