Enter your email address to be notified of new blog entries:



06/07/2006 - 8:01pm

HOWTO: Wireless Bridge with Linksys WRTs and OpenWRT


    del.icio.us

This HOWTO is constantly monitored. If there are any questions or comments regarding this HOWTO, or any clarification needed, please post those comments at the bottom.

Introduction


This documents describes the process of using a pair of Linksys WRT54G, WRT54GS, or WRT54GL boxes to create a wireless point-to-point bridge that can be used to bridge the LANs of two buildings over several miles apart. It's likely that in many cases other hardware can replace that specified in this document, such as a different router, cable, or type of antenna.

Hardware


In our setup, we used a pair of Linksys WRT54GL routers, 19dBi flat panel antennas, and RG6 Coax cable with an N-Male adapter to connect to the antenna on the roof and a reverse TNC female adapter to connect to the routers. Additional miscellaneous hardware was used, such as tripods and mounting hardware.

Prerequisites


The two Linksys WRT routers need to be flashed with OpenWRT. We'll assume that you have already done that. If not, you can get details here: OpenWRT. We'll also assume that you're familiar with Linux, know your way around a command line, and can use tools such as vi.

Installing wl


We're going to need a program called "wl", which is used configure the Broadcom chipset of the WRTs. Make sure your WRT is connected to the net, and run the following:

# ipkg update

This will update the list of available packages. Now, let's install wl:

# ipkg install wl

Execute these same commands on the remaining WRT.

Configuring The Base


In a setup such as this, even though we're creating a point-to-point bridge, it's still configured with one box as a base and one as a client.

Connect into the base WRT via SSH and configure the wireless for our purposes by typeing the following:

# nvram set wl0_mode=ap
# nvram set wl0_ssid=bridge
# nvram set wl0_wep=enabled
# nvram set wl0_key=1
# nvram set wl0_key1=[wepkey]
# nvram set wl0_channel=[channel]
# nvram commit

Note:
  • Replace [wepkey] with your desired WEP key.
  • Replace [channel] with your desired channel.
  • We're using WEP instead of WPA because, from what I understand, WPA doesn't work when you're setting up a system for bridging. That may not always be the case as newer releases of OpenWRT come out, so keep trying because WPA is much better than WEP.

Now that the base is configured, simply reboot it for the settings to take affect.

Configuring The Client


The client is going to go through much the same setup, with the difference being the mode in which it functions:

# nvram set wl0_mode=wet
# nvram set wl0_ssid=bridge
# nvram set wl0_wep=enabled
# nvram set wl0_key=1
# nvram set wl0_key1=[wepkey]
# nvram set wl0_channel=[channel]
# nvram commit

Notice it's set to "wet". This tells OpenWRT to put the WRT into a Client-Bridge mode so that it will communicate with an AP and act as a bridge.

Transmit Power


