open80211s HOWTO

This page explains how to set up a mesh network using open80211s and a supported driver.

Note: at this time, this HOWTO assumes that you are not running a WiFi manager such as NetworkManager. Please kill or otherwise stop NetworkManager or similar software before setting up your mesh interfaces or tell it to ignore the device that you plan to use for mesh.

Getting all the pieces

Each mesh node needs to be configured as follows:

The kernel

Get the wireless-testing kernel:

$ git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git

Configure the kernel including the mac80211 stack with mesh capabilities (CONFIG_MAC80211, CONFIG_MAC80211_MESH) and enable the driver(s) that you need, for example the zd1211-rw driver (CONFIG_ZD1211RW). Compile and install on your target. Here are instructions for Ubuntu.

You also have the option of using compat-wireless instead of building the kernel or you may also use the 2.6.26 or later mainline kernel. Using wireless-testing is strongly recommended as it represents the latest development and driver support.

iw

Follow the instructions at iw documentation page to build the latest version of iw from source.

Testing

  • Boot several nodes with the compiled kernel and with iw properly installed.
  • Choose a mesh id. The mesh id will be used in the mesh node beacons, and only mesh points with the same mesh id will be able to communicate to each other. The mesh id is a maximum of 32 bytes long.
  • Add a new mesh interface for the wlanN device on each node.
# iw dev wlan0 interface add mesh type mp mesh_id $MESH_ID

A new interface will be created:

# ifconfig -a | grep mesh
mesh      Link encap:Ethernet  HWaddr 00:18:39:14:48:B5  

Note: depending on your Linux distribution, you may see a slightly different name for the mesh interface.

Bring up your mesh interface:

# ifconfig mesh up
  • All mesh interfaces start by default in channel 1. The channel can be changed with
# iw dev <mesh_iface> set channel <channel>

or

# iwconfig <mesh_iface> channel <channel>
  • Assign a same-subnet IP to the mesh interface in each node.
# ifconfig <mesh_iface> <ip_addr>

For this tutorial, let's assume that our mesh nodes are assigned addresses in the 192.168.3.80/28 subnet.

# ifconfig mesh 192.168.3.80
  • In the default configuration, mesh points will automatically attempt to create peer links will all other mesh nodes with the same mesh ID. You can examine which peer links have been established with the iw dev mesh station dump command:
# iw dev mesh station dump
Station 00:ff:f3:00:f7:3d (on mesh)
	inactive time:	504 ms
	rx bytes:	443
	tx bytes:	709
	mesh llid:	33183
	mesh plid:	19335
	mesh plink:	ESTAB
Station 00:ff:f3:00:f7:30 (on mesh)
	inactive time:	692 ms
	rx bytes:	1994
	tx bytes:	510
	mesh llid:	40419
	mesh plid:	6405
	mesh plink:	ESTAB
Station 00:ff:f3:a0:27:15 (on mesh)
	inactive time:	836 ms
	rx bytes:	5653
	tx bytes:	222
	mesh llid:	3233
	mesh plid:	47892
	mesh plink:	ESTAB
Station 00:ff:f3:a0:24:b8 (on mesh)
	inactive time:	800 ms
	rx bytes:	26680
	tx bytes:	294
	mesh llid:	22106
	mesh plid:	33481
	mesh plink:	ESTAB
  • You should now be able to ping any node in the mesh. After doing that you can use iw again to inspect the path table and see which path was used to reach the ping destination.
jr-192-168-1-91:~# ping -c 2 192.168.10.87
PING 192.168.10.87 (192.168.10.87) 56(84) bytes of data.
64 bytes from 192.168.10.87: icmp_seq=1 ttl=64 time=8.85 ms
64 bytes from 192.168.10.87: icmp_seq=2 ttl=64 time=3.42 ms

192-168-1-80:~# arp 192.168.10.87
Address                  HWtype  HWaddress           Flags Mask            Iface
jr-192-168-1-87.local    ether   00:ff:f3:00:f7:3d   C                     mesh

