The question is… why would you want a Dynamic Domain Name System (DDNS)?
Here are 5 reasons why you would want a DDNS:
1. Dynamic IP Addressing:
- Many residential and consumer ISPs assign dynamic IP addresses, which can change unexpectedly.
- Static IP addresses are typically assigned to businesses.
2. Accessing Home Labs:
- DDNS allows you to access your home network or lab through a domain name, even when your IP address changes.
3. Hosting Websites/Services:
- If you host websites or services at home or on a personal server, DDNS ensures that your domain name always points to the correct IP address.
4. Secure Connections:
- By updating your DNS records automatically, DDNS helps to maintain security and prevent connection disruptions.
5. Simplified Networking:
- With DDNS, you can easily remember and use a domain name instead of remembering and updating IP addresses.
21 Easy Steps
Ready to set up Dynamic DNS with Cloudflare? Follow these steps:
- Get a Linux Box: Use a Linux-based system like Ubuntu or even a Raspberry Pi.
- Clone the Repository: Clone the following repository by K0p1-Git: cloudflare-ddns-updater.
- Change Directory: Navigate into the cloned directory and rename
cloudflare-template.sh
to a name of your choice. - Edit the Script: Open the file in your favorite IDE or text editor. Before you start editing, log in to Cloudflare to get your Global API token and Zone ID.
- Fill in Your Details: Input your Cloudflare details into the script and save the file.
- Make the Script Executable: Run
sudo chmod +x nameOfYourFile.sh
to make the script executable. - Test the Script: Go back Cloudflare and change your DNS A record to
8.8.8.8
and save. - Run the Script: Go back to your terminal and execute
bash nameOfYourFile.sh
. - Verify the Change: Refresh your DNS records in Cloudflare to see if the IP has been updated.
- Set Up a Cron Job: Automate the script by setting up a cron job. This will run the script at specified intervals to update your IP address.
- Update Your System: Update your Linux box with
sudo apt-get update && sudo apt-get upgrade
. - Install Cron: If cron isn’t installed, install it using
sudo apt-get install cron
. - Check Cron Status: Verify that cron is running with
sudo systemctl status cron
. - Enable Cron on Startup: Ensure cron starts on boot with
sudo systemctl enable cron
. - Create a Cron Job: Edit your cron jobs by running
crontab -e
. - Add the Job: Add the following line at the bottom:
* * * * * /usr/bin/bash /home/user/Projects/cloudflare-ddns-updater/nameOfYourFile.sh
. This example runs the script every mintue for testing purpose. Adjust as needed and save your changes. visit here to define your timings. - Restart Cron: Restart cron to apply the changes with
sudo systemctl restart cron
. - Check Cron Status Again: Go back to step 13 and verify that cron is still running.
- View Cron Jobs: List your cron jobs with
crontab -l
. - Test Again: Go back to Step 7 and change your DNS A record to
8.8.8.8
and save. - Wait and Verify: Wait for a minute and check if your IP address is updated. If so, you’ve successfully set up your own DDNS.
Following these steps will ensure your dynamic DNS is properly configured with Cloudflare. Enjoy your automated IP updates!
Comments are closed