Here is my problem, my ISP use CGNAT on IPv4, my router is CCR1009, it get a 10.0.0.0/8 reserved ip address on PPPoE out interface, and a 2408:8000::/20 IPv6 address, right now, those address are 10.70.163.179, and 2408:82077150:62e7:d3ff:fe04:2780. so when I need link devices in my room, I configured a openvpn over a DYNV6 domain, to IPv6 address of my router. But last morning, I found that IPv6 address was over 19 days not change, my ISP should change it each 3 days. that cause my router didn't update DDNS by script in nearly 19 days, and DYNV6 paused DNS resolution of my domain. my script run each 5 minutes, check and update my domain when the IPv6 address change before, so I add a counter in script, to force update my domain in each 10 days. But I think if my router shutdown, like power failure, the counter will be lost, and if my router still get a same IPv6 address as same as last time, that will cause my domain not get update in a long time, maybe a other 19 days. So I'm thinking, there is a flie download when update my DYNV6 domain, what about get date of this file, and calculate it, that will know how many days since last update. But I've no idea how to get the date and calculate.
The files download when update DYNV6, they named same, the file name will be "update?hostname=MYDOMAIN.dynv6.net&token=1a2b3c4d5e6f".
My added counter script of update DYNV6 below:
Code: Select all
{
:local dynv6addr
:local currentv6addr
:local dynv6domain "MYDOMAIN.dynv6.net"
:local dynv6token "1a2b3c4d5e6f"
:local dynv6url
:global dynv6holdcounter
:set $currentv6addr [/ipv6 address get [/ipv6 address find interface=pppoe-out-Unicom from-pool=unicom-pool-v6] address]
:set $currentv6addr [:pick $currentv6addr 0 [:find $currentv6addr "/"]]
:set $dynv6addr [:resolve domain-name=MYDOMAIN.dynv6.net server=2620:fe::fe]
:set $dynv6url "http://dynv6.com/api/update?hostname=$dynv6domain&token=$dynv6token&ipv6=$currentv6addr"
:if ([:typeof $currentv6addr]="ip6" && :get[$currentv6addr]!="::1") do={
:if (:get$currentv6addr!=:get $dynv6addr || :get[$dynv6holdcounter]="2880") do={
:set $dynv6holdcounter 0;
/file remove "update?hostname=MYDOMAIN.dynv6.net&token=1a2b3c4d5e6f";
/tool fetch url=($dynv6url) mode=http;
/log info message=("IPv6 address of dynv6 updated to ".$currentv6addr);
} else={
:set $dynv6holdcounter ($dynv6holdcounter+1);
}
} else={
/log info message="bad ipv6 address for dynv6.";
:set $dynv6holdcounter 0;
}
}