Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # update via ddns
- # /etc/hotplug.d/iface/30-skan-ddns
- [ "$INTERFACE" != "wan" ] && ( [ "$ACTION" != "ifup" ] || [ "$ACTION" != "update" ] ) && exit 0
- user='username-here'
- password='password-here'
- token="hmac-md5:$user:$password"
- host='rtr'
- zone='home-okc.flame.org'
- server='dns01.flame.org'
- ipaddr=`ifconfig eth1 | grep 'inet addr:' | awk '{ print $2}' | cut -f2 -d:`
- ipaddr6=`ifconfig eth1 | grep 'inet6 addr:' | grep Global | awk '{ print $3 }' | cut -f1 -d/`
- if [ -z "$ipaddr$ipaddr6" ] ; then
- echo "Not updating as we have no external addresses"
- exit 1
- fi
- rm -f /tmp/ddns.$$
- echo >> /tmp/ddns.$$ server $server
- echo >> /tmp/ddns.$$ zone $zone.
- if [ -n "$ipaddr" ] ; then
- echo >> /tmp/ddns.$$ update delete $host.$zone. A
- echo >> /tmp/ddns.$$ update add $host.$zone. 86400 A $ipaddr
- fi
- if [ -n "$ipaddr6" ] ; then
- echo >> /tmp/ddns.$$ update delete $host.$zone. AAAA
- echo >> /tmp/ddns.$$ update add $host.$zone. 86400 AAAA $ipaddr6
- fi
- echo >> /tmp/ddns.$$ show
- echo >> /tmp/ddns.$$ send
- cat /tmp/ddns.$$ | nsupdate -y $token -v
- rm -f /tmp/ddns.$$
Add Comment
Please, Sign In to add comment