eth0:1 aliases in NM, manual setup
Thomas Haller
thaller at redhat.com
Mon Jul 22 11:44:00 UTC 2024
On Mon, 2024-07-22 at 14:24 +0300, Andrei Borzenkov wrote:
> On Mon, Jul 22, 2024 at 12:59 PM Thomas Haller <thaller at redhat.com>
> wrote:
> >
> > On Mon, 2024-07-22 at 12:45 +0300, Andrei Borzenkov wrote:
> > > On Mon, Jul 22, 2024 at 11:17 AM Íñigo Huguet
> > > <ihuguet at redhat.com>
> > > wrote:
> > >
> > >
> > > AFAIU kernel considers the very first interface address for a
> > > given
> > > subnet/scope as primary and all addresses for the same
> > > combination of
> > > subnet/scope added later as secondary. So, to keep the specific
> > > address as primary it has to be configured first. I suspect
> > > legacy
> > > scripts implicitly processed ifcfg-ethX before ifcfg-ethX:N, so
> > > address in ifcfg-ethX became primary.
> > >
> > > Does NetworkManager process ipv4.addresses in deterministic
> > > order?
> > > Can
> > > we rely that for "ipv4.addresses A1 A2 A3" it will always add A1
> > > first, then A2, then A3? Especially with DHCP where there could
> > > be
> > > delay waiting for completion of the DHCP transaction.
> > >
> >
> > Hi,
> >
> > It works.
> >
> > Addresses can become ready for configuration in any order. For
> > example,
> > if you do DAD/ACD. Or if you do `nmcli device modify DEV
> > ipv4.addresses
> > ADDRS`.
> >
> > When NetworkManager notices that the order is not as required, it
> > will
> > delete and re-add them in the right order.
> >
> >
> > The complexity of getting that right, is considerable. It's here:
> > https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/777418dfd786722d4dc16d4e60d2ca724f93b55c/src/libnm-platform/nm-platform.c#L4327
> >
>
> Thank you! It is even documented :)
>
> Is there deterministic order between different methods? I.e.
> suggested
>
> ipv4.method=auto
> ipv4.addresses=x.y.z.w/M
>
> Which one has priority and becomes primary - from DHCP or static?
>
There was quite some back and forth in the past. Only consider recent
versions (e.g. 1.40+).
Static addresses (ipv4.addresses + ipv6.addresses) are preferred over
DHCP/SLAAC/DHCPv6. And the list of the static addresses are sorted with
primary address first.
(If you test it, beware, that the order only matters between addresses
of the same subnet (IPv4) or scope (IPv6)).
Thomas
More information about the Networkmanager
mailing list