What's new

Double NAT custom DDNS script

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

You're not completely right. The script saves your external ip and checks your current external ip against it. If the current external ip differs, a request to no-ip will be made. And only then.
It is generally bad to send a request to a website when it can be handled locally in the script.
Initially, e.g. after each router reboot, your external ip has not been stored, thus the script will send a request and store your external ip. Afterwards it will only update/send a request if you have a new ip.
 
Thank you for this.
I hope something like this will be integrated into stock-merlin for all of us in the future.
 
The script looks wonderful, however, I would like to use the free Asus ddns service in a double nat situation. Anyone knows a script that could do that? Is there any documentation on how the asus ddns api should be called?
 
The script looks wonderful, however, I would like to use the free Asus ddns service in a double nat situation. Anyone knows a script that could do that? Is there any documentation on how the asus ddns api should be called?
Hello,

I have not been able to find any example/documentation of that...

@RMerlin Do you know if asus ddns service can be accessed through an api?
 
Hello,

I have not been able to find any example/documentation of that...

@RMerlin Do you know if asus ddns service can be accessed through an api?

No idea. Look at the ez-ipupdate sources to get an idea of how their API works.
 
Hello,

Can I just log ddns messages in case of ext. IP change?

I set the interval to 10 min and the system log is now full of ddns messages.

thanks in advance.
 
Features:
  • External IP lookup
  • Only perform DDNS update if external IP has changed
  • Automatically detect Carrier grade NAT(https://en.wikipedia.org/wiki/Carrier-grade_NAT) and perform external lookup
  • Logging to Asus log, or logfile
  • Custom update rate, i.e. possible check if external IP has changed each 10 mins instead for daily.

I worry about privacy here - GPDR and all the related stuff...

Nice script, that being said...

Code:
LogMe "CustomUpdateDDNS: Reported asus router ip: $ASUSIP"
if [[ -n "$(echo "$ASUSIP" | grep -E '^(10\.|100\.(6[4-9]|7[0-9]|8[0-9]|9[0-9]|1[0-2][0-9])\.|172\.(1[6789]|2[0-9]|3[01])\.|192\.0\.0\.|192\.168|198\.1[89])')" ]]; then
# check if we have a local ip. If true, then look up external ip
LogMe "CustomUpdateDDNS: Local ip detected"
# look up external ip
NEWIP=$(curl -s http://icanhazip.com/)
# backup ipcheck if first one fails
if [[ -z "$NEWIP" ]]; then
NEWIP=$(curl -s http://ipv4.myip.dk/api/info/IPv4Address | cut -d "\"" -f2)
fi
LogMe "CustomUpdateDDNS: Found external ip: $NEWIP"
else
NEWIP="$ASUSIP"
LogMe "CustomUpdateDDNS: External ip detected"
fi

Sources there - have they been vetted?
 
Sure valid point. And, no - they have not been vetted. GDPR has recently approved and gone live - way later than the original script was written.

You're welcome to use your own source to look up the ip if you have a more "trusted one", or if you can suggest me one. Then I can update the script for everyone. Thank you.
 
Sounds like they do the same, but this script uses noip.me for DNS provider not the asus one.
 
I modified the script a bit that added some "###" at the front of the line with those "Logme "s i don't need. Now it is much better for me.

It is hard to remove bellowed lines in the router system log in case of Ext. IP not changed, isn't it? Now they are appeared in the log every 10 min as I set the interval.

Sep 2 16:20:00 crond[765]: USER admin pid 3488 cmd /jffs/scripts/ddns-start
Sep 2 16:20:02 ddns: Completed custom ddns update

Anyway, I am satisfied with this script.
 
New version: https://pastebin.com/P18y0nS7 (will upload to github once asuswrt has been verified)

@Grisu: Added amazon as default ip lookup provider - i expect them to follow the law :) In any case. You can enter whomever you like. No default backup procider though.

@chncar: Please try this version. A silent mode has been added. It should only write in case ip has change. Please confirm. Sorry, crond and ddns is out my hand.

@mmjlmjl: Added asuswrt ddns in this version. Please check if it works - i cannot do that myself.

In all cases please add logs. E.g. execute manually sh -x ddns-start (remember to remove personal information.) Thank you.
 
@Steffe
Loaded. So far so good. And sorry I am not good at PC code, so I just copied messages from the router system log.

(IP address is fake)
Sep 2 21:24:51 admin: CustomUpdateDDNS: Starting custom DDNS updater v3.0
Sep 2 21:24:51 admin: CustomUpdateDDNS: Reported asus router ip: 192.168.999.999
Sep 2 21:24:51 admin: CustomUpdateDDNS: Local ip detected
Sep 2 21:24:54 admin: CustomUpdateDDNS: Found external ip: 999.95.999.206
Sep 2 21:24:54 admin: CustomUpdateDDNS: (nochange) External IP address is current: 999.95.999.206
Sep 2 21:24:54 admin: CustomUpdateDDNS: Update not needed
Sep 2 21:24:54 ddns: Completed custom ddns update
Sep 2 21:24:54 admin: CustomUpdateDDNS: DDNS update complete

I set SILENT="false" for the 1st time run and will change to "true" after this posted.

My operator will change my ext. IP tomorrow night. Keep you informed.
 
New version: https://pastebin.com/P18y0nS7
Added asuswrt ddns in this version. Please check if it works - i cannot do that myself.
Could you answer if Asus ez-ipupdate is useing https or only http, or will we simply have to wait that the new version of ez-ipupdate will be implemented in firmwares (and maybe Merlins new test-build uses it from my 3rd link above)?
 
I only know what is stated by rmerlin: "I need people to test a new version of ez-ipupdate that now supports HTTPS for updating your DDNS service (previously ez-ipupdate only supported HTTP - that's right, zero encryption...)"

You'll have to wait unfortunately.
Amazon+noip is https.
 
And if you wait a bit longer, I have a new solution that will make it no longer necessary to use a script to handle double NAT.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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

Staff online

Top