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."

Share this page:

19 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Anonymous

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.

By:

LOL Sorry, It's always the little things huh. Fixed now. To be honest I had no idea anyone even looked at this.

By:

Also, thanks for letting me know :)

By: Anonymous


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

By: wael

 

 

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

#######################################################
# alt-by wael salah eldien eplusweb.com

#! /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
    ;;
    status)
        echo -n "display info about running clients"
        /usr/local/bin/noip2 -S
    ;;
    *)
        echo "Usage: $0 {start|stop|status}"
        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

 sudo /etc/init.d/noip status

result like this

display info about running clients1 noip2 process active.

Process 2711, started as noip2, (version 2.1.9)
Using configuration from /usr/local/etc/no-ip2.conf
Last IP Address set xx.xx.xx.xx
Account xxxxAcount
configured for:
        host  xxxxxx.noip.me
Updating every 5 minutes via /dev/eth0 with NAT enabled.

By: Nate

I followed to the letter but I got an error...

 

[email protected]:/etc/init.d$ sudo /etc/init.d/noip start

sudo: /etc/init.d/noip: command not found

 

[email protected]:/etc/init.d$

 

Why?!

By: Bonzai

Had the same problem.

chmod +x /etc/init.d/noip

This worked for me. 

By: chris Maratas

Hi,

 sudo /etc/init.d/noip status    

there is no status displayed after running the command. I can seem to know if its realy working. I can also open 8245 port in my ROUTER this is wierd

By: Anonymous

Im lookint at this now xD

Thanks you 

By: Raytek

First sorry for my bad English. I would like to thank you for the help, was having problems with the update-rc and permissions using the rc.local my problems were solved. Once again, thank you!

By: pedropt

this solution break my startup , the boot does not finish because of the noip script .

a better way that works too (tested here) is  like this :

in rc.local above exit 0  write this only :

/usr/local/bin/noip2

 

and noip will start on boot without stopping it .

By: Misjah

I installed no-ip updater and it starts at boot normaly (12.04). The problem is that it does not update public ip when isp change it or when router is rebooted so I have to enter it manualy... I have no idea why is this happening. It works under windows with same account but different host.

By: Connel

Awesome guide, much better than the offical No IP knowledge base!

By: Michael

I recommend editing to run the chmod on /etc/init.d/noip BEFORE trying to run start/stop - I had to do that otherwise I got the error "sudo: /etc/init.d/noip: command not found"

Otherwise, awesome tutorial! Thanks.

By: Jeton

I have three hosts with the same IP address, but only one gets updated. How to add the other two hosts?

By: joo

Great instructions. Works nicely with Ubuntu 16.04 LTS.

By: Dan Lester

This is now outdated as of ubuntu 15 because rc.local is no longer used by default.  systemd is now used to enable system services.

So for ubuntu 15+ you would finalize the setup with.

Create a systemd-File with the name noip2.service in /etc/systemd/system/ with:

Code: [Unit] Description=DynDNS by NoIP [Service] Type=forking ExecStart=/usr/local/bin/noip2 [Install] WantedBy=multi-user.target

Enable at Boot:

Code: systemctl enable noip2.service

Start:

Code: systemctl start noip2.service

Status:

Code: systemctl status noip2.service

By: Anonymous

Thanks, this was very helpful!

By: Ralph Shnelvar

You wrote: "Hit enter to accept the 30 second update rate"

This is 30 minutes, not 30 seconds.

no-ip technical support tells me the minimum amount of time for the refresh rate allowed is 5 minutes.