Setting up my Raspberry Pi to be the home server

When I first had a broadband connection, the cable company provided a modem, but it was up to me to provide the router. Not long after, I was having regular failures from the small proprietary routers that you could buy which a detailed examination showed could not keep up with the massive amount of low level ethernet protocol messages coming from the cable side (looking like a large ethernet community) that seemed to be caused by a virus someone on that network had. I put a linux box in to see if I could get more information, but it was rock solid and was up for almost a year before a power failure caused a reboot. However it remaining running was crucial to my whole houses internet connectivity. Recent disk failures in this PC has highlighted its vunerability, and I decided to see if I could do something about it.

My Raspberry Pi
My Raspberry Pi – showing the 4G SD card on the right holding the debian distribution and a small San Disk Cruz thumbnail sized 32GB usb memory stick on the left as my main storage (/var partition, including users mailboxes stored in /var/mail).

Fairly quickly into its new role this PC (which I have named Owl – after the Winnie the Pooh character) became a more and more important part of the network. It is the dhcp server and dns server for the home. It provides the firewall. It hosts this WordPress web site I am writing this blog post on, and it also hosts several other applications I use within the home – such as financial planning, and a chat server.

I added disks to it – and with this large amount of disk space it became a backup server for all the other PCs in the home. Not only that, but it became backup server for some of the other sites I run including Melinda’s Backups and those related to my business (Hartley Consultants) and its clients.

Almost straight after it was launched last year I bought myself a Raspberry Pi. I didn’t know at the time quite what to do with it, but I thought I would play around with it to explore its capabilities. It was a model B (with an ethernet interface) but, at that time, only had 256Mb on memory. Subsequent model B units have double that amount.

A couple of months later, I saw the availability of a plastic case for it, and decided to get it. But still the Raspberry Pi remained in its original packing, as I didn’t have time to do anything with it.

A couple of months ago one of the disks on Owl started failing. Fortunately I had taken the precaution of using two disks in a raid array, so it wasn’t catasrophic, but it did highlight the vunerability, especially when the replacement arrived and I had no choice but to power the machine down in order to remove the old and insert the new. Whilst that process was happening our home had no internet connection. This vunerability worried me.

It was then I realised that I might be safer using the hub as the main gateway (rather than as just a modem) so that if the server failed, others would still have internet accesses. Obviously if that failed it would prevent the whole house from having and internet connection – but if that failed in the old scenario it would do the same. So there is some nervousness that switching on the hub as a router may be more vunerable than just having it as a modem – but (provided everything is reversible) it was worth an experiment to see if I could do it. It was then I realised that the Raspberry Pi – which I will call Piserver from now on could actually provide many of the other services that had been undertaken by Owl. The picture below shows that architecture.

The overall archicture using Piserver for home services
The overall architecture using Piserver for home services. I am using ntp for time services, dnsmasq for dhcp and dns services, postfix and dovecot and sqlite for mail services, and apache as the web server, with home written applications in php and javascript. Backup DHCP to be provided by the Superhub in an emergency.

At the time of writing this blog post, I have completed phase 1 of the project (Piserver is now the home dhcp and name server) and am currently working my way through phase 2 – setting up Piserver to be a mail server for the home. I intend to follow up with other posts that describe how I achieved each function. As I write them, I will provide links to the articles below.

I am not yet sure it will work – this Raspberry Pi only has 256Mb of memery. The fallback will be to buy a new unit with double the memory, but for now it is looking good.

Author: Alan

I am Alan Chandler.

Leave a Reply

Your email address will not be published. Required fields are marked *