Score:0

What controls the NIC naming convention after fresh Ubuntu 20.04 install?

us flag

This is a fresh install Ubuntu server 20.04.04 system. I'm using networkd and netplan to configure networking. I did not do any custom install steps, just loaded the .iso and installed Ubuntu server through the prompts.

When these machines were shipped from the vendor, Ubuntu was already installed and the network interfaces were named ens1f0 and ens1f1:

root@oldHost2:~# sudo lshw -C network |grep "logical name"
       logical name: ens1f0
       logical name: ens1f1
       logical name: bond0

However after reinstalling the OS (before running netplan) I get....

root@freshHost1:~# sudo lshw -C network |grep "logical name"
       logical name: ens1f0np0
       logical name: ens1f1np1
       logical name: bond0

Across all my sites, we use a netplan config that assumes ens1f0 and ens1f0. I would like all interfaces to match this.

I know you can set the interface name with set-name in netplan (as defined in https://ubuntu.com/server/docs/network-configuration) however you need to already match the interface somehow (using Mac address, etc) which is going to make auto-provisioning a nightmare (if not impossible). A chicken/egg scenario. I have hundreds of machines to provision and I would like to template out my netplan config without knowing the Mac addresses.

I know you can also group together the interfaces in netplan:

  ethernets:
    eports:
      match:
        name: ens*

Which may work for my case, but not all the systems have a simple two NIC setup like this so I'm not sure what the best course of action will be.

My questions to ServerFault...

  • Since this logical name is set before Netplan is even ran, what is deciding on this name? How can I override it during OS install/provision?
  • What does the np0 and np1 mean in the interface names?
in flag
Does this answer your question? [Network interface naming](https://serverfault.com/questions/1067418/network-interface-naming)
Rino Bino avatar
us flag
@GeraldSchneider My post has two questions, and ... sort of? Doesn't answer where `np0` and `np1` are coming from and doesn't respond to if it's possible the names can be overridden before netplan is ran, which is asked in the OP.
Brandon Xavier avatar
us flag
Most likely `udev` assigns the initial names. These can easily be overridden with rules. A good strategy might be to compare the udev rules on a vendor imaged machine to the rules installed by a generic Ubuntu installation.
Rino Bino avatar
us flag
@BrandonXavier Thanks for the suggestions. I'll start down that path and see what solutions I can come up with and will report back. My goal is to just have a predictable device name on all these hosts when they are provisioned.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.