On 2024-05-21, Dale <rdalek1...@gmail.com> wrote:

>> If you want consisent network device names (even when you change
>> hardware), you need to either
>>
>>  1. create udev rules that assign device names based on MAC addresses.
>>
>>  2. use a network configuration subsystem that assigns device names
>>     and configurations based on MAC addresses.
>
> Do you, or someone else, know of a good howto on how to use MAC
> addresses like that?  Given this thing is usually remotely accessed, I
> really need it to be consistent with or without the card.  Maybe you
> have a bookmarked link saved somewhere.  I'm on openrc to.  I'll google
> around but you, or someone else here, may have a really good and simple
> howto link. 

The udev way is probably the most universal. Some distros will create
udev rules automagically so that network interface names persist over
hardware changes, but Gentoo doesn't.  Here's my udev rules file that
defines my network interface names for the machine I'm on at the moment:

------------------/etc/udev/rules.d/70-my-persistent-net.rules-----------------------
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="2c:f0:5d:6f:10:af", NAME="net0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:1b:21:b1:d1:e9", NAME="net1"
-------------------------------------------------------------------------------------

I used to use "ethN" instead of "netN", but those names are used
internally by the kernel during startup, and people were warned not to
use them in udev rules because of certain race conditions that might
happen.  I never ran into problems using "ethN" names, but eventually
decided not to push my luck.

The network configuration route depends on what network configuration
(and possibly init) system you use.  I know how to do it that way on
Ubunutu (which is systemd based) using netplan...

--
Grant






Reply via email to