I'm a beginner at linux.

I'm doing some self training and am aware that in older versions of linux I was able to rename the network interface from /etc/udev/rules.d/70-persistent-net.rules, however this file is missing in Ubuntu 16.04.

Can someone help me with this please ?

Thanks in advance. J

  • This is an OK enough place to ask this question, but I would really recommend asking Ubuntu-specific questions at AskUbuntu (askubuntu.com). Usually the response times are better there too. – Brenton Horne Dec 6 '16 at 20:24
  • I have faith in this forum :P – joebegborg07 Dec 6 '16 at 20:40

Create the /etc/udev/rules.d/70-persistent-net.rules file as follows :

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

add the following line:

# PCI device 0x10ec:0x8xxxx (ethernet_module_here)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="3x:17:ef:6f:s2:2h", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x168c:0xyyy (wifi_module_here)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="74:e5:ii:uu:de:nn", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

Run sudo ifconfig to get the mac adress and change it with yours here :ATTR{address}=="74:e5:ii:uu:de:nn"

CtrlO then press Enter exit with CtrlX

Disable the Predictable Network Interface Names with:

ln -sf /dev/null /lib/udev/rules.d/80-net-setup-link.rules

This will overwrite the existing file, so, optionally, back it up before executing the command.

Bring up your interface:

ip link set eth0 up
ip link set eth0 down

Alternative methode:

Edit your grub configuration file:

sudo nano /etc/default/grub

add net.ifnames=0 biosdevname=0 to GRUB_CMDLINE_LINUX="" like this:

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

update grub.cfg :sudo grub-mkconfig -o /boot/grub/grub.cfg

Edit your /etc/network/interfaces to change interface name then reboot.

  • Thanks for your reply @GAD3R. The udev rules seem to have been moved to /lib/udev/rules.d/ with newer Ubuntu version, however the 70-persistent-net.rule is still not there. – joebegborg07 Dec 6 '16 at 20:40
  • 1
    I think ln -s should be changed to ln -sf, otherwise, the existing file won't be overwritten. – Marcus Apr 13 at 10:07

For me it worked modifying /etc/udev/rules.d/70-persistent-net.rules. However I had to remove the kernel from that line.

Eg:

# PCI device 0x10ec:0x8xxxx (ethernet_module_here)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="3x:17:ef:6f:s2:2h", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"

# PCI device 0x168c:0xyyy (wifi_module_here)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="74:e5:ii:uu:de:nn", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="wlan0"

I am on Ubuntu 16.04

For people new to this or struggling with it, GAD3R's answer is correct, however if you're following the first method it is worth noting the following two points:

  1. /etc/udev/rules.d/70-persistent-net.rules may not actually exist (in which case you need to create it).

  2. If /lib/udev/rules.d/80-net-setup-link.rules DOES exist, you will get an error message indicating as such when trying to use the "ln -s" command and will need to rename it before setting a symbolic link to /dev/null (for complete beginners: "it's a safer option than deleting").

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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