How to customize the valid_lifetime and preferred_lifetime of RA in SLAAC mode

The router obtains IPv6-PD through PPPoE dial-up, and the LAN interface only enables SLAAC mode to deliver IPv6-PD. Modifying the valid_lifetime and preferred_lifetime parameters of the RA message through the relevant parameters of the following two documents does not take effect. What is the reason?

Reference documentation:



The preferred_lifetime option only takes effect if ra_useleasetime is disabled.

The parameters in these two documents are set and tested separately and have no effect. I am wondering if there are other parameters that need to be used together

I'm wondering the same, but on a stateful dhcpv6 lan. ISP is changing prefix on every 24h reconnect. It's driving me insane.

wireshark on a client returns:

My config:

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        list dhcp_option '6,'
        option leasetime '10m'
        option ra_useleasetime '0'
        option preferred_lifetime '10m'
        option dhcpv6 'server'
        option ra 'server'
        option ra_management '2'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

Wondering whether to put these options in odhcpd or dhcp and why it's not working.

Is this problem unsolved?

I still have problems with preferred_lifetime. Did ra_useleasetime = 0 fix the issue for you?

One can get the leases like this: ubus call dhcp ipv6leases

					"duid": "00010001265fd17970bc123456",
					"iaid": 327426150,
					"hostname": "Client1",
					"accept-reconf": false,
					"assigned": 706,
					"flags": [
					"ipv6-addr": [
							"address": "2001...",
							"preferred-lifetime": 158836,
							"valid-lifetime": 245236
							"address": "fd61...",
							"preferred-lifetime": -1,
							"valid-lifetime": -1
					"valid": 2880

Did anyone find a solution for this?

I am trying to setup 2 (or more) IPv6 routers in a single LAN network (each with their own WAN connection) such that each router will advertise its upstream prefix to the LAN for configuration using SLAAC. I need to be able to tweak the announced preferred_lifetime for the routers manually so that I can set which prefix is preferred over other when multiple prefixes are available from different routers.

I have tried setting preferred_lifetime to a custom value and ra_useleasetime to 0 but that doesn't seem to work. The routers still advertise the same preferred_lifetime value that they recieve from upstream WAN (which is controlled by the ISP's device connected to the WAN port of each router).

@jow the default for RA is still odhcpd, right? But Dnsmasq provides this too? Could it be that then dnsmasq-full is needed?

If nothing helps, disable RA in /etc/config/dhcp and use radv or bird2. If you want to try bird I can offer help with a basis config.

@_bernd thanks.

If using a different RA server is the only option, I might consider making the switch. Would you mind checking another issue I am facing with odhcpd too, and if that too can be solved using another RA server, I'll make the switch.

An update on this - I was able to get this working with odhcpd!

The preferred_lifetime option only takes effect if ra_useleasetime is disabled.

Contrary to what @jow suggested above, the current implementation in the source code has the following logic:

If ra_useleasetime is true, and the actual preferred lifetime of the prefix is greater than the manually set preferred_lifetime in the configuration, then the advertised preferred lifetime is set to the defined preferred_lifetime value in the configuration.

This still doesn't let me increase the preferred lifetime value in the RA beyond what is given by the ISP device, but I am fine without this customisation.

1 Like