Cooja: simulating a border router
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:
Then, add another mote type, e.g.,
Add one node of each, and place the nodes such as they are within communication range:
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
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
Attach the "Serial Socket" to the
Then run the native border router on the host side, with
make TARGET=native connect-router-cooja.