How-to: setup DDNS client to update A record with your public IP with simply.com domain.

Guide on how to setup a linux server as DDNS Client for your simply.com domain.

Why would you do this?

Here is one example. This is my use case.
At home, my WAN connection is DHCP and I have multiple uplinks. So my external IP changes quite a bit.
I use DDNS when connecting to my VPN server at home. When I’m at work or school, I type vpn.mydomain.com in my VPN client. I don’t have to worry about my IP changing at home.

Prerequisites

  • You need a domain from simply.com.
    This guide is based on their API.
  • You need a Linux server available inside your network.
  • This guide is not for lazy people. I make you do a lot of the work yourself 😉

Step 1. Create Python script that updates the A record.

Here is the API syntax:
https://api.simply.com/ddns.php?apikey=[APIKEY]&domain=[DOMAIN]&hostname=[HOSTNAME]&myip=[IP]

from requests import get
import os

ip = get('https://api.ipify.org').text
command = "curl -s -L \"https://api.simply.com/ddns.php?apikey=YOUR_API_KEY&domain=YOUR_DOMAIN.COM&hostname=THE_A_RECORD_NAME&myip="
command = command + ip + "\""
print(command)

stream = os.popen(command)
output = stream.read()
print(output)

Step 2. Use Cron to automatically run the script

For this idea to make sense, you want your server to run this script every x minutes.
With linux, this is very easy.

Btw crontab -e uses vim by default. Here is a guide on how to change that: link.

Open your shell and type “crontab -e”.

Cronjob template:
15 * * * * /usr/bin/python full_path_to_your_script >/dev/null 2>&1

Here is a calculator for the time settings: link.

The code is use is:
15 * * * * /usr/bin/python full_path_to_my_script >/dev/null 2>&1
# This means the script will run every hour when the clock is xx:15.
# >/dev/null 2>&1 means the output of the cronjob gets deleted. By default, you get a mail every time the cronjob runs.

Step 3. Done

This is not the most thorough guide in the world. If you want me to add something to the guide or need help. Feel free to write a comment or contact me.

Leave a Reply