Run It All

The previous pages explain in detail how to build and configure an IPv6-to-OpenWSN gateway. This page details how you can run pre-written scripts on a SLUG. The only requirement is that you have a SLUG running Debian (if you do, follow Run It All) and a free account with http://tunnelbroker.net/ (if you don't, follow Run It All). Note that you can replace the SLUG with any computer running any flavor of Linux.

Installation

We will install a bootstrapping script, and have it run whenever the OpenLBR's Ethernet interface comes up.

But first, you need to configure the hostname of your LBR, in our case openlbr1.

ebox:~# echo openlbr1 > /etc/hostname
ebox:~# shutdown -r now

Install ssh to be able to connect remotely:

openlbr1:~# apt-get install ssh

Optionally, install  public key authentication.

Install the IPv6 Router Advertisement daemon (RADVD), but have it not start at boot time:

openlbr1:~# apt-get install radvd
openlbr1:~# mv /etc/rc2.d/S50radvd /etc/rc2.d/K50radvd

You also need to install unix2dos, a small tool which allows the OpenLBR to convert Windows-style newlines to Unix-style newlines of a script, after having downloading it. This tool is part of package called tofrodos.

openlbr1:~# apt-get install tofrodos

Next, install screen:

openlbr1:~# apt-get install screen

Next, install python-serial:

openlbr1:~# apt-get install python-serial

Next, we need to install the openbootloader.sh script, which will take of all the rest of the installation:

openlbr1:~# mkdir /etc/network/if-up.d/openlbr/
openlbr1:~# cd /etc/network/if-up.d/openlbr/
openlbr1:~# echo "cd /etc/network/if-up.d/openlbr/" >> ~/.bashrc
openlbr1:/etc/network/if-up.d/openlbr# wget http://openwsn.berkeley.edu/svn/software/openlbr/openbootloader.sh
openlbr1:/etc/network/if-up.d/openlbr# dos2unix openbootloader.sh
openlbr1:/etc/network/if-up.d/openlbr# chmod u+x openbootloader.sh

Finally, you need to configure your OpenLBR to run that script when the Ethernet interface comes up:

openlbr1:~# echo "post-up /etc/network/if-up.d/openlbr/openbootloader.sh" >> /etc/network/interfaces

Type the following to reboot your OpenLBR.

shutdown -r now

When boot, the openbootloader.sh script downloads and runs the openlbr.sh script in a screen session.

script details

This script will run successfully only if you have registered your OpenLBR with Thomas Watteyne.

Registration implies adding files openprefix_<hostname>.pyopentunnel_<hostname>.sh and openradvd_<hostname>.conf to http://openwsn.berkeley.edu/svn/software/openlbr/. Take a look at what's in there already; basically, those files contain the LBR-specific configuration: creating the IPv6-in-IPv4 tunnel and assigning an IPv6 prefix.

Alternatively, you may elect to duplicate the http://openwsn.berkeley.edu/svn/software/openlbr/ folder on your own server, or hard-code the openprefix_<hostname>.pyopentunnel_<hostname>.sh and openradvd_<hostname>.conf files into your OpeLBR. Contact Thomas Watteyne with questions.

The openlbr.sh script:

  • reports the OpenLBR's address to a remote server (see how in Run It All);
  • sets up the IPv6 tunnel (see how in Run It All)
  • download and runs the openlbr.py script.

The openlbr.py script:

  • creates a virtual interface (see how in OpenVirtualInterface)
  • creates and starts the execution of two threads:
    • moteThreadcommunicates with the mote attached to the OpenLBR:
      • it is immune against connecting/disconnecting the mote (see how in Run It All);
      • to be completed...
    • virtualInterfaceThreadcommunicates with the virtual interface:
      • it compacts/decompacts IPv6 headers into 6LoWPAN headers (see how in Run It All)
      • to be completed...

Testing

icmpv6_udp_tcp_checksum.pcap shows a Wireshark trace of data exchange between Internet host (2607:f140:400:1176:e5fd:3e00:26fa:a7a2) and a node on the OpenWSN network (2001:470:1f05:98e::4):

  • packets 1-16 are triggered by the following commands on the Internet host. ICMPv6 Echo requests and replies are separated by IEEE802.15.4 acknowledgements.
C:\Users\Thomas>ping -6 2001:470:1f05:98e::4

Pinging 2001:470:1f05:98e::4 from 2607:f140:400:1176:e5fd:3e00:26fa:a7a2 with 32 bytes of data:
Reply from 2001:470:1f05:98e::4: time=491ms
Reply from 2001:470:1f05:98e::4: time=495ms
Reply from 2001:470:1f05:98e::4: time=360ms
Reply from 2001:470:1f05:98e::4: time=393ms

Ping statistics for 2001:470:1f05:98e::4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 360ms, Maximum = 495ms, Average = 434ms
  • packet 17 is triggered by pressing the udpData on the OpenVisualizer connected to mote 2001:470:1f05:98e::4 and sent to mote 2001:470:1f05:98e::1. Packet 18 is the IEEE802.15.4 acknowledgements.
  • packets 19 and 20 are similarly triggered by pressing the tcpData button. the TCP session establishment/tear down sequences are not captured in this trace.

If you obtain similar results, congratulations! You have successfully connected your motes to the IPv6 cloud.