Skip to content

Instantly share code, notes, and snippets.

@poikilotherm
Created December 15, 2020 22:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save poikilotherm/563f57c43124a23ee4c690586a49945f to your computer and use it in GitHub Desktop.
Save poikilotherm/563f57c43124a23ee4c690586a49945f to your computer and use it in GitHub Desktop.
Update DynV6.net DynDNS via Bash Script
#!/bin/bash
set -euo pipefail
IP4=$(curl -sS -f https://api.ipify.org)
IP4_DNS=$(dig +short myhostname.dynv6.net A @dynv6.com)
IP6=$(curl -sS -f https://api64.ipify.org)
IP6_DNS=$(dig +short myhostname.dynv6.net AAAA @dynv6.com)
if [[ "${IP6}" == "${IP6_DNS}" ]] && [[ "${IP4}" == "${IP4_DNS}" ]]; then
echo "No update necessary." 1>&2
exit 0;
fi
echo "Updating DynV6.net" 1>&2
curl -sS -f "http://dynv6.com/api/update?hostname=myhostname.dynv6.net&ipv4=${IP4}&ipv6=${IP6}&token=mysecrettoken" > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment