Thursday, November 13, 2008

mesh networking in Ubuntu 8.10

I was happy to find this when I upgraded my laptop to the new 8.10 release:

$ grep MESH /boot/config-`uname -r`
CONFIG_MAC80211_MESH=y

The kernel shipped with Ubuntu 8.10 (2.6.27) comes with draft-802.11s enabled and mesh-capable b43 and zd1211rw wireless drivers. I suggest that you try and make your own mesh if you have two or more PCs with a b43-supported interface! The only prerequisite is building iw from source as it's not packaged yet, but it's quite easy. Here's how:

First, get a couple of dependencies:

$ sudo apt-get install build-essential libnl-dev

Download the latest iw tarball and extract it, for example:

$ wget http://wireless.kernel.org/download/iw/iw-0.9.6.tar.bz2
$ tar -xf iw-0.9.6.tar.bz2
$ cd iw-0.9.6

Now make a config (the default config works fine) and build and install iw:

$ cp defconfig .config
$ make
$ sudo make install

Now that you have iw, you can use it to turn your wireless card into a mesh node. First, kill NetworkManager (it doesn't deal with Mesh Point interfaces at this time) and identify your wireless device. For example, you can run "ifconfig -a" and look for an interface named "wlan0". To make a mesh, on each PC do:

$ sudo killall NetworkManager
$ sudo iw dev wlan0 interface add mesh0 type mp mesh_id mymesh

...where "mesh0" is the name of your new interface. The Mesh ID is similar to an SSID and should be the same for all your mesh nodes. Now bring that interface up and assign each one a unique address on the same subnet, for example:

$ sudo ifconfig mesh0 192.168.2.1 up

Each PC should be able to ping any other in the mesh. Once in a mesh, you can ask iw for a list of nodes that your interface sees like this:

$ sudo iw dev mesh0 station dump

For more details, see the iw documentation or the open80211s.org HOWTO.

7 comments:

andrey said...

I've seen a few questions about using mesh with Zydas-based USB WiFi interfaces in Ubuntu. This is supported but, at this time, Ubuntu ships the vendor driver (which does not use mac80211 and doesn't support mesh) instead of the mainline "zd1211rw" driver which supports mesh. If you wish to use this card, please install the zd1211rw driver. One easy way to do this is to use compat-wireless:

http://wireless.kernel.org/en/users/Download#Buildingandinstalling

More information is available here:
http://wireless.kernel.org/en/users/Download

Please be aware that the Zydas chipset itself seems to have a firmware problem that manifests itself in mesh mode on some systems. This may cause your card to lock up until you restart it. A note about this and other drivers/cards available is found in the o11s wiki:
http://o11s.org/trac/wiki#DriverStatus

ManBoy said...

I've been trying to set up a mesh interface on my system (ubuntu 8.04).
I have the Intel ProWireless 4965agn card, using the iwlwifi drivers. My mac80211 subsystem is loaded too. However, on running:

tkudari@tkudari-laptop:~/iw-0.9.6$ sudo iw dev wlan0 interface add mesh0 type mp mesh_id mymesh
command failed: Operation not supported (-95)

Why would this happen?

andrey said...

Just to be clear: Intel WiFi hardware is not supported. Please see the supported drivers list on o11s.org or wireless.kernel.org for details on what hardware you can use.

Benjamin Selinger said...

sudo iw dev eth1 interface add mesh0 type mp mesh_id mymesh
nl80211 not found.

This is with a bcm4322 on Ubuntu 11.04. Idea's? I see CONFIG_NL80211_TESTMODE is not set in the stock kernel. This have anything to do with it?

andrey said...

you're using Broadcom's proprietary driver rather than the mainline Linux driver. The proprietary once doesn't use the mac80211 stack and therefore has no mesh support. You need to switch to the b43 driver:
http://wireless.kernel.org/en/users/Drivers/b43

Liu Peng said...

when I use iw to config a mesh, there is always such a msg:
Failed to read classid file: Object not found.

who can help me out? pls....

Bring_it_on said...

I got my mesh running with the following command:
$ sudo iw phy phy0 interface add mesh type mp mesh_id mymesh

But when I tried to assign an IP it failed:
$ sudo ifconfig mesh 192.168.2.1 up
SIOCSIFFLAGS: Name not unique on network
SIOCSIFFLAGS: Name not unique on network