What's new

How to get DDNS for secondary WAN

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

Santiago C

Regular Contributor
Hi,

I was trying to get an additional DDNS name for my secondary wan in a load balance dual wan config but since the GUI only provides options for the primary one, I created this simple script to update another service with my secondary ip (http://freedns.afraid.org/dynamic/).
Credit where credit is due, it is based on another script I found on that site, barely modified it to use nvram variables instead of files and use secondary ip instead of primary

What you need:
- Public IP on secondary wan
- afraid.org account (free)
- afraid.org authentication token

create this script and make it executable:
Code:
#!/bin/sh
#FreeDNS updater script

registered=$(nvram get zwan1_ipaddr)
current=$(nvram get wan1_ipaddr)
UPDATEURL="http://freedns.afraid.org/dynamic/update.php?HereGoesYourAuthToken&address="$current

[ "$current" != "$registered" ] && {                          
          wget -q -O /dev/null $UPDATEURL
          echo "DNS updated on:"; date
          nvram set zwan1_ipaddr=$current
  }

That's it, call that script from /jffs/scripts/dhcpc-event and you should be set to go

I did not use /jffs/scripts/ddns-start for this since my understanding is that script is invoked only when primary wan IP has to be updated, which might not happen at the same moment we need to update the secondary IP.

Bear in mind this scripts send your token unencrypted, I know there are ways to do that with curl and https, will look into it later
 

Similar threads

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