open80211s HOWTO

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

Getting all the pieces

Each mesh node needs to be configured as follows:

The kernel

Get a kernel including the open80211s stack:

$ 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.

The o11s patches have are now included in compat-wireless so you have the option of using compat-wireless instead of building the kernel. You may also use the 2.6.26 or later mainline kernel.

iw

Follow the instructions at iw documentation page, but apply the appropriate mesh support patch available before compiling.

Update: the mesh support patch has been included in iw git repository, so it is no longer necessary to apply it separately.

Testing

  • Boot several nodes with the compiled kernel and with iw userspace tools 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 wmasterN device on each node.
# iw dev wmaster0 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.

  • All mesh interfaces start by default in channel 1. The channel can be changed with
# 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:
192-168-3.80:~# iw dev mesh station dump
00:11:a3:04:af:ed mesh  792     65228   168     20860   36108   ESTAB
00:11:a3:04:b1:06 mesh  204     65744   168     25545   34728   ESTAB
00:11:a3:04:b0:85 mesh  496     65770   168     43006   53475   ESTAB
00:11:a3:04:b1:05 mesh  304     65749   168     65287   62867   ESTAB
00:11:a3:04:b1:0c mesh  1008    66099   484     33584   11108   ESTAB
  • You should now be able to ping any node in the mesh. After doing that you can use ip again to inspect the path table and see which path was used to reach the ping destination.
192-168-1-80:~# ping -c 2 192.168.3.87
PING 192.168.3.87 (192.168.3.87) 56(84) bytes of data.
64 bytes from 192.168.3.87: icmp_seq=1 ttl=64 time=36.6 ms
64 bytes from 192.168.3.87: icmp_seq=2 ttl=64 time=11.0 ms

192-168-1-80:~# arp 192.168.3.87
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.3.87             ether   00:11:A3:04:B0:85   C                     mesh

192-168-1-80:~# iw dev mesh mpath dump
00:11:a3:04:b0:85 00:11:a3:04:b0:85 mesh 7 1 0x4 17642779 0 25 0
00:11:a3:04:b2:17 00:11:a3:04:b2:33 mesh 7 2 0x4 17642780 0 25 0




00:11:a3:04:b1:0c 00:11:a3:04:b1:0c mesh 0 1 0x20 17642779 0 0 0
00:11:a3:04:b1:06 00:11:a3:04:b1:06 mesh 0 1 0x20 17642780 0 0 0
00:11:a3:04:b2:33 00:11:a3:04:b2:33 mesh 0 1 0x20 17642780 0 0 0

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). On the example table we can see a multi-hop path to destination 00:11:a3:04:b2:17.

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.
  • Mount the debug filesystem, debugfs, and you'll be able to examine mesh statistics and modify configuration parameters:
192-168-1-80:~# mount -t debugfs null /mnt

192-168-1-80:~# # find /mnt/debugfs/ieee80211/phy0/netdev\:mesh/mesh_config
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/min_discovery_timeout
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/path_refresh_time
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshHWMPmaxPREQretries
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshHWMPnetDiameterTraversalTime
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshHWMPpreqMinInterval
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshHWMPactivePathTimeout
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshMaxPeerLinks
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/auto_open_plinks
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshTTL
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshHoldingTimeout
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshConfirmTimeout
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshRetryTimeout
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshMaxRetries

192-168-1-80:~# find /mnt/debugfs/ieee80211/phy0/netdev\:mesh/mesh_stats
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_stats
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_stats/estab_plinks
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_stats/dropped_frames_no_route
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_stats/dropped_frames_ttl
/mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_stats/fwded_frames

For instance, to change the mesh TTL value for the interface (which currently defaults to 5) one would:

192-168-1-80:~# cat /mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshTTL
5
192-168-1-80:~# echo 3 > /mnt/debugfs/ieee80211/phy0/netdev:mesh/mesh_config/dot11MeshTTL

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

Comments? Questions? Praise? Flames?