Connecting Sensor Networks 1|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Matthias Kovatsch
Virtual IoT Meetup #3
Connecting Sensor Networks
Tuesday, 23 Sep 2014Virtual IoT Meetup #3
http://www.meetup.com/Virtual-IoT/
Connecting Sensor Networks 2|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Agenda
1. Wireless Sensor Networks
2. Introduction to 6LoWPAN
3. IPv6 & 6LoWPAN Setup
Focus on “Connecting”
Pointers for Sensor Nodes
4. Outlook
Questions?
#virtualiot
Hangouts Q&A
Connecting Sensor Networks
Connecting Sensor Networks 3|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Smart Dust in 2000
the advent of Wireless Sensor Networks
Connecting Sensor Networks 4|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
e.g., TinyDB
Focus on resource constraints
Sink nodes and custom software
Wireless Sensor Networks
Mica2 (AVR)
Tmote Sky / TelosB (MSP430)
BTnode (AVR + Bluetooth)
Connecting Sensor Networks 5|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
First Proposals for Low-power IPv4 in 2003
A. Dunkels. Full TCP/IP for 8-bit Architectures.
In Proceedings MobiSys, San Francisco, CA, USA, 2003
Z. Shelby, P. Mahonen, J. Riihijarvi, O. Raivio, and P.
Huuskonen. NanoIP: The Zen of Embedded Networking.
In Proceedings ICC, Anchorage, AK, USA, 2003
http://contiki-os.org
Connecting Sensor Networks 6|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
6LoWPAN for Sensor Networks
Connecting Sensor Networks 7|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Low-power IP Stack
Layer Protocol
Application CoAP
Transport UDP
Network IPv6
Adaption 6LoWPAN
MAC CSMA
Radio Duty Cycling IEEE 802.15.4e / ContikiMAC
Physical IEEE 802.15.4
Connecting Sensor Networks 8|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Low-power IP Stack
Layer Protocol
Application CoAP
Transport UDP
Network IPv6 ( + RPL routing protocol )
Adaption 6LoWPAN
MAC CSMA
Radio Duty Cycling IEEE 802.15.4e / ContikiMAC
Physical IEEE 802.15.4
Connecting Sensor Networks 9|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Low-power IP Stack
Layer Protocol
Application CoAP
Transport UDP
Network IPv6
Adaption 6LoWPAN
MAC CSMA
Radio Duty Cycling IEEE 802.15.4e / ContikiMAC
Physical IEEE 802.15.4
Connecting Sensor Networks 10|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Low-power IP Stack
Layer Protocol
Application CoAP
Transport UDP
Network IPv6
Adaption 6LoWPAN
MAC CSMA
Radio Duty Cycling IEEE 802.15.4e / ContikiMAC
Physical IEEE 802.15.4
Connecting Sensor Networks 11|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Edge Networks
LoWPAN Local
server
Border Router
6LoWPAN adaption
PC
Backbone (LAN)
Internet
ServerRouter
Connecting Sensor Networks 12|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Number of fixed bits in prefix
8 bytes prefix 8 bytes interface identifier
IPv6 Addresses
128 bits = 16 bytes
xxxx:xxxx:xxxx:xxxx:yyyy:yyyy:yyyy:yyyy /zz
Connecting Sensor Networks 13|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Leading zeros can be omitted
Zero blocks can be omitted with “::”
xxxx:xxx : : / zz
IPv6 Addresses
Localhost
::1/128
Default route
::/0
Link-local
FE80::/64
Multicast
FF00::/8
Connecting Sensor Networks 14|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
… prefixes
IPv6 Addressing
LoWPAN
ISP
Router
Border Router
Backbone (LAN)
2001:470:CAFE::/48
2001:470:CAFE:10::/64
2001:470:CAFE::/64
EUI-64 = MAC address
212:7400:DEAD:BEEF2001:470:CAFE:10:
2001:470:CAFE::1
2001:470:CAFE::10
Mote
Laptop
Connecting Sensor Networks 15|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Nice ISP
Check athttp://www.ipv6forum.com/ipv6_
enabled/isp/approval_list.php
IPv6 tunnel
For instance
Register at
https://tunnelbroker.net/
Your Own IPv6 Prefix
Connecting Sensor Networks 16|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Connecting Sensor Networks 17|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Your WAN IP
Choose something close
Connecting Sensor Networks 18|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Connecting Sensor Networks 19|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Firmware with good IPv6 support
Pick one that supports your model
Find lots of support online (flash router, DD-WRT, Tomato, …)
For instance
Tomato by Shibby (continuation of TomatoUSB)
http://tomato.groov.pl/
Good old WRT54GL has not enough flash
for good IPv6 builds
Model list
http://tomato.groov.pl/?page_id=69
Router
Connecting Sensor Networks 20|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Connecting Sensor Networks 21|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Linksys E900
Cheap ($ ~30)
Netgear WRN3500L
More features ($ ~50)
Router Hardware
Connecting Sensor Networks 22|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Perform a hard reset
with the “30/30/30”
Use the Web interface
to upload new binary
Search for help
firmware name + router model
Flash Firmware
Connecting Sensor Networks 23|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Routed /48 (e.g., 2001:470:cafe::)
/48 + ‘1’ (e.g., 2001:470:cafe::1)
Server IPv4 Address
Client IPv6 Address
Connecting Sensor Networks 24|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
ip -6 r add 2001:470:cafe:10::/64 via 2001:470:cafe::10
6LoWPAN prefix Gateway with
border router
Connecting Sensor Networks 25|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
ip6tables -A FORWARD -p udp --dport 5683–d 2001:470:cafe:10:<mote EUI-64> -j ACCEPT
See ip6tables manual for more options
(e.g., source filtering)
Connecting Sensor Networks 26|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Raspberry Pi
Shortcut: Use a Linux PC (avoids cross-compiling)
Beagle Bone (Black)
Gateway
Connecting Sensor Networks 27|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
SSH or direct connection
Add static IPv6 address for routing (see slide 24)
sudo ip -6 a add 2001:470:cafe::10 dev eth0
Enable routing in the kernel
echo "1" > /proc/sys/net/ipv6/conf/all/forwarding
Install the border router
Gateway Configuration
Connecting Sensor Networks 28|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Tmote Sky / TelosB(old, hard to get)
Search “MTM-CM5000-MSP”
Zolertia Z1
http://zolertia.com/
OpenMote(up-to-date, growing support)
http://www.openmote.com/
Econotag IIhttp://redwirellc.com/
Border Router Hardware
Connecting Sensor Networks 29|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Get Contiki
git clone https://github.com/contiki-os/contiki
Relevant projects are in contiki/examples/ipv6/
Seek further help online
https://github.com/contiki-os/contiki/wiki
http://www.openmote.com/getting-started-with-contiki-and-openmote/
Check the 6lbr project by Cetic
http://cetic.github.io/6lbr/
Contiki OS
Connecting Sensor Networks 30|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Old RPL border router
rpl-border-router running on the mote
make TARGET=sky border-router.upload
tunslip6 (in contiki/tools/) running on the gateway
make tunslip6 (compile on gateway or with cross-compiler)
New native border router (recommended)
slip-radio running on the mote
make TARGET=sky slip-radio.upload
native-border-router running on the gateway
make border-router (compile on gateway or with cross-compiler)
Projects in contiki/examples/ipv6/
Connecting Sensor Networks 31|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
sudo ./{tunslip6|border-router.native} 2001:470:cafe:10::1/64
Opens tun0 interface
Adds route into 6LoWPAN subnet
Starting the Border Router
$ sudo ./border-router.native 2001:470:cafe:10::1/64Contiki 3.x started with IPV6, RPLRime started with address 1.2.3.4.5.6.7.8MAC nullmac RDC br-rdc NETWORK sicslowpanTentative link-local IPv6 address fe80:0000:0000:0000:0302:0304:0506:0708RPL-Border router started********SLIP started on ``/dev/ttyUSB0''opened tun device ``/dev/tun0''ifconfig tun0 inet `hostname` upifconfig tun0 add 2001:470:cafe:10::1/64ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:127.0.1.1 P-t-P:127.0.1.1 Mask:255.255.255.255inet6 addr: 2001:470:cafe:10::1/64 Scope:Global
[…]
Setting prefix 2001:470:cafe:10::1created a new RPL dagServer IPv6 addresses:0x806a6b8: =>2001:470:cafe:10:212:7400:da0:d7480x806a6d8: =>fe80::212:7400:da0:d748
Border router address
Connecting Sensor Networks 32|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Connecting Sensor Networks 33|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Use Erbium (Er)
CoAP in Contiki
Examples in contiki/examples/er-rest-example/ make TARGET=sky er-example-server.upload MOTE=2
Sensor Nodes (“Motes”)
Avoid reprogramming
the border-router/slip-radio
Connecting Sensor Networks 34|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Mote address
Connecting Sensor Networks 35|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
https://addons.mozilla.org/en-US/firefox/addon/copper-270430/
Connecting Sensor Networks 36|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Build Applications with CoAP
Web Sensor Nodes
Constrained Application Protocol (CoAP)
Connecting Sensor Networks 37|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Californium Tutorial: Hands-on with CoAP
http://goo.gl/LLQ03whttp://eclipse.org/californium
Connecting Sensor Networks 38|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Current Efforts
Connecting Sensor Networks 39|Matthias Kovatsch
http://people.inf.ethz.ch/mkovatsc
Interoperable, scalable security
Elliptic curve cryptography
Public key cryptography?
Crypto hardware acceleration
DTLS Profiles (DICE)
Authentication/Authorization in Constrained Environments (ACE)
Secure multicast?
Next Big Step for Low-power IP
Questions?
Matthias Kovatsch https://github.com/mkovatsc/
[email protected] http://people.inf.ethz.ch/mkovatsc/