Tuesday, March 21, 2017

Custom DDNS update script on ASUS router with merlin firmware

This post is a bit different than others, but it might save some of you some time. Lately, my ISP upgraded my network connection and forced me to use new cable modem which turns out to be multifunction modem and router. Unfortunately, it turns out that it had buggy firmware and was unable to work in bridge mode. It was very shitty device, so I would like to use my own ASUS router.
I was forced to switch to dual NAT, where ISP device was configured to NAT with my router address added as DMZ. This solved most of the problems related to port forwarding, etc.

Another set of problems started with ASUS DYNDNS service. Router was complaining that it's WAN port have IP address from private pool, due to dual NAT configuration. Because of that, it was unable to register in DynDNS service. Fortunately, I was using merlin's modified firmware, so I thought I will start wrote simple script to detect my public IP and register manually in Asus DYNDNS service.

First thing was to set the DDNS (dynamic DNS) service to "Custom", then you can fully control the update process through a ddns-start user script.
Following user script will do the work, by detecting external IP address and pointing domain to right IP address


#!/bin/sh
DOMAIN=your_domain
ez-ipupdate -h $DOMAIN -s ns1.asuscomm.com -S dyndns -a `curl ipecho.net/plain` -A 1 >/dev/null 2>&1 &

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


Put the script in place and voila!

3 comments:

  1. Iam a noob , can you help me with step by step process ?
    Iam using No Ip.com..

    ReplyDelete
    Replies
    1. Do you need custom scripts ? Is your device working behind the NAT, or it is enough to simply configure no-ip as per this tutorial http://www.noip.com/support/knowledgebase/asus-ddns/ ?

      Delete
  2. This comment has been removed by a blog administrator.

    ReplyDelete