Friday, 10 February 2012

How to Make Almost Any Wired Device Wireless

Running my Xbox 360 wirelessly without using the official Microsoft wireless adapter is something I've been doing for a number of years now, and it's not that difficult.  I wanted to write this guide for a long time as I believe it's such a better alternative to the grossly overpriced Xbox 360 wireless USB adapter (seriously, it's around 4x the price of the PC equivalent), and more to the point has the potential to be much faster.  Fortunately, I decided to upgrade my wireless bridge which means I'll be revisiting the setup.

Basically it involves taking a standard internet router and putting custom firmware on it that gives it additional features such as wireless bridge mode.  This is what will let your secondary router connect to your internet wireless router, wirelessly which effectively turns it into a wireless adapter or a client just like a laptop.  The clever part is that since your devices connect to it with ethernet cable, they act just like a wired device, so once the initial setup is completed, adding "wireless" devices to your network is as easy as plugging the cable in.  No messing with router passwords or anything ever again.

Top: Xbox 360 with original adapter connected to a wireless router limited to around 20mbps.
Bottom: Xbox 360 connected to a wireless router acting as a bridge, which is connected wirelessly to another router transferring at least 105mbps.




There are numerous advantages to this, which is what stood out to me more than the fact I was getting one over on Microsoft, or saving a good amount of money.  For instance, depending on the router model you go for, it can be cheaper than the Xbox 360 wireless adapter.  My old router was £35 compared to £60 for the USB adapter and since it allowed me to connect multiple devices it meant I didn't have to buy an adapter for each device.


The other big advantage with this method is that you are not bound to the speeds of internal or official wireless adapters.  My PS3 has an internal 54G wireless card which has a real world performance of about 20mbps max which is the same as the original Xbox 360 wireless USB adapter.  Even with the new Xbox 360 built in wireless or the Wireless N adapter, those are dual stream which means they top out at around 60mbps at any realistic range, but since the routers I am using are triple stream I am able to get around 120mbps from them at opposite sides of the house.  Remember that even if you decide to replace your existing router with an E4200 triple stream router, the client must support it which means having 3 antennas, and the Xbox 360 only has two.  It will still work, but it will be limited to around 60-80mbps at best, whereas a triple antenna device can transfer as fast as 230mbps at very close range

Wifi speed ratings are very misleading.  One of the most common standards we will have come across at some point is Wireless G which is rated as 54mbps, but since wireless communications are effectively half duplex in the way they work, the bandwidth available is at best half of the rated link speed or less.  In other words when they rate a device as 54mbps, that's 54mbps shared in both directions, operating in the best theoretical conditions.

Wireless G is fine for a lot of people, but is not so good for streaming high definition movies that can have bitrates peak in excess of 20mbps, or people with fast connections.  With the wireless bridge method, the wireless adapter is in effect external now, it means I can upgrade the routers as and when faster products and new specifications come out, so you are never stuck to a certain wifi speed or spec.  In fact right now, it's the Xbox 360's ethernet port that is the bottleneck in my setup.  If it had gigabit like the PS3, I would be able to download up to 120mbps in theory once Virgin carry out the upgrade in the summer.


Take a look at the above picture. In this typical situation, all devices are competing for wireless bandwidth. If someone is streaming movies from the PC to the PS3, it will take away from the total wireless bandwidth that could be otherwise used for the Xbox 360 causing slower downloads or the real possibility of lag.  The PS3 wireless is limited to around 20mbps, meaning that high bitrate movies could stutter and lag and the Xbox 360's original wireless adapter is also limited to around 20mbps (since it is also Wireless G), which means if you have a connection over 20mbps, you simply won't make the most of it.  What's worst is that if your main router is only Wireless G, then it will only have about 20mbps to share out between all the devices, so if when your brother or sister is streaming films on the PS3 from the laptop and it hits a part of the video that comes close to or exceeds 20mbps, the router will run out of bandwidth meaning there is none left for the Xbox and then your download will stall or game will lag.  You should at the very least ensure you have a high quality wireless router, even if you don't go to the trouble of setting up a second router as a wireless bridge.


Now let's revisit that situation but put a wireless bridge in there.  Straight away you eliminate a lot of potential for wireless bottlenecking, in particular with things like streaming.  Now instead of the laptop having to send the movie data through it's wireless to the router, and from the router through the PS3's wireless, the transfer now just takes place over ethernet, which in this situation is way better since the PS3 has gigabit lan, so do most laptops and the routers used in this example (Linksys E4200) have gigabit ports too.  Not only are transfers faster to the PS3, but lag in movies is eliminated and it has no impact on local users as the wireless link is now only used for internet data, and not communication between devices.  Communication between devices is now done on a switch/ethernet level, unless of course you have another laptop connected directly via wireless to the main router/modem.  Since the PS3 and PC are communicating through the switch, the Xbox 360 is free to request data from the internet using the wireless link as it likes.

