Using:SLIP

maniacbug edited this page Aug 15, 2011 · 8 revisions

Navigation: Home | Scenarios | Installing | Using | Future

Using:Setup | Using:Troubleshooting | Using:Shell | Using:Sensors | Using:Actuation | Using:SLIP | Using:Webserver | Using:HTTP | Using:RPL

Table of Contents

What is SLIP?

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.

Platform Changes

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.

Building

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.

$&nbsp;cd&nbsp;examples/ipv6/rpl-border-router<br/> $&nbsp;make&nbsp;TARGET=avr-zigduino&nbsp;savetarget<br/> $&nbsp;make&nbsp;WITH_SLIP=1&nbsp;WITH_WEBSERVER=0&nbsp;-j10<br/> $&nbsp;make&nbsp;upload&nbsp;AVRDUDE_PORT=/dev/ttyUSB0<br/>

Connecting

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.

$&nbsp;sudo&nbsp;../../../tools/tunslip6&nbsp;aaaa::1/64&nbsp;-s&nbsp;/dev/ttyUSB0&nbsp;-B&nbsp;38400&nbsp;-v6<br/> <br/> ********SLIP&nbsp;started&nbsp;on&nbsp;``/dev/ttyUSB0''<br/> opened&nbsp;tun&nbsp;device&nbsp;``/dev/tun0''<br/> ifconfig&nbsp;tun0&nbsp;inet&nbsp;`hostname`&nbsp;up<br/> ifconfig&nbsp;tun0&nbsp;add&nbsp;aaaa::1/64<br/> ifconfig&nbsp;tun0<br/> <br/> tun0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Link&nbsp;encap:UNSPEC&nbsp;&nbsp;HWaddr&nbsp;00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00&nbsp;&nbsp;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inet&nbsp;addr:127.0.1.1&nbsp;&nbsp;P-t-P:127.0.1.1&nbsp;&nbsp;Mask:255.255.255.255<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inet6&nbsp;addr:&nbsp;aaaa::1/64&nbsp;Scope:Global<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UP&nbsp;POINTOPOINT&nbsp;RUNNING&nbsp;NOARP&nbsp;MULTICAST&nbsp;&nbsp;MTU:1500&nbsp;&nbsp;Metric:1<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RX&nbsp;packets:0&nbsp;errors:0&nbsp;dropped:0&nbsp;overruns:0&nbsp;frame:0<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TX&nbsp;packets:0&nbsp;errors:0&nbsp;dropped:0&nbsp;overruns:0&nbsp;carrier:0<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collisions:0&nbsp;txqueuelen:500&nbsp;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RX&nbsp;bytes:0&nbsp;(0.0&nbsp;B)&nbsp;&nbsp;TX&nbsp;bytes:0&nbsp;(0.0&nbsp;B)<br/> <br/> tun0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Link&nbsp;encap:UNSPEC&nbsp;&nbsp;HWaddr&nbsp;00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00&nbsp;&nbsp;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inet&nbsp;addr:127.0.0.1&nbsp;&nbsp;P-t-P:127.0.0.1&nbsp;&nbsp;Mask:255.255.255.255<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inet6&nbsp;addr:&nbsp;aaaa::1/64&nbsp;Scope:Global<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UP&nbsp;POINTOPOINT&nbsp;RUNNING&nbsp;NOARP&nbsp;MULTICAST&nbsp;&nbsp;MTU:1500&nbsp;&nbsp;Metric:1<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RX&nbsp;packets:0&nbsp;errors:0&nbsp;dropped:0&nbsp;overruns:0&nbsp;frame:0<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TX&nbsp;packets:0&nbsp;errors:0&nbsp;dropped:0&nbsp;overruns:0&nbsp;carrier:0<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collisions:0&nbsp;txqueuelen:500&nbsp;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RX&nbsp;bytes:0&nbsp;(0.0&nbsp;B)&nbsp;&nbsp;TX&nbsp;bytes:0&nbsp;(0.0&nbsp;B)<br/> <br/> <br/> IP&nbsp;addresses&nbsp;[4&nbsp;max]<br/> fdfd::3<br/> fe80::11:22ff:fe33:4403<br/> RPL-Border&nbsp;router&nbsp;started<br/> ***&nbsp;Address:aaaa::1&nbsp;=&gt;&nbsp;aaaa:0000:0000:0000<br/> SIN:&nbsp;10<br/> Got&nbsp;configuration&nbsp;message&nbsp;of&nbsp;type&nbsp;P<br/> Setting&nbsp;prefix&nbsp;aaaa::<br/> created&nbsp;a&nbsp;new&nbsp;RPL&nbsp;dag<br/> Server&nbsp;IPv6&nbsp;addresses:<br/> &nbsp;aaaa::11:22ff:fe33:4403<br/> &nbsp;fdfd::3<br/> &nbsp;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.

Ping

We should now be able to ping the border router from the host PC. First, we can ping its auto-configured aaaa::/64 address

$&nbsp;ping6&nbsp;aaaa::11:22ff:fe33:4403<br/> PING&nbsp;aaaa::11:22ff:fe33:4403(aaaa::11:22ff:fe33:4403)&nbsp;56&nbsp;data&nbsp;bytes<br/> 64&nbsp;bytes&nbsp;from&nbsp;aaaa::11:22ff:fe33:4403:&nbsp;icmp_seq=1&nbsp;ttl=64&nbsp;time=66.1&nbsp;ms<br/> 64&nbsp;bytes&nbsp;from&nbsp;aaaa::11:22ff:fe33:4403:&nbsp;icmp_seq=2&nbsp;ttl=64&nbsp;time=68.6&nbsp;ms<br/> 64&nbsp;bytes&nbsp;from&nbsp;aaaa::11:22ff:fe33:4403:&nbsp;icmp_seq=3&nbsp;ttl=64&nbsp;time=66.2&nbsp;ms<br/>

Nodes beyond the border

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.

$&nbsp;sudo&nbsp;route&nbsp;-A&nbsp;inet6&nbsp;add&nbsp;fdfd::/64&nbsp;dev&nbsp;tun0<br/> $&nbsp;netstat&nbsp;-r6<br/> Kernel&nbsp;IPv6&nbsp;routing&nbsp;table<br/> Destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Next&nbsp;Hop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Flag&nbsp;Met&nbsp;Ref&nbsp;Use&nbsp;If<br/> aaaa::/64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U&nbsp;&nbsp;&nbsp;&nbsp;256&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;tun0<br/> fdfd::/64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;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

$&nbsp;cd&nbsp;examples/ipv6/rpl-collect<br/> $&nbsp;make&nbsp;TARGET=avr-zigduino&nbsp;savetarget<br/> $&nbsp;make&nbsp;udp-sender.avr-zigduino.u&nbsp;AVRDUDE_PORT=/dev/ttyUSB1&nbsp;-j10<br/>

Now see that we can ping it ok:

$&nbsp;ping6&nbsp;fdfd::1<br/> PING&nbsp;fdfd::1(fdfd::1)&nbsp;56&nbsp;data&nbsp;bytes<br/> 64&nbsp;bytes&nbsp;from&nbsp;fdfd::1:&nbsp;icmp_seq=1&nbsp;ttl=64&nbsp;time=67.8&nbsp;ms<br/> 64&nbsp;bytes&nbsp;from&nbsp;fdfd::1:&nbsp;icmp_seq=2&nbsp;ttl=64&nbsp;time=66.3&nbsp;ms<br/>