Raspberry Pi with Cloudflare’s Dynamic DNS (ddclient)
I’ve used DynDNS and other providers (which even my Cisco router supports) but instead of using a horrible domain-name, I wanted to use a subdomain of my personal domain. eg. raspberrypi.mydomain.com
If you don’t have Cloudflare i recommend it not only because they give you tons of features for your website but also because it’s a reliable DNS (better than GoDaddy at least), plus did I mentioned almost everything is free? :)
The latest version of raspbian, the Debian distribution optimised for the Raspberry Pi, is 2012-09-18-wheezy-raspbian.zip (as to this writing)
Once you have enabled ssh, connect to it via your main computer or use your USB keyboard to type this commands. (I left it powered via my router USB port and plugged the Ethernet cable to it)
Install the ddclient required packages.
$ sudo apt-get install sendmail $ sudo apt-get install libio-socket-ssl-perl
$ wget https://gist.github.com/gists/3942373/download $ sudo mv ddclient /usr/sbin/ $ sudo chmod +x /usr/sbin/ddclient $ mkdir -p /etc/ddclient/ $ sudo nano /etc/ddclient/ddclient.conf
daemon=300 # check every 300 seconds syslog=yes # log update msgs to syslog mail=root # mail all msgs to root mail-failure=root # mail failed update msgs to root pid=/var/run/ddclient.pid # record PID in file. ssl=yes # use ssl-support. Works with # ssl-library use=web, web=checkip.dyndns.com/, web-skip='IP Address' cache=/tmp/ddclient.cache # ## CloudFlare (cloudflare.com) ## protocol=cloudflare, \ server=www.cloudflare.com, \ login=<cloudflare_email_login> \ password=<cloudflare_api_key> \ <domain_or_subdomain_on_CF>,
Replace the login, password (the api key from your CF account) and the domain or subdomain you want to update the IP to.
Then run to verify that everything works fine:
$ sudo ddclient -daemon=0 -debug -verbose -noquiet
$ sudo ddclient
Just run this ^ to start the process in the background, aka as a daemon.
Now just forward the ssh or any other port, you want to be able to connect from the ‘world’, from your router to Raspberry Pi ip-address.
Tips: - Change the sshd port from the 22 default (a lot of bots/hackers will try to bruteforce your password) Even better use a ssh key (how to generate one)
(any issues or comments tweet me @gianpaj)