Tools for a WPAN enabled Raspbian
To ease deployment the folder structure in this repo matches root filesystem layout of Raspbian - just copy files as need to the respective location. They depend on a Raspbian Jessie running a WPAN enabled Linux Kernel with installed WPAN tools.
Take a look at our Wiki for a guide to create a WPAN enabled Raspbian image.
Note: install or running these scripts and services requires root or sudo privileges!
The following shell scripts are little helper to create and delete lowpan or monitor devices. To install the scripts copy them as follows:
# cp <path/to/repo/clone>/usr/local/sbin/* /usr/local/sbin/.
# chmod +x /usr/local/sbin/*
Create a 6LoWPAN device named lowpan0 with distinct CHANNEL and PANID.
This script will also take down an existing monitor0 device and will update
the channel and pan id of lowpan0 if it already exists. This script is
used by the systemd lowpan service described below to create a device on startup.
# create_lowpan <CHANNEL> <PANID> [<LLADDR>]
Note: optionally this scripts allows to modify/set the LLADDR of the lowpan device, as some devices generate a new LLADDR at each boot.
Delete an existing 6LoWPAN device named lowpan0. This script is used
by the systemd lowpan service described below to take down the device.
# delete_lowpan
Create a 6LoWPAN monitoring device named monitor0 with distinct CHANNEL.
This script will also take down an existing lowpan0 device and will update
the channel of an existing monitor0.
# create_monitor <CHANNEL>
Delete an existing 6LoWPAN monitoring device named monitor0.
# delete_monitor
For real IoT deployment you typically want to have your 6LoWPAN devices created and configured during the boot process. Raspbian Jessie uses Systemd to run services, so we want to use that to init a lowpan devices on startup.
The lowpan.service file provides a service definition to create lowpan0. It
requires the file /etc/default/lowpan to specify channel (CHN), panid
(PAN), and (optional) the link layer address (MAC). Further it uses the
scripts create_lowpan and delete_lowpan as described above, so install them
as well.
To install the service, copy the files
# cp <path/to/repo/clone>/etc/default/lowpan /etc/default/.
# cp <path/to/repo/clone>/etc/systemd/system/lowpan.service /etc/systemd/system/.
# systemctl enable lowpan.service
Note: modify channel and panid if required in /etc/default/lowpan.
The 6LoWPAN standard states that there must be at least one router (6LR) in a
network answering router solicitations (RS) by responding with router
advertisements (RA). Typically, a rather strong machine like the Pi would also
act as the Authoritative Border Router and gateway (6LBR) between LoWPAN and
real IPv6 networks such as the Internet. A simple way to transform the Pi
in a 6LBR is to run radvd. More detailed information can be found here.