Friday, July 22, 2011

MiniDLNA upnp-av media sharing on DD-WRT

This is how to get UPNP sharing working from your router using MiniDLNA. I also got sharing working via UShare, but will write this with MiniDLNA because ushare is less compatible and no longer in development. This is a pretty straight forward and simple process if you're familiar with working in the DDWRT environment. The guide is derived from my install using a Buffalo WZR-HP-G300NH running Buffalo's official DDWRT distribution, svn 14889, but can be used for other builds.

Edit: Buffalo's official build mentioned above does not work with inotify. This module in the program allows scanning of watched folders without completely re-building the database.

First off, you need to have a useable IPKG or OPKG installed to automatically retrieve and install MiniDLNA and it's dependencies. The Software Installation tutorial is required to use this application.

Monday, July 18, 2011

Asterisk, the VoIP Server on DD-WRT

I'm a big fan of Asterisk on router -- imho, it's the perfect platform for anyone want to try Asterisk at home -- 24x7, fanless and even the cheapest router can handle at least 2-3 concurrent conversation. Before this WZR-HP-G300NH, I had Asterisk running on a WRT54G-TM for over a year with lots of fun.
Installing Asterisk on the router is easier now as current OpenWrt trunk build(the one we use) includes prebuilt Asterisk binaries. As always, since OpenWrt is designed to work with / not /opt, some adjustment is required to get Asterisk working properly.

Lighttpd and PHP on DD-WRT (Possibly OpenWRT too)

Busybox httpd is good for simple static pages, now here is a tutorial for installing lighttpd and php with fastcgi support in the router. Here I choose lighttpd over Apache for its light cpu usage and small memory footprint.

Since all our software are based in /opt folder, some modification must be done to get everything working:

Simple Busybox HTTP Server

By default DD-WRT runs its own http server (/usr/sbin/httpd), providing web management interface to configure the router. The server is highly integrated and hard to reuse for our own contents. If you just want to host some web pages without CGI support, the httpd server in busybox is a good alternative.

Set local time in DD-WRT

***This has been fixed in newer builds of DD-WRT - Check yours before continuing***

This never looks to be a problem since DD-WRT provides such extensive options. Unfortunately, unlike Tomato and OpenWrt, which do a good job, DD-WRT's approach is way off and completely wrong.

A Linux box can keep its time in either local time or UTC -- both are fine as long as the corresponding time zone info is presented. However, in DD-WRT, the time zone info is completely missing and instead of standard implementing used in almost all Linux distros, DD-WRT  coins a weird scheme to setup(and keep) the time.

For example, 8AM PST(GMT-8) should be 4PM GMT, but a DD-WRT router would "think" the current time is 8AM GMT. Now if you change the time zone to EST(GMT-5), what will the router think? 11AM GMT!! Yes, that's after you've set all the "time zone" info in DD-WRT web management page. This is usually not a problem if you just want to use it as a router but for a Linux server, you definitely don't want to deal with any file created in future.

Now here is the fix: