27.01.2026 14:12, Mantas Mikulėnas wrpte:
If you do this often (i.e. bypassing networkd to configure extra addresses), then configure your default route with the "preferred source" parameter, [Route] PreferredSource= (equivalent to "ip route add default ... src ...") to give the kernel a stronger hint for the default source address selection.

Alternatively, add the "one-off" address with 'ip addr add ... preferred_lft 0' to prevent it from being chosen as a source address entirely (unless a program specifically binds to it). Normally an IPv6 parameter but I *think* it now also works for IPv4 addresses as well.

No, this was a one-time test, which happened to be done at the same time as 
this network
glitch.

I'm aware of other ways to make it non-primary, and you suggested other ways I 
didn't think
of immediately, -- thank you for that.

Also killermoehre suggested another way, to edit the config file.

The problem is that one has to remember about this possibility when doing 
things like this.
This is needed very rarely, and remembering this at the right time is really 
difficult.

And if it's a server which normally is supposed to have a permanent connection, then use IgnoreCarrierLoss=yes (as well as ConfigureWithoutCarrier) – that's literally the use case for that parameter.

Yes.  I wrote I'm aware about these two parameters -- I toggled them on right 
after I've
hit this issue, on all servers with static networking (to be done wrt "all" 
anyway).

This is, again, the same issue: one has to remember about this - very rare - 
possibility.
I know about it now, but even for me it would be difficult to recall if/when 
I'll need
to test something like that in some other place a few years later.

Honestly I don't think networkd is really going to care about IP address order when you're already going behind its back (and for that matter I'm not sure if there is an API to make some specific address primary in the first place, without removing all secondary addresses?).

Yes I understand this is a situation where networkd shouldn't care much.  With 
the above
(the "difficult to remember" part), this issue becomes.. unsolvable :)

Maybe networkd can have some global default for this stuff?  Like, 
StaticNetworking=yes
in /etc/systemd/networkd.conf, which turns on IgnoreCarrierLoss & Co by default?

I dunno.  On one hand, the problem sounds like a no-problem because it is very 
rare.
On another, there can be quite some damage when a user hits it, and most are 
completely
unaware even about IgnoreCarrierLoss and the default behavior, which isn't 
nice..

Thanks,  and thank you for the interesting ways to achieve the "temporariness" 
of a
test address.

/mjt

Reply via email to