Hello, this is my first topic in this forum, and my mother tongue isn’t English, may be I’m looks like not polite enough,trust me, I’m not mean it.
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:8207:254a:7150: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”.
I find out how to get date of file, and I wrote another script for calculate how many days did’n update DYNV6, run once per day. I ignored leap year problem this time, but there is some thing wrong in my script, I need some help.
Do not lost time in useless frills.
You need to do something every 10 days?
Schedule someting that run every 10 days: done…
(and when you copy someone script is nice to cite the source…)
And about the update script before, why wear uselessly the flash? Has a limited write count…
But if you insist on that way… How to calculate time difference between current RouterOS date and time and timezone to one internal file (or just between two dates)
In the example is checked the date of the “skins” folder. On device that have flash the name must be “flash/skins”
Thank you.
I want to calculate the time between twice update, because I heard about DYNV6.com required user update threir domains when IP address changed, not allowed many times update for the same IP address. So I'm thinking if I schedule to 10 days update once, when power failure, maybe my router will update my domain in a row. and I don't like DYNV6 disable my service.
Let me make my script better, I think I find a way, thank you for your scripts again.
And I'm not understand about write flash part, Is the Conuter in my script do that?
Script A run every 5 minutes, if the global function dynv6holdday over 14, will force update my domain.
Script B run once in one day, set function dynv6holdday to calculate how many days not update DYNv6, base on when DYNV6 update, it’s will download a web page file.
And I’m still trying to understand rextended’s script.
If what only matter is the IP… save inside RouterOS the IP and update only if after a reboot the current IP is different to the saved one…
You can use “unused” layer7 rules for store variables than must keeped between reboots…
/ip firewall layer7-protocol
add name="dyndns_ip" regexp="0.0.0.0"
add name="dyndns_ipv6" regexp="::"
set [find where name="dyndns_ip"] regexp="127.45.68.79"
set [find where name="dyndns_ipv6"] regexp="dead:beef:46::44"
:put [get [find where name="dyndns_ip"] regexp]
:put [get [find where name="dyndns_ipv6"] regexp]
That maybe a great idea, but I've no idea, how to get last update time by use layer7.
I'd like figure your script out, although I'm not fully understand it. what is "$1"? I can find out where is it come from.
Thank you.
What do you care about the last date?
Simply if the saved IP is different from the current one, update the saved IP with the new one and update the dyndns…
Why you going to complicate things?..
Because at first, I found mydomain stop gave me any resolution, that day, I noticed my ISP didn't changed my IPv6 address over 19 days. so my router didn't update DDNS as long as that.
My ISP gave me a PPPoE internet line, without fixed IP, normally, this PPPoE session redial every time, I got new IP addresses include IPv4 and IPv6. But, last time, I found my PPPoE client didn't redial in 19 days. Usually, my ISP should force the client offline once per 3 to 4 days, to redial PPPoE, but not happend. So I got a problem with my domain.
Ok, split the problem on two…
First is the usual dyndns need to upgrade the IP only if change,
the other is to force redial the pppoe after X times stil up?
In my situation, my router didn't do anything, because my IPv6 didn't change at all during this time, and DYNV6 stop my domain DNS resolution, it comes nothing result. I've tried to force my router last friday, make it redial the PPPoE in several times, and it got a same IPv6 address. So I got a idea, if the IPv6 address not change in another 14 days, force my router to upgrade DYNV6 once.
facing an issue with your ISP’s use of CGNAT on IPv4 and your router’s IPv6 address not changing as frequently as it should. While you have added a counter in your script to force updates, you’re concerned about losing the counter in case of a power failure. You’re considering calculating the days since the last update by getting the date of the file downloaded during the DYNV6 update. However, you’re unsure of how to get the date and perform the calculation.