We're gonna be setting up a DDNS service with automatic updates from our RaspberryPi!
No-IP service at noip.com, provides up to 3 hostnames for free. The only caveat is that they need to be confirmed every 30 days, for a small fee all those limitations are lifted.
Register a new account (or use your existing one) and setup a new hostname under the hostnames section. Once this is done come back here and we're gonna setup automatic updates!
SHH into you RaspberryPi and let's get started. (You can do a new installation following the guide here.)
I like to use VIM to edit files, which doesn't come by default with
Raspbian Stretch Lite.
Type the following to install it:
$ sudo apt-get install vim
Feel free to use whatever editor you know and it's comfortable to you.
Install Dynamic Update Client
We're gonna be downloading the DUC from no-ip website.
$ cd /usr/local/src
$ sudo wget https://www.noip.com/client/linux/noip-duc-linux.tar.gz
$ sudo tar xzf noip-duc-linux.tar.gz
At this point you need to
ls to check what version is the one you downloaded. At the time of writing the latest version is
We need to build the sources now:
$ cd noip-2.1.9-1
$ sudo make
$ sudo make install
At this point you will be prompted by the installer for a few things:
Please enter the login/email string for no-ip.com
Please enter the password for user 'firstname.lastname@example.org'
This section only apply if you have multiple hosts for the same account.
2 hosts are registered to this account.
Do you wish to have them all updated?[N] (y/N)
Do you wish to have host [xxx.ddns.net] updated?[N] (y/N)
Please enter an update interval:
This is the interval which you want the service to update your IP address. I find 5 minutes to be frequent enough.
Do you wish to run something at successful update?[N] (y/N)
Unless you have specific needs, you don't need to run anything after the update so you can just say no to this one.
Run DUC as a service
We need to create a service to run the DUC in background.
Create the following file:
$ sudo vim /etc/systemd/system/noip2.service
Paste the following into the newly created file:
# Simple No-ip.com Dynamic DNS Updater # # By Nathan Giesbrecht (http://nathangiesbrecht.com) # # 1) Install binary as described in no-ip.com's source file (assuming results in /usr/local/bin) # 2) Run sudo /usr/local/bin/noip2 -C to generate configuration file # 3) Copy this file noip2.service to /etc/systemd/system/ # 4) Execute `sudo systemctl enable noip2` # 5) Execute `sudo systemctl start noip2` # # systemd supports lots of fancy features, look here (and linked docs) for a full list: # http://www.freedesktop.org/software/systemd/man/systemd.exec.html [Unit] Description=No-ip.com dynamic IP address updater After=network.target After=syslog.target [Install] WantedBy=multi-user.target Alias=noip.service [Service] # Start main service ExecStart=/usr/local/bin/noip2 Restart=always Type=forking
You can find Nathan's gist here.
Save the file.
Enable the service (This will guarantee that it will restart after reboots.):
$ sudo systemctl enable noip2
Start the service:
$ sudo systemctl start noip2
Verify the DDNS gets updated
To verify that the DUC is updating the DDNS correctly you can go in the no-ip.com dashboard and verify that the "Last Update" field in
Dynamic DNS ->
Additionally you can see the status of the service by typing:
$ sudo service noip2 status
This will output the last few lines of logs. You should be able to see something like this:
Jun 02 14:12:28 pi systemd: Starting No-ip.com dynamic IP address updater... Jun 02 14:12:28 pi noip2: v2.1.9 daemon started with NAT enabled Jun 02 14:12:28 pi systemd: Started No-ip.com dynamic IP address updater. Jun 02 14:12:28 pi noip2: example.ddns.net was already set to xxx.xxx.xxx.xxx.
Please note that the update only occurs if the IP changes. If you setup your IP when you created the new hostname it will not update until your IP differs.
Usually I set it to a different IP manually and restart the DUC to validate everything is working fine!
To restart the service type:
$ sudo service noip2 stop
$ sudo service noip2 start
Now, when we look at the status again, you can see that the IP has been updated.
Jun 02 14:29:11 pi systemd: Starting No-ip.com dynamic IP address updater... Jun 02 14:29:11 pi noip2: v2.1.9 daemon started with NAT enabled Jun 02 14:29:11 pi systemd: Started No-ip.com dynamic IP address updater. Jun 02 14:29:11 pi noip2: example.ddns.net set to xxx.xxx.xxx.xxx
Hope I saved you some time and headache.
Let me know in the comments if you encounter any issue or have any questions!