What's new

DDNS: how to set up ASUS (primary), No-IP (backup), and push notification?

  • 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!

XIII

Very Senior Member
For an experiment I want to achieve this:
  1. Use *.asuscomm.com as main DDNS service
  2. Use No-IP as backup DDNS service
  3. Get a push notification (using Pushover) when the IP changes
Unfortunately I'm confused by the Wiki page on DDNS services.

It seems like I can achieve this by:
  1. Configuring WWW.ASUS.COM in the web GUI
  2. Additionally configuring No-IP in /jffs/configs/inadyn.conf.add
  3. Writing code to send a push notification in /jffs/scripts/ddns-start
My questions:
  • Do I understand this correctly, or does one of these steps exclude another?
  • Does the ddns-start script only get called when the IP changes, or do I need to check that myself? (to prevent too many push notifications)
  • How can I test this flow, without forcing a new ISP IP (if possible at all)?
 
I was hoping I could at least answer my second question myself by looking at the source code, but I can't even find "ddns-start" (except just as "text" twice):


Huh?
 
I tried to add No-IP as a backup, but it does not seem to work...

Code:
inadyn --check-config
gives no errors for my /jffs/configs/inadyn.conf.add:
Code:
provider default@no-ip.com {
hostname = <hostname>.ddns.net
username = "<username>"
password = "<password>"
}

And it seems to work when invoked manually:
Code:
> inadyn --force -n
inadyn[6170]: In-a-dyn version 2.7 -- Dynamic DNS update client.
inadyn[6170]: Update forced for alias <hostname>.ddns.net, new IP# <my wan IP>
inadyn[6170]: Updating cache for <hostname>.ddns.net

However:
Code:
> dig +short <hostname>.ddns.net
1.1.1.1

And on https://my.noip.com/#!/dynamic-dns it's also still 1.1.1.1 (which I manually set it to before running these tests, to see the change)

What am I doing wrong?
 
Looks like Skynet is blocking it, because when I disable Skynet I see this:
Code:
> inadyn --force -n
inadyn[9988]: In-a-dyn version 2.7 -- Dynamic DNS update client.
inadyn[9988]: Update forced for alias <hostname>.ddns.net, new IP# <my wan IP>
inadyn[9988]: Fatal error in DDNS server response:
inadyn[9988]: [401 Unauthorized] badauth
inadyn[9988]: Error response from DDNS server, exiting!
inadyn[9988]: Error code 50: Authentication failure

(my password may have special characters that make parsing it difficult...)
 
With a simple password I'm back to this:
Code:
> inadyn --force -n
inadyn[6170]: In-a-dyn version 2.7 -- Dynamic DNS update client.
inadyn[6170]: Update forced for alias <hostname>.ddns.net, new IP# <my wan IP>
inadyn[6170]: Updating cache for <hostname>.ddns.net

But no update on No-IP...
 
Unfortunately I'm confused by the Wiki page on DDNS services.
The "services supported by In-a-dyn but not by the Asuswrt-Merlin" bit is just using ddns-start, and running inadyn manually from there.

My questions:
  • Do I understand this correctly, or does one of these steps exclude another?
  • Does the ddns-start script only get called when the IP changes, or do I need to check that myself? (to prevent too many push notifications)
  • How can I test this flow, without forcing a new ISP IP (if possible at all)?
  • That should work.
  • It'd be best to check if the IP has changed yourself since it's easy enough to do, it's also worthwhile to make sure it only runs once at a time.
  • Not sure about inadyn (perhaps service start_ddns), but you can run /jffs/scripts/ddns-start "$(nvram get wan0_ipaddr)" from the command line to test ddns-start
For the second point, something like the following, using namecheap as an example since I'm not sure how your push notification are called.
Bash:
#!/bin/sh

# IP update code
ddns_update() {
    # for example
    HOSTNAME='hostname'
    DOMAIN='domain.com'
    PASSWORD='XXXXXXXXXXXXXXXXXXXXXXXX'
    curl -fs -o /dev/null "https://dynamicdns.park-your-domain.com/update?host=$HOSTNAME&domain=$DOMAIN&password=$PASSWORD&ip=$1"
}

# Lock file to prevent multiple instances
LOCKFILE='/tmp/.ddns-start.lck'
# File to store last successfully set IP
CACHEFILE='/jffs/configs/.ddns-start.cache'

