What's new

[Solution] ASUSwrt DDNS updater script that works with multi-NAT

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

Wallace

Occasional Visitor
I am sharing a shell script to use the free DDNS service for your ASUSwrt device.
The available DDNS hostname is [your-hostname].asuscomm.com

This solution will work with Access Point (AP) mode, when the web ui does not allow DDNS configuration.

DDNS update script:
update-ddns-asuswrt.sh
  1. Enable SSH on ASUSwrt device.
  2. Update [your-hostname] with your preferred hostname in update-ddns-asuswrt.sh
  3. Use scp to upload update-ddns-asuswrt.sh to ASUSwrt device, execute this from your computer (macbook) while connected to ASUSwrt device:
    Code:
    scp update-ddns-asuswrt.sh [asus-device-ip]:/jffs/
    For Windows users, see Transfer Files Using PuTTY
  4. SSH to ASUSwrt device, execute this from your computer (macbook) while connected to ASUSwrt device:
    Typically [username] is admin.
    Code:
    ssh [username]@[asus-device-ip]
  5. For Windows users, see Using PuTTY SSH
  6. Execute the following commands on the ASUSwrt device over the SSH connection:
    Code:
    cru a 1 "*/5 * * * *" /jffs/update-ddns-asuswrt.sh
  7. Verify the cronjob is created:
    Code:
    cru l

    Output:
    Code:
    */5 * * * * /jffs/update-ddns-asuswrt.sh #1#
  8. This cronjob runs every 5 minutes, check the logfile to monitor the cronjob:
    Code:
    tail -f /tmp/var/log/syslog.log
  • Optional: If cronjob is not running, reload the crond process:
    Code:
    echo admin > /tmp/var/spool/cron/crontabs/cron.update
Hope this helps!
 
Last edited:
THANKS a lot!

THAT what I am waiting for 5 years !!!

Will try it on weekend and report back whether I got it, seems to be a noob proof manual, hope I get it. Never done anything with scripts and no Linux experience.
Best requirements to be a tester.
 
Is there a possibility to run this script from an USB-stick as I use only asuswrt because of Aimesh or is even jffs possible on asuswrt?
 
Is there a possibility to run this script from an USB-stick as I use only asuswrt because of Aimesh or is even jffs possible on asuswrt?

You can run the script from whichever path you choose, including from an USB drive.
 
You can run the script from whichever path you choose, including from an USB drive.

Thanks, could you please advice me how to do, never did something like that, know only how to telnet or SSH to the router and execute given commands, linux and its world is something very strange to me.
What would I have to change in the above perfect manuel for USB usage.
 
Last edited:
Thanks, could you please advice me how to do, never did something like that, know only how to telnet or SSH to the router, linux and its commands is something very strange to me.
What would I have to change in the above perfect manuel for USB usage.

Just change /jffs to /tmp/mnt/sda1

Your USB drive might mount to a different path
 
this command gave a failure:
/tmp/home/root# tail -f /tmp/var/log/update_ddns_asuswrt.log
tail: can't open '/tmp/var/log/update_ddns_asuswrt.log': No such file or directory
tail: no files

IP lookup not updated at the moment (after 10 min. now).

I edited "update-ddns-asuswrt.sh" with my x1x2x3x4x5.asuscomm.com, put it on a FAT stick which is seen on USB2.0 but no ftp activated or something else.
Then entered this commands in SSH:
scp update-ddns-asuswrt.sh to /tmp/mnt/2GB_stick/
cru a 1 "*/5 * * * *" /tmp/mnt/2GB_stick/update-ddns-asuswrt.sh
cru l
# correct output: */5 * * * * /tmp/mnt/2GB_stick/update-ddns-asuswrt.sh #1#
tail -f /tmp/var/log/update_ddns_asuswrt.log
# wrong output: can't open '/tmp/var/log/update_ddns_asuswrt.log': No such file or directory
# wrong output: tail: no files
echo admin > /var/spool/cron/crontabs/cron.update

Sorry for being completely lost.
 
Is there a way to log rotate in ASUSwrt firmware?
 
sorry does not work for me.

IP seems to be seen correct but not updated to asus-DDNS, public_IP and MYIP is same as on modem 62.46.xxx.xxx:
zzzzz@RT-AC68U:/tmp/mnt/2GB_stick# sh ./update-ddns-asuswrt.sh
PUBLIC_IP : '62.46.xxx.xxx'
DDNS_IP : '62.47.yyy.yyy'
/tmp/myip : 62.46.xxx.xxx
MYIP : '62.46.xxx.xxx'
ez-ipupdate Version 3.0.11b5
Copyright (C) 1998-2001 Angus Mackay.
read_input ret: 1
read_input ret: 1
Update failed. (203)

used this command for testing update
zzzzz@RT-AC68U:/tmp/mnt/2GB_stick# /usr/sbin/ez-ipupdate -S dyndns -i eth0 -a 62.46.xxx.xxx -h my_name.asuscomm.com -A 2 -s nwsrv-ns1.asus.com
ez-ipupdate Version 3.0.11b5
Copyright (C) 1998-2001 Angus Mackay.
read_input ret: 1
read_input ret: 1
Update failed. (203)

