[systemd-devel] Updating network file during boot
Silvio Knizek
killermoehre at gmx.net
Tue Aug 13 17:04:49 UTC 2024
Am Dienstag, dem 13.08.2024 um 17:16 +0100 schrieb Henti Smith:
> Good day everybody.
>
> I've searched high and low and cannot seem to find an answer for what I'm trying to do. The most relevant I found was this [1] thread in 2020, but only because I'm using a script to change the contents of my .link files during boot, which is not working constantly.
>
> Some things to note:
> 1. The hardware is sample hardware so Mac addresses are 00:00:00:00:00.
> 2. The hardware has an external hot-swap PCId port that takes a board for VGA out.
> 3. We're attempting to configure two interfaces.
>
> The problem is when the board is attached the PCI numbering of the two interfaces change. With the board attached, it's 5 and 6, without it 4 and 5.
>
> Normally this would not be a problem, since you can Match on mac address, but in this case, both have the same mac address of 00:00:00:00:00.
>
> My attempt to fix this was to create a script [2] that enumerated the PCI ports for the hardware manufacturer and use that information to update the link files [2] before systemd-networkd starts, but this does not work constantly.
>
> Are there any other recommendations to resolve this situation or if my approach is the only real way to do this, how can I ensure my script is executed before systemd uses the link files to apply the interface configuration ?
>
> [1] https://lists.freedesktop.org/archives/systemd-devel/2020-June/044784.html
> [2] https://paste.mozilla.org/jgcCyo9A
> [3] https://paste.mozilla.org/zXQYpXpd
>
> Any guidance would be most welcome.
>
> Kind regards
> Henti Smith
Hi Henti,
you can [Match] onto basically everything provided by `udevadm info /sys/class/net/<device_name>`.
See `man:systemd.link` for further information.
BR
Silvio
More information about the systemd-devel
mailing list