Wednesday, 13 June 2012

Raspberry Pi - access from the internet using no-ip

Anyway...  As part of my iPlayer custom podcast solution I needed to be able to connect to my Pi externally over the internet.

Sign up for a host with no-ip.com

My ISP assigns IP addresses dynamically (pretty typical but not very useful for accessing from the internet), so I setup a free account with www.no-ip.com who offer a free dynamic dns service whereby they provide you with a URL (e.g. myhost.no-ip.org) and they redirect internet traffic from that URL to your IP address.

You can either login to no-ip.com and update your ip address manually, as and when it changes (not practical!), or no-ip provide client software which will run in the background on your Pi and periodically update your no-ip host with your IP address.

Note - Its important you create yourself an account and add a host on no-ip before installing the client as you will need your account details as part of the install.

Install no-ip client
(most of this detail is taken from http://www.no-ip.com/support/guides/update_clients/setting_up_linux_update_client.html but there are a few discrepancies)

Create a directory for the client software

mkdir /home/pi/noip
cd /home/pi/noip

Download the client software

wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz

Extract the archive

tar vzxf noip-duc-linux.tar.gz

Navigate to the archive directory
Note - use 'ls' to check the directory name create when the archive was extracted, it was noip-2.1.9-1 when I installed the client.

cd noip-2.1.9-1

Compile and install
The client was compiled and installed on the Raspberry Pi, using the following commands:

sudo make
sudo make install

During the install I was asked to proide my login, password and a refresh interval.

Run the client
The client is run using the following command:

sudo /usr/local/bin/noip2

The client runs continuously until shutdown or the Raspberry Pi is shutdown, if you want to set up your Pi so the no-ip client is started at boot, check out this blog which describes how to configure the application to start at boot.

I then had to configure my broadband router to forward the specific port I wanted my Pi to service (e.g. port 80 for www) to the internal IP address of my Raspberry Pi, see portforward.com for more information about port forwarding guides and info; you may find setting up port forwarding simpler if your raspberry Pi has a static IP address, see this post on how to set a static IP address.

20 comments:

  1. Hi Martin,
    I've done as you've said, and gotten all the way through it, however, how come it doesn't ask which host I want to update using the Pi, or is it because I only have the one host to update?

    I've had it running for a while last night, set the update interval to 60 however, it isn't updating, so have removed the file at /usr/local/bin and ran sudo make install again and reconfig'd it. Is there anything else I should do?

    ReplyDelete
    Replies
    1. I vaguely remember when I installed the client and only had 1 host in no-ip it didn't ask to confirm - so this sounds ok.

      I would check the simple things, is the client actually running, run "ps -LA" and you should see no-ip2 running, also make sure your Pi is connected to the internet and can connect to no-ip run "ping www.no-ip.com" and make sure you get a response.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Thanks for this Martin, took a lot of The Fear out of the process, for an init.d noob like myself.

    ReplyDelete
  4. There is also this PHP client:

    http://www.os-cms.net/blog/view/21/NO-IP-client-written-in-PHP

    ReplyDelete
    Replies
    1. What are the benefits of running a php client over the no-ip supplied one?

      Delete
    2. None really. They do the same job, but I wrote the PHP client because I could not install the no-ip supplied one. So it is a matter of what language you prefer. If you program in PHP it will be easy to modify the PHP client to your needs .)

      Delete
  5. So, if I install no-ip, can I go to internet?

    ReplyDelete
  6. Replies
    1. What do you want to do? Host a webserver, a vpn, get access to your pi via ssh from work? You tell me!

      Delete
  7. i want to host a webserver for my monitoring system.. what should i do now?

    ReplyDelete
    Replies
    1. I think that depends on your requirements for a webserver. If your looking for a LAMP (linux, apache, mysql, php) setup, have a look at this http://www.penguintutor.com/linux/raspberrypi-webserver, if you looking for a lightweight webserver, do a search for lighttpd, which you can install with sudo apt-get install lighttpd

      Delete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Followed this to the letter, but it just doesnt want to connect to my no-ip no idea why either.
    Using pwnpi3.0

    ReplyDelete
    Replies
    1. I have no experience of pwnpi. These instructions are based on the raspbian distribution. Are you presented with any error message?

      Delete
  10. I have tried this over and over again. But I can not get it to work. I even set up a fresh load of the Pi OS on a new memory card. No luck. I made an account with No-ip. I setup the software on the Pi. I can access the default Wordpress website on other PCs on my network. Setup the No-ip on the Pi. I can ping the web address and the URL from the pi and all computers on the network. The router has been setup for port forwarding. But when I enter the No-ip URL I set up, it times out. Not matter what computer I use, one of off my network. Help please!!!!

    ReplyDelete
    Replies
    1. Very active forum I see. Oh well.

      Delete
    2. I was just reading your original comment (while on my family holiday!) considering how to respond...

      If your looking for a forum try the raspberry pi one. Raspberrypi.org/forum

      Delete
  11. Hi,
    i am trying to get access to my raspberry too.
    I installed no-ip on it but i don t exactly know which type of no-ip i have to select for my Hostname ?
    - DNS Host (A)
    - DNS Host (Round Robin)
    - DNS Alias (CNAME)
    - Port 80 Redirect Web Redirect
    ?

    ReplyDelete
  12. Lifting the restrictions of your own country can be part of the attraction to a British IP. UK ip address

    ReplyDelete

Note: only a member of this blog may post a comment.