IPv6 DDNS Scripting Question


Senior Member
I wish to add a set of commands to runs after a boot/reboot to enable IPv6 DDNS and am looking for advice as how / where to add them - my initial thought is in post-mount

The problem
I have dynamic IPv6 (Native, DHCP-PD, Stateless) and my ISP connection is VDSL using Option 61
The default boot leaves the global IPv4 on eth0 (WAN) but global IPv6 on br0
Because of how (which is way over my head) the router boots, I cannot add any IPv6 addresses to eth0 via wan-event - they will be ignored.
if DDNS attempts to run at start-up with IPv6 Update = Yes, it will fail (for IPv4 and IPv6) as there is no global IPV6 on eth0

To avoid needing to login and reset the DDNS via the GUI it seems simpler to set IPv6 Update = No in the DDNS GUI and once the router is up, run

ip -6 address add dev eth0 $(nvram get ipv6_rtr_addr)
nvram set ddns_ipv6_update=1
service restart_ddns

As long as the command are run consecutively this works perfectly from the SSH prompt and DDNS is now on IPV4 and IPv6. So the question is where and when - it should be as late as possible in the boot process so that eth0 is available for new IPv6 addresses (prior testing indicates this can be 10 minutes or more, given the other scripts running at start-up).

Is adding these as the last lines in post-mount the right place and if that occurs too soon
ip -6 address add dev eth0 $(nvram get ipv6_rtr_addr)
fails, what is the recommended way to add a delay - either in post-mount, elsewhere or in a stand-alone script.


Occasional Visitor
Set a cron job that runs every minute.

Script would:
- check if ipv6 is enabled on the eth0 interface
- read what address is assigned on the eth0 interface (or even better read the WLAN interface from nvram wan0_ifname variable) and if it is different from ipv6_rtr_addr
- if they are different, run your script lines.

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!