I recently went on holiday to Italy, and wanted to check on the house with my IP camera whilst I was away. Being the fool that I am, I forgot to set up a dynamic DNS before I left home. I need a dynamic DNS to log in to my router from outside of the home, as my external IP address changes all of the time.
As this external IP address is required to access my IP camera, as soon as it changes, the settings in my IP camera app are wrong which means I can’t access it.
There are many websites offering a Dynamic DNS – I went with No-IP.com from a recommendation.
In order for a Dynamic DNS to work, it needs to be able to connect to ‘something’ (like a PC) within your home network to keep the IP address updated. Now you could just leave your PC on with the update software running, but that could get expensive on your electric bill.
Enter our friend the Raspberry Pi…
In a few simple steps you can set the Raspberry Pi with a No-IP Dynamic DNS client, which will keep your External IP address updated with No-IP.
Step 1: Get a No-IP account
Clearly you will need a No-IP.com account for this to work.
Make sure you do this before you install the client on the Raspberry Pi as you need the following information to set it up in Terminal:
- Log In (the email address/name you use to log in to No-IP.com)
- Password (your No-IP.com password)
Step 2: Install and Set Up the No-IP client software
Create a ‘noip’ Directory
First, let’s create a directory (folder) for the No-IP client software to be installed into. Go into Terminal and type the following:
Now press Enter. Done.
Go to the new ‘noip’ directory
Still in Terminal, enter the following to go to the new directory we just created:
Press Enter and you’re done.
Download the No-IP client
In the previous step we set ourselves in the noip directory. We will now download the No-IP client into this directory.
Again, using terminal:
Press Enter. Let it do its thing until Terminal becomes available again.
Extract the downloaded archive file
The last step downloaded the No-IP client as an archive file. Time to extract it. Once again, in Terminal:
tar vzxf noip-duc-linux.tar.gz
Press Enter. Done
Go to the extracted directory
We just extracted the file which made a new directory in our ‘noip’ directory. Let’s navigate to it. Back to Terminal again:
(If that doesn’t work, the version number may have changed/updated. If this happens, whilst in the ‘noip’ directory enter ls and press enter to check the version number/name.)
Install and confirm your No-IP account information
Time to finish installation and enter your No-IP account details. In Terminal again:
Press enter, let it finish, then enter the following:
sudo make install
It will do some ‘stuff’ then ask you for your No-IP account log-in and password. Just enter those and press Enter after each.
It will ask for a refresh interval. I think this is minutes, so I just used 30. It also says something along the lines of “Do you want to complete other actions” – I just typed ‘N’ for ‘no’ and hit enter again.
This should now be all set and ready to go. If you just realised you entered something wrong there, use the following command in Terminal to recreate the config file:
sudo /usr/local/bin/noip2 -C (ONLY required if you want to recreate the file due to entering something wrong)
Start the client
Now that we’re all set up – time to fire up the client. In Terminal:
That’s it, you now have the client running on your Raspberry Pi.
Step 3 (Optional): Auto-Run the Client on Boot
I didn’t like the thought of having to start the client every time I reboot, so I also did a bit of searching and found out how to get it to start every time the Pi starts.
All we need to do is add a line into an existing file, and that’ll do it.
Open up the existing file to edit
We need to open a file for editing to add our line. To do this, type this into Terminal:
sudo nano /etc/rc.local(Many guides don’t include the ‘sudo’ part – if you miss this out, you may get a ‘permission denied’ error when you try and save the changes)
Add the new line into the file
Now that we have the file open, we just need to add the new line. It’s important to put this new line in the right place.
Here’s a picture to show you where it should go – see where my cursor is – between ‘fi’ and ‘exit 0’:
Press Ctrl+X and enter ‘Y’ to save changes.
That’s it – the client will now start every time you turn on/reboot your Raspberry Pi. To check if it’s running, just use:
sudo /usr/local/bin/noip2 -S
Let me know if you have any problems.