In Ubuntu 16+, for a network interface "ens192", where does the "192" come from?

6,822

Solution 1

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,....

Solution 2

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.

Share:
6,822

Related videos on Youtube

bblackmoor
Author by

bblackmoor

Updated on September 18, 2022

Comments

  • bblackmoor
    bblackmoor over 1 year

    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?

    • Boris Hamanov
      Boris Hamanov over 5 years
      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.
    • bblackmoor
      bblackmoor over 5 years
      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?
    • Boris Hamanov
      Boris Hamanov over 5 years
      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.
  • bblackmoor
    bblackmoor over 5 years
    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###?
  • JavaProphet
    JavaProphet over 5 years
    @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.