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=184.108.40.206 no-hosts addn-hosts=/etc/hosts.dns
Note that the server=220.127.116.11 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
Before I forget. Here’s some handy OpenSSL commands. More here – http://shib.kuleuven.be/docs/ssl_commands.shtml
To check a trust chain of a local certificate (say for use with Apache HTTPD)
openssl verify -CAfile MYCHAINFILE.pem -verbose MYCERT.crt
To test an SSL Connection
openssl s_client -connect idp.example.be:443
So I’ve been sampling my incoming and outgoing bandwidth at home ever since I switched over to AT&T U-Verse, but haven’t really done much with it. Out of curiosity I decided to crunch some numbers the other day to see what my typical bandwidth usage has been. Before U-Verse I had AT&T DSL service up to 3.0 Mbps but really maxed out at only 1.5 Mbps. With U-Verse, I have a 12 Mbps plan. Clearly I don’t always use all that bandwidth but its nice to have when I need it. So how much have I needed it?
Here’s a chart of my bandwidth usage in September. What I did was put the samples in bandwidth ranges and calculated percentages in each range.
I guess its pretty reasonable that 55 percent of the time, a little more that 12 hours a day – including weekends, there is really nothing going on, network-wise. So lets just drop off that bit and readjust percentages for the other ranges.
These numbers are looking a little more reasonable, I guess. A large part of the work and other online time, there is mainly IM and email (IMAP+SMTP) traffic. That likely accounts for the 10-25 Kbps range. Lay down occasional bursty web traffic and SSH into the next few ranges, say 25-250 Kbps. More seldom there’s RDP starting to push above 250 Kbps and then into the heavy file transfers pushing 1 Mbps and higher.
One thing is certain, I’ve got a whole lot of bandwidth I need to figure out something to do with.
So, first off, I really do like Adium on OSX. Its got a great interface, full featured, etc except its missing one thing. The ability to connect to Microsoft Office Communication Server (OCS). Which, with my current employer, is a necessity.
Those who know me, know I hate running multiple apps to do the same thing. So, although I could run Adium for my non-Work IM and Microsoft Messenger for Work IM, I’d really prefer not to.
Fortunately there is at least one solution, some good folks have put together a plugin for Pidgin called SIPE that allows you to configure OCS accounts and so forth. All is good; I use this combo on my Windows desktops all the time, but sadly, every time I have looked, the plugin has not been ported to Adium.
But all is not lost. Apparently, now some folks have ported the (GNOME) GTK to the native OSX Quartz interface, which provides some hope for running Pidgin on OSX more natively, instead of say an X11 window.
Well, I am happy to report that I have been successful in doing just that, here’s the procedure, before I forget.
First off, install MacPorts, just following the regular procedure. Now to the fun stuff.
MacPorts has Porfiles set up for Pidgin and all its prerequisites, so first off, fire up a base install Pidgin
sudo port install pidgin +quartz +no_x11
Now just walk away for a while, there’s a lot that needs to be downloaded, compiled, and installed.
Once its done, you can try to run it, but things will probably be pretty wonky, due to some bugs in the version of pango that gets built. See issue 20924 for more information. The downside is you need to pull down the patch-pango-1.28.1-introspection-revised.diff from the bug, and use it to build a new version of pango
cd ~ wget https://svn.macports.org/attachment/ticket/20924/patch-pango-1.28.1-introspection-revised.diff cd /opt/local/var/macports/sources/ cd rsync.macports.org/release/ports/x11/pango patch < ~/patch-pango-1.28.1-introspection-revised.diff sudo port install pango +quartz +no_x11 sudo port -f activate pango @1.28.1_0+no_x11+quartz
Ok, from here, you should now have a working version of Pidgin that you can fire up, and connect to your Yahoo, AIM & Jabber buddies with.
Next stop, installing SIPE. Grab the multi-platform file from http://sourceforge.net/projects/sipe/files/ and extract it.
Now, configure the package, and build it:
export PATH=/opt/local/bin:$PATH ./configure --prefix=/opt/local make
Now, I had a problem where the build stopped at one point because gcc warnings were being considered errors. I fixed this by removing the -Werror directives from the QUALITY_FLAGS variable in the Makefiles. The build completed correctly after that.
Finally, install the plugin with
sudo make install
And that is it.
Now, one more thing for bonus points, I try to use Off-The-Record (OTR) messaging when possible, so I like to have the OTR plugin available in Pidgin as well. MacPorts has an answer for that:
sudo port install libotr sudo port install pidgin-otr