Wednesday, April 20, 2016

RPL Routing on RIOT Native Platform

RPL is the de facto routing protocol to be used on low powered wireless devices such as Internet of Things (IoT) applications. Therefore it is the most important thing to try on an operating system designed to be run on low powered wireless network. Today I tried the RPL routing protocol implementation on RIOT OS and decided to write a short note about the steps I followed to get it done. It is important to note that I tried this on the native platform, so there's no any real wireless network in this scenario. It's just a set of virtual network interfaces on my Linux machine that interconnects the RIOT instances. Let's see.

(1) Let's start 4 TAP interfaces on our machine.

./dist/tools/tapsetup/tapsetup -c 4

(2) We will be using the gnrc_networking application for this trial. So, move into that directory and build the application.

cd examples/gnrc_networking
make clean all

(3) Now we have to start 4 RIOT instances in 4 separate Linux terminals. In the first terminal, we start the first instance as follow.
make term PORT=tap0

On the second terminal,

make term PORT=tap1

On the third terminal,

make term PORT=tap2

On the fourth terminal,

make term PORT=tap3

(4) Now our RIOT instances are up and running on 4 different terminals. It's time to prepare the RPL boarder router. We choose the RIOT instance running in first terminal as the RPL boarder router. So, let's set an IP address for that instance.

First of all, we just use the following command to get to know the name of the available network interface for this RIOT instance,


Then, set an IP address as follows,

ifconfig 6 add 2001:db8::1

(5) Our boarder router is ready. We should now initialize RPL routing on all the RIOT instances by entering following command on each of the terminals. (note that the parameter given as 6 is the name of the networking interface on which RPL will be based on)

rpl init 6

(6) Now our all the RIOT instances are running RPL protocol but we don't have a real RPL network using a DODAG is not not available yet. For that, we should tell the boarder router that it is the root node of this routing tree as follows. Then it will automatically build the DODAG by communicating with the other nodes in the vicinity.

rpl root 1 2001:db8::1

(7) To see the status of the network now, we can use the rpl command on each terminal. It will show some important details of each RIOT instance such as it's rank and the parent nodes IP address. It is interesting to see that


(8) Let's ping from the second, third and fourth RIOT instances to the first instance and see whether the connectivity is available.

ping6 2001:db8::1

(9) Let's try the UDP example on this network. We will run the UDP server on the first RIOT interface and UDP clients on the other RIOT instances.

On first RIOT instance,
udp server start 80

On any other RIOT instance,

udp send 2001:db8::1 80 hello

(10) To wrap up our work, let's remove the virtual network interfaces (TAP) we created on our Linux machine for this trial as follows.

../../dist/tools/tapsetup/tapsetup -d

That's all folks!! :)


No comments:

Post a Comment