Differences between revisions 4 and 6 (spanning 2 versions)
Revision 4 as of 2013-02-09 03:24:15
Size: 11034
Comment: pad out the lesson plan
Revision 6 as of 2013-02-09 04:11:59
Size: 10964
Comment: fix a typo
Deletions are marked like this. Additions are marked like this.
Line 244: Line 244:
        option ifname adhoc0
Line 252: Line 253:
        option 'proto' 'none'         option 'ifname' 'adhoc0'
option 'proto' 'batadv'
Line 254: Line 256:
  a. insert an "interfaces" line in /etc/config/batman-adv
config 'mesh' 'bat0'
 option 'interfaces' 'wlan0-1'
 option 'aggregated_ogms'
        option 'mesh' 'bat0'

Location: NodeWorldCup
Date and Time: Saturday, February 9, 2013, Noon to 5pm
Scribe: You
Roll Call: Them


  • Set up wifi meshes using openwrt and batman-adv on UbiquitiAirRouters and AcctonMR3201A

  • Bring your laptop
  • Bring your OpenWrt'able router

  • Does anyone have a whiteboard they can bring?
  • Or look over the shoulder of others


  • Stuff Russell is bringing:
    • 1x whiteboard (thanks cseppa!)
    • 15x Accton MR3201A's with antennas and power supplies
    • 15x cat5 cables (flat white ones we received with the routers)
    • 1x 16-port 10/100 ethernet switch with power supply
    • 1x Buffalo WZR600DHP configured to provide ethernet from NodeWorldCup wifi and also enable parallel flashing of Acctons

    • 2x power strips
  • Flashing Base OpenWrt onto Accton MR3201A: The Accton MR3201A devices have rather slow flash, and as a result, writing an image to them takes a considerable amount of time, approximately 15 minutes. In order to speed that process up, I configured a Buffalo WZR600DHP to flash 4 of them in parallel. The Buffalo was chosen because it has enough flash space of its own to persistently store the base image that is flashed on the Accton, and it has 4 LAN ports that can be configured as distinct interfaces. On the Buffalo, I used a basic Ar71Cab image, with the addition of the ap51-flash package and a custom configuration.

    • Buffalo flasher configuration changes
      • /etc/config/network:
        • switch configuration:
          config switch
                  option name 'eth0'
                  option reset '1'
                  option enable_vlan '1'
          #config switch_vlan
          #        option device 'eth0'
          #        option vlan '1'
          #        option ports '0 1 2 3 4'
          config switch_vlan
                  option device 'eth0'
                  option vlan '1'
                  option ports '0t 1'
          config switch_vlan
                  option device 'eth0'
                  option vlan '2'
                  option ports '0t 2'
          config switch_vlan
                  option device 'eth0'
                  option vlan '3'
                  option ports '0t 3'
          config switch_vlan
                  option device 'eth0'
                  option vlan '4'
                  option ports '0t 4'
        • network interfaces:
          config 'interface' 'lan1'
                  option 'ifname' 'eth0.1'
                  option 'proto' 'static'
                  option 'ipaddr' ''
                  option 'netmask' ''
          config 'interface' 'lan2'
                  option 'ifname' 'eth0.2'
                  option 'proto' 'static'
                  option 'ipaddr' ''
                  option 'netmask' ''
          config 'interface' 'lan3'
                  option 'ifname' 'eth0.3'
                  option 'proto' 'static'
                  option 'ipaddr' ''
                  option 'netmask' ''
          config 'interface' 'lan4'
                  option 'ifname' 'eth0.4'
                  option 'proto' 'static'
                  option 'ipaddr' ''
                  option 'netmask' ''
      • /etc/config/dhcp add interfaces:
        #config dhcp priv
        #       option interface        priv
        #       option start            100
        #       option limit            150
        #       option leasetime        12h
        config dhcp lan1
                option interface        lan1
                option start            10
                option limit            200
                option leasetime        1h
        config dhcp lan2
                option interface        lan2
                option start            10
                option limit            200
                option leasetime        1h
        config dhcp lan3
                option interface        lan3
                option start            10
                option limit            200
                option leasetime        1h
        config dhcp lan4
                option interface        lan4
                option start            10
                option limit            200
                option leasetime        1h
      • create and populate /src with Accton image files:
        -rw-r--r-- 1 russell users    1411 Feb  8 17:59 md5sums
        -rw-r--r-- 1 russell users 2949120 Feb  8 17:59 openwrt-atheros-combined.squashfs.img
        -rw-r--r-- 1 russell users 1966080 Feb  8 17:59 openwrt-atheros-root.squashfs
        -rwxr-xr-x 1 russell users 2844736 Feb  8 17:58 openwrt-atheros-vmlinux.elf
        -rw-r--r-- 1 russell users 1310720 Feb  8 17:58 openwrt-atheros-vmlinux.gz
        -rw-r--r-- 1 russell users  917504 Feb  8 17:58 openwrt-atheros-vmlinux.lzma
      • add ap51-flash package to Buffalo
    • Flashing Accton's:
      • associate with MeshPlayDay

      • connect ethernet cables between the 4 LAN ports on the Buffalo and the Acctons
      • connect de-energized power strip's power supplies to the Acctons
      • login to Buffalo, N times (where N <= 4):  ssh root@ 

      • in each shell:
        cd /src 
        ap51-flash eth0.N openwrt-atheros-root.squashfs openwrt-atheros-vmlinux.lzma
        where N is the LAN port number
      • when each shell's ap51-flash has started, energize the power strip
      • confirm each of the ap51-flash's has detected its Accton and has begun flashing
      • wait about 15 minutes for ap51-flash to complete, the Accton to reboot, and the firstboot sequence to complete
      • for each Accton:
        • remove the Accton from the ethernet cable
        • connect to a laptop via ethernet (with a staticly configured interface)
        • confirm that the Accton answers telnet at

