How To Install No-ip2 On Ubuntu 12.04 LTS In Order To Host Servers On A Dynamic IP Address

Want to support HowtoForge? Become a subscriber!
 
Submitted by mrpurple (Contact Author) (Forums) on Wed, 2013-08-07 19:58. :: Ubuntu

How To Install No-ip2 On Ubuntu 12.04 LTS In Order To Host Servers On A Dynamic IP Address

Hosting your own servers at home is great, you can host your own website from home, share family photos, and stream your media to anywhere in the world. However all of this requires that you have a location on the internet which people can find such as http://www.mywebsitedomain.com.

This is normally done by purchasing a domain name and pointing it to a static IP address which isn't free. 

In this how-to I will show you how to achieve the same web address result on a dynamic IP address by installing the free No-IP service into Ubuntu 12.04 LTS which is also the perfect host for your own websites and streaming services.

To install Ubuntu 12.04 LTS you need a computer with nothing on it to be the server. These days almost any old PC can be repostioned as a succesful Ubuntu server. Just take that old PC you were going to throw away and follow the great guide for installing a LAMP server at http://www.ubuntugeek.com/step-by-step-ubuntu-12-04-precise-lamp-server-setup.html Go all the way to the "static ip" part and stop there.

Once you have a LAMP server running with SSH as in that example you can access a terminal on that server from your normal PC using putty for example. Now you are ready to get the No-IP service running on it.

First go to http://www.noip.com click "sign up now" under "Free dynamic DNS"
Sign up with a unique no-ip username and password. You will be assigned a free web site name probably something like http://<your_noip_user_name>.no-ip.biz

Click the "no thanks I'll use no-ip.biz" link to use the free DNS with the site you were assigned

I unclicked the "send me stuff" check box because I'm not a fan of being sent stuff but hey, since they are offering it all for free, you should do what you feel is best there.

Click "sign up" under the "free dns service" column. Of course if you so chose you could pay for some premium services but that's outisde the scope of this how-to.

Now open a terminal to your server using putty for example and login with the username and password that you setup during the LAMP installation.

Switch to the root user

sudo -s

When asked, enter the password for the username you installed ubuntu with

Install the software required to build the no-ip client

 apt-get install build-essential checkinstall

Download the no-ip client

cd /usr/local/src/
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar xf noip-duc-linux.tar.gz
dir

Note down the directory where the client was extracted to eg:  noip-2.1.9-1 and "cd" to it

cd  noip-2.1.9-1/

Start the installation process

checkinstall

Click y to accept the default docs
Enter "noip" as a name for the software
Hit enter three times to accept the name and descriptions for the program

Now you will configure the client for your no-ip web service

When asked, enter your no-ip login name
When asked, enter the no-ip password for that username
Hit enter to accept the 30 second update rate
Hit enter to accept N and go on without running a script on successful update (you dont need it)
Hit enter to accept n and skip listing the included docs
Hit enter to accept y and exclude the additional docs from the package

Note down the dpkg uninstall line but DONT run it. Its for uninstalling the package.
It will be something like: dpkg -r noip-2.1.9

Switch back to the normal user

su <ubuntu_username>

We will make the file permission quite permissive for ease of setup and then restrict them again later

sudo chmod 7777 /usr/local/etc/no-ip2.conf

Now we will write a simple start up script so the client will start when the computer starts.

sudo nano /etc/init.d/noip

Copy and paste all the following lines (between the long ##### lines) into the file you have just started. (If you are using putty from within windows you can use ctrl-c to copy then in the putty terminal either right cick or use shift-ins to paste

#######################################################
#! /bin/sh
case "$1" in
    start)
        echo "Starting noip2"
        /usr/local/bin/noip2
    ;;
    stop)
        echo -n "Shutting down noip2"
        for i in `noip2 -S 2>&1 | grep Process | awk '{print $2}' | tr -d ','`
        do
          noip2 -K $i
        done
    ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac
exit 0
#######################################################

Now exit and save. ctrl-x to exit and y to save.

You should be able to test the startup scripts with

sudo /etc/init.d/noip stop
sudo /etc/init.d/noip start

Now we reset the persmissions so only the root user (ie the system itself) will run the programs from within the start up procedure

sudo chmod 700 /usr/local/bin/noip2
sudo chown root:root /usr/local/bin/noip2
sudo chmod 700 /etc/init.d/noip
sudo chown root:root /etc/init.d/noip
sudo chmod 700 /usr/local/etc/no-ip2.conf
sudo chown root:root /usr/local/etc/no-ip2.conf

Now we will add the the noip start script to the ubuntu startup process

sudo nano /etc/rc.local

In the line above "exit 0" add the following line

/etc/init.d/noip start

In order for the client to work you will need to open port 8245 through to the server. The way you do this depends on your modem/router. This is called port forwarding. If you need help with port forwarding go to: www.portforward.com

Finally after all this your servers should be available from everywhere at
http://<your_noip_user_name>.no-ip.biz

Obviously in addition tot he no-ip client port 8245 you will also need to open up ports for the services you are trying to run on your home server. Port 80 for a web server for example

If you had installed the Ubuntu LAMP server as described in the link I gave at the top you can check if its working by going to your site and you should see the ubuntu apache default web page saying something like "Its working"

Please note that since No-IP is a free service they will prune unused ip addresses every thirty days. You will be warned of this at the email address you gave and you can log back into No-IP to keep the address live. As per the No-IP website "Free hostnames must be updated every 30 days in order to keep them active. We do this to keep our network clear of unused hostnames. We send frequent notifications via email to remind you to update your hostname, or you can manually update your hostname by logging in to your No-IP account and clicking the “Hosts/Redirects” tab, click “Modify” next to the hostname you would like to update and click “Update” at the bottom right."


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Fri, 2014-03-07 04:21.

This was very help, thanks!
 
This part...
 

You should be able to test the startup scripts with

sudo /etc/init.d/noip stop

sudo /etc/init.d/noip start 

 ...should have something that says to test with /bin/sh *or* have a comment that says it should be executable:

chmod +x /etc/init.d/noip start|stop

Submitted by Anonymous (not registered) on Sat, 2014-02-08 17:19.

Please remove the period at the end of ( sudo chmod 7777 /usr/local/etc/no-ip2.conf.)

 

I spent an hour googling what the problem was.
Submitted by mrpurple (registered user) on Sun, 2014-02-16 01:41.
Also, thanks for letting me know :)
Submitted by mrpurple (registered user) on Sun, 2014-02-16 01:40.
LOL Sorry, It's always the little things huh. Fixed now. To be honest I had no idea anyone even looked at this.