notesassorted ramblings on computer

IEEE 802.15.4 Border Router using Alpine Linux

This is a severely outdated guide for setting up a IEEE 802.15.4 border router using Alpine Linux 3.8 on a Raspberry Pi 2 with an AT86RF233 radio from openlabs. Most of the information provided is no longer applicable as is but—with some extra effort—may still provide useful pointers for setting up an Alpine-based IEEE 802.15.4 border router.

Disclaimer

Most changes initially made by myself to different Alpine packages required for using the RPI as a border router are already part of the latest stable release. Unfortunately, wpan-tools is not packaged for stable yet and installing it requires a little hack.

Installation

  1. Prepare your SD card for booting Alpine Linux
  2. Adjust the cmdline.txt configuration file on the SD card. This is not strictly required but makes debugging via TTY a bit easier.
    1. Remove the quiet kernel parameter
    2. Add a console=ttyAMA0,115200 kernel parameter
  3. Create a usercfg.txt configuration file with the content dtoverlay=at86rf233 on the SD card.
  4. Unmount the SD card, put it into your RPI and boot it.
  5. Log in on the TTY as root and verify that your wpan devices actually shows up in the ip a output.
  6. Configure the installation using setup-alpine as explained in [4].

Install wpan-tools

wpan-tools is not packaged in Alpine 3.8 (but will be in Alpine 3.9). Therefore we are installing it from edge on 3.8 (which is usually a really bad idea but should work in this case). To do so:

  1. Edit /etc/apk/repositories on the RPI. Add the following lines:
@edge http://nl.alpinelinux.org/alpine/edge/main
@edge http://nl.alpinelinux.org/alpine/edge/community
  1. Update your repositories using apk update.
  2. Install wpan-tools using apk add wpan-tools@edge.
  3. Verify that everything works as expected using iwpan list.

Configure (lo)wpan interface

We will configure our (lo)wpan interfaces by invoking the required wpan-tools commands from /etc/network/interfaces. The exact configuration depends on your setup. In the following example we are using the following ULA fdf9:6a5a:3d48::/48. We are also manually setting a MAC address for our wpan interfaces.

Add the following to /etc/network/interfaces:

auto wpan0
iface wpan0 inet6 manual
	pre-up ip link set wpan0 address 86:ca:ba:3e:bb:fa:15:d2
	pre-up iwpan dev wpan0 set pan_id 0x23
	pre-up iwpan phy phy0 set channel 0 26
	post-up ip link add link wpan0 name lowpan0 type lowpan
	post-up ip link set wpan0 up

auto lowpan0
iface lowpan0 inet6 static
	address fdf9:6a5a:3d48::1
	netmask 48
	autoconf 0
	accept_ra 0
	privext 0

Enable IPv6 packet forwarding:

echo 'net.ipv6.conf.all.forwarding=1' > /etc/sysctl.d/01-forwarding.conf
lbu add /etc/sysctl.d/01-forwarding.conf

Install and configure radvd

  1. Install radvd using apk add radvd.

  2. Configure radvd according to [2] by creating /etc/radvd.conf. For example:

    interface lowpan0 {
    	AdvSendAdvert on;
    	UnicastOnly on;
    	AdvSourceLLAddress on;
    	AdvCurHopLimit 255;
    
    	prefix fdf9:6a5a:3d48::/48 {
    		AdvOnLink off;
    		AdvAutonomous on;
    		AdvRouterAddr on;
    	};
    
    	abro fe80::84ca:ba3e:bbfa:15d2 {
    		AdvVersionLow 10;
    		AdvVersionHigh 2;
    		AdvValidLifeTime 2;
    	};
    };
  3. Enable the radvd services using rc-update add radvd.

Final touches

  1. Commit your changes using lbu commit - VERY IMPORTANT.
  2. Double check that a password was set for root.
  3. Reboot.

See also