Web Analytics Made Easy - Statcounter

Free Dynamic DNS with Namecheap for Raspberry Pi

Dynamic DNS

I've got a PiHole set up on my raspberry pi and have it connected to my home router. My ISP won't assign me a static IP address though it's pretty good about keeping the one I've got active until I reboot my router. For the most part that's been good enough for me but I wanted to finally get dynamic dns going so I wouldn't have to worry about it again. There are some paid solutions out there and my router even supports a few of them by default. I'm a cheapskate though and didn't want to have yet another subscription weighing me down. (Enough is enough!)

My Registrar and DNS provider for the last decade or so has been Namecheap. They're not paying me to say this, but these guys rock. I've never had a problem with them, never had them show up in my news feed for some negative BS, and any time I've needed support their team has been there quickly and with helpful solutions. So my first choice was to see if I could use them for Dynamic DNS too. Turns out the answer is YES.

A prerequisite is you've got to have a domain over at Namecheap and use them as the DNS provider as well. With that out of the way, here's what you need to do.

  1. Head over to your domain's advanced DNS section and create an "A+ Dynamic DNS Record" Enter a subdomain (e.g. vpn.example.com) and just use a dummy ip address for now (e.g. 2.2.1.1)

  2. At the bottom you'll see a toggle switch for Dynamic DNS. Switch it on and take note of the password

You are now done with Namecheap. The next steps will require you to be on the device you'd like to automatically access when its IP changes. In my case it's a Raspberry Pi 4B running Raspberry Pi OS. I've ssh'd into my Pi and updated and upgraded:

1$ sudo apt update
2$ sudo apt upgrade

Next, it's time to install ddclient

1$ sudo apt install ddclient

In my experience the wizard here is pretty good but I ended up modifying the configuration file manually and then testing it out to make sure it worked. Just go ahead and fill in whatever you'd like with the wizard and then when done, edit the conf file:

1$ sudo vi /etc/ddclient.conf

Once that's up, edit it so it looks like this. Below, use your domain and password from namecheap.

 1# Configuration file for ddclient generated by debconf
 2#
 3# /etc/ddclient.conf
 4
 5protocol=namecheap \
 6ssl=yes
 7use=web, web=https://api.ipify.org/ \
 8login=your-actual-domain.org \
 9password='namecheap-generated-password' \
10subdomain-you-selected-in-step-1.your-actual-domain.org

After you've saved the file, you can test to see if it works. From the console, let's run ddclient manually and see if we get good output:

1$ sudo ddclient -daemon=0 -noquiet -debug

If the test worked you'll see the output telling you so. Next you'll be able to log back in to your namecheap console, visit your domain and see that the A+ Dyanamic DNS record you'd previously temporarily set to a dummy IP has now been updated to reflect your correct IP address. Congratulations, you're done! If you need help, I highly recommend talking with Namecheap's support. Otherwise you can find documentation over at the ddclient homepage.