Custom DDNS

François M edited this page May 1, 2018 · 70 revisions
Clone this wiki locally


If you set the DDNS (dynamic DNS) service to "Custom", then you can fully control the update process through a ddns-start user script (which could launch a custom update client, or run a simple "wget" on a provider's update URL). The ddns-start script is passed the WAN IP as an argument.

Note that your custom script is responsible for notifying the firmware on the success or failure of the process. To do this your script must execute:

/sbin/ddns_custom_updated 0 or 1

(where 0 = failure, 1 = successful update)

If you can't determine the success or failure, then report it as a success to ensure that the firmware won't continuously try to force an update.

Finally, like all user scripts, the option to support custom scripts and config files must be enabled under Administration -> System.

After enabling custom scripts, place the contents of your update script in /jffs/scripts/ddns-start and Enable the DDNS Client in WAN -> DDNS and use Custom as Server.

Using a DDNS with Double NAT

If your ASUS router is double NATed behind your ISP's router, you may need to retrieve your external IP rather than using the one passed to it from the Custom DDNS settings. Find the line in your update script where the IP is used


and change it to get the IP from an external source

IP=$(wget -O - -q

The above uses dnsomatic, but it can be modified to work with any source. The OpenWrt wiki provides a list here.

Using a DDNS with VPN

Here is an example of a script for redirecting a DDNS to a VPN IP, in openvpn-event script, add:

sh /jffs/scripts/ &

create /jffs/scripts/ and add the following code, editing the username, password and dyndns host

#keep looping until all the routing for the VPN tunnel is established
while [ ! -n  "`ifconfig | grep tun11`" ]; do
    sleep 1
#once established, get VPN IP
VPNIP=$(wget -qO -
sleep 10
ez-ipupdate -S dyndns -u user:password -h -a $VPNIP #update dyndns with VPN IP
exit 0

and make it executable

chmod 700 /jffs/scripts/

For more sample scripts please check the following link