4

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
  • 3
    The format is <device name><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 1, 2018 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 2, 2018 at 1: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 2, 2018 at 3:00

2 Answers 2

4

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.

2
  • 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 2, 2018 at 1: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. Dec 2, 2018 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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