This article will show you how to use ddlcient to update your dynamic DNS settings in Google domain service
Assume you have your website top domain as : example.com, you want to create a subdomain blog.example.com on your google domain and point to your home host server, google provides a dynamic DNS service that can generate credentials for your domain/sub-domains, ddclient is a tool to use this generated credentials dynamically update your site in case your ISP changed your dynamically assigned IP address
Step 1: Create a dynamic DNS record
Log on to https://domains.google.com/ choose “DNS” on the left menu list, then go to “Dynamic DNS” advanced settings, click “create new record” button, fill the host you want to use, eg: blog.example.com, click “save” , you should have a new record “blog.example.com” in the section right below “Dynamic DNS”, where list all available records you created, there’s a “view credential” button at the end of each record, you’ll need to copy those credential to ddclient configuration file on you home host server
Step 2: Add Google dynamic DNS client configuration to ddclient
Edit your ddclient configuration file example: /etc/ddclient.conf
sudo vi /etc/ddclient.conf
# Add below information for you new subdomain on Google
# database sub domain
protocol=dyndns2
use=web
server=domains.google.com
login=<your username generated by google for your blog.example.com site>
password=<your password generated by google for your blog.example.com site>
blog.example.com
# Cloudflare example
# database sub domain
ssl=yes
protocol=cloudflare
use=web
zone=yourdomain.com
login=cloudflare api token
password=cloud flare api key
subdomain.yourdomain.com, sub2.yourdomain.com, sub3.yourdomain.com
Save and exit
Step 3: Debug and verify your site change
# Run below command on your host server
sudo ddclient -daemon=0 -debug -verbose -noquiet
# Example output:
...
DEBUG: nic_dyndns2_update -------------------
INFO: setting IP address to 12.34.56.78 for blog.example.com
UPDATE: updating blog.example.com
DEBUG: proxy =
DEBUG: url = http://domains.google.com/nic/update?system=dyndns&hostname=blog.example.com&myip=12.34.56.78
DEBUG: server = domains.google.com
CONNECT: domains.google.com
If no error showed, go to google domain dashboard check if the record has your home server IP address attached
Run below command if there’s cache issue
# Delete cache if change not reflected
sudo rm /var/cache/ddclient/ddclient.cache
sudo systemctl restart ddclient