Self-hosted Dynamic DNS Updater: A Quick Guide

Dynamic DNS (DDNS) is essential if you’re hosting services from home (self-hosted) where your IP address changes periodically. Namecheap (as well as others) offers a straightforward DDNS service for their domains that allow you to programmatically update the DNS. Here’s how to set it up.

Step 1: Enable Dynamic DNS (NameCheap)

  1. Log into your Namecheap account
  2. Go to the Domain List and select “Manage” next to your domain
  3. Navigate to the “Advanced DNS” tab
  4. Enable “Dynamic DNS” by toggling the switch

Step 2: Get Your Dynamic DNS Password

  1. Stay on the Advanced DNS page
  2. Look for “Dynamic DNS Password”
  3. Copy this Dynamic DNS password – you’ll need it for the change the password simply use the refresh button
Screenshot

Step 3: Configure Your Records

  1. Add an ‘A + Dynamic DNS’ record
  2. Set your hostname (e.g., ‘@’ for root domain, or ‘www’ for subdomain)
  3. Leave the IP address field empty – it will be updated automatically

Step 4: Set Up the Updater

You have several options for updating your IP:

Option 1: Using ddclient (Linux)

bash# Install ddclient
sudo apt-get install ddclient

# Edit configuration
sudo nano /etc/ddclient.conf

# Add these lines:
protocol=namecheap
use=web
server=dynamicdns.park-your-domain.com
login=yourdomain.com
password=your_dynamic_dns_password
yourdomain.com

Option 2: Using the URL Method

You can update your IP by visiting this URL:


curl -k https://dynamicdns.park-your-domain.com/update?host=@&domain=yourdomain.com&password=DYNAMICDNSPASSWORD

Option 3: Using a Scheduled Task (Windows)

Create a PowerShell script and schedule it to run periodically:

$url = "https://dynamicdns.park-your-domain.com/update"
$params = @{
    host = "@"
    domain = "yourdomain.com"
    password = "your_dynamic_dns_password"
}
Invoke-RestMethod -Uri $url -Body $params

Option 4 – Go Progam multiple domains

Finally, if you want to update multiple domains , I have created a simple Go Lang program that checks your current WAN IP every xx minutes then when it detects a change it runs through the confg.json file updates the domains DNS records automatically.

Here’s the link to the GitHub code: https://github.com/acbrandao/GoDnsUpdater/tree/main

{
    "domains": [
        {
            "domain": "example.com",
            "host": "@",
            "password": "your-ddns-password-1"
        },
        {
            "domain": "example.com",
            "host": "www",
            "password": "your-ddns-password-1"
        },
        {
            "domain": "otherdomain.com",
            "host": "@",
            "password": "your-ddns-password-2"
        }
    ],
    "check_interval_minutes": 5,
    "log_file": "ddns.log"
}

Verification

After setting up your updater, verify it’s working by:

  1. Check your domain’s DNS records in Namecheap
  2. The IP address should match your current public IP
  3. Try pinging your domain to ensure it resolves correctly

Remember to keep your Dynamic DNS password secure and never share it publicly. If you suspect it’s been compromised, you can generate a new one from the Namecheap dashboard.

Troubleshooting

If your updates aren’t working:

  • Verify your password is correct
  • Check if your domain has Dynamic DNS enabled
  • Ensure your A + Dynamic DNS record is properly configured
  • Look for any error messages in your updater logs

Leave a Reply

  

  

  

Newark , US
2:45 am
36°F
Broken clouds
High: 39°F
Low: 32°F
Wind: 3 mph