I played with Single-Board Computers for some time now, and although I was completely happy with just having a mediacenter and something to play with, I wanted to do something I can benefit of. So I decided to start hosting my own services on my Raspberry Pis.
Now I relocated a bunch of them into my basement, supplying them with ethernet over the powerline being responsible for many „cloud services“ I use. The headline to this article could also read: Reclaim your cloud!
Problem #1: I don’t have a fixed IP
Well, that’s not really a problem, is it? You can just go ahead and get dynamic DNS services from the various providers, such as dyndns, no-ip and many more. Some tend to bill from their services from time to time (dyn.com recently discontinued their free services) but you can always find a free service, even if it’s only temporarily
Problem #2: Dialup IPs are a bad choice for mail servers
Get this: Apparently the bigger mail providers classify IP address spaces from ISPs as „bad“, since mail coming from them are usually spam, that is being sent from botnets. If you run your own mail server on your dynamic IP, you are most likely to be blocked by most of the bigger mail providers. Trying to get your IP unlisted is a tiring job, as you will have to do it everytime your IP changes
Solution: Root-Server with OpenVPN and Port-Forwarding
So I needed an IP address that usually only servers have, and somehow route that to my home. I decided to give OpenVPN a try and succeded immediately. Setting up a cheap virtual server at a datacanter for as low as 8 EUR/month, I now have a computer I control with a static IP address. I installed and configured OpenVPN as server and my Raspberry Pi as client. The OpenVPN server is now doing, what your plastic router at home is doing: NAT. It acts as a gateway and routes the packets back in. And just like your router, it can use iptables to forward traffic from ports you choose to your Raspberry Pi.
With this setup, you can host your services at home. Out of the box with only OpenVPN and port forwarding, you are limited to a manimum number of 1 RasPi-server per port, making it unsuitable for hosting different well visited websites, but for single user (or family) mail, owncloud or xmpp/jabber, this is sufficient and energy-efficient.
If you want to host multiple sites at home, you can use a load balancer on your OpenVPN server and use a dedicated database host. Services you can host at home include:
- Chat Server (i.e. Jabber/XMPP/IRC)
- Cloud software (although I would put that into Webserver)
- Mail Server
- Print Server
- Torrent tracker
What are you hosting at home with your Raspberry Pi? Let me know in the comments!