Use Afraid Custom Dynamic DNS on Asus Routers

Asuswrt-MerlinAsusWRT-Merlin custom firmware extends the functionality of your Asus wireless router. RMerl provides the source code on github so you know there is nothing shady going on. The Asus routers are a fantastic choice for any user looking to get more functionality out of their home network like VPN access or automatically updating custom dynamic DNS. Installing the AsusWRT-Merlin custom firmware takes less than 5 minutes and a reboot (guide). This Asus router configure dynamic DNS tutorial was adapted from the Wiki for Afraid’s great free DNS service.

Router Model
Wireless
Speed
Band
USB
Price
Asus RT-AC68U
802.11 ac
1900 Mbps
2.4 + 5 GHz
2 (1 USB 3.0)
$174
Asus RT-AC88U
802.11 ac
2100 Mbps
2.4 + 5 GHz
2 (1 USB 3.0)
$274
Asus RT-AC66U
802.11 ac
1750 Mbps
2.4 + 5 GHz
2 USB 2.0
$133
Asus RT-N66U
802.11 n
900 Mbps
2.4 + 5 GHz
2 USB 2.0
$100

Use Afraid Custom Dynamic DNS on Asus Routers

Here is the overall todo list to get custom dynamic DNS to work on your Asus router

  • Enable SSH on your Asus router (guide)
  • Sign up for Dynamic DNS and get your secret key
  • Turn off jffs partition formatting
  • Create and enable the Dynamic DNS script

Sign up for Dynamic DNS

I use Afraid DNS since they have minimal nagging about how often you need to log in to keep your account active. Last I checked it was every 6 months.

You will need your Direct URL with secret key from the Free Dynamic DNS account you just created.

Log in to your account at afraid.freedns.org and click Dynamic DNS in the left pane.

Scroll down and you will see a Direct URL hyperlink.

The link looks something like this with a hash string instead of HTPCGuidesSecretKey

http://freedns.afraid.org/dynamic/update.php?HTPCGuidesSecretKey

You will need that secret key later when we create the script on the Asus router

Turn off JFFS Formatting

We are going to put the custom DNS script on a partition that is wiped when the router reboots. You can disable wiping of this partition so the script stays there forever.

Log in to the Asus web interface. In the left pane under the Advanced Settings section, click Administration

Now click the System tab, under Persistent JFFS2 partition set Format JFFS partition at next boot to No

Set Enable JFFS custom scripts and configs to Yes

Scroll down and click Apply

asus-router-jffs-disable-min

Create the Custom DDNS Script

SSH into Asus router and enter the jffs scripts folder

cd /jffs/scripts

Create the ddns-start script

vi ddns-start

Now copy these lines  and paste them into the vi editor (in Putty right-click pastes).

This script is very simple, it makes a call to Afraid FreeDNS using your private key to update the IP address for you dynamic DNS address.

#!/bin/sh

wget -q http://freedns.afraid.org/dynamic/update.php?your-private-key-goes-here -O - >/dev/null

if [ $? -eq 0 ]; then
    /sbin/ddns_custom_updated 1
else
    /sbin/ddns_custom_updated 0
fi

Vi can be fiddly, to save this file you must be in a specific mode which you can see by look in the bottom left corner of the screen.

Press Esc and you should see a dash in the bottom left corner

- ddns-start [Modified]

While in this mode you can save by entering :w and then exit by entering :q

Make the DDNS script executable

chmod a+x /jffs/scripts/ddns-start

Enable the Custom DDNS Script

Log back into the Asus router web interface to enable custom DDNS.

Under Advanced Settings choose WAN

Click the DDNS tab and set Enable the DDNS Client to Yes

Set Server to Custom (which uses the script we created before) and click Apply

asus-router-enable-custom-ddns-web-interface-min

Test the script is owrking by looking at the Asus router’s log files which you can do straight in the web interface.

Under Advanced Settings choose System Log and then General Log tab

You should see entries like this indicating the custom DDNS script is running successfully

May  6 09:55:24 watchdog: start ddns.
May  6 09:55:24 rc_service: watchdog 263:notify_rc start_ddns
May  6 09:55:24 custom script: Running /jffs/scripts/ddns-start (args: your.internet.ip)
May  6 09:55:25 ddns: Completed custom ddns update

Now your dynamic DNS address from Afraid DNS will be automatically updated when your IP address changes