A note on transmit power. The Linksys WRT devices come with a factory default setting for the transmit power at 30mW. Flashing the device with OpenWRT will automatically take it to 251mW (the radio's max), and installing "wl" will bring it down to 79mW.

Your gut reaction might be "Wow! 30mW to 251mW! That means I can get 8 times the range!" While it may seem to make sense, that's actually not true at all. There are a couple of things to watch out for when playing with the power settings:

  • First and foremost, the FCC (or whomever regulates radio transmissions in your country) limits transmit power. The actual power being used depends partially on the gain of the antenna. In most cases, your setup will fall well below allow effective power output. But verify this with the regulating body in your country just to be sure.
  • Doubling your power on only one side of the link will not increase your coverage to any real degree. When you increase your transmit power, you're increasing the power with which that device throws its signal. But if it's ability to receive hasn't been increased, then this enhancement of one-way communication won't help at all.
  • The louder your access point is "shouting" its presence to the world, the more likely your system is to be known to war-drivers. Setting the power levels to "sufficient" instead of "overkill" is beneficial in this regard.
  • Increasing the power output increases heat, which increases noise, which decreases the overall link quality. For best results, use high-gain antennas, and set the power to the lowest possible level that will give you the desired link.

Think of radio communication the same way you would think of a conversation between two people in a room filled with hundreds of other people all having their own conversations. If you want to improve the other person's ability to hear you, and keep your conversation as private as possible, it's better for the other person to increase their listening capacity than it is for you to shout. In an attempt to improve their conversations, imagine if everyone in the room began shouting.

Antenna Diversity


If you're going to create a short-range bridge (i.e. a couple hundred feet) and use the stock antennas, you don't need to worry about this section. If, however, you're using directional antennas to setup a long-range bridge, keep reading.

The Linksys WRT routers use antenna diversity. You'll notice that they have two antennas sticking out the back. Both are used for transmit and for receive. A 2.4GHz wave is only about 12.5 centimeters in length. When the wave passes through the air, it goes up and down. If the wave happens to be halfway through this process (right in th middle), it carries no signal at that point, which means that a poorly placed router might not be able to pick up a signal properly. With diversity, a second antenna sits only a few inches away so that whichever antenna happens to be at the right location to pick up the wave at its strongest point is the one that's used.

With that being said, we won't be using diversity with our single antenna, as diversity would require a second. You can modify the antenna diversity setting if you'd like, but it's not necessary.

By default, diversity is set to auto, or a value of "3". So it'll be used if the radio believes that it should be used. You can also force diversity on or off. Initially, I disabled diversity on my setup and ran into problems with horrible signal strength. The problem was that when reading through various forums, nearly everyone recommended setting diversity to "0", which supposedly forced the use of the antenna connector on the back of the WRT that's nearest the power connector. Through trial and error, my best connection by far was by setting the diversity to "1" and using the antenna connector neareast the power connector.

Testing The Setup


Once you've gotten everything configured, you'll want to make sure the WRTs can communicate with each other before putting a distance of five miles between them, so you'll know if any problems are caused by configuration errors or weak signals.

Put the WRTs within a few feet of each other and boot them up. SSH into the client WRT and execute the following:

# wl status

This should give you a screen that looks something like this:

SSID: "bridge"
Mode: Managed RSSI: -56 dBm noise: -96 dBm Channel: 6
BSSID: xx:xx:xx:xx:xx:xx Capability: ESS WEP ShortSlot
Supported Rates: [ 1(b) 2(b) 5.5(b) 6 9 11(b) 12 18 24 36 48 54 ]

Here's what you're wanting to see:

- RSSI: The signal strength.
- Noise: The amount of noise or interferrence. This should pretty much always be below -90 (-96 is good). If it's not, then you're in a particularly noisy environment, and this could cause problems. Though using directional antennas normally decreases noise to a small extent because you're narrowing your "field of view", unless the noise happens to be coming from the direction your antenna will soon face.
- SNR: While not specifically shown, the SNR, or signal-to-noise ratio, is the difference between the signal strength and the noise, in this case we have an SNR of 40dB.

If you don't see something like this indicating a connection, double-check your wireless configuration. This needs to work before moving on. When you make changes, the simplest way to make those changes take affect is to reboot (don't forget to "nvram commit"). Simply setting the variables in nvram doesn't do anything until they're applied, which rebooting will do.

Once your wireless is up and running, try to ping between the two over the wireless connection. If this works, then you're set to move on. If not, troubleshoot this first. Verify things like your WEP key. An incorrect WEP key will show a connection as above, but it won't communicate.

wl Configuration


Using wl is optional, but it does give you a variety of customization options. You can use it to play with the antenna diversity, but the most common thing wl is used for is modifying the signal strength. The max power output is 251mW and is the default with OpenWRT. Once wl is installed, the default changes to 79mW. In most cases, 79mW will work okay. If you're going to change the defaults, please keep these things in mind:

- Make the changes the same on both sides. The output only affects how much power is used to transmit, but it doesn't change the receive side, so changes need to be made to both sides to see any improvement.
- Increasing the transmit power will increase the heat the device generates. As the device gets warmer, it will create more noise that will interfere with the the signal. Modifying the signal strength should only be done if the end result after setup is not satisfactory, and it should be done slowly as getting the proper setting can be a fine line.

