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

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

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)?
 

XIII

Very Senior Member
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?
 

XIII

Very Senior Member
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 [email protected] {
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?
 

XIII

Very Senior Member
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...)
 

XIII

Very Senior Member
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...
 

Dabombber

Senior Member
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.
 

XIII

Very Senior Member
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.
 

XIII

Very Senior Member
And thanks: service restart_ddns works to update /etc/inadyn.conf with the contents of /jffs/configs/inadyn.conf.add without rebooting the router.
 

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