This post will give a quick tutorial on how to install a 6LowPAN Border Router (6lbr) inside a virtual machine which is using a Texas Instruments CC2538DK configured as a slip radio to access an IEEE 802.15.4/6LowPAN based Contiki network.
The host will be a Debian 9 ‘stretch’ running in a virtual machine in Virtual Box and the CC2538DK will be connected to the VM host computer via a serial cable. This is achieved by a FTD232/CH340/CP2102 based USB UART converter which will be forwarded to the virtual machine. I did have problems with 6lbr and the VM disconnecting the CC2538DK when I was using the XDS100 UART interface provided on the boards so I switched to the external UART console.
How it works
The virtual machine host is running a background service and is serving as web server to enable access to the web interface. The service is creating a network bridging interface between an ethernet device and a slip radio that is connected via USB/Serial. By doing so the computer is able to send packets to any sensor node that is deployed in the WPAN by addressing every nodes unique IPv6 network address.
Some prerequisites need to be met on the host system first:
apt-get install libncurses5-dev bridge-utils
To get the newest development version and build the binaries by yourself check out the source code and the corresponding submodules:
git clone https://github.com/cetic/6lbr cd 6lbr git submodule update --init --recursive cd examples/6lbr
Note: There are also some precompiled packages available on the 6lbr wiki.
Now compile everything:
make all #all_native for version < 1.4 make plugins make tools
And install it as a service:
make install make plugins-install update-rc.d 6lbr defaults
More information can be found in the wiki.
The 6lbr border router will be configured in the router mode in this tutorial. By doing so it creates a bridge interface between one ethernet interface and the slip radio. In this configuration I am using a virtual machine with two bridged network interfaces, one for the bridge and one for the outside communication (e.g. web traffic).
MODE=ROUTER DEV_ETH=enp0s3 RAW_ETH_FCS=0 BRIDGE=1 DEV_BRIDGE=br0 DEV_RADIO=/dev/ttyUSB0 LOG_LEVEL=3
Slip radio installation
Different development boards are supported by the 6lbr to be used as a slip radio, check the wiki.
To build the slip radio firmware change the directory and select a target:
cd examples/ipv6/slip-radio make TARGET=cc2538dk
which creates the slip-radio.bin file you can the flash to the target. How to flash the CC2538DK is described in another post.
The network configuration is using default settings on the CC2538DK configuration, which are:
Net: sicslowpan LLSEC: nullsec MAC: CSMA RDC: nullrdc Channel: 26 PAN-ID: abcd
You should probably check those default settings if you are mixing different kind of boards as they can differ between different development boards. You can also change them later on by using the web interface.
Starting it up
When the slip radio is connected the 6lbr service can be powered up:
service 6lbr start
To check if everything is alright have a look at the /var/logs folder and check the 6lbr.log and 6lbr.ip file. If the latter is not existent 6lbr start-up is hanging at some point. Quite handy is to check whats going on there by using:
tail -f /var/logs/6lbr.log
If the log looks fine and you can see something like
2017-03-28 10:58:00.504350: INFO: 6LBR: CETIC 6LBR Started
you can finally try to access the webserver by opening your browser and open http://[bbbb::100] which should then display the web page:
How to deploy new sensor nodes and connect them to 6lbr can be found here.