A simple tool written in Ruby to update Dynamic DNS entries on Google Domains
Go to file
2022-11-13 17:22:02 -08:00
.gitignore Initial commit 2016-02-17 22:51:19 -08:00
googledomains_dyndns_update.rb Using Ruby Logger for messages 2016-02-18 22:16:01 -08:00
LICENSE Initial commit 2016-02-17 22:51:19 -08:00
README.md Added sample log to README 2022-11-13 17:22:02 -08:00

Google Domains Dynamic DNS Updater

googledomains_dyndns_update is a simple tool written in Ruby to update Dynamic DNS entries on Google Domains. More information on Dynamic DNS pertaining to Google Domains can be found in the following support answer:

https://support.google.com/domains/answer/6147083

Installation

The tool can be run by executing googledomains_dyndns_update.rb script from a clone of this repository.

Configuration

This tool uses a configuration file, located by default in ~/.gddyndns.yaml, to get information on hosts to update. An alternate configuration file can be specified with the -f|--config_file option. Configuration is specified in YAML format with a template as follows:

hosts:
- host: hostone.com
  username: <google domain hostone username>
  password: <google domain hostone password>
- host: hosttwo.com
  username: <google domain hosttwo username>
  password: <google domain hosttwo password>
- ...

Username and password for this file can be obtained from the Google Domains dashboard as mentioned in the URL above.

Caching

To avoid frequent queries to Google Domains, store the status of latest update to a cache file, located by default in ~/.gddyndns.cache. Alternate location may be provided with -c|--cache_file option.

Google Domains is updated only if public IP of the host has changed. An update can, however, be forced with the -u|--force_update option.

Usage

Following usage help is available with the --help option:

$ googledomains_dyndns_update.rb --help
Usage: googledomains_dyndns_update.rb [options]
    -d, --debug                      Enable debug messages
    -u, --force_update               Force DNS update
    -f, --config_file FILE           Location of configuration file
    -c, --cache_file FILE            Location of cache file
    -h, --help                       Display this help

Sample log

I, [2021-09-02T08:00:01.367731 #137228]  INFO -- /home/mahesh/tools/googledomains_dyndns_update/googledomains_dyndns_update.rb: Done.
I, [2021-09-02T09:00:01.663947 #137511]  INFO -- /home/mahesh/tools/googledomains_dyndns_update/googledomains_dyndns_update.rb: Starting...
I, [2021-09-02T09:00:01.752664 #137511]  INFO -- : Public IP: o1.o2.o2.o4
I, [2021-09-02T09:00:01.752744 #137511]  INFO -- : Skipping heshapps.com - Already pointing to o1.o2.o2.o4
I, [2021-09-02T09:00:01.752774 #137511]  INFO -- : Skipping funding.heshapps.com - Already pointing to o1.o2.o2.o4
I, [2021-09-02T09:00:01.752832 #137511]  INFO -- : Skipping hstumblr.heshapps.com - Already pointing to o1.o2.o2.o4
I, [2021-09-02T09:00:01.752851 #137511]  INFO -- : Skipping hssoundcloud.heshapps.com - Already pointing to o1.o2.o2.o4
I, [2021-09-02T09:00:01.752931 #137511]  INFO -- : Skipping git.heshapps.com - Already pointing to o1.o2.o2.o4
I, [2021-09-02T09:00:01.752970 #137511]  INFO -- : Skipping gp.heshapps.com - Already pointing to o1.o2.o2.o4
I, [2021-09-02T09:00:01.753005 #137511]  INFO -- /home/mahesh/tools/googledomains_dyndns_update/googledomains_dyndns_update.rb: Done.
I, [2021-09-02T10:00:02.023736 #137796]  INFO -- /home/mahesh/tools/googledomains_dyndns_update/googledomains_dyndns_update.rb: Starting...
I, [2021-09-02T10:00:02.233768 #137796]  INFO -- : Public IP: n1.n2.n3.n4
I, [2021-09-02T10:00:02.233885 #137796]  INFO -- : Updating host [heshapps.com] - https://domains.google.com/nic/update?hostname=heshapps.com&myip=n1.n2.n3.n4
I, [2021-09-02T10:00:03.737974 #137796]  INFO -- : Updating host [funding.heshapps.com] - https://domains.google.com/nic/update?hostname=funding.heshapps.com&myip=n1.n2.n3.n4
I, [2021-09-02T10:00:13.611667 #137796]  INFO -- : Updating host [hstumblr.heshapps.com] - https://domains.google.com/nic/update?hostname=hstumblr.heshapps.com&myip=n1.n2.n3.n4
I, [2021-09-02T10:00:14.961589 #137796]  INFO -- : Updating host [hssoundcloud.heshapps.com] - https://domains.google.com/nic/update?hostname=hssoundcloud.heshapps.com&myip=n1.n2.n3.n4
I, [2021-09-02T10:00:23.773025 #137796]  INFO -- : Updating host [git.heshapps.com] - https://domains.google.com/nic/update?hostname=git.heshapps.com&myip=n1.n2.n3.n4
I, [2021-09-02T10:00:28.948759 #137796]  INFO -- : Updating host [gp.heshapps.com] - https://domains.google.com/nic/update?hostname=gp.heshapps.com&myip=n1.n2.n3.n4
I, [2021-09-02T10:00:33.816178 #137796]  INFO -- /home/mahesh/tools/googledomains_dyndns_update/googledomains_dyndns_update.rb: Done.
I, [2021-09-02T11:00:02.078239 #138078]  INFO -- /home/mahesh/tools/googledomains_dyndns_update/googledomains_dyndns_update.rb: Starting...
I, [2021-09-02T11:00:02.277009 #138078]  INFO -- : Public IP: n1.n2.n3.n4
I, [2021-09-02T11:00:02.277121 #138078]  INFO -- : Skipping heshapps.com - Already pointing to n1.n2.n3.n4
I, [2021-09-02T11:00:02.277165 #138078]  INFO -- : Skipping funding.heshapps.com - Already pointing to n1.n2.n3.n4
I, [2021-09-02T11:00:02.277255 #138078]  INFO -- : Skipping hstumblr.heshapps.com - Already pointing to n1.n2.n3.n4
I, [2021-09-02T11:00:02.277289 #138078]  INFO -- : Skipping hssoundcloud.heshapps.com - Already pointing to n1.n2.n3.n4
I, [2021-09-02T11:00:02.277411 #138078]  INFO -- : Skipping git.heshapps.com - Already pointing to n1.n2.n3.n4
I, [2021-09-02T11:00:02.277466 #138078]  INFO -- : Skipping gp.heshapps.com - Already pointing to n1.n2.n3.n4
```

License
--

This tool is licensed under the MIT License.