Monday, April 7, 2014

My Home Network Setup

A couple of people have asked me how my home network is basically set up and why I've chosen to do things a particular way. So rather than repeat myself several times, I thought I'd just try and write it all down in a blog post.

Although this is all for home use, I've tried to maintain a certain level of discipline around how I've set things up. But I don't work in IT infrastructure and I know nothing about "best practice". So a lot of it has been trial and error and a bit of guess work.

The NAS is the centre of everything

My HP N40L serves as my NAS and it is basically the centre of everything. It currently has 5 storage drives (3x4TB and 2x2TB) plus a small SSD for the operating system. I use SnapRAID for parity protection, with one of the 4TB drives storing parity and a second drive storing q-parity. For those not familiar with SnapRAID, this gives something roughly like RAID6 protection.

The OS on the NAS is Open Media Vault (OMV) which is basically Debian with a web management interface. I use it because it's free, it's open source and it's pretty easy to use. Truth be told, I could probably use vanilla Debian but in the early days I found configuring Samba to be a real pain and OMV made that a lot easier. OMV has also started to attract a growing community of plugin developers, although I generally don't use plugins much myself. One of the nice things about installing and configuring software from source is the level of control you have. Over time, I've got to the point where I can get software like Sickbeard, SABnzbd, Subsonic, et al up and running pretty quickly, and configured the way I like things.

The primary purpose of my NAS (as you would expect) is to serve content to the rest of the household. Mostly, this is done using samba, although I also run netatalk. Netatalk is an open source implementation of Apple's Appletalk suite, which is required if you want your NAS to serve as a Timemachine destination (and I do).

Playing Media

Initially, I tried to have my NAS also serve as a media player and there are certainly benefits to this arrangement. Having your media player and your media content close to each other means you don't have to worry about bandwidth issues and bottlenecks. And if you throw in a half-height graphics card, the HP N40L is definitely capable of serving as a media player. In fact, the default graphics capability of the N40L is, reportedly, capable of playing 1080p content. But it only has a VGA output, so you'll want an add-on graphics card if you want to plug in to your TV via HDMI.

Unfortunately I encountered a few issues with this approach. Firstly, I wanted my media player to be as easy to use as possible. I played around with a few options and ultimately settled on OpenELEC which is a variation or flavour of XBMC. OpenELEC is designed to create an appliance-like experience. It runs on a stripped down, bare-bones implementation of Linux, with a customised XBMC install over the top. From the end-user perspective they barely know that the media player is a computer. It boots, it displays a splash screen and then XBMC starts. And if run from an SSD, the boot process is very, very fast.

The problem with OpenELEC is that is just doesn't pack a lot of features that I wanted out of a NAS. True, out of the box it provides basic file sharing. And there are a number of 3rd-party plugins available. But I wanted to be able to tinker in a way that OpenELEC just wasn't intended.

This lead me to my second realisation. The design of a media player and design of a NAS are (generally) two different things. The OS, as I pointed out, is fundamentally different. Yes, there are some shared functionality between OpenELEC and OMV. But they are designed with different goals in mind. The same goes with hardware. The HP N40L is a pretty nifty piece of gear and it doesn't look entirely out of place alongside a television. But my media player goes just one step further -- it uses a picoPSU which is super quiet, along with a Ninja Scythe CPU fan. It runs cool, and silent which is exactly what I want in the TV room. The HP on the other hand, has a slight hum, along with the clicking sound of 5 hard drives. It's not super loud or annoying, but it belongs in the study rather than the TV room.

The third realisation is that I wanted my media player and NAS to be separate from a risk mitigation point of view. If the NAS goes down, I can still load content on to the media player and play it locally. Similarly, if the media player goes down, I can just connect my laptop to the TV and continue to source content from the NAS.

Getting the Geography Right

My NAS is located right next to the router, so it makes sense to be connected via wired Ethernet. However, the media player is located in TV room, so I tried a few different options. Connecting by wireless is possible, but typically causes issues with high bit-rate content. Forget about streaming 1080p Blu-Ray rips over wireless. Theoretically, the wireless network can sustain speeds of up to 300Mbps, which should be enough for streaming most 1080p content. But in practice, I pretty much never get speeds like that.

If your content is mostly DVD rips and TV recordings, this should be fine. I tend to leave 1080p ripping for movies that really justify the higher resolution -- big, loud action movies with lots of movement and special effects. So the majority of my content is ripped at 720p or lower (in the case of DVDs). This means that quite a lot of the content can actually play quite comfortably over the wireless connection if required. I have a copy of XBMC on my laptop, and more often than not, it runs content stored on the NAS (over the wireless) quite nicely. But for bigger, meatier content (particularly 3D stuff), and for added reliability, you'll want a hard-wired connection.

I tried Ethernet-over-Power, which generally works ok but proved to be a bit flaky and has a habit of dropping out at inopportune times. Resetting the EOP devices usually resolves everything pretty quickly, but you really don't want to have to do this in the middle of a movie. I still use EOP plugs in a few parts of the house, but have decided against using it for the media player. So in the end, I just wired the media player directly the router -- thereby, creating a 1Gbps link between media player and NAS. This involved some careful routing of cables along the skirting boards to keep everything looking neat. Most hardware stores stock a variety of capping products designed to hide cabling in a neat and unobtrusive way, so check them out. I also painted the cable in some sections so it would blend in with the wall. It took a bit of effort, but in the end I think it was worth it. Take a bit of advice though, test your cables before going through the arduous process of neatly routing them around walls and behind furniture. Although the whole affair only took a couple of hours, I really wouldn't want to go through it all again.