The above is for reference. Russell has pre-flashed the Acctons as far as this. The remainder of the notes indicate the steps needed to install and configure batman-adv on the Accton's to participate in a mesh.

  1. configure Accton:
    1. turn off firewall
      /etc/init.d/firewall disable
    2. turn off dnsmasq
      /etc/init.d/dnsmasq disable
    3. set a password (this will disable telnet, so remember the password you give it!)
    4. edit /etc/config/system to assign a hostname (helps to remind you what device you are logged into)
      config system
              option hostname 'meshnode-11-2'
              option timezone 'PST8PDT'
    5. edit /etc/config/wireless
      vi /etc/config/wireless
      • enable the radio
        # option disabled 1
      • set a unique SSID for the ap mode
        config wifi-iface
                option device   radio0
                option network  lan
                option mode     ap
                option ssid     meshnode-11.2    
                option encryption none
    6. configure network interfaces to either dynamic or static so that you can log in to the device *and* reach package archives on the internets (if dynamic, configure upstream router to provide a consistent ip address)
      vi /etc/config/network
      config interface lan
              option ifname   eth0
              option type     bridge
              option proto    static
              option ipaddr
              option netmask
              option gateway
              option dns
      Note that the SSID in the step above was derived from the static IP address assigned here, that way we can tell what we are connecting to. The network is derived from a the network I was connected to when I did this configuration, we may want to choose 10.11.25.x during the playday, but it should correspond to the network the device is connected to while configuration is performed. It is important to coordinate the IP addresses you are assigning. If you assign a static IP address, please WRITE IT ON THE WHITE BOARD so others can see what is already in use!
    7. reboot
    8. ssh in
      ssh root@
    9. confirm you can get to the internets from the Accton
      ping google.com
    10. fix /etc/opkg.conf, the first line should be this:
      src/gz barrier_breaker http://iris.personaltelco.net/~russell/openwrt/r35525-atheros
    11. update package metadata (the metadata is stored to a RAM-based filesystem, so it must be repeated after a reboot if you want to install more packages)
      opkg update
    12. install batman-adv:
      opkg install kmod-batman-adv
      you should see:
      Installing kmod-batman-adv (3.3.8+2013.0.0-2) to root...
      Downloading http://iris.personaltelco.net/~russell/openwrt/r35525-atheros/kmod-batman-adv_3.3.8+2013.0.0-2_atheros.ipk.
      Installing kmod-lib-crc16 (3.3.8-1) to root...
      Downloading http://iris.personaltelco.net/~russell/openwrt/r35525-atheros/kmod-lib-crc16_3.3.8-1_atheros.ipk.
      Installing kmod-crypto-crc32c (3.3.8-1) to root...
      Downloading http://iris.personaltelco.net/~russell/openwrt/r35525-atheros/kmod-crypto-crc32c_3.3.8-1_atheros.ipk.
      Installing kmod-crypto-hash (3.3.8-1) to root...
      Downloading http://iris.personaltelco.net/~russell/openwrt/r35525-atheros/kmod-crypto-hash_3.3.8-1_atheros.ipk.
      Installing kmod-lib-crc32c (3.3.8-1) to root...
      Downloading http://iris.personaltelco.net/~russell/openwrt/r35525-atheros/kmod-lib-crc32c_3.3.8-1_atheros.ipk.
      Configuring kmod-crypto-hash.
      Configuring kmod-lib-crc16.
      Configuring kmod-crypto-crc32c.
      Configuring kmod-lib-crc32c.
      Configuring kmod-batman-adv.
    13. (optional) install some other useful tools:
      opkg install wireless-tools iwinfo ip
    14. add a mesh interface to /etc/config/wireless:
      config wifi-iface
              option  device  radio0
              option  ifname  adhoc0
              option  network mesh        
              option  mode    adhoc                
              option  ssid    ptp-mesh                        
              option  encryption none                               
    15. this interface needs a larger than normal MTU to accomodate the batman-adv wrappers, so add this stanza to /etc/config/network:
      config 'interface' 'mesh'
              option 'ifname' 'adhoc0'
              option 'proto' 'batadv'
              option 'mtu' '1528'
              option 'mesh' 'bat0'
    16. add bat0 to the lan bridge in /etc/config/network
      config interface lan
              option ifname   "eth0 bat0"
              option type     bridge
    17. logout and disconnect
    18. repeat for next Accton, then plug in power-only to previously configured Accton and see if you can ping it over the mesh
    19. do a happy dance

Note, you should avoid having multiple nodes participating in the same mesh and connected to a common ethernet network at the same time (at least historically), for fear of bridge loops (packets going around in circles until the network melts). If there are multiple teams working on separate meshes, choose different wireless channels (defined in the first stanza of /etc/config/wireless).

Open Questions:

  • what do all those options in /etc/config/batman-adv mean?
  • does bridge loop avoidance really work?
  • when your mesh is complete, pick a device to be vis_mode server and then look at the batctl vd dot, what does it look like?
  • why isn't the wireless interface getting added to the bat0 mesh interface?


PlayDay20130209 (last edited 2013-02-09 18:57:44 by RussellSenior)