Clone this wiki locally
Table of Contents
SLIP is the "mostly obsolete" wikipedia:Serial Line Internet Protocol. "On personal computers, SLIP has been largely replaced by the Point-to-Point Protocol (PPP), which is better engineered, has more features and does not require its IP address configuration to be set before it is established. On microcontrollers, however, SLIP is still the preferred way of encapsulating IP packets due to its very small overhead."
Contiki uses SLIP to bridge the wireless IPv6 network onto a PC via a USB connection. So with your Zigduino plugged into your PC, and the right software running on each, traffic from the wireless IP network can reach your site-wide Ethernet network and potentially beyond.
On Zigduino, there is only one UART exposed. This means we have to choose between reading debug messages and connecting to our PC via SLIP. This change is exposed by adding "WITH_SLIP=1" to the makefile or command line for any particular project. Projects made "WITH_SLIP" will expect to talk to a slip tunnel on the PC side.
Speaking of the PC side... In order for SLIP to work, something on the host PC has to be listening. Using Instant Contiki, the 'tunslip6' will do this. Running it in Linux creates a 'tun0' interface which gives the connected Zigduino an address of aaaa::1 on your local network.
Commit #629608e adds SLIP capability to Zigduino. This change adds in the SLIP-handling files, slip.c and slip_uart0.c. It also changes the bootup process to dedicate UART0 to SLIP, not simple debug traffic.
First, built the tunslip6 tool. This works without modification on Instant Contiki.
$ cd tools<br/> $ make tunslip6
Now make and upload the border router itself. Be sure to include "WITH_SLIP=1" to turn on slip for this node, and "WITH_WEBSERVER=0" to exclude a web server from this node.
$ cd examples/ipv6/rpl-border-router<br/> $ make TARGET=avr-zigduino savetarget<br/> $ make WITH_SLIP=1 WITH_WEBSERVER=0 -j10<br/> $ make upload AVRDUDE_PORT=/dev/ttyUSB0<br/>
Ok, now it's built. Let's bring up the slip interface on Linux. Note that the baud rate here has to match the baud rate in the uart setup on the board, which is currently 38400. That's a little slow, but I'll work on bringing it up in future revisions. Also note the "v6" switch. That turns on maximum debugging output so we can follow along.
$ sudo ../../../tools/tunslip6 aaaa::1/64 -s /dev/ttyUSB0 -B 38400 -v6<br/> <br/> ********SLIP started on ``/dev/ttyUSB0''<br/> opened tun device ``/dev/tun0''<br/> ifconfig tun0 inet `hostname` up<br/> ifconfig tun0 add aaaa::1/64<br/> ifconfig tun0<br/> <br/> tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 <br/> inet addr:127.0.1.1 P-t-P:127.0.1.1 Mask:255.255.255.255<br/> inet6 addr: aaaa::1/64 Scope:Global<br/> UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1<br/> RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br/> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br/> collisions:0 txqueuelen:500 <br/> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)<br/> <br/> tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 <br/> inet addr:127.0.0.1 P-t-P:127.0.0.1 Mask:255.255.255.255<br/> inet6 addr: aaaa::1/64 Scope:Global<br/> UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1<br/> RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br/> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br/> collisions:0 txqueuelen:500 <br/> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)<br/> <br/> <br/> IP addresses [4 max]<br/> fdfd::3<br/> fe80::11:22ff:fe33:4403<br/> RPL-Border router started<br/> *** Address:aaaa::1 => aaaa:0000:0000:0000<br/> SIN: 10<br/> Got configuration message of type P<br/> Setting prefix aaaa::<br/> created a new RPL dag<br/> Server IPv6 addresses:<br/> aaaa::11:22ff:fe33:4403<br/> fdfd::3<br/> fe80::11:22ff:fe33:4403<br/>
It's helpful that tunslip6 is putting through the debug messages from the Zigduino. So we can see the boot-up process complete successfully.
We should now be able to ping the border router from the host PC. First, we can ping its auto-configured aaaa::/64 address
$ ping6 aaaa::11:22ff:fe33:4403<br/> PING aaaa::11:22ff:fe33:4403(aaaa::11:22ff:fe33:4403) 56 data bytes<br/> 64 bytes from aaaa::11:22ff:fe33:4403: icmp_seq=1 ttl=64 time=66.1 ms<br/> 64 bytes from aaaa::11:22ff:fe33:4403: icmp_seq=2 ttl=64 time=68.6 ms<br/> 64 bytes from aaaa::11:22ff:fe33:4403: icmp_seq=3 ttl=64 time=66.2 ms<br/>
We want to reach more nodes than just the one connected. So let's add a route on the host PC. This "route add" command tells Ubuntu that whenever it wants to reach a node whose IP starts with fdfd::/64, it can send that through the tun0 interface.
$ sudo route -A inet6 add fdfd::/64 dev tun0<br/> $ netstat -r6<br/> Kernel IPv6 routing table<br/> Destination Next Hop Flag Met Ref Use If<br/> aaaa::/64 :: U 256 0 0 tun0<br/> fdfd::/64 :: U 1 0 0 tun0<br/>
Now that we have the route set up, we can put another node on the network, and ping that.
Put anything that speaks RPL on fdfd::1, for example rpl-collect/sender
$ cd examples/ipv6/rpl-collect<br/> $ make TARGET=avr-zigduino savetarget<br/> $ make udp-sender.avr-zigduino.u AVRDUDE_PORT=/dev/ttyUSB1 -j10<br/>
Now see that we can ping it ok:
$ ping6 fdfd::1<br/> PING fdfd::1(fdfd::1) 56 data bytes<br/> 64 bytes from fdfd::1: icmp_seq=1 ttl=64 time=67.8 ms<br/> 64 bytes from fdfd::1: icmp_seq=2 ttl=64 time=66.3 ms<br/>