Dynamic DNS and you

Okay, so I know the popular thing with network engineers is to remember the IP of EVERYTHING.  I’m pretty good at it too.  But having a lab at home and needing to be able to deal with my provider using DHCP for my WAN IP I like to use dynamic DNS.

I’ve used DYNDNS for years, and they have a great product, albeit a bit expensive for my tastes.

Enter Google Domains.  $15 a year gets you registration, DNS, and some other fun stuff.

Google Domains Dynamic DNS Setup

This assumes you can figure out how to register a domain on google domains and get static DNS working.

Go to your domains area, choose the domain you are working with, then go to the ‘Synthetic Records’ section and choose ‘Dynamic DNS’ from the dropdown:

Then choose the subdomain you wish to have Dynamic DNS for and choose ‘Add’ (if you want the main domain to use Dyanmic DNS just leave the subdomain blank and click ‘Add’)

You should now have a new entry:

Click ‘View Credentials’ and note the Username and Password, as this will be needed later on.  It’s also worth noting here that these are specific for each Dynamic DNS entry (thank you Google for not making me put my admin login just so that I can use DNS, although to be fair, DYNDNS is moving to a more API-Centric approach as well).

ddclient Setup and Installation

Special note, this is based on an Centos install.  Some systems support the install of ddclient via the apt-get install ddclient or yum install ddclient commands.  I would try those first, then skip to the ddclient configuration section (the configuration files are typically in the same place, or very similar).
First head on over to the ddclient project page to get the latest copy of ddclient (sorry, its hosted on SourceForge).

You could probably tell curl to follow redirects and grab the file from their download link, but I just grab it myself then SCP it over to my linux instance that needs ddclient.

Once you’ve copied it to your linux box untar the file with tar -jxvf <filename>.tar.bz2

Now that you’ve got the files unzipped  cd ddclient-x.x.x/ (where x’s represent the version number)

Now lets make some directories:
mkdir /etc/ddclient mkdir /var/cache/ddclient

Now lets copy the relevant sample files:

cp ddclient /usr/local/bin
cp sample-etc_ddclient.conf /etc/ddclient/ddclient.conf
cp sample-etc_rc.d_init.d_ddclient /etc/rc.d/init.d/ddclient

Add ddclient to chkconfig:

chkconfig --add ddclient

We’re done with that download we can nuke it now:

cd .. rm -rf ddclient-x.x.x/ (where x’s represent the version number)

Sweet.  Now lets configure ddclient for use with Google Domains.

Open up /etc/ddclient/ddclient.conf in your favorite text editor (hint, its vi/vim) and make sure you have the following info:

####################################
####Google Dynamic DNS##############
server=domains.google.com
protocol=dyndns2
use=web, web=checkip.dyndns.com, web-skip='IP Address'
login=*******************
password='**********'
ssl=yes
foo.yourdomain.com
####################################

Google was nice enough to use the DYNDNS2 protocol so there is already a lot of support for doing Dyanamic DNS with them(eg ddclient)

The login will be the ‘Username’ that you noted when you created the Dyanmic DNS entry, and the password will be the ‘Password’ that you noted in the same place.

There are a lot of different websites you can use for getting your public IP, but I prefer dyndns, hence the ‘use=web section’.

SSL is required and your client will not update unless this is enabled!  Again, kudos to Google for getting this right out of the gate.

Finally list the domain that you want the dynamic IP for.

Once you’ve saved your file (:wq! for you vi/vim folks!) you can now update your IP from you server using the command ddclient

If all goes well you should see your dyanmic IP update in Google Domains under the ‘Data’ section (you will need to refresh the page to see the results).

Tagged #ddclient, #dynamic dns, #dyndns, #google, #google domains

2021

Back to top ↑

2020

Self Service with Satellite

less than 1 minute read

Recently I had a customer who was running into some legacy infrastructure challenges with VM consistency, meeting (internal) customer expectations, and gener...

Winning with Soft Tokens

2 minute read

Well, I’d call that a sabbatical, but I think that would mean I was relaxing. Time to revive this thing (again).

Back to top ↑

2018

Back to top ↑

2017

Using Powershell and Posh-SSH to GSD.

5 minute read

I’m a guy who thinks you should use the right tool for the job. For instance, if you’re in a Windows environment, and you need to script something, installi...

iDrac, RACADM, sshpass, and BASH

8 minute read

If it were up to me, I suppose that the only thing that I’d really be responsible for would be core networking infrastructure (and consumption of craft brews...

Dynamic DNS and you

3 minute read

Okay, so I know the popular thing with network engineers is to remember the IP of EVERYTHING.  I’m pretty good at it too.  But having a lab at home and needi...

Back to top ↑