Skip to content

Cooja: simulating a border router

Simon Duquennoy edited this page Nov 9, 2018 · 4 revisions

This tutorial will show you how to simulate a RPL border router in Cooja and connect to it to the outside world.

First, create a simulation, as described in tutorial:cooja-getting-started. Add a new mote type, using the border router example: Cooja

Then, add another mote type, e.g., hello-world. Add one node of each, and place the nodes such as they are within communication range: Cooja

To connect the border router to the outside world, we will use a Serial Socket. This will basically map the border router node's serial port to a UDP port on the host computer that runs Cooja. Right click on the border router in the Network view, More tools..., Serial socket (SERVER). This will create a new window in the Cooja GUI. By default the UDP port is 60001. Cooja

Now click Start in the Serial Socket plugin, and then also in the simulation control to start the simulation. From a terminal in the same host that runs Cooja, go to examples/rpl-border-router, and run:

$ make TARGET=cooja connect-router-cooja 

This will start tunslip6 and connect it to the UDP port mapped to the Cooja border router node. After the simulated RPL network converges, you will be able to reach any node in the network, for example with a ping:

$ ping6 fd00::202:2:2:2
PING fd00::202:2:2:2(fd00::202:2:2:2) 56 data bytes
64 bytes from fd00::202:2:2:2: icmp_seq=1 ttl=63 time=131 ms
64 bytes from fd00::202:2:2:2: icmp_seq=2 ttl=63 time=210 ms
64 bytes from fd00::202:2:2:2: icmp_seq=3 ttl=63 time=199 ms
64 bytes from fd00::202:2:2:2: icmp_seq=4 ttl=63 time=104 ms
64 bytes from fd00::202:2:2:2: icmp_seq=5 ttl=63 time=137 ms

Note that this works just as well with a native border router. Try this out by replacing the border-router node in Cooja with a slip-radio node. Attach the "Serial Socket" to the slip-radio node. Then run the native border router on the host side, with make TARGET=native connect-router-cooja.

Clone this wiki locally
You can’t perform that action at this time.