You are not logged in.

#1 2024-01-31 22:32:48

thorstenhirsch
Member
Registered: 2005-08-03
Posts: 102

[SOLVED] traditional interface name (eth0) doesn't work

Hi, my network interface name changes from enp3s0 to enp4s0 when I deploy a nvme drivde in the 2nd M.2 slot of my mainboard. So I want to revert to the traditional network name eth0. Our wiki recommends to go the systemd way, but it doesn't work for me. I've tried:

- no [Match] at all (like in the wiki)
- [Match] OriginalName=*
- [Match] MACAddress=$myMacAddress

- [Link] NamePolicy=keep kernel (like in the wiki)
- [Link] NamePolicy=kernel
- [Link] Name=eth0

And I've tried to put these settings in the following files:

- /etc/systemd/network/99-default.link.d/traditional-naming.conf (like in the wiki)
- /etc/systemd/network/wired.link (because wired.network is where I've configured to use DHCP for this interface)
- /etc/systemd/network/wired.link.d/10-eth0.conf
- /etc/systemd/network/10-eth0.link

I always rebooted between my changes, but nothing worked. My interface always kept the name enp3s0 (now that I'm not using the 2nd M.2 slot).
The systemd documentation ("man systemd.link" and "man systemd.network") couldn't help me, either.

Any ideas what might be wrong?

Last edited by thorstenhirsch (2024-01-31 23:43:59)

Offline

#2 2024-01-31 22:48:15

seth
Member
Registered: 2012-09-03
Posts: 51,343

Re: [SOLVED] traditional interface name (eth0) doesn't work

Just mask the default

ln -s /dev/null /etc/systemd/network/99-default.link

(that's NOT the for whatever reason suggested "ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules" in the wiki) or by add net.ifnames=0 to the kernel parameters.
/etc/systemd/network/99-default.link.d/traditional-naming.conf  should™ work, sure you're not seeing the AlternativeNamesPolicy ?

Offline

#3 2024-01-31 23:42:46

thorstenhirsch
Member
Registered: 2005-08-03
Posts: 102

Re: [SOLVED] traditional interface name (eth0) doesn't work

Yay, that really worked. Thank you, seth!
(But I don't know about AlternativeNamesPolicy. Haven't used it nor seen it anywhere.)

Offline

#4 2024-02-01 08:17:51

seth
Member
Registered: 2012-09-03
Posts: 51,343

Re: [SOLVED] traditional interface name (eth0) doesn't work

usr/lib/systemd/network/99-default.link has

AlternativeNamesPolicy=database onboard slot path

The NIC might show up w/ two names in "ip a", eth0 and enp4s0

But I assume the problem with the wiki approach was that NamePolicy first needs to be cleared.
Updated the wiki a bit itr, thanks for the heads up.

Offline

Board footer

Powered by FluxBB