|
Alyz Solutions
|
|
OpenWrt on a WRT54GS
|
|
Table of Contents
The Linksys WRT54GS is a consumer 802.11g wireless router/switch/ap based on the Broadcom Afterburner chipset with a street price of less than $75. It has a 200Mhz MIPS CPU with 32Mb of RAM and 8Mb of flash memory. Compare that to the original Linksys WRT54G, which has a 125Mhz MIPS CPU with 16Mb RAM and 4Mb flash, although version 2 of the WRT54G reportedly has the 200Mhz MIPS CPU and 32Mb RAM as well, but still only 4Mb flash.
OpenWrt is an alternative firmware for the Linksys WRT54G family of routers. While the standard Linksys firmware is designed to be consumer friendly with a simple menu driven web interface to a standard feature set, the OpenWrt firmware is designed to be developer friendly, providing direct access to the underlying Linux operating system and thus the ability to freely extend its functionality with standard or customized Linux packages.
Update: Linksys recently released version 4.0 of the WRT54GS and version 5.0 of the WRT54G routers that are not targeted to run Linux firmware. They have half the quantity of RAM and half the quantity of flash memory as their predecessors. If possible, avoid these versions if you plan to use OpenWRT or any other Linux-based firmware on it. For a detailed table of all supported hardware, see OpenWrt TableOfHardware.
The installation of OpenWrt on the WRT54GS is described in detail in the OpenWrt User Guide from the openwrt.org site. It is important to read this completely and understand everything described there before overwriting the firmware on the WRT54GS.
In summary, the steps that need to be taken are:
The nvram utility is used to configure many of the important settings on the WRT54GS. Although this is thoroughly discussed in the OpenWrt User Guide and reiterated in the OpenWrtFaq, the basic commands are worth repeating here.
To see an alphabetical list of the current nvram settings:
nvram show | sort
To see the value of a single variable in nvram:
nvram get variable
To set the values of variables in nvram:
nvram set variable1=value1 nvram set variable2=value2 ... nvram commit
The complete list of nvram variables can be found here.
The standard Linksys firmware on the WRT54GS only allows the wireless portion of the device to be used in access point mode, not in client or bridge mode. In other words, wireless clients can connect to the device and access its built-in switch and router, but the device cannot connect to other wireless routers and other wireless routers cannot connect to the device. With the OpenWrt firmware, one assumes total control over the wireless portion of the device, so it is possible to use it in access point, client, or bridge mode. This is very convenient since devices that are sold as "wireless bridges" tend to be on the expensive side.
Based on available documentation, there appears to be three typical alternatives for setting up the WRT54GS as a wireless bridge to connect two separate network segments: using client mode, using WET (wireless ethernet bridge) mode, and using WDS mode.
Using the wireless device built-in to the WRT54GS in client mode allows it to be connected to the host AP just like any normal Linux machine. Once connected, standard Linux tools can be used to configure the network logistics. Possible tools include a bridge device from bridge-utils, proxy arp settings built-in to the kernel, and standard routing built-in to the kernel.
Unfortunately, using a bridge device does not appear to work for us no matter how we change the configuration settings. The default br0 device set up by OpenWrt on the WRT54GS should logically bridge the lan ports (vlan0) with the wireless adapter (eth1), but it does not appear to work. Placing vlan0 on its own bridge works fine and placing eth1 on its own bridge works fine, but when put into the same bridge, packets from eth1 cannot be seen on vlan0 and packets from vlan0 cannot be seen on eth1, effectively defeating the purpose of a bridge. Please let us know if anyone can get this configuration working.
The following example uses proxy arp settings to simulate the functionality of a bridge so that the WRT54GS and the host AP can operate on the same local subnet.
Assume there exists a main wireless AP that is already connected to the Internet with an internal IP of 192.168.1.1/255.255.255.0 using a SSID of mynet, and a 128 bit wep key of hex 11111111112222222222abcdef. The WRT54GS device will be assigned an IP of 192.168.1.17 with allowable local addresses in the subnet 192.168.1.16/255.255.255.240 (192.168.1.18-30 assignable)
Detach the wireless device (eth1) from the default bridge (br0) containing the lan ports (vlan0):
nvram set lan_ifname=br0 nvram set lan_ifnames=vlan0
Configure wireless device (eth1):
nvram set wl0_mode=sta nvram set wl0_ssid=mynet nvram set wl0_wep=on nvram set wl0_wep_bit=128 nvram set wl0_key1=11111111112222222222abcdef nvram set wl0_key=1 nvram set wifi_ifname=eth1 nvram set wifi_proto=static nvram set wifi_ipaddr=192.168.1.17 nvram set wifi_netmask=255.255.255.0
Configure local IP address for lan (br0):
nvram set lan_proto=static nvram set lan_ipaddr=192.168.1.17 nvram set lan_netmask=255.255.255.240
Modify default gateway and dns (modify IPs as appropriate):
nvram set wan_gateway=192.168.1.1 nvram set wan_dns=192.168.1.1
Set up arp proxy to simulate bridge (add a new script to /etc/init.d, or possibly append to the end of /etc/init.d/S40network):
echo 1 > /proc/sys/net/ipv4/conf/eth1/proxy_arp
Update DHCP server by modifying /etc/dnsmasq.conf:
dhcp-range=192.168.1.18,192.168.1.30,255.255.255.240,12h
Commit and reboot the WRT54GS:
nvram commit reboot
This example can easily be modified to use different subnets on the two devices with simple routing used to connect the subnets. If interested, here is another HOWTO that provides a specific example of the routing configuration.
Setting the wireless device on the WRT54GS to WET mode is supposed to allow it to be easily configured to bridge the WRT54GS to an existing wireless AP. However, our experiences show no difference between setting wl0_mode=wet and setting wl0_mode=sta. Others have reported problems with attempts at using WET mode. We would be interested to hear from anyone successful in getting WET mode to work properly.
The Wireless Distribution System, or WDS, allows two or more wireless devices to sync with each other to effectively bridge all of the wireless segments into one logical segment. As with a regular bridge, WDS connections are based on MAC addresses to avoid polluting the IP address space. A disadvantage of WDS mode is that the separate wireless devices communicate with each other via the same channel and radio, so the space must be shared and the bandwidth available reduced as a result. Another disadvantage is that the WDS implemented by different chipsets may or may not be compatible with each other, so using the same or similar wireless device for each of the segments is recommended.
Assuming two WRT54GS devices, device1 with internal IP address 192.168.1.1 and MAC address xx:xx:xx:xx:xx:x1, and device2 with internal IP address 192.168.1.2 and MAC address xx:xx:xx:xx:xx:x2, using wireless channel 6, the required settings to use WDS are:
At device1:
nvram set wl0_mode=ap nvram set wl0_wds=xx:xx:xx:xx:xx:x2 nvram set wl0_channel=6 nvram set lan_ipaddr=192.168.1.1 nvram commit reboot
At device2:
nvram set wl0_mode=ap nvram set wl0_wds=xx:xx:xx:xx:xx:x1 nvram set wl0_channel=6 nvram set lan_ipaddr=192.168.1.2 nvram commit reboot
Additional information on WDS Bridging can be found in the article from Tom's Networking.