Re: Automatically assign link local ipv4 address if dhcp fails



On Wed, Mar 15, 2017 at 01:36:29PM +0100, Viktor S. Wold Eide wrote:
What is the recommended approach / configuration to use in order to
automatically have an ipv4 link local address (in the 169.254/16 range)
assigned to an interface in case DHCP fails?


What is the recommended approach to achieve the described behavior?

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.

Unfortunately, NM 1.2 does not allow configuring the number of retries
for each connection and thus NM will try eth0-auto 4 times before
switching to the other one. With NM 1.6+ you could change this
behavior through through the 'connection.autoconnect-retries' property
of eth0-auto.

A possible, but sub-optimal, way to mitigate the long fallback delay
(45 seconds for 4 tries) on NM 1.2 is to shorten the DHCP timeout
interval through the ipv4.dhcp-timeout property.

Beniamino

Attachment: signature.asc
Description: PGP signature



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