Raj's adventures with Linux, MacOSX, the HD revolution, and any other toys he might pick up along the way.

Tuesday, April 15, 2008

Using a WTR54Gv5 as a Wireless Bridge to Connect non WiFi devices to the net

I plugged the NMT up to the internet for the first time in a while to get the latest firmware. This is always an annoying process because while all the other internet capable devices in my entertainment center (PS3, Wii) have WiFi built in, the NMT does NOT, it only supports wired Ethernet. This means I have to run a 15 feet cable across my living room any time I want to use the networked functionality. I got to thinking that it would be nice to get my wireless signal to be picked up by some kind of small dongle with an antenna to pick up WiFi, and an Ethernet cable to go to the NMT.

This kind of thing is called a wireless bridge. It is kind of like an access point, except that it blindly forwards traffic both ways (wireless->wired and vice versa), whereas an access point does NAT and DHCP, and expects the WAN to be on a wired link and the LAN to be on the wireless. As far as hardware goes though, an AP has all of the right parts to act as a layer 2 bridge.

Because of the similarity to an access point, my idea of a small dongle was beginning to fall through, but a different idea was forming in my head: try to use an access point in this kind of bridge mode to make my NMT effectively wireless! It should be possible to do in software on an AP. I immediately started playing with two Airport "Snow" routers I had recently bought to see if they supported this mode out of the box, but they didn't (the newer Airport Extreme series CAN do this out of the box).

So I started looking at my other router, the Linksys WRT54G. I had read that this device was highly moddable with non-Linksys firmware available due to the fact that the device used Linux code, and Linksys released the source code to the firmware to satisfy the terms of the GPL. Clever hackers used this source as a starting point to create custom firmwares that can do lots of fancy things that the stock firmware cannot. One of these fancy things is bridge mode. This was the ticket...by reflashing the device to use the open source free DD-WRT firmware, I was able to use the WRT54G in bridge mode. Here's a quick guide on how to do this if you have a WRT54G, version 5 or 6. This is written from a Windows perspective, but the only difference with Linux or Mac is how you do the static IP assignment, and TFTP step. The static IP assignment, you probably know how to do on your OS. On Mac OS X it is System Preferences->Network->Show:Built In Ethernet->Configure Ipv4 using:Manually. And you can skip the steps that are setting the MAC address of the new firmware correctly. On Mac or Linux, first cd to the directory where you downloaded the dd-wrt firmware, then:

tftp -e 192.168.1.1

Then at the tftp prompt, you want to do this:

put dd-wrt-blah-blah-micro.bin

When it report success, you are done! Ctrl+d out of tftp, and the router should reboot and voila, you have a magically better router. Log in, and remember the username is root and the password is admin. To get the wireless bridging you desire, you can use either client mode wireless (in which the router DHCPs and NATs the wireless signal to its wired ports) or client mode bridge (in which the router simply does a layer 2 forwarding). I prefer the bridging, this way all the devices are on the same subnet.