Keep Your Dynamic IP Online: NameSilo DDNS Auto-Update Guide

Your home network’s IP address likely changes, making it tricky to consistently access services with a NameSilo domain. This guide offers a simple way to set up your NameSilo domain to automatically track your home’s changing IP, keeping your services online 24/7.

We’ll use a handy script: packingbox’s namesilo_ddns_synology. While “Synology” is in the name, this script works great on any Linux system for easy NameSilo domain updates.


What You’ll Need

Before we start, make sure you have these ready:

  1. NameSilo API Key: This is the “password” the script uses to talk to NameSilo. Log into your NameSilo account, go to “API Manager,” and generate one. Make sure it has permissions to modify DNS records.
  2. Your Domain and Subdomain: For example, yourdomain.com, and the subdomain you want to use for DDNS, like home.yourdomain.com.
  3. SSH Access to Your Linux Device: Ensure your device (like a Raspberry Pi, an old PC turned server, etc.) has SSH enabled, and you know its administrator username and password.

Three Steps to Auto-Update

1. Connect to Your Linux Device

First, connect to your Linux device via SSH. You can use PuTTY (Windows) or Terminal (macOS/Linux).

ssh your_username@your_device_ip_address

After entering your password, you’ll be in the device’s command-line interface.

2. Download and Configure the Script

Choose a location for the script, for example, /opt/namesilo_ddns.

sudo mkdir -p /opt/namesilo_ddns
cd /opt/namesilo_ddns

Then, download the script:

sudo wget https://raw.githubusercontent.com/packingbox/namesilo_ddns_synology/main/namesilo_ddns.sh

Give the script execution permissions:

sudo chmod +x namesilo_ddns.sh

Now, you’ll need to edit the script file to enter your NameSilo API Key and domain information.

sudo vi namesilo_ddns.sh

Press i to enter edit mode, then find and modify the following lines:

  • Configure Directories:
    • Ensure the script can correctly store temporary files and logs. Find these definitions at the top of the file.
    • These paths usually don’t need changing, as /tmp is a standard system directory for temporary files. They’re used to store the NameSilo domain list, the last recorded IP address, and the script’s run log.
domain_xml="/tmp/namesilo_domain_list.xml"
domain_txt="/tmp/namesilo_last_ip.txt"
log_path="/tmp/namesilo_ip_update.log"
  • Fill in NameSilo API Key and Domain Info:
    • Replace yourmaindomain.com with your actual main domain. For HOST, enter your subdomain (e.g., home for home.yourmaindomain.com). If you’re updating the root domain (e.g., yourdomain.com), leave HOST empty.
API_KEY="YOUR_NAMESILO_API_KEY"

DOMAIN="yourmaindomain.com"
HOST="subdomain" # Leave empty for root domain. E.g., home for home.yourmaindomain.com
  • Fix Subdomain Update Issue:
    • If you’ve encountered a “Domain is not active, or does not belong to this user” error when updating subdomains, it’s because the script incorrectly appends the subdomain when constructing the request URL. Please find and comment out the following lines of code.
# if [[ $sub_domain != "" ]];then
#     domain_name="$sub_domain.$domain_name"
# fi

After making your changes, press Esc to exit edit mode, then type :wq and press Enter to save and quit.

You can manually run the script once to test it:

sudo ./namesilo_ddns.sh

If everything works, the script will show update information. You can also check your NameSilo dashboard to see if the DNS record has been updated. For more details, you can inspect the /tmp/namesilo_ip_update.log file.

3. Set Up a Scheduled Task (Cron Job)

To make it run automatically, we need to set up a scheduled task (Cron Job) that will periodically check and update the IP.

sudo crontab -e

The first time you run this, you might be asked to choose an editor; pick the one you’re comfortable with. Add the following line at the end of the file. For example, to run it every hour:

0 * * * * /opt/namesilo_ddns/namesilo_ddns.sh >/dev/null 2>&1

Here’s what that line means:

  • 0 * * * *: This specifies that the script will run at the 0th minute of every hour (i.e., on the hour).
  • /opt/namesilo_ddns/namesilo_ddns.sh: This is the full path to your script.
  • >/dev/null 2>&1: This part redirects the script’s output and error messages to /dev/null (the “null device”), preventing it from generating too many log files. If you want to see the script’s run logs, you can remove this part or redirect it to a log file.

Save and exit the crontab file.


You’re all set! Now your device can stay online via your NameSilo domain.

Leave a Reply

Your email address will not be published. Required fields are marked *