# Make sure only one ddns update runs at a time
ddns_lock() {
    [ ! -f "$LOCKFILE" ] && touch "$LOCKFILE" && trap '{ rm -f "$LOCKFILE"; exit; }' EXIT INT TERM
}

# Compare the cached IP to an IP
ddns_cache_cmp() {
    [ -f "$CACHEFILE" ] && printf '%s\n' "$1" | cmp -s "$CACHEFILE"
}

# Save the current IP
ddns_cache_set() {
    printf '%s\n' "$2" > "$CACHEFILE"
}

if ! ddns_lock; then
    logger -t 'ddns-start' 'ddns update already in progress'
elif ddns_cache_cmp "$1"; then
    logger 'ddns is up to date'
    /sbin/ddns_custom_updated 1
else
    if ddns_update "$1"; then
        logger -t 'ddns-start' "ddns successfully updated ($1)"
        ddns_cache_set "$1"
        /sbin/ddns_custom_updated 1
    else
        logger -t 'ddns-start' 'ddns failed to update'
        /sbin/ddns_custom_updated 0
    fi
fi

I was hoping I could at least answer my second question myself by looking at the source code, but I can't even find "ddns-start" (except just as "text" twice)
The code you're looking for is in src/router/rc/services.c, where a lot of the good stuff is.
 
The "services supported by In-a-dyn but not by the Asuswrt-Merlin" bit is just using ddns-start, and running inadyn manually from there.
I'm actually following the Updating multiple services section of the Wiki. That only mentions creating/updating /jffs/configs/inadyn.conf.add, but not ddns-start (there's currently no such script on my router).

I already created a simple script that compares nvram get wan_ipaddr with the output of nslookup my.domain.com and sends a push notification when the IP changed. Let's see whether this KISS approach works...

Thank you for pointing me to the correct source file. I will investigate that to learn about how this flow operates.
 
And thanks: service restart_ddns works to update /etc/inadyn.conf with the contents of /jffs/configs/inadyn.conf.add without rebooting the router.
 
~~
It seems like I can achieve this by:
  1. Configuring WWW.ASUS.COM in the web GUI
  2. Additionally configuring No-IP in /jffs/configs/inadyn.conf.add
  3. Writing code to send a push notification in /jffs/scripts/ddns-start
FWIW I have a similar setup, that I've used for a long time now. The main differences are, that I use No-IP as the main / 1st DDNS provider (see SSL note below as to why) and Asus as the additional / 2nd DDNS provider. So my No-IP DDNS domain is configured in the web GUI & my Asus DDNS domain is added in the file you've mentioned: /jffs/configs/inadyn.conf.add - I don't use push notifications, as everything that's needed (by me) is in the logs.

The only current issue I have, is that there is no 100% fully functional IPv6 DDNS service yet from Asus. So those IPv6 DDNS dysfunctional parts was removed by Merlin a little while ago, until those issues are solved by Asus.
I'm actually following the Updating multiple services section of the Wiki. That only mentions creating/updating /jffs/configs/inadyn.conf.add, but not ddns-start (there's currently no such script on my router).
Yep. That's how I've done it. as for the re-start, see below:
And thanks: service restart_ddns works to update /etc/inadyn.conf with the contents of /jffs/configs/inadyn.conf.add without rebooting the router.
You can re-start the DDNS Client from within the GUI scMerlin add-on, which will also do that ^^ too - FWIW.

The choice of No-IP for being the first in my DDNS setup, was because they provide a One Year Trustcor Standard DV SSL Certificate which is included for FREE with all of their DDNS Accounts. It's easy to add and then, via the simple, effective add-on that's mentioned in this helpful post, you can use your No-IP DDNS name as the FQDN:8443 to reach your router via https locally, but... you can do this without all of the error warnings that you will receive, if, you just use the IP address e.g. 192.168.1.1:8443 This still works perfectly, if, as expected, you have selected No for the Enable Web Access from WAN on your /Advanced_System_Content.asp GUI page too.
 
My situation has changed over time:
  • using Cloudflare (D)DNS (and Let's Encrypt certificates) as primary DDNS
  • using No-IP as secondary DDNS
  • using Asus as tertiary DDNS
Works great so far, but I don't like that credentials are stored in JFFS, so a future experiment is to throw 1Password in the mix:

 
Last edited:

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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