One of the other cool things about this setup is that I can share my ethernet laser printer on the network, so if you imagine the laser printer is connected at the same point where the Xbox and PS3 are, and that the laptops in my house connect to the first router on the left, it means I can print wirelessly.

Port forwarding remains unchanged too, and rather than having to set port forwards on both devices, you just set them on the main router.  There is no need to set port forwards on your wireless bridge.

The only real downsides to this method are that it can be expensive if you want a good router (£130 for a Linksys E4200 for example) and that the choices of routers are limited by what are supported by custom firmwares, and at the end of the day, you still require some amount of cable (although if you are like me, all your entertainment stuff tends to be in a corner of the room).  One other limitation that was present the first time I tried this was that when your router is set up as a wireless bridge, other wireless devices cannot connect to it directly as the link is used solely for communications between the wireless routers.  Wireless clients will have to connect to the original wireless router/modem as usual. That said, I'm sure you will agree that the advantages far outweigh the disadvantages.


Flashing the Custom Firmware
For this particular project I will be using DD-WRT again.  Although stability is as much a hardware thing as it is software, my old faithful WRT-54GL has had in excess of 100 days uptime with no signs of getting bogged down with an 8% overclock.  There are two ways to attack this, either check the website to see if an existing/spare router you have is supported (in general, hardware with built in ADSL modems are not supported), or if you are looking to buy some hardware specifically to use as a wireless bridge, check the router database.  I will be using a Linksys E4200 V1 with DD-WRT.  It is currently a work in progress as the hardware isn't really that old in comparison with some of the supported routers.  Normally I would say to stick with tried and tested stable builds and hardware, but my hand has been forced a little into this because the WAN/Internet port on my E4200 was acting funny, so I bought a new one and decided to retire the old one to replace my decrepit WRT54GL.  Although the E4200 is a very good piece of hardware there are certain reasons why it is unlikely that DD-WRT will ever be able to extract the full speed out of it, but people on the forums are saying it should be good for 100mbps over wireless, which is good enough for my use.

1) 30-30-30 Reset
The very first thing you must do is a 30-30-30 reset.  This should be done before and after the firmware upgrade as this clears contents from NVRAM.  If you don't do this, remnants of information may be left in the NVRAM and cause conflicts with the new firmware.

A 30-30-30 reset is as follows.  First with the router switched on and everything else unplugged, hold the reset button in for 30 seconds.  While still holding the button in, pull the power cable out and wait another 30 seconds.  Finally while still keeping the reset button pressed in, connect the power and wait for another 30 seconds.  In all, you should have held the reset button in for 90 seconds continuously.

2) Inital Flash
The next step is an initial flash, which flashes a base version of DD-WRT onto your router, which you may then upgrade later to a version with more features.  The process for flashing can be a little different for each router and may also require different files, so it's strongly advised that you visit the DD-WRT Wiki and look for instructions relating to your specific model.  I'll be using this page for my E4200.  Download the initial flash file, then disconnect all your network connections, turn off wireless and connect the router to be flashed by ethernet cable.  The file I am using for the initial flash is:
ftp://ftp.dd-wrt.com/others/eko/V24-K26/svn16773/dd-wrt.v24-16773_NEWD-2_K2.6_mini-e4200.bin

Load up the web interface for the router you are flashing.  The exact address for these vary depending on model and manufacturer, but in general Linksys stuff can be accessed at http://192.168.1.1  Once you have logged in, find the administration tab and click to browse for and upload the firmware.


Click start and leave the web page open.  Flashing only took about 30 seconds for my router, but the DD-WRT guys say to wait for at least 5 minutes just to make sure.  When that has passed, click Continue and you should be greeted with a screen similar to this:



When prompted for a login, the default username is root and the password is admin.  These can both be changed later.

3) 30-30-30 Reset
As a matter of course, disconnect all network cables and clients then perform another 30-30-30 reset as outlined in step 1.  This will ensure that the NVRAM is cleared of any settings left by the stock Linksys firmware.

