[Networkmanager] NetworkManager link local IPv4 address based on last 2 octets of ethernet MAC address

Andrei Borzenkov arvidjaar at gmail.com
Thu Oct 19 12:30:33 UTC 2023


On Thu, Oct 19, 2023 at 3:18 PM manjunatha srinivasan
<manjunathan.n at gmail.com> wrote:
>
> Hi
> I have 2 following ethernet profiles at /etc/NetworkManager/system-connections:
> One for dynamic ip configuration and other for link local as fallback when DHCP server is not reachable. As expected when DHCP server is not reachable, fall back IPv4 address happens e.g. 169.254.105.20 with subnet mask as 255.255.0.0 by the NetworkManager.
> This particular IP address is always the same which is expected one.

You can not expect this. There is always the possibility of address
collision and NetworkManager will then generate a different address.

> Please let me know how this constant IPv4 address is decided by the NetworkManager.

By default it hashes the interface MAC address.

> Also let me know if there is any configuration option in NetworkManager to change last 2 octets (i.e.105.20) represented in the decimal value of last 2 values of ethernet MAC hex address.
>

It is not guaranteed to be unique. Besides, you have two addresses
less than 2 octets, so for some MAC this cannot be used at all.

> Ethernet (eth0) method based on DHCP:
> [connection]
> id=my-eth0
> uuid=8466b654-0183-4900-a2d6-26a9e6af275e
> type=ethernet
> autoconnect-priority=1
> interface-name=eth0
> timestamp=1697699281
>
> [ethernet]
>
> [ipv4]
> dhcp-timeout=10
> method=auto
>
> [ipv6]
> addr-gen-mode=stable-privacy
> method=auto
> ra-timeout=10
>
> [proxy]
> -------------------
> Ethernet (eth0) method based on link-local:
> root at FXR90D5FB72:/etc/NetworkManager/system-connections# cat  rfid-ll-eth0.nmconnection
> [connection]
> id=ll-eth0
> uuid=f07f43e6-59c8-428f-bc04-55a0e581e621
> type=ethernet
> interface-name=eth0
>
> [ethernet]
>
> [ipv4]
> method=link-local
>
> [ipv6]
> addr-gen-mode=stable-privacy
> method=auto
>
> [proxy]
> ------
>
> When DHCP request fails, the IPv4 address fallback to
>
>
>
> Thanks & Regards
> Manjunatha Srinivasan N


More information about the Networkmanager mailing list