I’ve installed Raspcontrol by Jacob Clark along with Apache and PHP. I did a guide for that in a previous post.
What I want to do now is to get the webserver running it open to the World.
I’m on a dynamic IP with my ISP (I think!) so I want a way of getting the Pi to use some kind Dynamic DNS so I can refer to it by hostname.
I looked around for Dynamic DNS providers and found DNSDynamic.org
Looking at http://www.dnsdynamic.org/api.php, I can see they have an API that can be configured with ddclient, whatever that is. It’s got an obscure name, so it’s probably linux!
So first of all:
- Go to www.dnsdynamic.org and register.
- Then, once you’ve validated using their registration email, add a new domain.
- For the purposes of this tutorial, let’s go with
- Start the Pi, login as root and then:
- apt-get install ddclient
That installs and I automatically get an interface pop up on my screen:
So I choose other…
- Asking me for the name of the provider server, so let’s put in www.dnsdynamic.org
- DNS Dynamic uses the dyndns2 protocol, so choose that.
- Enter your username and password.
- It now asks for the network interface to use. Now, I use Wifi, so I put in wlan0, but if you are using a cabled LAN connection, you’ll use eth0.
- Now enter your domain – wibble.dnsdynamic.com
- At this point, ddclient will configure itself. At this point, I rather hope that it tells me what it does next!
- Okay, so it installs more stuff…
- Interesting… the installation completes and… tells me nothing…
- Right, looking at the ddclient documentation it tells me where the configuration file is. Not quite right in the documentation – the config file is at /etc/ddclient.conf
- Apparently, the way to run it automatically is to add the following to your /etc/rc.local:
/usr/sbin/ddclient -daemon 300 -syslog
- The ‘300’ is the number of seconds it should wait before checking to see if the IP address has changed. I think this is fine, even for my wifi connection with it’s customary 2 minute connection delay.
- So, let’s try it!
You check your IP address by going to dnsdynamic.com, logging in, going to “manage” and editing your existing domains.
- Edit /etc/ddclient.conf (for example > nano /etc/ddclient.conf)
- Change the line
and add a # in front of it.
- Add the line
- Save and quit.
You need to kill the current ddclient and restart it:
- ps -ef | grep ddclient
- Make a note of the process id (which is the first number on the left)
- kill -9 <process id>
- Then re-run ddclient by typing:
This will run it in the background and update the dynamicdns.org IP address to your external ip.
Go back to dnsdynamic.org and check your existing domains again. You should have your external IP address showing now. (I did).
You should now be able to: ping wibble.dnsdynamic.org and get that same IP address back.
The next thing to do is to do a port forward on your router. There are various guides to do this. You will need to point port 80 (HTTP) of your router at your INTERNAL IP address, port 80, or however your router identifies the destination. (Assuming that’s the port your webserver is running on).
I managed to do this on my BT Home Hub without much trouble
Now, to test it. First of all you cannot
just put your dynamic DNS hostname into your browser and expect it to work. I think it’s got something to do with looping back to yourself.
So, go to www.proxify.com
and type your wibble.dnsdynamic.com into there. You should get your Pi’s homepage! Wahey!