[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Predictable Network Interface Names



On Wed, Mar 30, 2022 at 07:18:07PM +0100, Brian wrote:
> On Wed 30 Mar 2022 at 13:32:53 -0400, Greg Wooledge wrote:
> > Yes.  You've now seen direct evidence of the lie.  I guess I won't need
> > to post links to the wiki articles that say the same thing you've already
> > observed.
> 
> I would be interested in a couple of links to the same observations
> as given by the OP.

<https://wiki.debian.org/NetworkInterfaceNames#Complications_and_corner_cases>
tries very hard to avoid mentioning the issue directly, but ultimately
has this paragraph down near the bottom of the section:

  it turns out even after all this there are still reported cases of
  interfaces changing their name on a reboot. All that needs to happen
  is that some buggy BIOS (or some new, less buggy version of a driver
  module, or systemd's naming policy) changes its mind about some detail
  like whether or not your hardware counts as the kind that should have
  an ONBOARD name. There are even reports of devices changing their
  PCI-port numbering due to other hardware being installed.

This links to
<https://utcc.utoronto.ca/~cks/space/blog/linux/PCINamesNotStable> which
goes into some detail.

I'm sure there are many more pages like this one.

> Recently, we have had a mail or two about iwd. It uses the kernel
> interface wlan0, which broke my /e/n/i. In the end I went with the
> flow on the basis that wlan0 is stable enough and changed /e/n/i
> rather than fighting iwd.

Wireless interfaces are not my strong suit.  I don't have any advice
for those.

> > 2) If you have multiple ethernet interfaces, or the possibility of this
> >    occurring in the future, take control of their names yourself.  Set
> >    up systemd.link(5) files to assign a name to each interface based on
> >    its MAC address, or some other identifying characteristic.
> 
> That's good advice, but are MAC addresses memorable?

Doesn't matter.  You can choose a memorable name.  The MAC address is
simply the data point you place in the config file, so the system knows
this is the interface you're talking about.

unicorn:~$ cat /etc/systemd/network/10-lan0.link 
[Match]
MACAddress=18:60:24:77:5c:ec

[Link]
Name=lan0

That's what I'm using.  Of course, this relies on the MAC address being
consistent across boots.  I've heard of some cases where this isn't
true, but I believe those cases involved removable devices (USB network
interfaces or similar).

"lan0" is familiar to me from HP-UX, and it also isn't "eth0", so there's
no risk of collision with the kernel's default name scheme.  I have
no idea what happens if you try to assign the names "eth0" and "eth1"
to a pair of interfaces that come up as "eth1" and "eth0" by default.
Are the renames done sequentially?  Will they fail in this case?  I don't
know, and I don't want to find out the hard way.


Reply to: