How to Install and Use DuckDNS for Dynamic DNS
How to Install and Use DuckDNS for Dynamic DNS
Dynamic DNS (DDNS) is an invaluable service for anyone who needs to access their home network remotely but has an Internet Service Provider (ISP) that changes their IP address frequently. DuckDNS is a popular and free dynamic DNS service that helps users to maintain a consistent domain name for their dynamic IP addresses. In this article, we will guide you through the installation and usage of DuckDNS, ensuring that you have all the information needed to set it up correctly.
What is DuckDNS?
DuckDNS is a free dynamic DNS service that allows users to link a domain name to their dynamic IP address. This is particularly useful for home users who host servers, use remote desktop applications, or want to access their home network from anywhere in the world. DuckDNS provides users with the ability to create subdomains under the duckdns.org domain, making it easy to remember and access your services remotely.
Why Use DuckDNS?
- Cost-Effective: DuckDNS is completely free, making it an excellent choice for individuals and small businesses.
- Easy Setup: The installation process is straightforward and can be completed in just a few minutes.
- Wide Compatibility: DuckDNS works with most operating systems and network configurations, allowing users to update their IP addresses from various devices.
- Open Source: DuckDNS is an open-source project, providing transparency and trustworthiness.
Prerequisites
Before you begin the installation process, ensure that you have the following:
- A DuckDNS account: Visit DuckDNS and sign up for a free account.
- A device with internet access: This can be your home computer, a Raspberry Pi, or any other device that you can use to run the DuckDNS update script.
- Basic knowledge of command line interface (CLI) commands, as you will need to run some commands in your terminal.
- Step-by-Step Guide to Install and Use DuckDNS
Step 1: Create a DuckDNS Account
- Go to the DuckDNS website.
- Click on the “Sign up” link located at the top right corner.
- You can sign up using an existing account from GitHub, Google, Twitter, or Reddit. Choose one and follow the prompts to authenticate.
- Once logged in, you will be redirected to your DuckDNS dashboard.
Step 2: Create a Subdomain
- On your dashboard, find the “Add Domain” section.
- Enter your desired subdomain name (for example, myhome) and click on the “add domain” button.
- Your DuckDNS subdomain (e.g., myhome.duckdns.org) will now be created and displayed on your dashboard.
Step 3: Obtain Your DuckDNS Token
In your DuckDNS dashboard, you will see a token displayed. This token is essential as it is used to authenticate your updates.
Keep this token secure, as it grants access to your DuckDNS account.
Step 4: Set Up the Update Script
DuckDNS provides an update script that automatically updates your IP address whenever it changes. You can set this up on your home device.
For Linux Users
Open your terminal.
Create a new directory for your DuckDNS script:
mkdir ~/duckdns
cd ~/duckdns
Create a new shell script:
nano duck.sh
Add the following lines to the duck.sh file, replacing YOUR_DOMAIN and YOUR_TOKEN with your actual subdomain and token:
echo url=”http://www.duckdns.org/update?domains=YOUR_DOMAIN&token=YOUR_TOKEN&ip=” | curl -k -o ~/duckdns/duck.log -K –
Save the file by pressing CTRL + X, then Y, and Enter.
Make the script executable:
chmod 700 duck.sh
Test the script by running:
./duck.sh
If successful, you should see an update confirmation in the duck.log file.
For Windows Users
Download Cygwin or use a tool like Git Bash to run shell scripts.
Create a new text file and rename it to duck.bat.
Add the following line to the file, replacing YOUR_DOMAIN and YOUR_TOKEN with your actual subdomain and token:
curl “http://www.duckdns.org/update?domains=YOUR_DOMAIN&token=YOUR_TOKEN&ip=”
Save the file and run it to test the update.
Step 5: Schedule Automatic Updates
To ensure your IP address is updated automatically, you can schedule the update script to run at regular intervals.
For Linux Users
Open your crontab file:
crontab -e
Add the following line to schedule the script to run every 5 minutes:
*/5 * * * * ~/duckdns/duck.sh
Save and exit the editor. Your DuckDNS update will now run every 5 minutes.
For Windows Users
Open the Task Scheduler.
Create a new task and set it to run your duck.bat file every 5 minutes.
Step 6: Verify Your DuckDNS Setup
To confirm that everything is working properly, visit your DuckDNS subdomain in a web browser (e.g., http://myhome.duckdns.org). If your network’s public IP address has been updated correctly, you should be able to access your network services using this domain name.