Skip to content

Instantly share code, notes, and snippets.

@lira
Forked from greysAcademicCode/ddns-start
Created July 10, 2023 15:26
Show Gist options
  • Save lira/c89a4a294329a17561bdd0ab8b9becaa to your computer and use it in GitHub Desktop.
Save lira/c89a4a294329a17561bdd0ab8b9becaa to your computer and use it in GitHub Desktop.
Google Domains DDNS registration script
#!/bin/sh
# see: https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS#google-domains
# this script could go into /jffs/scripts of a router running Merlin's asus-wrt firmware
# you must then choose the "Custom" option for DDNS in the router's web interface
# it registers the WAN IP of the router with Google Domains' DDNS system
# get your login info from yout Google Domains dashboard
IP=$1
USER=
PASS=
DOMAIN=
HOST=
curl https://$USER:$PASS@domains.google.com/nic/update?hostname=$HOST.$DOMAIN
if [ $? -eq 0 ]; then
/sbin/ddns_custom_updated 1
echo "DDNS update done."
else
/sbin/ddns_custom_updated 0
echo "DDNS update failed."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment