Double NAT custom DDNS script
I have made a double NAT custom DDNS script for asus router (and possibly others as well) working for DDNS provider NOIP. The issues with double NAT is that our asus router does not report the external IP, only the ip reported for the WAN interface. For that reason it is necessary to perform a lookup on an external site (http://icanhazip.com/ and http://ipv4.myip.dk for backup).
Other examples of this script might be found here https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS, but a couple of users contacted me for help, and that is why I post my script and how to use it here. Also, supporting and adding features is easier through posts the forum. The script is free for use and feel free to implement modifications. I was also asked to add a donation link, which can be found on my profile - thank you very much.
Finally, I would like to give @Tanner Harman a huge thanks for his extensive testing and @Pila for great ideas.
Features:
A typical example of the Asus log:
How to use:
Script:
I have made a double NAT custom DDNS script for asus router (and possibly others as well) working for DDNS provider NOIP. The issues with double NAT is that our asus router does not report the external IP, only the ip reported for the WAN interface. For that reason it is necessary to perform a lookup on an external site (http://icanhazip.com/ and http://ipv4.myip.dk for backup).
Other examples of this script might be found here https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS, but a couple of users contacted me for help, and that is why I post my script and how to use it here. Also, supporting and adding features is easier through posts the forum. The script is free for use and feel free to implement modifications. I was also asked to add a donation link, which can be found on my profile - thank you very much.
Finally, I would like to give @Tanner Harman a huge thanks for his extensive testing and @Pila for great ideas.
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.
A typical example of the Asus log:
Aug 24 20:11:31 custom script: Running /jffs/scripts/ddns-start (args: 123.123.123.123)
Aug 24 20:11:31 admin: CustomUpdateDDNS: Starting custom DDNS updater v2.4
Aug 24 20:11:31 admin: CustomUpdateDDNS: Reported asus router ip: 123.123.123.123
Aug 24 20:11:31 admin: CustomUpdateDDNS: External ip detected
Aug 24 20:11:31 admin: CustomUpdateDDNS: (nochange) External IP address is current: 123.123.123.123
Aug 24 20:11:31 admin: CustomUpdateDDNS: Update not needed
Aug 24 20:11:32 ddns: Completed custom ddns update
Aug 24 20:11:32 admin: CustomUpdateDDNS: DDNS update complete
How to use:
- Remember to enable custom scripts (https://github.com/RMerl/asuswrt-merlin/wiki/User-scripts)
- Add the script below to /jffs/scripts/ddns-start and make it executable chmod +x ddns-start
- Enable the custom script in the DDNS setting i asus webui.
Version 2.4: First public release
Script:
Code:
Find it at https://github.com/Meliox/Utils/blob/master/ddns-start/ddns-start
Last edited: