Hi!

I faced an interesting situation here with networkd, manually added
IP address, and momentary carrier loss on the interface.

We had an ethernet interface with an IP address A, configured in
/etc/systemd/network/ as usual.

For testing purposes, I've added another address, B, to the same
interface, using command `ip addr add B dev IFACE`.  This address
has become "secondary" address on the interface:

    inet A scope global IFACE
       valid_lft forever preferred_lft forever
    inet B scope global secondary IFACE

This temporary address, B, is not specified in networkd config,
only runtme-added.

With this configuration, outgoing connections were using source address
A, expectedly, since this one is the primary address.

Now, a momentary carrier loss occurred.  During the loss, networkd
removed IP addresses it managed from the interface.  So the only
address remains is the manually added B.

Now, after carrier is back again, networkd added address A back.  But
now, it has become *secondary* instead:

    inet B scope global IFACE
       valid_lft forever preferred_lft forever
    inet A scope global secondary IFACE

(it is the same situation as before, but with A and B swapped).

And now, nothing ever worked, since address B isn't supposed to be used
as source address, firewall rules prevented all outgoing connections.

Yes I'm aware about IgnoreCarrierLoss and other related parameters.

But I wonder if we can handle this situation better?

Thanks,

/mjt

Reply via email to