Created
December 15, 2020 22:19
-
-
Save poikilotherm/563f57c43124a23ee4c690586a49945f to your computer and use it in GitHub Desktop.
Update DynV6.net DynDNS via Bash Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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