Sometimes you just want to reach your Raspberry Pi even if you are not at home. Which means that you are trying to reach it outside of your own home network. This could be very helpful, if you want to give it some download tasks via pyLoad while being away from home, for example.
However, the problem is, that nearly every IP address gets assigned dynamically and changes every 24 hours. Therefore, your Raspberry Pi gets a new IP address every day and you can’t reach it anymore. The solution for this problem is called a DynDNS Domain. In the following you will learn how to this, with the help of NoIP.com.
Requirements: Raspbian or any comparable distribution installed
Step 1: Register your account on No-IP.com and get your free subdomain
First, in order to get your free subdomain, you need to register a free account on NoIP.com. Make sure to check the Create my hostname later box and finish the registration process by clicking Free Sign Up. As soon as you activated and logged in to your account successfully, click the Hosts/Redirects button at the menu.
To create a new subdomain, click on Add A Host, enter your preferred name as hostname and pick the NO-IP Free Domain (Scroll all the way down in the dropdown menu). Leave the Hosttype on DNS Host (A). You don’t need to change any other settings.
Step 2: Download the Dynamic DNS Update Client for Linux
Now we are going to download the Dynamic DNS Update Client for Linux straight to our Raspberry Pi and unzip it. Later on, it will check every few minutes if our IP address changed, and if, notify No-IP.com about your new IP address, so that your subdomain points to your new IP again. Enter the following commands:
tar xf noip-duc-linux.tar.gz
Step 3: Rename the folder
The just unzipped archive includes a folder, which we will rename now and also change into its directory. Execute the following commands:
mv noip-* noip
Step 4: Install the application
Once we are in the correct directory, compile and install the application (see the command below). In the final stages of the installation process, it will ask you about your No-IP.com account information (E-Mail address, password, your subdomain) and your desired update interval. In my opinion, an interval of 10 minutes is sensible.
sudo make install
Step 5: Start the application
Now, you just need to start the installed application with the following command:
Step 6: Start the Client automatically upon boot (optional; but recommended)
If you want that the update client automatically starts while the raspberry pi boots, thus always updates the IP, you need to create a crontab which does this task for you. This might sound complicated at first, but it really isn’t. First you need to execute the following command:
In the file which opened, scroll to the end and add the following in a new line:
@reboot cd /home/pi/noip && sudo noip2
That’s it! You might need to open some ports in your router. For help, please refer to the manual of your router.
Now you can reach your raspberry pi easily if you’re not at home! If you liked this how-to, please consider sharing it with your friends (you can find sharing buttons to the left).