Tonight, I managed to get one item off my wishlist done that I’ve wanted to accomplish for a very long time — I managed to switch my mythfrontend setup from a wired connection to a wireless one. I have had network cables running all across my house, from my living room through my kitchen to my laundry room where my media server is, and it always drives me nuts seeing the nasty things running around everywhere. With a bit of hacking, though, I got my Linksys router running OpenWRT to act as a wireless bridge to my wireless router. It works pretty good, too. Theres some small latency on the myth frontend, but with caching the playback it’s an acceptable few seconds to wait for playback.
Here’s how I got it all setup. First of all, I have a Linksys WRTSL54GS that I’ve had for a few years, and it works great as a router. It’s running OpenWRT WhiteRussian 0.9 with X-WRT on there. Up until tonight, I’ve been using it as my main router, but since openwrt provides me with everything I need to turn it into a secondary access point on the same network, all I needed was a second wireless router.
So, I went to Circuit City tonight and picked up a Linksys WRT110. After playing with it for an hour or so, I must say it is nice. It’s got this slick design that makes it seriously look like a little alien blinking at you. There’s no external antenna either, which is nice. Just really well designed. Plus, it seems much more responsive, though that could just be my imagination. I can’t put OpenWRT on there, but that’s okay — I’ve always been pretty happy with Linksys’ stock firmware if I don’t need to get down to the nitty gritty. And it’s still much simpler than Netgear’s and gives you more options. I’ve gone through a few Linksys routers in my day, and I didn’t expect to be disappointed, and I haven’t been yet. I picked mine up for $60. Not too bad. Plus, it supports the 802.11n draft, so it’s nice to have that for when I need it.
Anyway, now the new WRT110 is going to be my new router. I quickly set that up and set it next to my media server, ready to do its job.
Setting up OpenWRT wasn’t quite as simple, but really the hardest part was reading the documentation and understanding what I was supposed to be doing. I locked myself out of my router while setting it up, and managed to get back in failsafe mode and restore things, thank goodness. That’s happened before. Networking is seriously not my thing, I dunno why, but I have the hardest time just grasping the most simpe of principles. So I’m usually pretty dangerous and clumsy when it comes to messing around with nvram settings. My advice, though, is to simply document everything you change, and what the original settings were. Probably most importantly, though, is to see if you can get into failsafe mode if you do screw things up.
The instructions for setting up my openwrt router are here. I went with the routed client mode. I have no idea what that means. I’ll explain it in layman terms though. Basically the internet wifi router (the WRT110) acts as the main router (192.168.1.1), and the openwrt bridged router (the WRTSL54GS, 192.168.2.1) has it’s own subnet. Everything is pretty stock on the first router, and there’s nothing you would need to change to get it working. The openwrt router uses the wireless interface to connect to the first router using DHCP. So basically you’re turning the wireless part into a client instead of a server. But it will still act as a LAN router besides that, handing out DHCP leases on it’s own subnet (192.168.2.1) for whatever you plug into the onboard ports.
I’m going to borrow some ASCII art from another part of the openwrt wiki to illustrate my setup:
/ - - - Wireless Clients | INTERNET-----WRT110- - - - - - - WRTSL54GS
| | | | | | | | 4 clients 4 clients
----- Cable link - - - Wlan link
I don’t wanna get into a halfway written howto on what I did, but I’ll illustrate where my changes (for *this* specific router) were different from the instructions. Actually, all I had to do was consult the page that lists my network configuration devices, and replace those with what the howto said to use.
Specifically, here’s all I changed:
- nvram set wl0_mode=sta
- nvram set lan_ipaddr=192.168.2.1
- nvram set lan_ifnames=eth0 (howto says vlan0, but my LAN is eth0)
- nvram set wan_ifname=eth2 (howto says eth1, but my WIFI is eth2)
That’s about it. Commit the changes and reboot the router. You can also confirm that the eth2 device is the wireless one by running iwlist on it:
- iwlist eth2 scanning
After that, I just had to take down the wifi, set the new ssid and channel, then turn the wifi back on, and it worked. 🙂 I must say I was impressed it was so easy. I’m not exactly sure what my signal strength is like, but it seems to be a healthy connection, even though my walls are made of Kryptonite.
The first thing I did was poke at mythfrontend to see how badly the damage was gonna be on playback. Without any options, it sucked, skipping a bit. I threw in framedropping (mplayer -framedrop) and that helped a little, but would still bounce badly on any scenes with motion. I threw in an 8mb cache (mplayer -cache 8192) along with framedrop and it looks great. It does take a few seconds to start up, but that’s fine. One thing I was worried about was if mplayer-resume would handle it or not, since I thought that using -cache and -ss (starting point) would cause it to crash, but so far it’s working fine.
Most people probably wouldn’t have problems with their media files to start with. Mine are about as large as they can get, with MPEG2 video and AC3 audio. Over 802.11g it works fine though. No real complaints. Myth is a bit laggy pulling up the menus when I browse the folders in mythvideo. Everytime you go in a new directory it takes a good 2 to 5 seconds to come up. I’m guessing it’s my folder covers (usually between10 to 25k), and it has to display 30 of them at a time. I dunno. Could be anything.
I’m pretty excited. I’ve already yanked the offending network cables from my kitchen so I won’t trip on them anymore. I tell you what. I really can’t believe it was that simple, I was expecting it to be much harder.
Edit: I should clarify a few things.
First of all, using wireless to stream multimedia is not the best-case scenario. Using a wired connection is by far the best solution, obviously. I just don’t want anyone to think that this works super great and go out and try and duplicate the same thing.
Second, it’s really important to get a good line of sight, or I can’t get a good streaming connection at all. I’m still looking at ways to improve my wireless connection, but again, it wasn’t really designed for this. Sure, it works, but its not optimal.