OpenWRT wifi bridge

by gnudutch

This document describes how to setup a Linksys WRT54G router as a wifi bridge using the open source firmware OpenWRT. There are lots of docs for setting up client mode, but all of them break the bridge and rely on pf/firewall to do bridging in software. You can use the hardware bridge and save yourself a few steps (and headaches).


Step 1 - Install OpenWRT

Follow the instructions at the OpenWRT "Installing" page.

Connect to the internet using a wired port. The WAN port is a dhcp client by default so use it.

Once you are able to log in to your new firmware with telnet, AND connect to the internet from the shell, continue with step 2.


Step 2 - Get some packages

At the shell type ipkg update

Then ipkg install http://nthill.free.fr/openwrt/ipkg/stable/20041003/wl_0.1-2_mipsel.ipk

If you like SSH then ipkg install dropbear


Step 3 - Disable pf/firewall and telnet

Delete /etc/init.d/S45firewall

Delete /etc/init.d/S50telnet (ONLY if you have dropbear working correctly!)


Step 4 - Setup the network interfaces using the nvram utility

Please note that interface names are for version 1 hardware. Type the following in the shell:

  • nvram set lan_proto=static
  • nvram set lan_ipaddr=192.168.6.1
  • nvram set lan_netmask=255.255.255.0
  • nvram unset lan_gateway
  • nvram unset lan_dns
  • This sets up the lan interface with a static ip. Since the lan ports are bridged to the wireless card by default, you COULD setup the lan interface as a dhcp client. This is nice because the router will get an ip address in the same pool as the other wireless clients, nice for remote administration. If you want to do this, edit /etc/init.d/S40network and add the line udhcpc -i br0 -b after "wifi up". br0 is the bridge interface. (It's not as easy as lan_proto=dhcp, the OpenWRT people hardcoded the lan interfaces for static ip)

  • nvram set wan_proto=static
  • nvram set wan_ipaddr=192.168.7.1
  • nvram set wan_netmask=255.255.255.0
  • nvram unset wan_gateway
  • nvram unset wan_dns
  • Do NOT allow your wan and lan addresses to be in the same segment. In other words do NOT set them to 192.168.1.1 and 192.168.1.2. This will DISABLE the physical wan port for no good reason!!

  • nvram set wl0_mode=wet
  • nvram set wl0_infra=1
  • nvram set wl0_ssid=MyWirelessNetwork
  • Do NOT set the wifi_* nvram variables!! Those are ONLY for non-bridge use!

    Please note that "MyWirelessNetwork" should be a wifi access point that you want to connect to. A bridge does NOT create a wireless network, it simply BRIDGES it to something else, like lan ports.

  • nvram commit
  • reboot
  • That's it :)


    Why bridge?

    What's the point of a bridge? Aren't routers better?

    Not in my opinion. Routers get in the middle and cause more headaches than anything. You have to configure them, forward ports for stuff, deal with network segments, blah blah blah.

    With this bridge setup, you just set the SSID, and the lan ports are now wireless bridge ports. You can plug clients into the lan ports and they can communicate unhindered with all the wireless clients.

    This is one of the more powerful ways to "extend" the range of an access point that doesn't support stuff like WDS. Just setup this bridge, then plug a stock access point into the bridge, for a two-piece repeater.

    Don't they make stand-alone wifi bridges you can buy? YES they do, BUT they often cost more than access points. I've tried the cheaper Linksys B and G "game bridges", but their web interfaces are quite lacking and the wireless link is flakey. Besides, you get a shell on this one! :)