You are reading this post because: you are looking for a solution how to point your website domain to your home dynamic IP which I was looking for a long time for my HomeLab project. My domain bacnh.com bought from name.com which does not support dynamic DNS and static IP subscription from my ISP is quite expensive about 25$/month.

By chance, I am using DigitalOcean paid service for almost 1 year, and DigitalOcean supports API to change DNS records for domain which is managed by DigitalOcean.

Thus, idea of this method is:

  • Change your domain DNS server to DigitalOcean DNS
  • Use DigitalOcean API to update A record to match your home IP address

There are many useful How-Tos posts that you can follow.

Change your current DNS server

You need to change DNS to DigitalOcean DNS, so it can take over control of your domain DNS records.

Basically, you need to change your DNS server to:

  • ns1.digitalocean.com
  • ns2.digitalocean.com
  • ns3.digitalocean.com

Create DigitalOcean account, setup your DNS record

In order to change DNS records for your domain, pls see below steps:

  1. Create DigitalOcean account if you don't have
  2. Create your project - named whatever you like
  3. Add your domain into your project
  4. Create A record: As I want to control all main and sub-domain, I need to create A record with hostname is @ for main domain, and * for all subdomain. In case, you want to point a blog.yourdomain.com, you need to create a A record with HOSTNAME=blog.

Pls take note to change TTL value to 30 (second), as you want to change made to A record updated ASAP, so your client don't feel any interruption once you reboot your router or ISP releases new IP to your home router. Default value is 3600 = 1 hour.

Create A record for main domain

Update your domain DNS record

This Github project is a very well-writen that I use to update my DigitalOcean DNS record. Before doing this, you need to get DigitalOcean API key, so the app can update domain DNS records on your behalf.

Then create a JSON configuration for your domain, let's say: info.json

{
  "apikey": "your_digital_ocean_api_key",
  "doPageSize": 20,
  "useIPv4": true,
  "useIPv6": false,
  "allowIPv4InIPv6": false,
  "ipv4CheckUrl": "https://ipv4bot.whatismyipaddress.com",
  "domains": [
    {
      "domain": "your_domain.com",
      "records": [
        {
          "name": "@",
          "type": "A",
          "TTL": 30
        }
      ]
    },
    {
      "domain": "your_domain.com",
      "records": [
        {
          "name": "*",
          "type": "A",
          "TTL": 30
        }
      ]
    }
  ]
}
DigitalOcean DNS API JSON configuration

Then download respective binary for your system:

Then, you can now ask DigitalOcean to update your home IP with my ClearLinux box.

You can create a cron job to update every 5 minutes, for example:

# run `crontab -e` to edit your crontab
# sample cron job task

# m h  dom mon dow   command
*/5 * * * * path/to/digitalocean-dynamic-dns-ip-linux-amd64  /path/to/info.json

Windows users

You may want to create a DOS script and add it to Windows scheduler

digitalocean-dynamic-dns-ip-windows-amd64.exe path_to_config/info.json

Good luck!