so this line seems for me to fail.

Shall I try different name.asuscomm.com?
I set it before with this router and another modem in bridge-mode and is registered to me.
http://iplookup.asus.com shows old IP 62.47.. which I had weeks ago with this test.

Syslog showing something confusing to me as there is additional 60 to my_name, is that correct?
Jul 4 12:10:05 update-ddns-asuswrt.sh[4100]: Public IP changed
Jul 4 12:10:05 update-ddns-asuswrt.sh[4100]: Updating my_name.asuscomm.com to new IP: 62.46.xxx.xxx
Jul 4 12:10:05 ddns update: ez-ipupdate: starting...
Jul 4 12:10:05 ddns update: g_asus_ddns_mode == 2
Jul 4 12:10:05 ddns update: connected to nwsrv-ns1.asus.com (103.10.4.108) on port 80.
Jul 4 12:10:08 ddns update: Asus update entry:: return: HTTP/1.1 203 |myname.asuscomm.com|myname60.asuscomm.com^M Date: Wed, 04 Jul 2018 10:10:05 GMT^M Server: Apache^M X-Powered-By: PHP/5.6.30^M Content-Length: 0^M Content-Type: text/html; charset=UTF-8^M ^M
Jul 4 12:10:08 ddns update: retval= 1, ddns_return_code (,203)
Jul 4 12:10:08 ddns update: asusddns_update: 1
Jul 4 12:10:08 ddns update: exit_main
 
"my_name.asuscomm.com" is not a valid hostname.
Underscores (_) are not allowed in hostnames.
 
"my_name.asuscomm.com" is not a valid hostname.
Underscores (_) are not allowed in hostnames.
it's only a placeholder for my real username (only some characters).

Router is set to AP-mode with IP from modem-DHCP.

Last command will produce failure too:
echo admin > /var/spool/cron/crontabs/cron.update
Jul 4 16:45:01 crond[288]: admin: No such file or directory

For test loaded merlin A2 and get failure too, jffs enabled and reboot:
scp update-ddns-asuswrt.sh to /jffs/
cp: can't stat 'to': No such file or directory
 
Last edited:
zzzzz@RT-AC68U:/tmp/mnt/2GB_stick# /usr/sbin/ez-ipupdate -S dyndns -i eth0 -a 62.46.xxx.xxx -h my_name.asuscomm.com -A 2 -s nwsrv-ns1.asus.com
ez-ipupdate Version 3.0.11b5
Copyright (C) 1998-2001 Angus Mackay.
read_input ret: 1
read_input ret: 1
Update failed. (203)

so this line seems for me to fail.

Try without "-i eth0" option, your device might not have "eth0" interface.
Code:
/usr/sbin/ez-ipupdate -S dyndns -a 62.46.xxx.xxx -h your-hostname.asuscomm.com -A 2 -s nwsrv-ns1.asus.com
 
same error with Merlin and jffs

Your first command doesn't work, gives error:
Code:
scp update-ddns-asuswrt.sh to /jffs/
correct I think without "to":
scp update-ddns-asuswrt.sh /jffs/

I think there is a eth0 on my RT-AC68U (got little help to find this):
eth0: Broadcom BCM47XX 10/100/1000 Mbps Ethernet Controller 6.37.14.126 (r561982)
eth1: Broadcom BCM4360 802.11 Wireless Controller 6.37.14.126 (r561982)
eth2: Broadcom BCM4360 802.11 Wireless Controller 6.37.14.126 (r561982)

Suggestion: will it need any port forward on my modem to update IP?

Another interesting thing: my system time shows 19:49:30 and cron-job ran with error and time stamp 19:50:08, so about a half minute before system time?!?
 
Last edited:
Your first command doesn't work, gives error:
Code:
scp update-ddns-asuswrt.sh to /jffs/
correct I think without "to":
scp update-ddns-asuswrt.sh /jffs/

I think there is a eth0 on my RT-AC68U

Suggestion: will it need any port forward on my modem to update IP?

Another interesting thing: my system time shows 19:49:30 and cron-job ran with error and time stamp 19:50:08, so about a half minute before system time?!?

That command is no meant to be copy and pasted, it’s more an instruction. It’s just transferring the EDITED script (with name of your choosing for domain name) to the router.

All Most* devices have eth0, that’s the WAN/Internet port.

Edit: PPPoE might not

You won’t need port forwarding anywhere for this. Do you mean modem or router?

Half minute before or after system time? The error timestamp looks to be LATER than the system timestamp, not sure what you’re trying to say here.
 
Last edited:
sorry, thought 'Code:' would really mean code and not instruction.

I mean modem (modem-router of course, bridge not possible) which is on the line.

So script with "-i eth0" should be fine, is it that what you want to say?

Sys-log is running 1/2 minute before system time so it shows later time stamp like clock is running earlier than system clock.
But before or late, maybe only my broken english - sorry for that!
In my opinion it should be system time and not something around, thats all I wanted to say.
I am wondering to get recent time stamps from the future ... like my router knows what will happen in a minute, should bet on horse races with it ...

Does it have a separate RTC?
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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