192-168-1-80:~# iw dev mesh mpath dump
00:ff:f3:00:f7:30 00:ff:f3:00:f7:30 mesh	1	16386	0	1496	0	0	0x11
00:ff:f3:00:f7:3d 00:ff:f3:00:f7:3d mesh	2	16386	0	1496	0	0	0x15
00:ff:f3:a0:24:b8 00:ff:f3:a0:24:b8 mesh	5	16386	0	1496	0	0	0x11
00:ff:f3:a0:27:15 00:ff:f3:a0:27:15 mesh	1	8577	0	1496	0	0	0x11

In this example we can see that the destination was a single hop from the origin because the destination address (first column) matches the next hop address (second column).

Et voilà! But keep reading for...

Advanced Tinkering

  • You can modify the mesh path table with these commands:
    • iw dev mesh mpath $DST_ADDR del: to delete a mesh path entry.
    • iw dev mesh mpath $DST_ADDR add next_hop $NEXTHOP_ADDR to force a specific network topology.
  • You can modify the mesh peer links table with these commands:
    • iw dev mesh station dump: list all the plinks.
    • iw dev mesh station $HW_ADDR set plink_action [open|block]: trigers a specific peer link stablishment process or blocks a specific peer link.
    • iw dev mesh station del $HW_ADDR: deletes a peer link from the peer table.
  • You can get and set mesh parameters using the "mesh_param" command in iw. For example, to change the mesh TTL value (which defaults to 5), one would:
    # iw dev mesh get mesh_param mesh_ttl
    5
    # iw dev mesh set mesh_param mesh_ttl 3
    

The following mesh parameters can be inspected and set:

  • mesh_retry_timeout
  • mesh_confirm_timeout
  • mesh_holding_timeout
  • mesh_max_peer_links
  • mesh_max_retries
  • mesh_ttl
  • mesh_auto_open_plinks
  • mesh_hwmp_max_preq_retries
  • mesh_path_refresh_time
  • mesh_min_discovery_timeout
  • mesh_hwmp_active_path_timeout
  • mesh_hwmp_preq_min_interval
  • mesh_hwmp_net_diameter_traversal_time

Wireshark

Patch wireshark and start analyzing traffic. Thanks to Steve Brown for porting this patch from an older version of wireshark

plink_open-wireshark.pngpreq-wireshark.png

Mesh Portal (MPP)

A Mesh Portal (MPP) provides the ability to bridge networks over a mesh. Although the implementation of the full MPP specification detailed in the 802.11s draft has not yet been finished, an interesting intermediate step has been contributed that will be outlined here.

Note: At this time, mesh points will not be able to ping outside the mesh and vice versa. This is because support for proxied entities in the forwarding table have not been implemented. However, this implementation will allow an MPP to use the 6 address frame format and therefore be able to propagate traffic though the mesh successfully.Thanks to YanBo? for submitting this functionality.

To bring up an MPP we need to setup up a bridge between a mesh interface and, for example, an Ethernet interface.

1. Bring up a mesh interface as described in the "Testing" section above.

mpp$ iw dev wlan0 interface add mesh type mp mesh_id ${MESH_ID}
mpp$ ifconfig mesh up

2. Add this new interface and your ethN interface to a new bridge:

mpp$ brctl addbr br0
mpp$ brctl stp br0 off
mpp$ brctl addif br0 eth1
mpp$ brctl addif br0 mesh
mpp$ ifconfig mesh down
mpp$ ifconfig eth1 down
mpp$ ifconfig mesh 0.0.0.0 up
mpp$ ifconfig eth1 0.0.0.0 up
mpp$ ifconfig br0 ${MESH_IP}

If you are having problem setting up the bridge, here is a great howto: Ethernet Bridge + netfilter HOWTO

Comments? Questions? Praise? Flames? escali digital food scaleplastic storage shedsbissell hose graco booster car seat Bags & Filters