Re: Automatically assign link local ipv4 address if dhcp fails

On Wed, Mar 15, 2017 at 3:16 PM, Beniamino Galvani <bgalvani redhat com> wrote:
You can achieve this by creating two connections with different
autoconnect priorities:

 nmcli connection add type ethernet ifname eth0 con-name eth0-auto
 nmcli connection add type ethernet ifname eth0 con-name eth0-ll
 nmcli connection modify eth0-auto connection.autoconnect-priority 100
 nmcli connection modify eth0-ll connection.autoconnect-priority 50 ipv4.method link-local

In this way NM will try first to autoactivate eth0-auto and, upon
failure, it will fall back to the link-local connection.

Hi Beniamino,

Thanks a lot for the quick response and for the suggestion.

What would happen if the DHCP server is only temporary down in the scenario with two connections that you describe? I would expect that the low priority link-local would remain active, even if the DHCP server came back up.  I can of course test it.

If there are other alternatives, I would appreciate suggestions.

As written, a different DHCP client could have been an option, but no luck so far in this direction. Alternatively, it might be possible to hook into the system, for example via a script in /etc/NetworkManager/dispatcher.d that can check for DHCP failure / success. However, I was wondering if I had missed something or whether there is some recommended configuration to achieve the desired behavior.

Best regards
Viktor S. Wold Eide

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]