Dns

Dynamic DNS script to update Linode.com domain records

My Macbook pro died and I decided a get a shiny new Windows laptop that I could convert to a Linux laptop. I partitioned the disk and created a dual boot with Linux Mint and Windows. Linux Mint installled like a champ and has been running happily ever since. I don’t think I have booted to Windows but twice in the last year.

Moving to a new OS did mean that I needed to rewrite some of the scripts I use on a regular basis. One of the scripts updates DNS records at Linode with my current IPv4 and IPv6 WAN addresses and is run as a cron job. It’s a bash script I first wrote about here. The updated script can be found here.

Script: Update Linode DNS Records with WAN IPs (Dynamic DNS)

Either of these scripts will grab both the IPv4 and IPv6 (if any) addresses assigned to any WAN I’m behind, and, using Linode’s DNS API, will update my DNS records with same and log changes/errors using logger. In effect, it’s a homemade Dynamic DNS updater. Linode’s developing a new API so that’s why  two versions exist.

Download from Bitbucket

To use the script, you need:

  1. A Linode API key (for version 3 of Linode’s DNS API) or Personal Access Token (for version 4 of Linode’s DNS API),
  2. the domain ID, and
  3. the resource (called record in v4) IDs of the DNS records you want to update.

The IDs don’t change, whether you’re using version 3 or version 4.