Hack 69. Extend Your Wireless Network with WDS

Use the Wireless Distribution System to have multiple access points communicate wirelessly.

There are many reasons you might want to use this hack: your house is too large for a single access point to cover and you don't want to run Ethernet cable in your walls, you want to provide wireless access in a location that has power but no copper or other data backhaul, or any situation in which you would like to have a wireless signal but can't or don't have the necessary network infrastructure.

Wireless Distribution System (WDS) is a layer 2 standard originally defined in the revised IEEE 802.11 specification from 1999. WDS-enabled access points broadcast MAC (layer 2) messages across all connected nodes. In short, WDS makes access points appear as if they are all connected to an Ethernet hub.

What's the catch to this otherwise seemingly magical technology? WDS decreases your available bandwidth that the access points can serve to clients. In addition, WDS units must use the same radio channel, which can cause interference problems and also decrease wireless throughput. However, 802.11g or 802.11a can help here by providing higher available bandwidth.

One final caveat: WDS is not part of the Wi-Fi Alliance testing and certification program, so vendors are free to implement it however they choose. If you're considering using WDS, you might want to spec out access points from the same manufacturer. It's worth noting that if you are okay with 802.11b only, HostAP-based access points on Linux hardware are capable of speaking WDS to many other brands of access points.

5.8.1. WDS Requirements

In order to take advantage of WDS, your access point hardware must support it. Fortunately, a lot of consumer-grade wireless hardware now comes with WDS support built in. Access points from Linksys, Apple, Buffalo, and NetGear all are capable of participating in a WDS network.

On the homebrew side, any machine running the HostAP driver with a Prism II radio can create or join a WDS network. Atheros card users with the Madwifi driver will need to get the preview release of the Madwifi-ng driver code. Details can be found on the Madwifi Wiki (http://madwifi.org/UserDocs/WDSBridge). "Build Your Own Access Point with Linux" [Hack #63] provides details on building both of these drivers.

Lastly, if you've installed alternate firmware or a complete Linux distribution on your wireless router such as a Linksys WRT54G [Hack #67], a Netgear wgt634u, or an Intel ipx42x-based device like the Linksys WRV54G, you'll also be able to set up a WDS connection.

This hack sets up two Linksys WRT54G units with the Sveasoft Alchemy firmware to use WDS. It then takes two Linux machines running HostAP and shows how to automatically find and provision WDS links between HostAP devices.

5.8.2. Linksys Alchemy Setup

Setting up WDS on a Linksys WRT54G is dead simple, using the Sveasoft Alchemy custom firmware [Hack #67]. Make sure that you're connected via wireless or Ethernet to the private LAN side of the Linksys. Navigate to the administrative web pages, which on the default configuration is 192.168.1.1. Enter the username and password when prompted, and then choose Wireless images/U2192.jpg border=0> Basic Settings, as shown in Figure 5-6.

Here, you'll need to choose the wireless channel that your WDS bridge will use. WDS requires that all participating access points use the same channel. Using the same SSID is not required. In fact, you should use a different SSID for each AP and choose a name based on the access point's physical location.

Figure 5-6. WRT54G basic wireless settings

Next, choose Wireless images/U2192.jpg border=0> WDS in the tab navigation, as shown in Figure 5-7.

Figure 5-7. WRT54G WDS settings

You'll need to do this on both Linksys units, because you will need the Wireless MAC shown at the top of the screen to correctly configure WDS on each unit. Enter the Wireless MAC from Linksys unit #2 into the first line of the WDS configuration on Linksys unit #1.

This completes a simple WDS configuration. All that is required is the Wireless MAC from the second Linksys unit, which we have entered into the first line of the WDS configuration. Lastly, choose a LAN configuration in the first drop-down of the menu.

To complete the WDS setup, go to the second WRT54G unit, and repeat the previous steps. Make sure you have the same wireless channel selected, and in the WDS section, enter the Wireless MAC from the first WRT54G unit.

Once the changes have been applied, you can test the WDS configuration by associating with one of the Linksys units, getting an IP address, and then pinging the IP address of the other Linksys unit.

The Alchemy firmware also supports an advanced configuration, which allows you to assign an IP subnet to the WDS interface. This is handy if you want to keep the WDS addresses of the Linksys units private or unpublished. As shown in Figure 5-8, you can set up your units with a private subnet that is only capable of having two devices on it, so you have turned the bridged WDS network into a point-to-point IP network.

5.8.3. HostAP Setup

If you've built and are using the HostAP driver [Hack #63] for Prism II 802.11b cards, you already know it has many great features. You might not realize that it is capable of WDS or that it has a neat trick or two available that makes setting up WDS a snap.

When you compiled the HostAP utilities, one of the included tools is prism2_param. If you took the default configuration, it should have been installed in /usr/sbin. This is a powerful tool for setting (and potentially breaking) all sorts of parameters in your Prism II card.

This bears repeating: prism2_param is a wrapper around the very powerful iwpriv command. You can do some seriously funky things to your Prism II firmware with this utility, so be very careful when using it. If your card starts acting strangely, you may need to reboot or unload and reload HostAP.

Figure 5-8. WRT54G separate WDS subnet

You can set your Prism II card to automatically detect other Prism II cards in WDS mode and create WDS links on the fly. This requires three commands:

prism2_param wlan0 wds_type 4 prism2_param wlan0 autom_ap_wds 1 prism2_param wlan0 other_ap_policy 1

The first commands makes the card use standards-compliant WDS framing, the second command is the kicker that tells HostAP to automatically establish WDS links, and the third command tells HostAP to only accept WDS beacons from other APs having the same ESSID. If you want to include access points with other ESSIDs, you can use this command instead:

prism2_param wlan0 other_ap_policy 2

If you enter these commands on two machines, both running HostAP, you will now find that a new interface has been created: wlan0wds0. HostAP creates these special interfaces for each WDS link on the local machine.

In order to take advantage of this newly created WDS interface, however, you'll need to take care of the bridging and IP transport yourself. Consult "Bridge Your Linux AP" [Hack #64] for more details on installing the bridge-utils package. Once you've taken care of that, you can execute these commands to create and bring up a wireless bridge using the WDS:

brctl addbr br0 brctl addif br0 wlan0 brctl addif br0 wlan0wds0 ifconfig wlan0 0.0.0.0 ifconfig wlan0wds0 0.0.0.0 ifconfig wlan0 up ifconfig wlan0wds0 up ifconfig br0 192.168.2.1 netmask 255.255.255.0

This creates a bridge, adds the wlan0 and wlan0wds0 interfaces to the bridge, brings up those interfaces, and assigns an IP address of 192.168.2.1 to the bridge. Now, execute these commands on the second HostAP machine, making sure to alter the last line:

ifconfig br0 192.168.2.2 netmask 255.255.255.0

You'll want to wait 30 seconds or so for the bridges and WDS to come up on each side; then, you should be able to ping across the bridge. The bridge code needs this time to learn MAC addresses on either side of the bridge to prevent bridging deadlocks. Your WDS network is now live; you can associate with either AP and WDS will take care of the rest.

5.8.4. Hacking the Hack

There a number of things you can do to extend your WDS network. For example, you can add up to five other access points, but bear in mind that your performance will decrease each time you add a new AP to WDS. For better performance, you could set up three machines in a WDS network, and set up another three in another location that has wired access. You can also implement WDS on the Linksys WRT54G using the OpenWRT linux distribution [Hack #67].

Категории