139

A lot of my scripts stopped working after installing Ubuntu 15.10 and I have trouble remembering this new name as I was used to ethx and wlanx for years. Is there a reason for this change? Do I have to get used to this or can I just rename it and go back to good old eth0?

$ ifconfig

enp0s25   Link encap:Ethernet  HWaddr 77:5a:5e:a6:86:d5  
      inet addr:192.168.31.239  Bcast:192.168.31.255  Mask:255.255.255.0
      inet6 addr: fe80::725a:b6ff:fea6:86d7/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:4833 errors:1332 dropped:0 overruns:0 frame:666
      TX packets:5589 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:3266446 (3.2 MB)  TX bytes:1046654 (1.0 MB)
      Interrupt:20 Memory:d3500000-d3520000
5
  • 2
    see this which also has a further link to more details. Nov 30, 2015 at 19:19
  • 5
    Ooooooooooooooor fix your scripts once and for all and remove the reference (and change it for a command to determine the device name) ;-) (here are some pointers: askubuntu.com/questions/396837/… )
    – Rinzwind
    Dec 1, 2015 at 9:56
  • @Rinzwind That is great idea.
    – Mike
    Dec 1, 2015 at 10:41
  • @Mike my boss (= lead coder) always agrees with me on that too but then he always uses hard coded paths and devices... and I scold him again and again ;)
    – Rinzwind
    Dec 1, 2015 at 10:46
  • 1
    Dupe of this: unix.stackexchange.com/questions/134483/…
    – rugk
    Oct 11, 2018 at 20:23

3 Answers 3

140

This is known as Predictable Network Interface naming and is part of systemd, to which Ubuntu has been transitioning as of version 15.04.

Basic idea is that unlike previous *nix naming scheme where probing for hardware occurs in no particular order and may change between reboots, here interface name depends on physical location of hardware and can be predicted/guessed by looking at lspci or lshw output. Conversely we can guess information about it's physical position in the pci system. In your case that would be pci bus 0, slot 2. According to the freedesktop.org article, there actually are 3 ways how interface name is assigned: based on BIOS/Firmware for onboard cards, based on PCI information, and based on MAC address of the interface. Refer here for other examples.

According to the freedesktop.org page one of the reasons for switching to predictable naming is that classic naming convention can lead to software security risks in multi-interface systems when devices are added and removed at boot. Also, according to the comment by Sam Hanes, "On a big server with many Ethernet ports it's invaluable: you can immediately tell which interface goes to which port and adding or removing hardware doesn't change the names of other ports."

See How to rename network interface in 15.10 in case you decide to revert back to the other version of naming.

17
  • 50
    I see little irony in word "predictable" :), thank you for the pointers.
    – Mike
    Dec 1, 2015 at 10:35
  • 13
    "predictable", yeah, sure. I have ethernet disconnections after upgrade to 15.10 (clean install, old /home). Why break APIs and conventions? Now I have to figured out what is failing. I'm very upset with this :(
    – gorlok
    Jan 24, 2016 at 14:31
  • 17
    failing is predictable i guess ;)
    – Anwar
    Aug 20, 2016 at 7:16
  • 6
    eh, tell that to the systemd developers, guys. Aug 20, 2016 at 7:23
  • 28
    Predictable Naming isn't particularly useful on desktop systems with only one interface, and in that case it's kind of obnoxious. On a big server with many Ethernet ports it's invaluable: you can immediately tell which interface goes to which port and adding or removing hardware doesn't change the names of other ports. That's the case it's designed for.
    – Sam Hanes
    Nov 12, 2016 at 7:33
2

FWIW the freedesktop.org PredictableNetworkInterfaceNames file references a source file's comments as canonical but that file has been altered to remove the comments - see https://github.com/systemd/systemd/pull/12518.

1
  • 2
    The new canonical reference is here.
    – MrR
    Sep 3, 2021 at 21:48
1

Here is the quick fix I use on Debian and RHEL based systems

#Edit /etc/grub/default

Step 1. ) Add this to the line below "net.ifnames=0 biosdevname=0"

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

Step 2.) Update GRUB

This depends on your OS.

Debian based Ubuntu/Mint:

update-grub

Centos/RHEL

grub2-mkconfig -o /boot/grub2/grub.cfg

Source: http://realtechtalk.com/Linux_How_To_Change_NIC_Name_to_eth0_instead_of_enps33_or_enp0s25-2303-articles

You must log in to answer this question.

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