4) Upgrading to a Bigger/Newer Build
This step is optional since the initial build you just flashed should be pretty much fully functional, but you will probably want to flash one of the later builds for increased performance, stability and features.  Routers have a limited amount of flash memory, so this will dictate which build you can use.  Check the wiki to see how much flash and RAM your device has.  Recommended builds are sometimes listed in the Wiki for your device, but may not be up to date, so check this thread for recommended builds.  Pay special attention to details in the Wiki about any special requirements your device may have, such as the E4200 must have a build that uses no more than 60KB NVRAM, as denoted by -nv60k in the filename.  Do not use micro builds as they are reported to brick Wireless N devices.

The version I am upgrading to is:
ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2011/12-12-11-r18000/broadcom_K26/dd-wrt.v24-18000_NEWD-2_K2.6_big-nv60k.bin

Now that you have your device with the initial file flashed and have performed a 30-30-30 reset, you can proceed to upgrade the firmware.  Enter your router's address in your web browser to reach the interface.  If prompted for a username, it is root and password is admin, then find your way to the administration tab and then firmware upgrade from within that.  Again, making sure all other network devices are disconnected and wifi is shut off, select the firmware to be flashed and press upgrade.  Keep the browser window open all the time while the upgrade is in effect and wait for about 5 minutes.

5) 30-30-30 Reset
After 5 minutes has passed and your router has come back online, perform one last 30-30-30 reset.  You are now up and running with DD-WRT and can move on to configuration.


Configuring DD-WRT as a Wireless Bridge
Setting up DD-WRT to connect to your other wireless routers is very easy but we need to change some settings while the router is connected to only your computer as if you try to add it to the network with it's default settings it will likely cause an IP address conflict.

1) Ensuring your wireless is turned off and the only device connected to your computer is the one you just flashed, enter http://192.168.1.1 in your browser to reach the DD-WRT setup page.  At this point it will probably prompt you to enter a new username and password from the last 30-30-30 reset.  Do so and then click the setup tab.

2) Set the WAN connection type to disabled.  Next under the Network Setup header, change the local IP address to an unused one.  Since most Linksys routers default at 192.168.1.1, if we leave the DD-WRT flashed router with the same address it would cause a conflict.  You only need to change the number in the last segment of the address.  I have mine set at 192.168.1.3.  The gateway address should be that of your router that provides the internet connection.  Net mask should be left at 255.255.255.0 unless you have specific needs.  Local DNS is fine if it is left empty.  Check the option, Assign WAN port to switch.  Disable the DHCP server.  Click save settings and then apply.

Click for larger image.
Left page shows defaults and right page shows example settings for wireless bridging (your default gateway and IP settings may vary)


3) Once those settings have been saved and applied, you will have to enter the new address of the router into your browser to continue working in the GUI.  Once you are back into the setup, click the Wireless tab.  Depending on the hardware you have, you may see one or two sections.  Since I am using the 5GHz link, I disabled the 2.4GHz radio.  To set up the 5GHz radio to connect to my other router, set the wireless mode to client bridge, select your network mode from the drop down (5GHz was disabled by default) and under wireless network name (SSID), enter the name of the router you wish to connect to exactly.  Next go to the wireless security tab and enter the wireless key that you use to connect to the main router.  For Wireless N connections the encryption should be set as AES as TKIP will revert to Wireless G speeds.

Click for larger image.
Left page shows defaults and right page shows example settings for wireless settings (page may differ depending on DD-WRT version and how mant radios your device has)


4) Save and apply all settings.  It may also help if you reboot or power cycle your router.


Conclusion
It's pretty much as simple as that.  Of course I have a little experience with networking now so I am familar with most of the terms mentioned in the firmware, but as long as you know the IP address of your modem/router (which is referred to as the gateway) and you know of an open IP address to assign your router, you are good to go.

There are alternatives to this method.  You can actually buy wireless ethernet bridges from the likes of Linksys and Netgear, but in my past experience I found that they were often much lower spec than the routers and the performance just isn't that good.  All they do is flash existing hardware with their own wireless bridge firmware on it and that's pretty much all that device can do.  Flashing your own router with DD-WRT is a much better choice simply because of the amount of options and flexibility DD-WRT gives you.  For example if you ever decide to change how your network is set up or go wired instead of a wireless bridge, you can change some settings in the router and have it do something else ie working as another router or a switch, unlike off the shelf wireless bridges which tend to have such restrictive firmwares that you can't do anything else with them.

There are of course some alternatives too.  Possibly the easiest method of networking between floors without wires is with power line adapters, but I can't comment on how secure they are, much less the performance of them.  Last thing I heard was that the performance was pretty awful.  Basically they use your house wiring and transfer data over the mains.

Of course nothing beats the speed or security of Cat 6 cable and a couple of gigabit switches, but if like me you only need a means of getting internet data from one place to another this works quite well, and the local transfers are very fast over ethernet too.