Update: 8.Nov.2013 – Tweaked WiFi config to improve network performance.
This thanksgiving we are planning to drive, for once, to our destination in Southern California. In anticipation of the kids getting bored on the long drive, I started to think about a way to have more videos available than their iPods/iPads can hold, to keep them busy.
The idea I came up with was to see if I could configure a Raspberry Pi as a media server. You can hardly beat the form factor, and the simple power requirements, perfect for the car. I figured it would have to do a few things
- Act as a WiFi Access Point. The iDevices would be configured to connect to this.
- Serve as a simple DNS server for this isolated LAN.
- Serve media files in some way that the iDevices could understand.
- Handle the load of a few clients accessing it
After about a day’s work, I’m happy to report that I believe I have been successful. At least my initial configuration and testing so far is looking very promising. Here’s what I have done:
Configuring the WiFi Access Point
I found a great tutorial from Adafruit for Setting up the Raspberry Pi as an Access Point. Followed the instructions pretty much verbatim, and it ok, but in later testing I noticed wireless performance was pretty slow. I found the article Raspberry Pi with RT5370 Wireless Adapter which described a similar problem but with a different adapter.
Still his solution was simple so I gave it a shot and it worked. What I ended up doing is changing /etc/network/interfaces to add the directive wireless-power off, so the section now looks like
iface wlan0 inet static address 192.168.42.1 netmask 255.255.255.0 wireless-power off
I was worried that once I disconnected the ethernet side of the Pi, things would go haywire, like maybe the iDevice would no longer want to connect to the Access Point since it could no longer fully access the Internet. But that doesn’t appear to be a problem so far.
Setting up the DNS server
I wasn’t entirely sure I would need this, but thought I’d do it just in case. Found this tutorial for Setting up a simple intranet DNS Server on Linux, using dnsmasq.
I did a couple things different than the how-to though. First, I installed the full dnsmasq package (not just dnsmasq-base).
I also used a different location for the config file, to match the newer pattern for where to store dnsmasq config files, I created the file called/etc/dnsmasq.d/intranet.conf
In there I put
no-dhcp-interface= server=/localhost/192.168.42.1 server=22.214.171.124 no-hosts addn-hosts=/etc/hosts.dns
Note that the server=126.96.36.199 directive should probably be removed since in disconnected mode, there is really no upstream server to consult.
Finally, I then went back and tweaked /etc/dhcp/dhcpd.conf, to point the domain-name-servers option to 192.168.42.1
Installing a Media Server
My first hope was to just use Samba to provide a CIFS share to the iDevices. I have a used an app called File Explorer on the iPad which works fine talking to beefier hardware, but the Raspberry Pi struggled to serve media very well, so I looked for other solutions.
In my search I found several DNLA clients available for iOS, so I thought I’d give that a shot, so far it has worked well.
I followed the tutorial Mini DNLA on the Raspberry Pi. Pretty simple and straight forward.
DLNA Video Players
And finally, I’ve tried out several DLNA-enabled video players, here’s two good ones I’ve found so far