Forked from cyrusboadway/google-domains-dynamic-dns-update.sh
Created
August 24, 2018 09:11
-
-
Save sameersbn/d466fb97c12581329cd13561e318fde7 to your computer and use it in GitHub Desktop.
Script to update a Google Domains DNS record
This file contains 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 | |
### Google Domains provides an API to update a DNS "Syntheitc record". This script | |
### updates a record with the script-runner's public IP, as resolved using a DNS | |
### lookup. | |
### | |
### Google Dynamic DNS: https://support.google.com/domains/answer/6147083 | |
### Synthetic Records: https://support.google.com/domains/answer/6069273 | |
USERNAME="" | |
PASSWORD="" | |
HOSTNAME="yoursubdomain.yourdomain.here" | |
# Resolve current public IP | |
IP=$( dig +short myip.opendns.com @resolver1.opendns.com ) | |
# Update Google DNS Record | |
URL="https://${USERNAME}:${PASSWORD}@domains.google.com/nic/update?hostname=${HOSTNAME}&myip=${IP}" | |
curl -s $URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment