Blogs

Dynamic DNS: Who needs a static public IP address anyways! 🤭


Introduction 🌟

The short story behind this blog is that I wanted to access a device (a Raspberry PI) on my home network from the Internet. I ran into the issue of having my public IP address change every time my router reboots.
This happens because I'm on a residential IP address, not a static public IP address.
The easy solution is to purchase a static public IP address, but I need something else because it's expensive (costs around 200$ per month) and is not worth it for a simple use case.


But what is Dynamic DNS? ℹ

In simple terms, it's a service that automatically updates the DNS records for a domain name whenever the IP address changes.
This is extremely useful when devices connected to networks such as home networks which do not have static IP addresses.


How does it work? 🚀

Dynamic DNS mainly has two parts:

  1. Client software: you install this software on the device you want to keep its IP address updated. This part detects IP changes and can be as simple as a cron job.

  2. IP address update mechanism:Once the client detects an IP address change, you need a way to update the DNS records. This can also be as simple as sending an API request.


What is a good example of a dynamic DNS? 🙋

Duck DNS is a good one. It's popular and has a straightforward setup process.


Steps to do a quick demo of it 📓

  1. Create an account on Duck DNS

  2. Register your subdomain; you will get something like: my-domain.duckdns.org

  3. Create a cron job on your server to detect and update your IP address in Duck DNS.

  4. Verify in your browser by navigating to your registered domain, for example, my-domain.duckdns.org.


Summary ✅

In the next blog we'll see how you can host your website using the same concept but Nginx and Cloudflare; stay tuned!