Skip to content

Instantly share code, notes, and snippets.

@nmeum
Last active December 14, 2018 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmeum/5625be8c7b2b56530491af18c3e86422 to your computer and use it in GitHub Desktop.
Save nmeum/5625be8c7b2b56530491af18c3e86422 to your computer and use it in GitHub Desktop.
Using Alpine Linux v3.8 as an IEEE 802.15.4 border router

IEEE 802.15.4 on Alpine Linux

Hardware: RPI2, AT86RF233 from openlabs Software: Alpine Linux 3.8

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

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 fdf9:6a5a:3d48::1 {
		AdvVersionLow 10;
		AdvVersionHigh 2;
		AdvValidLifeTime 2;
	};
};
  1. Enable the radvd services using rc-update add radvd.

Finish and reboot

  1. Commit your changes using lbu commit - VERY IMPORTANT.
  2. Reboot and pray.

See also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment