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.
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.
Dynamic DNS mainly has two parts:
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.
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.
Duck DNS is a good one. It's popular and has a straightforward setup process.
Create an account on Duck DNS
Register your subdomain; you will get something like: my-domain.duckdns.org
Create a cron job on your server to detect and update your IP address in Duck DNS.
Verify in your browser by navigating to your registered domain, for example, my-domain.duckdns.org.
In the next blog we'll see how you can host your website using the same concept but Nginx and Cloudflare; stay tuned!