Home NAS and VPN with Odroid XU4

img_2310
Here’s my cool(literally cooled) home server. Still a lot of wires but none that I need to manage daily.

A month ago, the above title was a mystery for me too. I started with a very simple goal. In layman terms, to be able to wirelessly access my files over home WiFi. Why not use a Cloud provider? Simple but expensive. Data speeds aren’t really as great in different parts of India. The goal led to a lot more over time, and I have a great setup ready at home now:

  • Access all my files wirelessly on any device in the world.
  • Auto-Backup wirelessly, write speeds upto 50MBps on USB3.0 and 30MBps on USB2.0, read speeds go higher.
  • Can play anything from my hard disk over WiFi on my computer and phone.
  • At the same time, stream movies, audio and pictures to my UNIC UC-46 projector or a Chromecast, all wirelessly with my phone as a remote control.

This isn’t the first time that this has been done, and there are a lot of commercial NASes(Network Attached Storages) available, but this journey was extremely interesting and high amount of learning. And yeah, besides giving me a lot of control, this saved a lot of money too! It was a month long journey to build this amazing setup and I will walk you through. I don’t intend to add all the fine grain details of everything in this post(that would be huge), but have provided links that you can follow.

Find the hardware

My research started with looking for a small computer board, which should be powerful and support either SATA or USB3.0. Lot of looking and I found 2 systems that were not expensive and could do the job: Odroid XU4 and ASROCK Microboard

Comparing the above two: The Odroid is a compact board and includes everything but the EEPROM or MicroSD card for hosting the OS. On the other hand, the ASRock microboard needs PSU, RAM and Hard disk to be added separately. Odroid sadly misses a SATA port but has a couple of USB 3.0 ports and one USB 2.0 port. Good enough, although a bit of compromise so I decided to go ahead with the Odroid XU4. The only other disadvantage with the XU4 might be the hardware limitation in the future, but for now seems good enough.

Some caveats: Using an EEPROM can be expensive, I use a class 10 MicroSD card for running the OS.

Got the XU4, let’s play around with it

I Flashed the XU4 with OpenMediaVault, It’s a brilliant OS with a great GUI to easily work with it. It has a lot of plugins for working with different OSes and also setting up DLNA and VPN services. Rather than listing down the whole setup here, I will just leave the guide here in case you get stuck: https://www.howtoforge.com/tutorial/install-open-media-vault-nas/

I was able to set up optimized transfer mechanisms for all OSes with the default OMV plugins: AFP for OSX, SMB for Windows and NFS for Linux. However, FTP is still going to be the fastest for all the three, so give FileZilla a try if you aren’t looking to set up Network drives.

Some caveats: HDDs with EXT4 will give the best performance. Upto 2 times the speeds achieved using NTFS drives.

Optimising performance on XU4: Check out this great blog post on optimisations to look for on the XU4 with OMV.

Speed tests

Transfer speeds with my USB2.0 drive and LAN turned out to be ~8MBps. Seemed terribly slow for starters(USB2.0 maxes at 60MBps theoretically) . Dug a bit deeper into Connections to demystify networks for myself. The link speed for Ethernet with the router was 100Mbps(12.5MBps), and I thought Ethernet is never going to be a bottleneck.

Setting up a Gigabit connection without any extra hardware

Verifying the Ethernet bottleneck was the first thing I needed to do before investing in another better router. I got a CAT5e LAN cable(supports Gigabit ethernet) and was really amazed by how much better connecting 2 devices using a LAN cable has become. Yes, I come from the age where you had to create(or procure) a Crossover cable which basically connects 2 inverted ethernet ports.

The world is, a much better place now. Simply connect 2 devices by a normal Ethernet cable and done. You can have a look at this informative ArchLinux tutorial if you intend to set this up.

And voila! The speeds achieved with FTP were the order of 40MBps with a USB2.0 drive! Mission successful.

Understanding complexities of routers

