What's new

Resolved -- Custom DDNS Does Not Work (Check My Code)

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

PVO

New Around Here
Hey Forum. I've been desperately trying to get custom DDNS to work and finally gave up and am looking for help from you all. Chances are someone will know what's going on from looking at the logs (below) but I cant figure it out. Hoping for an easy fix... thanks in advance for the help!

My Setup:
  • RT-AC68U
  • Firmware Version:384.8_2
Preconditions:
1. Added the following script named `ddns-start` to `/jffs/scripts` directory on router via SSH (Obviously {{Redacted}} has a value):

Code:
#!/bin/sh
#setting variables

SUBDOMAIN="{{REDACTED}}"
TOKEN="{{REDACTED}}"
WANIP=${1}

# to get WAN externally
## WANIP=$(curl --silent http://api.ipify.org/)
echo "WANIP is $WANIP"

# updating IP
curl "https://njal.la/update/?h=$SUBDOMAIN&k=$TOKEN&a=$WANIP"
echo "result is $?"

# reporting results to router
if [ $? -eq 0 ];
then
    echo "update success"
    /sbin/ddns_custom_updated 1
else
    echo "update failure"
    /sbin/ddns_custom_updated 0
fi

2. Ran the code directly in the terminal to verify success which results in the following (I've faked the WANIP here since ${1} had no value when run directly in terminal but I've set the variable manually and run it to confirm no issues with the script structure):

Code:
XXXX@RT-AC68U-F048:/jffs/scripts# sh  ddns-start
WANIP is {REDACTED}
{"message": "record updated", "value": {REDACTED}, "status": 200} #response from nja.la
result is 0
update success

3. Navigated to AsusWRT Merlin interface on router /Advanced_ASUSDDNS_Content.asp to setup DDNS with the following Attributes:

  • Enable the DDNS Client = Yes
  • Method to retrieve WAN IP= Internal
  • Server=Custom
  • Host Name={{Redacted}} -- doesnt matter anyways since it's specified in the script as `subdomain`
  • Forced update interval (in days)=21
  • HTTPS/SSL Certificate=none
Repro
  1. Assuming all above preconditions click "Apply"
  2. ACTUAL: Layer comes up and says "UPDATING" and never goes away and is never successful (See logs below)
    1. I can force the UI to "successful" state by manually running the script in ssh.
  3. EXPECTED: Custom Script applied successfully without manual intervention
Logs
Show a loop of the following ({{REDACTED}} shows WANIP:
Code:
Jan  3 20:46:22 rc_service: watchdog 273:notify_rc start_ddns
Jan  3 20:46:22 start_ddns: update CUSTOM , wan_unit 0
Jan  3 20:46:22 custom_script: Running /jffs/scripts/ddns-start (args: {{REDACTED}} ) - max timeout = 120s
Jan  3 20:46:52 watchdog: start ddns.
Jan  3 20:46:52 rc_service: watchdog 273:notify_rc start_ddns
Jan  3 20:46:52 start_ddns: update CUSTOM , wan_unit 0
Jan  3 20:46:52 custom_script: Running /jffs/scripts/ddns-start (args: {{REDACTED}} ) - max timeout = 120s
Jan  3 20:47:22 watchdog: start ddns.
Jan  3 20:47:22 rc_service: watchdog 273:notify_rc start_ddns
Jan  3 20:47:22 start_ddns: update CUSTOM , wan_unit 0
Jan  3 20:47:22 custom_script: Running /jffs/scripts/ddns-start (args: {{REDACTED}} ) - max timeout = 120s
Jan  3 20:47:52 watchdog: start ddns.
Jan  3 20:47:52 rc_service: watchdog 273:notify_rc start_ddns
Jan  3 20:47:52 start_ddns: update CUSTOM , wan_unit 0
Jan  3 20:47:52 custom_script: Running /jffs/scripts/ddns-start (args: {{REDACTED}} ) - max timeout = 120s
 
Last edited:
Bump...

Still stuck here :( Any Ideas? I know this community is far more knowledgable than myself! Any help/direction/suggestions appreciated. Even "that seems like it should work" is helpful as I can file a formal bug if there's something awry here.
 
Do you have multiple WAN interfaces? The watchdog code dealing with DDNS updates is a bit hairy in multiwan setups, so something could be broken there for custom DDNS services.
 
I don't know whether it's relevant to your problem, but your script has output being to the terminal (stdout). That can sometimes cause problems for programs that aren't actually attached to a terminal, as is the case when it's called from rc_service.

So I'd start by removing the echo's and piping the output from curl to /dev/null.
 
Do you have multiple WAN interfaces? The watchdog code dealing with DDNS updates is a bit hairy in multiwan setups, so something could be broken there for custom DDNS services.

Nope, multi WAN is not configured.
 
I don't know whether it's relevant to your problem, but your script has output being to the terminal (stdout). That can sometimes cause problems for programs that aren't actually attached to a terminal, as is the case when it's called from rc_service.

So I'd start by removing the echo's and piping the output from curl to /dev/null.

I think i tried that originally and it didn't work so i added the output so i could try to debug (I'm sure theres a better way but this is my first script attempt so it's cobbled together from the internet -- as you might have noticed :D)

I can give this a shot again when i've got access to my router again this weekend.
 
I don't know whether it's relevant to your problem, but your script has output being to the terminal (stdout). That can sometimes cause problems for programs that aren't actually attached to a terminal, as is the case when it's called from rc_service.

So I'd start by removing the echo's and piping the output from curl to /dev/null.
Or perhaps redirect to a file on jffs for debugging purposes?
 
I've simplified the script and eliminated all output and still getting the same result. Here's my cleaned up script:
Code:
#!/bin/sh
#setting variables
SUBDOMAIN="REDACTED"
TOKEN="REDACTED"
# to get IP internally
WANIP=${1}
# updating IP
curl --silent "https://njal.la/update/?h=$SUBDOMAIN&k=$TOKEN&a=$WANIP" > /dev/null 2>&1
# reporting results to router
if [ $? -eq 0 ];
then
    /sbin/ddns_custom_updated 1
else
    /sbin/ddns_custom_updated 0
fi

Another note. I'm able to get the script to run just fine with the `sh ddns-start` command directly in PuTTY (of course the WANIP returns nothing since it's not provided by the internal router script so it reports a null IP -- but it DOES run). in fact it's the only way I'm able to stop the looping script executed by the router when it tries to run my ddns-start script to update the DDNS (thus the forever loading screen in the router interface described in my OP).

Any other ideas or is this worth a bug?
 

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