Simply running "wl" with no parameters will give you a long list of possible parameters.

Completion


At this point, it's simply a matter of physically installing the WRTs in the permanent location, connecting them to their antennas, and verifying signal strength. At this point, if you don't get good signal, or any signal at all, look at factors like distance, antenna gain, and line-of-sight. As distance increases, LOS is very important.



Comments
Add Comment

Posted by: Wayne Dawson
08/10/2006 2:55pm

I used this procedure on a 12Km link with parabolic antennas and it worked for a week. After that the link goes up and down every second or so - I can't access email, web, or anything else over the link. I replaced the client router, and the new one behaves the same way. Any ideas? Thanks.

Posted by: Nick Coons
08/11/2006 6:37pm

First off, I'm glad that this worked for you (albeit for a short period of time) over this distance.

Can you provide further details? For instance, what kind of RSSI are you seeing? How about pinging? You should be able to run a consistent ping between the two routers. If the link is going up and down, you'll see packet loss. If you have a solid ping with 3% or less loss, then your wireless link is good and the problem is elsewhere.

Posted by: Wayne Dawson
08/14/2006 10:36am

Thanks for the reply.

I have been doing pings in both directions and I have massive packet loss. For example earlier I ran a ping from the host side for about 30 minutes and got 83% packet loss.

I will write up and post a fairly full explanation of my setup and what I have done. I'll let you know the URL when I have it uploaded.

For now, my current thinking is that there's a lot of interference, and I have set the channel selection to auto (although I am still researching how that works).

One question right now is about the following message in my log:
Jan 1 00:00:08 (none) user.info : Warning: loading wl will taint the kernel: no license
Jan 1 00:00:08 (none) user.info : See http://www.tux.org/lkml/#export-tainted for information about tainted modules
I assume this is a standard message, and that I probably don't have to worry about it - but I suppose theoretically it could explain how the link might work for a week and then stop.

I'll let you know when I have the details posted.

Thanks.


Posted by: Nick Coons
08/14/2006 10:39am

The warning message that you're seeing is because "wl" is proprietary software, and "tainting" the kernel means that you're using it with proprietary software, it doesn't have anything to do with the functionality.. just that you're no longer using a system of entirely "free" software.

There may be a lot of interference. If you look at your signal strength levels, that should indicate it.. the noise is listed on a "wl status", realistically it should be less than -90 or so (-97 or better would be nice). You'll want to do this from the client side.

Posted by: Wayne Dawson
08/14/2006 8:50pm

My wireless link is now working pretty reliably (many times that I ping, I get zero packet loss). The auto channel selection didn't seem to do anything, so I tried a couple more channels by hand and 14 is what I am using now.

Regarding the noise level, and specifically the signal to noise ratio, the odd thing is that even with the major packet loss, when I did see the signal I would often see SNR's of 50 or so - same as I see now. The difference is that now the signal doesn't disappear every couple seconds. (I check the SNR with a script that calls wl scan and does a bit of text processing of the output of wl scanresults.)

Thanks for your help. I don't have the description of my setup ready yet, but when I do I'll post it at AWirelessLink.net.

Wayne


Posted by: Nick Coons
08/15/2006 8:46am

Where are you located? In the US, you're only allow to go up to channel 11, so I'm curious as to where channel 14 is allowed.

I suspect the signal dropping out frequently may have been caused by the channel-hopping.. perhaps the two weren't always in sync on that. I think finding a relatively clear channel and sticking with it is probably the way to go.

Posted by: Wayne Dawson
08/15/2006 11:15pm

I'm located in Costa Rica.

Regarding the channel hopping, I wasn't hopping from channel to channel every few seconds. I was trying out channel 7 for days (that's the one that worked for me for a week), then for days I tried channel 5, then channel 1. I tried auto for a couple hours, then finally tried channel 14, which still seems to be working. Hopefully I won't get somebody knocking on my door telling me that I'm using an illegal channel!


