Skip to content

Instantly share code, notes, and snippets.

@eritpchy
Last active November 22, 2022 02:00
Show Gist options
  • Save eritpchy/775d0adb8b8b8e4293ffa84bb6e9546a to your computer and use it in GitHub Desktop.
Save eritpchy/775d0adb8b8b8e4293ffa84bb6e9546a to your computer and use it in GitHub Desktop.
asus_ddns.sh wan_start or crontab
#!/bin/sh
server=`nvram get ddns_server_x`
hostname=`nvram get ddns_hostname_x`
wanip=`nvram get wan0_ipaddr`
wanoldip=`nvram get wan0_realip_ip`
nasserver="nwsrv-ns1.asus.com"
postexe="/sbin/ddns_updated"
cachefile="/tmp/ddns.cache"
#get real ip
getrealip.sh >& /dev/null
wanip=`nvram get wan0_realip_ip`
echo wanip: $wanip
echo hostname: $hostname
if [ "$1" != "" ] || [ "$wanoldip" != "$wanip" ]
then
if [ "$server" == "WWW.ASUS.COM" ]
then
ez-ipupdate -S "dyndns" -a $wanip -h $hostname -A 2 -s $nasserver -e $postexe -b $cachefile
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment