Running a hobby server at home can be a great way to learn something new. Hobby Linux servers have been a passion of mine for their simplicity and cost. They can be a quick way to kick the tires on an interesting CRM, ticket system, media server, etc. One of my favorite sites for this is TurnKey Linux. Turnkey Linux

While testing on a local hobby server may work just fine for most situations, there may be an instance where you want to have a public or remote access to your server. If you don’t have a static IP address through your ISP then you may need to use a service like No-IP. Services like No-IP will give you a hostname and client software which will check your current public IP address and update the hostname. These services work well as long as you have a way to run the client software. One of my favorite services DynDNS has recently been aquired by Oracle and now requires you to move to their cloud service.

There’s a solution that’s been right under my nose. Google offers a dynamic DNS solution as part of their Google Domains service. Google offers similar client options for updating the service with your current IP address, but this can lead to the same issue of needing to run client softare on some system. A quick solution would be to run a script or cronjob. This should not nor require any additional softare packages on most Linux systems. Here’s a cronjob for updating Google’s Dynamic DNS. Enter required username, password, and hostname that you setup in the DNS portion of Google Domains. The cronjob will check your public IP address every five minutes and update the service if it changes. Enjoy!

#!/bin/sh
# Script for updating Google Domains Dynamic DNS with your current IP address.
userName=""
passWord=""
hostName=""
ipAddress=$(curl -s "https://domains.google.com/checkip")
curl -s https://${userName}:${passWord}@domains.google.com/nic/update?hostname=${hostName}&myip=$ipAddress

# Create a crontab with the following to run the script every 5 minutes starting with minute 0.
# */5 * * * * /bin/sh /path/to/google_dyndns_updater.sh
# or this one if you want it to run on designated minutes (usful for multiple jobs)
# 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/sh /path/to/google_dyndns_updater.sh