In Google Domains, you can set up dynamic records that are updated by a local client. Here is how you do that.

Add record in Google Domains

Scroll to the bottom of the DNS records page and there is a Dynamic DNS section. Click on Manage dynamic DNS and add the record. After you save, you will see something like this:

Google DNS Dynamic Record

The IP address will be 0.0.0.0 until you run an update. So let’s go install a dynamic client!

You will need the details that you see in View Credentials, there is a unique username and password for each record.

Install DDClient

Run this command

sudo apt install ddclient

which will install and step through the ddclient config, asking you for the service you want to use, the credentials and records you want to update. You can also edit this later in the .conf file.

Once that completes, you can edit the config and either confirm, update or change

sudo nano /etc/ddclient.conf

It will look something like this:

protocol=googledomains
use=web, web=https://domains.google.com/checkip
login=[username1]
password=’[password1]’
[URL1.domain.com]

protocol=googledomains
use=web, web=https://domains.google.com/checkip
login=[username2]
password=’[password2]’
[URL2.domain.com]

Run this command the load in the new config:

sudo service ddclient restart

You should now be able to refresh the Google Domains page and see your IP address.

Run the update on a scheduled basis

So far we have a functional update when run manually. Probably not that helpful with a dynamic IP address. So let’s run a scheduled update.

We need to edit the ddclient defaults.

sudo nano /etc/default/ddclient

There are 4 entries that matter:

run_dhclient=“false”
run_ipup=“false”
run_daemon=“true”
daemon_interval=“5m”

the first two items need to be “false” if you want to run the daemon service. Change the “5m” value to the schedule you desire. Restart the ddclient service to update, and then check the status:

sudo service ddclient status

You should see something like this:

● ddclient.service - Update dynamic domain name service entries
     Loaded: loaded (/lib/systemd/system/ddclient.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-01-25 09:25:49 PST; 1h 58min ago
       Docs: man:ddclient(8)
    Process: 1160436 ExecStart=/usr/sbin/ddclient -daemon $daemon_interval -syslog -pid /run/ddclient.pid (code=exited, status=0/SUCCESS)
   Main PID: 1160437 (ddclient - slee)
      Tasks: 1 (limit: 4163)
        CPU: 888ms
     CGroup: /system.slice/ddclient.service
             └─1160437 ddclient - sleeping for 70 seconds

Congratulations, you’re done :)