Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Last active March 16, 2017 01:53
Show Gist options
  • Save bcomnes/709167e2254fbf290f8ef13c545d8fce to your computer and use it in GitHub Desktop.
Save bcomnes/709167e2254fbf290f8ef13c545d8fce to your computer and use it in GitHub Desktop.
IPv6 DDNS client
#!/bin/bash
# https://community.ubnt.com/t5/EdgeMAX/IPv6-DDNS-script/td-p/1082829
run=/opt/vyatta/bin/vyatta-op-cmd-wrapper
domain=leaf.bret.io
key=DDNSAUTHKEY
updateurl="https://${domain}:${key}@ipv6.dyn.dns.he.net/nic/update?hostname=${domain}"
interface=eth1
lastipv6=`cat /config/ipv6address`
outsideipv6=`$run show interfaces ethernet $interface brief | grep "[0-9abcdef]*:[0-9abcdef:]*/"|tr -d '[:space:]'|cut -d/ -f1`
if test `find "/config/ipv6address" -mmin +10080` || [ "$lastipv6" != "$outsideipv6" ]
then
echo "Over one week since update or Changed IPv6"
curl -k -6 "${updateurl}"
echo $outsideipv6 > /config/ipv6address
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment