Systemd predictable network interface names are awesome.

Not only I get easy to remember names like enp2s0f0u7u3c2 but I _also_ get to experience a machine not coming back up after reboot because a new (non-NIC!) PCIe card caused existing names to shuffle around.

@q3k who wants eth0 when you can have an unpronouncible monstrosity
@q3k
Nobody expected that ethernet network pcie 2 subdevice 0 function 0 usb 7 usb 3 configuration 2 would stop being pcie 2 at some point
@wolf480pl ... if only there was a universally present, globally unique identifier that could be used to track network devices across bus swaps!
@q3k I've been bitten by that too many times, so now I assign names myself.
That also bit me once, cause a kernel update somehow cause my NIC to change MAC address...
You can disable it with ln -s /dev/null /etc/systemd/network/99-default.link
Or create .link files that would assign names using MAC or device path (for example Path=pci-0000:00:14.0-usb-0:2.2:1.0)
@q3k I had a server have some issues on PCIe bus, causing one of the several redundant NVMes to fall off the bus. The machine rebooted and thanks god I had access to the BMC, because it changed up all the interface names and everything went down.
@qwertyoruiop @q3k I won't even begin with multi-socket systems and their enumeration of PCIe devices 🙃
@q3k, then you could have an USB network adapter…

@q3k yea we're predictable

predictably bad

@q3k real talk: I feel like a system like /dev/disk/by-* for interface names would solve many of these problems: it allows you to be specific when you need to, and to be generic when you don't

there's probably a way to do this with interface aliases, thinking of it 🤔

@q3k Here's another fun thing:
Power machines can have differen PCIe busses, so you can actually get things like
`enP19p96s0f0`, and if your driver decides, even `enP19p96s0f0np0` .
IF you then want a VLAN on that, the canonical name would be something like
`enP19p96s0f0np0.1450`. Thats 20 characters. Interface names *can only* be 16 (in practice 15) characters long.

Fun esues.

@krono @q3k

OMG don’t bring back the PTSD about name length restrictions. cm-usb3-a-gige (strlen = 14) u-dev rule works fine, ms-usb3-a-dongle (strlen = 16) => ‼️🚨🚫 I finally find in logs (networkctl info or status IIRC) a cryptic error from networkd where the only Google result is the error in the systemd repo. 🤦‍♂️ At least once I got that far it took about 15 minutes to realize my folly but they really need to plumb the error reason up to the log message output point!

Time to install Gentoo or Artix

@q3k I really like #OpenBSD's approach. Usually, you configure network interfaces in a file called /etc/hostname.<if> where <if> is the name of the interface.

To avoid the renaming problem, you can also name the file /etc/hostname.XX:XX:XX:XX:XX:XX so it's bound to the MAC address.

More details in https://man.openbsd.org/hostname.if

hostname.if(5) - OpenBSD manual pages

@_xhr_ that was annoying to get right!
@q3k
@AFresh1 Thanks a lot. A logical and elegant solution in the end.
@q3k
@q3k Wait; wasn't the whole point of using systemd's "predictable" network interface names that exactly this case cannot occur?! Or am I misremembering something 
@q3k @suqdiq when we were at twitter we got more deterministic names by turning all that shit off and letting normal unix behavior happen
@q3k arf yes, a classic :(
@q3k Yes, thankfully we no longer have to deal with complicated network interface names like eth2. That was awful!
@brouhaha @q3k if you take something difficult and make it easy it’s no big deal, but if you take something easy and make it difficult you are a Genius