I'm trying to set a name for an interface, "ethLan" instead of eth0. Doing so also ensures that the if's name will remain consistent at every reboot and kernel.

I did find some articles in the subject, but they are all a couple of years old:

I did as they said and added the ethLan mac to /etc/mactabs/. At this point I have two problems:
1) The if [...] && /sbin/nameif script I put at /etc/network/if-pre-up.d/ does not run. I solved this by adding this to the /etc/init.d/networking, but why doesn't if-pre-up.d work?
2) The interface won't load unless I manually do ifconfig ethLan up, in spite of adding it to /etc/network/interfaces. What am I doing wrong?

3 Answers 3


The articles you found are somewhat outdated. There is now an easy method to assign names to network interfaces, through Udev.

On Debian and derivatives (including Ubuntu), look out for a file called /etc/udev/rules.d/70-persistent-net.rules. This file is created by /lib/udev/rules.d/75-persistent-net-generator.rules with the help of the script /lib/udev/write_net_rules. Each time udev sees a new network device, it will assign it a new number and append that number to /etc/udev/rules.d/70-persistent-net.rules. That way, interface numbers are persistent across reboots, and will persist after a reinstallation if you restore /etc.

(If your distribution doesn't ship these files, look for them in the Debian package.)

If you want to give a meaningful name to an interface and you have /etc/udev/rules.d/70-persistent-net.rules, all you need to do is to edit that file and change "eth0" to "ethLan". Run udevadm trigger --sysname eth0 to rename the existing device after you've edited the file (I think this requires shutting down the interface). If you don't have that file, you can write the one-line matching yourself (the complicated scripts that Debian adds are only to do this automatically):

SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="01:23:45:67:89:ab", NAME="ethLan"
  • 2
    If you want a handy list of attributes usable in udev rules, you can try something like udevadm info -a /sys/class/net/eth0. (see udevadm(8) for details) Aug 21, 2015 at 1:18
  • 1
    The question clearly states to be for Wheezy, yet it might be worth noting that this answer is no longer valid for newer Debian and Ubuntu. Starting with systemd 220-7 interface naming needs to be done via other means.
    – sampi
    May 27, 2016 at 15:36
  • @sampi My answer still applies to Debian jessie (the current stable release). Does it fail on stretch, or is it just recommending a deprecated method? Do you know which release of Ubuntu is the cutoff? May 27, 2016 at 15:51
  • @Gilles I did not dig deep enough into the details in order to know whether it actually fails or merely is a recommended deprecation. It seems Ubuntu Wily and newer use systemd higher than 220-7.
    – sampi
    May 30, 2016 at 13:28

For people coming across this post via a search engine, like me:

In Debian stretch and newer, you can use systemd .link files to have udev rename the devices. See https://manpages.debian.org/stretch/udev/systemd.link.5.en.html for the manpage.

An example:

cat /etc/systemd/network/10-uplink0.link 


Don’t forget to run update-initramfs -u afterwards to embed these updated config files into your initramfs, where they will be applied.

  • If the link files are present in a system with udev.rules.d which one will take precedence?
    – vfclists
    Sep 18, 2018 at 14:27

There is a slightly simpler way to do that with a package named ifrename. It has a separate (from udev) configuration file and you can use MAC addresses to identify interfaces.

It conflicts with wireless-tools however.

  • 2
    It should be noted that ifrename will conflict with udev if both are used to give interfaces persistent names. Jan 12, 2012 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .