If you have, like me, an ISP that provides you a dynamic IP, you certainly need to use a dynamic DNS service like DynDNS or No-IP. This is important if you want to use your Raspberry Pi as a server. I personally use No-IP for historic reason since I have my free account for at least 10 years. In that post I’ll teach you how to use their official client as a service under Raspbian.
The No-IP team provides a little program called the Dynamic DNS Update (DUC) Client. DUC continually checks for IP address changes in the background and automatically updates the DNS at No-IP dynamic DNS whenever it changes. This program can be usable under Raspbian without any modifications, only the part for setting up the service is a little touchy. Follow the guide!
Compile the DUC Client
The first thing to perform is getting and compiling the client. Open a Terminal (or use a SSH client, like PuTTY) then enter the following commands:
1 2 3 4 5 6 |
cd /usr/local/src sudo wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz sudo tar xzf noip-duc-linux.tar.gz cd noip-2.1.9-1 sudo make sudo make install |
After that, the No-IP DUC Client will ask you some information:
- The login/email string for your no-ip.com account;
- The associated password;
- The preferences (like the refresh interval).
The No-IP DUC Client is now ready to be used. Time to set up the service now.
Setting up the No-IP DUC Client service
Now that you have a working DUC Client, it’s time to install the service. Doing this will allow the DUC Client to start when booting up your Raspberry Pi.
1 2 3 4 5 6 |
cd /usr/local/src sudo wget http://download.sizious.com/rpi/noip-duc-raspbian.tar.bz2 sudo tar -xjvf noip-duc-raspbian.tar.bz2 cd noip-2.1.9-1 sudo chmod +x raspbian.noip2.sh service.install.sh service.uninstall.sh sudo ./service.install.sh raspbian |
After passing all these commands, you should have the following output:
1 |
./service.install.sh: installing noip2 service for raspbian... OK! |
Everything is now set up!
Checking if the No-IP service is working
First of all you need to check if the No-IP service is the latest to be run by the Raspberry Pi. Enter the following command:
1 |
systemd-analyze blame |
The output should be something like that:
1 2 3 4 5 6 7 8 9 10 |
10.053s noip2.service 840ms networking.service 591ms systemd-logind.service 560ms keyboard-setup.service 460ms alsa-restore.service 447ms dhcpcd.service 437ms triggerhappy.service 434ms dphys-swapfile.service 373ms systemd-fsck-root.service ... |
Running the No-IP service in the last position avoid some problems. For example, if your network configuration is not ready when running the DUC Client, this can crash it with useless error messages. I already configured everything in the additional files provided above to solve this problem.
For checking if the No-IP DUC Client Service is running, just enter the following command:
1 |
systemctl status noip2 |
A correct output should be something like that:
1 2 3 4 5 |
● noip2.service - LSB: No-IP Dynamic Update Client (DUC) for Linux Loaded: loaded (/etc/init.d/noip2) Active: active (running) since Sat 2017-04-01 19:17:13 CEST; 4 weeks 0 days ago CGroup: /system.slice/noip2.service └─596 /usr/local/bin/noip2 |
As you can see, the noip2 service is up and running!
To get more information on the noip2 instance running, enter the following command:
1 |
sudo noip2 -S |
This will output something like:
1 2 3 4 5 6 7 8 9 |
1 noip2 process active. Process 705, started as noip2, (version 2.1.9) Using configuration from /usr/local/etc/no-ip2.conf Last IP Address set xxx.xxx.xxx.xxx Account xxxxxxxx@xxx.xxx configured for: host bonobo1985.no-ip.org Updating every 30 minutes via /dev/eth0 with NAT enabled. |
So everything seems fine. Now you can connect to your No-IP account and check if the concerned DNS has been updated, like this:
Wow you did it! Enjoy 🙂
Bonus
You can check for error messages thrown at startup by running the following command:
1 |
dmesg | grep "noip2" |
You can control the No-IP service by using the service command:
1 |
sudo service noip2 restart |
This command will restart the No-IP service (this command takes up to 10 seconds to be run).