Ubuntu – Why is the network interface named enp0s25 instead of eth0

networking

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

Best Answer

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.

Related Question