5

We have dozens of virtual machines in several data centers around the world. When upgrading an Ubuntu VM from 14 to 16 (as a step toward upgrading them to Ubuntu 18), the network interface names change. I am aware of this, and I know why they change, so that is not my question. My question is where does the number (the 33 in ens33, the 192 in ens192, etc.) come from? I have read many StackExchange questions and answers about what to do to get the server working: that is not the problem. What I want to know is how to predict what the ens### will be before the server is upgraded to Ubuntu 16. I have looked at lshw and lspci, and I can't see any reason why these numbers are chosen.

Please: where does the 192 (or 33, or anything else) come from?

  • 3
    The format is <slot #><port #>. It was a dumb idea to standardize network names. For example ens01p01 means the ethernet network port on slot #1 port #1. – heynnema Dec 01 '18 at 21:32
  • In oyr environment, they are always in the form ens### (or ens##). How would I know what that ### (or ##) is going to be before the system removed eth0 and creates ens192? – bblackmoor Dec 02 '18 at 01:06
  • 1
    I don't think you can. There might be similarities when using similar motherboards with similar ports. I can't say for sure. You can always add the kernel parameter net.ifnames=0 which keeps the old names... eth0, etc. – heynnema Dec 02 '18 at 03:00

2 Answers2

6

It is done in Linux, to avoid name confusion for the NICS. All NICs are named based on the PCI SLOT number they are using

for PCI it would be

  • ens33,ens34.....

On the other hand for NICs using PCIe slot would be having (notice for PCIe slots there is an increase of 32 for each NIC)

  • ens160,ens192,....
3

While I don't know why they are the ensXX format, if you want to disable them to have consistent naming across servers and get the legacy ethX, you'll want to set the net.ifnames=0 biosdevname=0 kernel boot arguments in GRUB or your bootloader in general.

  • I know how to do that, and I appreciate the information. However, my questions is: How would I know what that ### (or ##) is going to be before the system removes eth0 and creates ens###? – bblackmoor Dec 02 '18 at 01:07
  • @user3158465 From my experience, it seems to allocate them incrementally, and never reassigns them to another NIC (perhaps based on MAC address). In that, it provides consistency of configuration across swapped NICs, but not the same configuration for all NICs. This is just a guess though. – JavaProphet Dec 02 '18 at 05:15