Posted by: Alex
10/05/2006 3:56pm

Has anyone done any testing as to whether or not the AP's crystal oscillator stability has an effect on link range? Having done a lot of work recently on WiMAX timing standards (these base-stations rely heavily on both ends of the link having an accurate synchronised "timebase"), i wonder if the oscillator is aging and causing the two units to drop-sync....

I seem to remember reading that there was a timing limit on ACK packets (of the equivalent of 18-20Km) which would imply timing is important and so oscillator aging could be a factor....

I'd be very interested to learn you're progress,

Best regards

Alex

Posted by: vince
10/11/2006 4:58am

thanks Nick for your howto... i have a question though: is it possible to set up an ethernet bridge like this between the wrt54G and another router (mine is a wag354g)?

best
vince

Posted by: Nick Coons
11/08/2006 8:07am

You can't use a WRT54G unless it's an older model running Linux (the newer ones don't), so you'd want to stick with the WRT54GL. But yes, you can set up the WRT as the client, and connect it with any wifi AP you'd like.

Posted by: nert
11/08/2006 7:14pm

Ok, I have a wrt(running ddwrt atm, but also has had openwrt etc on it in the past). I use it in bridge mode to connect to my ISP, but I do so over a metropolitan providers linke (the ISP has agreement with them) Unfortunately they are using the same ssid, so I am getting alot of crap from the metropolitan wireless links that I dont want.

How about adding a macfilter/transparent firewall config/howto to this mix ;-)

Posted by: Derek Hardison
11/12/2006 12:35pm

I am currently using 2 WRT-54G routers with DD-WRT (similar to OpenWRT) with the network bridge setup. However, I am also using the client bridge as a repeater I suppose and connecting one of the jacks to a network switch in my house. Do you think I would see better performance if I were to leave my client bridge to be used as only a bridge, and install a seperate access point to be used as a wireless provider for my laptop and some other equipement? It eventually has to go back thru the bridge because my Internet connection is located on the other side.

Thanks,
Derek Hardison

Posted by: Nick Coons
11/13/2006 9:27pm

nert,

Even if you filtered it, you'd still have to receive it to analyze it to filter it. Bandwidth-wise, it wouldn't provide a benefit; and it might cause an overall performance decrease because your bridge would take on the task of filtering.

Derek,

I'm not sure I understand the distinction between the two scenarios you're referring to. In the first case, you're saying that the client side of your bridge connects to a switch, which presumably connects to other networking equipment. But your laptop probably communicates wireless with the base side of the bridge.

As I understand it, you're asking if adding an AP on the client side of bridge and connecting your laptop to that would improve the performance of your laptop's connection. That depends on the signal strength between your laptop and the AP it's currently connected to. If the signal is already good, then you'll take a performance hit because you're introducing a new hop into the network. If the signal is marginal, doing this could improve the performance because you're replacing a weak part of your network with a stronger one.

But if you do this, use proper channel separation. If you have at least five channels between your current AP and the new one you'd add (i.e. channels 1 and 6), then neither wireless link should cause interference with the other.

Posted by: Chris
11/29/2006 6:16am

Thanks for the easy HOWTO, this works great for wireless. I am using a second linksys as a bridge in a very long flat.

I wonder if i can also use the ethernet on the bridge linksys. It seems not to work either when I use dhcp or a static IP. I would like to use the ethernet ports as well, any suggestions?

How would I ssh to the bridge if both linksys are set up with 192.168.1.1? just use ethernet? That seems to be the way.



Posted by: Chris
11/29/2006 6:23am

Opps. wrote too soon. Now ethernet is working too.

My linux box is running static IP and after rebooting would not resolve DNS. But after minutes it just started working.

My windows laptop, using ethernet and dhcp, is also working now.

thanks!

Posted by: Nick Coons
11/29/2006 8:25am

Chris,

<How would I ssh to the bridge if both linksys are set up with 192.168.1.1?>

They should not both be using the same IP address, as that will cause an IP conflict on the network. Give them each their own static IP and you can then use that for SSH.

