Feature #160
Dynamic DNS with No-IP on Debian
Description
With all my other tutorials on setting up mail and web servers, I figured it only makes sense to write up a tutorial on setting up a Debian installation with a dynamic DNS client. Usually your home router has one IP that usually changes from time to time. Using a dynamic DNS client, in this case with No-IP, we can setup Debian so that it will automatically update your DNS records when your IP changes. I decided to use No-IP because they're one of the dynamic DNS providers that still offers a free account, this is useful if you're just learning and aren't quite ready to purchase a domain.
Secure the domain¶
The first thing you need to do is secure the domain either by means of creating a free account or purchasing a domain with No-IP.From the Hosts/Redirects tab, under Manage Hosts you'll want to click Add a host if you haven't already. You should probably set the IP for the domain initially. You can do this by making sure that DNS Host(A) is selected and then typing your IP in. By default No-IP will automatically default this value to whatever the external IP is of the system you're browsing the website with.
Install the No-IP client¶
The next step is downloading and installing the No-IP client that will update your DNS with your dynamic IP. Note, if you have several machines all behind the same external IP then you really only need to install the No-IP client on one of your servers. So we'll run a few commands to download the client, unpack it, build it, and install it:
cd /usr/src/ wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz tar xzf noip-duc-linux.tar.gz cd noip-duc-linux sudo make sudo make install
Upon running the final command you should be presented with some configuration questions. The first two will ask you for your No-IP username and password. After you've entered your credentials the installer will tell you how many hosts (domains/subdomains) you have available and if you'd like to update them all. If you select No it will go through each host and allow you to pick which ones you'd like to update.
After you've made your selections it will ask for an interval (in minutes). This controls how often the service will check to see if your IP has changed. 30 is a good default value, if you know that your IP changes more frequently then you may want to lower this value.
The final question will ask you if you'd like to run a program upon completing a DNS update. Most people can go ahead and say No here.
Now we just need to create an init script that will automatically start the service when Debian boots. As root, copy the following bash script and save it to /etc/init.d/noip2
:
#! /bin/sh # . /etc/rc.d/init.d/functions # uncomment/modify for your killproc case "$1" in start) echo "Starting noip2." /usr/local/bin/noip2 ;; stop) echo -n "Shutting down noip2." killproc -TERM /usr/local/bin/noip2 ;; *) echo "Usage: $0 {start|stop}" exit 1 esac exit 0
Next we need to modify the permissions on the script so that it's executable and add the service:
sudo chmod 755 /etc/init.d/noip2 sudo update-rc.d noip2 defaults
Go ahead and restart your installation and the No-IP service should now be running.
Related issues
Updated by Daniel Curtis almost 11 years ago
I encounter a problem over while connecting to the web services associated with the no-ip service. It appears that the init script did not work correctly. I found that editing /etc/rc.local
and adding the following before exit 0
:
/usr/local/bin/noip2
Now noip2 will launch at boot time. In order to apply the change without rebooting, run:
sudo /etc/rc.local
Updated by Daniel Curtis almost 10 years ago
- Project changed from 30 to GNU/Linux Administration
- Category set to Domain Name Server