Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Asus RT-AC68U (AsusWRT) DDNS problem

Discussion in 'Routers' started by andres99, Jun 19, 2017.

  1. andres99

    andres99 New Around Here

    Joined:
    Jun 19, 2017
    Messages:
    2
    It seems that I would need some help getting DDNS to work with AsusWRT 380.65. I am using an Asus RT-AC68U router, which is behind another router (and therefore does not get an external IP itself). I am using http://www.dynu.com as the dynamic DNS service.

    Dynu.com lets the hostname be updated by just going to the following URL:

    https://api.dynu.com/nic/update?hostname=xxx&myip=xxx&password=xxx

    where xxx are the respective values.

    In AsusWRT, I have enabled JFFS custom scripts and configs. I have copied a ddns-start script to /jffs/scripts/ddns-start (using WinSCP). In WAN -> DDNS I have enabled the DDNS Client (Server: Custom).

    The ddns-start script is as follows (all done on the basis of AsusWRT Wiki examples – dnsomatic.com is used to get the actual external IP address, according to an example that I found in AsusWRT wiki):
    Code:
    #!/bin/sh
    #
    # https://www.dynu.com/en-US/DynamicDNS/IP-Update-Protocol
    
    HOSTNAME=xxx.freeddns.org
    PASSWORD=xxx
    IP=$(wget -O - -q http://myip.dnsomatic.com/)
    
    URL="https://api.dynu.com/nic/update?hostname=${HOSTNAME}&myip=${IP}&password=${PASSWORD}"
    
    ANSWER=$(wget -q -O - "$URL")
    
    if [ "$ANSWER" == "good" ] || [ "$ANSWER" == "nochg" ]; then
      /sbin/ddns_custom_updated 1
    else
      /sbin/ddns_custom_updated 0
    fi
    
    However, the DDNS fails in practice and in the system log I am getting this every 30 seconds:
    Code:
    Jun 19 23:02:39 watchdog: start ddns.
    Jun 19 23:02:39 rc_service: watchdog 444:notify_rc start_ddns
    Jun 19 23:02:39 custom script: Running /jffs/scripts/ddns-start (args: 192.168.3.100)
    Jun 19 23:03:09 watchdog: start ddns.
    Jun 19 23:03:09 rc_service: watchdog 444:notify_rc start_ddns
    Jun 19 23:03:09 custom script: Running /jffs/scripts/ddns-start (args: 192.168.3.100)
    
    Note: 192.168.3.100 is the IP address of Asus RT-AC68U in the LAN behind the other router.

    Thanks anyone who can tell me what I have been doing wrong.
     
    Last edited: Jun 19, 2017
  2. andres99

    andres99 New Around Here

    Joined:
    Jun 19, 2017
    Messages:
    2
    It is quite surprising how relatively simple something can be in Tomato and how complicated the same thing can be in AsusWRT.

    However, I did it another way.

    Apparently Dynu also supports hostname updates that do not contain any IP address, like e.g.:

    https://api.dynu.com/nic/update?hostname=xxx&password=xxx

    So I created a script, /jffs/scripts/dynu.sh as follows:
    Code:
    #!/bin/sh
    curl -k --silent "https://api.dynu.com/nic/update?hostname=xxx&password=xxx"
    
    I also gave that script most access rights (0775). This script just connects to dynu.com and lets it know that the IP address from which it connects is presently used for my hostname. Apparently the DNSSEC option in LAN section of AsusWRT needs to be "Yes" for this to work.

    Then I also created /jffs/scripts/init-start (also with such access rights) as follows:
    Code:
    #!/bin/sh
    cru a dynu "*/30 * * * * /jffs/scripts/dynu.sh"
    
    The latter script makes dynu.sh run every 30 minutes to update the IP address information if it has changed meanwhile. The interval could also be shorter.

    Then I restarted the router and it works now. No updates for the AsusWRT interface but still much better than the previous situation of occurring retries every 30 secs for a reason that escaped me. It would still be interesting to know why Merlin's DDNS system, as proposed in AsusWRT wiki, did not work for me.

    P.S. I think that the method I used could also work with any other dynamic DNS service that does not require the IP address explicitly in the update URL/string.

    And if I got the logic correctly, this method may even be better than AsusWRT's native DDNS in the cases when the router is not directly connected to a WAN interface because when the WAN IP changes, the router might not know it and might not perform the DDNS update. But in this case it does that automatically after a certain interval.
     
    Last edited: Jun 20, 2017

Share This Page