Posted by: Andrei
01/04/2007 10:06pm

I Dont think that WRT54GL for example, comes with a default of 30mW power. I see on the net this statement many times but, looking to the certification (inside official guide) we found that it transmit at -18dB/m witch means aprox 64mW, so... the 30 "default" it must be induced by 3rd parties firmware.

Posted by: Nick Coons
01/09/2007 4:40pm

According to the User Guide on Linksys' website, you are correct, it is 18dBm. When the firmware is applied, it's taken to its max of 255mW. It's not until the wl package is installed that it's brought back down to a sane level.

So I'm not sure where the 30mW comes from either.

Posted by: Nick Coons
01/09/2007 4:41pm

Sorry, last comment should have read "it's taken to its max of 251mW."

Posted by: Mj Chai
02/20/2007 3:00am

would openwrt or dd-wrt give better performance as a Wireless Bridge ?

Posted by: Andrei
03/22/2007 5:42pm

Nick, I dig a little more, is seems that difference may come from the regionalization of the orig firmwares.

Posted by: radjoc
04/28/2007 12:52am

Hello
I have one question. Is it possible to use 2 WRT54GL to connect 2 different LANs, ie 192.168.1.0 and 192.168.2.0 and not just bridging one LAN? If yes, any help would be appreciated. Best regards Rade

Posted by: Nick Coons
04/28/2007 7:09am

radjoc,

Yes, you can do that by setting one of the devices up as a router. I don't have a step-by-step guide for you on that, but it would basically involve breaking the bridge that exists between the wired and wireless interfaces, setting IPs to each of them to match the networks you're connecting, and then creating a static routing table.

Posted by: radjoc
04/28/2007 11:49pm

Thanks Nick! Will try to do that.

Posted by: Mark K.
05/26/2007 9:28am

I like the article and found it very intriguing as my brother just asked me to setup a similar system for him to connect his office to some of his out-buildings. My question is with the OpenWRT can I do a multi-point bridge? What kind of antenna would you recommend to be able to bridge over a distance of about 1000 meters? (I realize that I know very little of antenna technologies, hence my question) What kind of bandwidth throughput could I expect to get on this kind of setup?

Thank you,
Mark


Posted by: Nick Coons
05/29/2007 8:14am

Mark K.,

<My question is with the OpenWRT can I do a multi-point bridge?>

Yes, this would work the same way, just add additional clients.

<What kind of antenna would you recommend to be able to bridge over a distance of about 1000 meters?>

This depends on where your client connections will be in the setup. You want to use an antenna that focuses the signal as narrowly as possible. So if your clients are all, say, to the south of the base, then a 60-degree panel might be a good choice. Worst case, if your clients are spread out all over the place, a 10dBi omni-directional should work. I've setup a 6.5 mile link like this before, and the connection was solid.

<What kind of bandwidth throughput could I expect to get on this kind of setup?>

That's always hard to say, because there are any number of things that can introduce noise and interference.

Posted by: Mr. Goot
06/07/2007 10:34pm

excellent setup, i'm very interested in using this setup as a cheap experiment to connect remote buildings.

Question: what is a reasonable length RG6 Coax cable? ie. before significant signal / performance loss

Posted by: Nick Coons
06/09/2007 6:38am

With RG6, I think you'll lose about 12dB per 100-foot run of cable, plus half a dB for each connection. "Reasonable" will be determined by The gain of your antennas, the power settings on the unit, and the power needed to cover the distance.

Posted by: Jason
02/20/2008 9:23pm

Ok, was searching for help on openwrt and this was one of the first sites i came to and I thought, 'I used to know a Nick Coons.'

Is this the Nick that used to practically live at Fair Lanes Tempe Village like dozen or so years ago? I used to work there. Send me an email if ya want.

Posted by: Alex
03/10/2010 4:19pm

The post touched different topics, but the most important to be addressed was the necessity of improving technology in the industry. A variety of new techniques and exhibitions were exposed.

Add Comment





Copyright 2004-2017 Arizona Paths

Arizona Paths Weather Button