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:
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
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