RADVD

We assume that you are able to set up a virtual interface on your OpenLBR. If not, go back to OpenVirtualInterface.

IPv6 Address Auto-Configuration

IPv6 enables stateless address auto-configuration of the nodes of the network (see RFC4862) by having router nodes send IPv6 Router Advertisement (RA) messages to the all nodes multicast address. Node extract information from RAs to auton-confgure themselves. In OpenWSN, motes use RAs to learn the prefix of the network they're on:

  1. Each mote is assumed to have a 64-bit Extended Unique Address (EUI).
  2. The router sends a ICMPv6 RA packet (in response for a request or periodically on the link) with the prefix option containing the 64-bit network prefix.
  3. Each mote configures its IPv6 address as NetworkPREFIX:EUI.

radvd installation and configuration

The daemon which sends RAs in Linux is called Router Advertisement Daemon, radvd. It listens for router solicitations (RS) and sends router advertisements (RA). It runs on the OpenLBR.

radvd is not shipped by default with the Debian distribution on the OpenLBR. To install it on the OpenLBR, type

# apt-get install radvd

Create the file /etc/radvd.conf which contains the following:

interface tun0 {
   AdvSendAdvert on;
   MinRtrAdvInterval 10;
   MaxRtrAdvInterval 20;
   prefix 2001:470:1f05:98e::/64 {
      AdvOnLink on;
      AdvAutonomous on;
      AdvRouterAddr on;
   };
};

running radvd

To start the daemon, one would issue:

# /etc/init.d/radvd start

Nevertheless, this command will not succeed at tun0 is only up when the Python script is running. Starting radvd therefore needs to happen in the Python script (introduced in OpenVirtualInterface). In that script, after IPv6 forwarding has been enabled, add the following lines:

# start radvd
os.system('/etc/init.d/radvd start')

When running the script, it outputs the following bytes

000000 60 00 00 00 00 24 00 01 fe 80 00 00 00 00 00 00 `....$..........
000010 00 00 00 00 00 00 00 01 ff 02 00 00 00 00 00 00 ................
000020 00 00 00 00 00 00 00 16 3a 00 05 02 00 00 01 00 ........:.......
000030 8f 00 70 08 00 00 00 01 04 00 00 00 ff 02 00 00 ..p.............
000040 00 00 00 00 00 00 00 00 00 00 00 02             ............
000000 60 00 00 00 00 30 3a ff fe 80 00 00 00 00 00 00 `....0:.........
000010 00 00 00 00 00 00 00 01 ff 02 00 00 00 00 00 00 ................
000020 00 00 00 00 00 00 00 01 86 00 e3 6f 40 00 00 06 ...........o@...
000030 00 00 00 00 00 00 00 00 03 04 40 e0 00 27 8d 00 ..........@..'..
000040 00 09 3a 80 00 00 00 00 20 01 04 70 1f 05 09 8e ..:........p....
000050 00 00 00 00 00 00 00 00                         ........
000000 60 00 00 00 00 30 3a ff fe 80 00 00 00 00 00 00 `....0:.........
000010 00 00 00 00 00 00 00 01 ff 02 00 00 00 00 00 00 ................
000020 00 00 00 00 00 00 00 01 86 00 e3 6f 40 00 00 06 ...........o@...
000030 00 00 00 00 00 00 00 00 03 04 40 e0 00 27 8d 00 ..........@..'..
000040 00 09 3a 80 00 00 00 00 20 01 04 70 1f 05 09 8e ..:........p....
000050 00 00 00 00 00 00 00 00                         ........
000000 60 00 00 00 00 30 3a ff fe 80 00 00 00 00 00 00 `....0:.........
000010 00 00 00 00 00 00 00 01 ff 02 00 00 00 00 00 00 ................
000020 00 00 00 00 00 00 00 01 86 00 e3 6f 40 00 00 06 ...........o@...
000030 00 00 00 00 00 00 00 00 03 04 40 e0 00 27 8d 00 ..........@..'..
000040 00 09 3a 80 00 00 00 00 20 01 04 70 1f 05 09 8e ..:........p....
000050 00 00 00 00 00 00 00 00                         ........

Using Wireshark to interpret the bytes

When using the text2pcap tool (see OpenVirtualInterface) one can see that radvd sends Router Advertisement with infrequent Multicast Listener Report Messages. In OpenWSN, we are only interested in the former.

The fields in the router advertisements are as expected:

  • IPv6 header:
    • source address is fe80::1, link-local address of the OpenLBR;
    • destination address is ff02::1, the IPv6 "all node" multicast address;
    • traffic class and flow labels are zeroed out;
    • the next header field is ICMPv6 (0x3a), as RAs are a type of ICMPv6 messages.
  • ICMPv6 header:
    • Type is 134 (Router Advertisement);
    • No flags are set;
    • Only one option is present, the Prefix information:
      • the prefix length is 64 bytes;
      • the prefix is Onlink and can be used for Auto-configuration;
      • the prefix is 2001:470:1f05:98e::

If everything works, go on to setup 6LowPAN compression.