Some(a lot of) realization on Wireless routers:
– WiFi is half duplex, meaning you are restricted to half the speed that router offers, the other half is used for uploading. Routers with 150Mbps will give a link speed of 72Mbps, Routers advertised as 300Mbps give a link speed of 144Mbps.
– 5GHz routers offer higher link speeds than 2.4GHz. The benefit with 5GHz is too less interference with other radio signal, and with MIMO, they offer full duplex like capabilities. So you can transfer data at 867Mbps with a 5GHz link if you aren’t sending it the other way.
– Gigabit ethernet ports a must. My Odroid board connects using Ethernet, so if the Ethernet is not of Gigabit capacity, the speed is limited to 100Mbps even when the wireless band supports 867Mbps. Pretty stupid that such things are manufactured, maybe just a marketing gimmick, be wary of them. A clear example of a router to NOT BUY if you are looking for a fast local network.

 

After a lot of research, I bought the Netgear R6220 router:
The Good parts: Feature rich, Dual bad with Gigabit ethernet, Has a USB port, does a lot of things that I make my XU4 do.
The Bad parts: Range is terrible, no high gain antennas. Anything that crosses 2 walls is unusable. No USB3.0 ports.
But having no other choice, since this is the only AC1200 router(2.4GHz 300Mbps + 800Mbps 5GHz) in this low a budget, I decided to proceed with this.

My suggestion: If you are planning to setup a home server, definitely skip the Odroid and start with just this router, upgrade to the XU4 along with the router when you feel the need. However, if you need a big range, then probably invest in a better router. From my experience, the Netgear router performs very badly even or read speeds, clocking a maximum of 10MBps for any transfer. Check it out if that seems a reasonable number for you.

Need for Stream

Coming to my favorite part of achieving highest level of coolness. Wireless streaming from Hard disk. This would need any device that supports DLNA. Tested with my projector UNIC UC-46 and also with a Chromecast.

First set up MiniDLNA on OpenMediaVault. This can be slightly tricky but there are a lot of guides to help you get sorted with the errors. I will leave the minimal blog post link here.

On your phone, you will need to set up a DLNA streamer app. I use BubbleUPNP, which in my opinion has a horrible UX, but is one of the most stable apps that I could find. Open up the app and select the renderer(should be on the same WiFi). The app should show the DLNA server found on the network too and all your Movies, Videos and Images! Now go and stream.

Caveats: Chromecast supports only a limited number of formats. BubbleUPNP provides 2 ways to solve this:
a) A local transcoder running on your phone.
b) A transcoder running on the server itself.

Access over the internet

This leads us to the final deciding factor on how it competes with a real Cloud service. The router supports VPN out of the box, and also allows coupling with a Dynamic DNS(basically a hostname for dynamic IP assigned from ISP). I used a DDNS account at No-IP and configured the router to use that.

Here are the guides for setting up VPN clients on Windows and Mac.

Sadly, as most ISPs in India, all incoming ports were blocked at my home internet connection. But given their amazing customer service, they unblocked the required ports for me within hours of an email! And finally, I had a working set up to access all the hard disks over internet.
Acknowledgements: My flatmates Umesh and Jitendra allowed me to try out multiple routers at home and even contributed to the cost! And of course, BBNL for their amazing customer service.

One thought on “Home NAS and VPN with Odroid XU4

  1. Hello,

    Is it possible to connect Raspberry Pi or your Odroid to the Internet via a usb WiFi antenna at a distance and connect to the Rasberry via Ethernet cable from my laptop and put laptop into Airplane mode? So, I was thinking of putting my laptop to the Airplane mode and use Rasberry Pi as my “guinea pig” that will connect to WIFI and my laptop will connect to it via Ethernet (wired).

    the plan is to use RPi as a router (maybe even with a firewall) and use my laptop to connect though it (with wired Ethernet) to the Internet. I have Alfa AWUS036NH, a WiFi usb card. I found a thread on Open WRT, but don’t know if it helps. Would Odroid do a better job at this? What parts do I need and how will I do this project? Thank you

Leave a comment