Skip to content

Instantly share code, notes, and snippets.

@x29a
Created January 7, 2017 20:41
Show Gist options
  • Save x29a/e2c9a3f7a98d68ad7ae1e0aa6cc595d8 to your computer and use it in GitHub Desktop.
Save x29a/e2c9a3f7a98d68ad7ae1e0aa6cc595d8 to your computer and use it in GitHub Desktop.
SPDYN/SPDNS update via bash
#!/bin/bash
# registered domains. might be the same for v4 and v6
DOMAINV4=foobar.my-router.de
DOMAINV6=${DOMAINV4}
# generated token for each domain
TOKENV4=abcd-abcd-abcd
TOKENV6=abcd-abcd-abcd
# get own IPs to feed them back to spdyn. See http://wiki.securepoint.de/index.php/SPDyn/meineIP
MYIPV4=$(curl -s http://checkip4.spdyn.de/)
MYIPV6=$(curl -s http://checkip6.spdyn.de/)
# update spdyn records if IPs were fetched
if [ -n "${MYIPV4}" ];
then
echo "updating v4 to: ${MYIPV4}"
curl -u "${DOMAINV4}:${TOKENV4}" "https://update.spdyn.de/nic/update?hostname=${DOMAINV4}&myip=${MYIPV4}"
else
echo "error retrieving v4"
fi
if [ -n "${MYIPV6}" ];
then
echo "updating v6 to: ${MYIPV6}"
curl -u "${DOMAINV6}:${TOKENV6}" "https://update.spdyn.de/nic/update?hostname=${DOMAINV6}&myip=${MYIPV6}"
else
echo "error retrieving v6"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment