Wednesday, 12 December 2007

Bridging and Routing using WRT54GL

The problems when Gateways disappear.

A client has an unstable wireless link (the building housing the ADSL router is 50m from the Office building housing the bridge) and there is a shutter on the window. Needless to say the signal strength isn't great. However, the problem comes when the Office building loses connection with the ADSL router. The ADSL router is currently the default gateway and DNS server for the office. All hell breaks loose when the router goes down.

I needed a solution which looked like the following

|ADSL router| 802.11g |Office gateway|
| WAG200G |<------------>| WRT54GL |
|| | |

Obviously the bridged mode built into White Russian (RC6) isn't great for this as it requires that the router and gateway be on the same subnet. I'm stuck with keeping the office on the subnet as it has legacy devices and it's a pain in the bum changing everything.

Following the instructions here: Linksys in bridged router mode., I managed to get a setup similar to the following working:

|ADSL router| Wired | Dedicated wireless AP | 802.11g |Office routed bridge| Wired
| WAG200G |<--------->| WRT54GL |<---------->| WRT54GL |---->*
|| |DHCP (| ||

* = Office devices.

The reason for the dedicated wireless AP is to allow 9-16DBi booster aerials to be put onto one or both ends of link. The WAG200G has a fixed aerial (sadly).

The Dedicated wireless AP runs as an out of the box White Russian access point. The Office routed bridge is a flashed White Russian, with the following commands run (where 11111111 is the WEP key of the Dedicated wireless AP).

root@OpenWrt:/# nvram set wl0_mode=sta
root@OpenWrt:/# nvram set lan_ifname=br0
root@OpenWrt:/# nvram set lan_ifnames=vlan0
root@OpenWrt:/# nvram set wan_ifname=eth1
root@OpenWrt:/# nvram set lan_ipaddr=
root@OpenWrt:/# nvram set lan_proto=static
root@OpenWrt:/# nvram set wan_proto=dhcp
root@OpenWrt:/# nvram commit

root@OpenWrt:~# iwlist eth1 scanning
eth1 No scan results
root@OpenWrt:~# iwlist eth1 scanning
eth1 Scan completed :
Cell 01 - Address: 00:1C:10:B2:18:34
Quality:0/0 Signal level:-39 dBm Noise level:-98 dBm
Encryption key:on
Bit Rate:1 Mb/s
Bit Rate:2 Mb/s
Bit Rate:5.5 Mb/s
Bit Rate:11 Mb/s
Bit Rate:18 Mb/s
Bit Rate:24 Mb/s
Bit Rate:36 Mb/s
Bit Rate:54 Mb/s
Bit Rate:6 Mb/s
Bit Rate:9 Mb/s
Bit Rate:12 Mb/s
Bit Rate:48 Mb/s

root@OpenWrt:~# ifdown wan
root@OpenWrt:~# nvram set wl0_ssid=myssid
root@OpenWrt:~# nvram set wl0_channel=1
root@OpenWrt:~# nvram set wl0_wep=enabled
root@OpenWrt:~# nvram set wl0_key=1
root@OpenWrt:~# nvram set wl0_key1=11111111
root@OpenWrt:~# ifup wan; /sbin/wifi
root@OpenWrt:~# nvram commit
root@OpenWrt:~# reboot

Now the system is resilient against the wireless link failing - ok they won't be able to get to the internet, but the Office equipment will play nicely as they will have their gateway always visible.

Obviously the system could be simplified further by removing the dedicated Wireless AP and changing the WEP and Wireless settings to those of the WAG200G. However this would mean no external aerial on the ADSL end.:

|ADSL router| 802.11g | Office bridge |Wired
| WAG200G |<---------->| WRT54GL |---->*
|| |DHCP ( |

* = Office devices.

No comments: