May 162013

So lately, I’ve been trying to use one of my Raspberry Pis as a WiFi bridge.
That is connecting the Pi to a WiFi network, and sharing it out via the ethernet port.
I was trying to do that with the RT5370 USB sticks that I was also using to broadcast hotspots.

With the default drivers in Raspbian however, trying to add wlan0 to a bridge results in this message

can't add wlan0 to bridge br0: Operation not supported

According the the drivers, wlan0 can’t do it.
The only way to add the RT5370 NIC to a bridge is to activate 4addr (4 address frame) mode.

iw wlan0 set 4addr on

However, once 4addr mode is on, traffic between the WiFi device and the AP seemed to stop altogether.

The solution to this issue, is to use the RALink drivers. The vendor drivers does not seem to use the Linux WiFi stack however, which means that those drivers can not be used to broadcast a hotspot using hostapd. So if you’re using a Pi as a WiFi repeater, you may have issues there, though that will be something I’m going to experiment with later as well.


Before we can actually compile the drivers, we’re going to need to grab the kernel sources.
I’m using Raspbian Server Edition, which uses the 3.6.11+ kernel. We’ll need the matching source from github.
We’ll change to the /usr/src directory first, then wget the sources from github, and then untarball it with these commands.

*Note* I’m doing it as root, so you can either prepend sudo to these commands, or run sudo bash before running these commands.

cd /usr/src
tar -xvzf rpi-3.6.y.tar.gz

Once the source is extracted, we’ll need to copy the current kernel configuration into the source directory.

cd linux-rpi-3.6.y
gzip -dc /proc/config.gz > .config

And then we need to create the files and symlinks neccesary for compiling external modules

make modules_prepare
ln -s /usr/src/rpi-3.6.y /lib/modules/3.6.11+/build

Compiling the Vendor drivers

In order to use the Vendor drivers, first we’ll need to get them.
The drivers can be found here.
Download the ones for the RT5370 and transfer it to the Pi as we’ll need to compile the drivers ourselves.

Once we have the drivers on the Pi, we’ll move them to /usr/src and untar them to keep things nice and neat. Assuming the drivers are in /home/pi
*Note* Again I’m doing everything as root.

mv /home/pi/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DP0.bz2 /usr/src
cd /usr/src
tar -xvjf 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DP0.bz2
cd 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DP0

Once it’s untarred, we’ll need to edit the file ‘os/linux/’ to enable WPA support and to allow network managers to control the device.
So find these lines, and change the n to y, then save and close the file.


Now, we should still be in the /usr/src/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DP0/ directory.
Time to compile the drivers !
To compile them, we just need to run the ‘make’ command in the drivers directory as root.
It took me just shy of 12 minutes to compile the drivers on a Class 4 SD Card on a non-overclocked pi.
Once they are compiled, running ‘sudo make install’ will install the drivers into the right spot

To make sure the drivers are installed properly, we’ll load the module to make sure no errors come up.
*Note* Run this as root again

modprobe rt5370a

If no errors come up, then that’s a good sign. Check that it’s been loaded by running lsmod and checking the output.

root@raspberrypi:/home/pi# lsmod
Module Size Used by

rt5370sta 786186 0

You should see the module rt5370sta in the list there.
Lastly we’ll disable the rt2800 usb module and enable autoloading of the new rt5370sta module.
We’ll need to edit /etc/modprobe.d/raspi-blacklist.conf and add the following line to the end

blacklist rt2800usb

And then we’ll need to edit the /etc/modules file to add the new module we’ve just compiled. Just need to add the module name to the end of the file


After the file has been modified, reboot the Pi and when it comes back up, run ifconfig -a and you should see something similar to the following –

eth0 Link encap:Ethernet HWaddr b8:27:eb:xx:xx:xx
RX packets:354 errors:0 dropped:0 overruns:0 frame:0
TX packets:181 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:30609 (29.8 KiB) TX bytes:25948 (25.3 KiB)

lo Link encap:Local Loopback
inet addr: Mask:
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

ra0 Link encap:Ethernet HWaddr 00:0f:54:xx:xx:xx
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:854641 (834.6 KiB) TX bytes:44800 (43.7 KiB)

Notice the ra0 rather than wlan0. This shows that the Pi is using the new rt5370sta module rather than the old rt2800usb one. You can still use the ra0 interface to connect to wireless networks like normal.