-
Notifications
You must be signed in to change notification settings - Fork 21
6lbr
A 6LoWPAN Border Router connects your 6LoWPAN devices to the Internet and is responsible for handling traffic to and from the IPv6/IPv4 and 802.15.4 interfaces. 6LBR is a deployment-ready solution for border routers, developed by CETIC
Support for Zolertia Zoul module and based-platforms in 6lbr is now mainstream. In an upcoming 1.4.0 release it will be officially featured.
The 21/04/2016 Snapshot features full Zoul support, for the RE-Mote, Firefly and most importantly the Zolertia IoT Gateway.
Status: Currently support for the 2.4GHz radio interface is fully working. Support for the 868/915MHz interface is currently under work.
The Zolertia Orion ethernet router comes prepared to deploy 6loWPAN IPv4/IPv6 applications easily, featuring a Zoul, the widely used ENJ28J60 and support for Active POE (Power over Ethernet), so just plug and play without extra power cabling.
Orion has built-in USB support, allowing to use its micro-USB to flash and debug your applications without any external devices. It is possible also to power the Ethernet IoT Gateway over this micro USB port.
The following instructions assume PR #250 has already been merged, if not you can clone this branch instead.
Clone the master 6lbr repository if you don't have it already.
git clone --recursive https://github.com/cetic/6lbr.git
cd 6lbr
git submodule update --init
And compile/flash the 6LBR application to the Orion.
cd examples/6lbr
make TARGET=zoul CETIC_6LBR_ROUTER=1 WITH_WEBSERVER=1 cetic-6lbr.upload
The following should appear on your screen:
CC ./6lbr/mac-wrapper.c
CC ./6lbr/ip64-eth-driver.c
LD cetic-6lbr.elf
arm-none-eabi-objcopy -O binary --gap-fill 0xff cetic-6lbr.elf cetic-6lbr.bin
Flashing /dev/ttyUSB1
Opening port /dev/ttyUSB1, baud 460800
Reading data from cetic-6lbr.bin
Connecting to target...
Target id 0xb964, CC2538
Erasing 524288 bytes starting at address 0x200000
Erase done
Writing 516096 bytes starting at address 0x202000
Write done
Verifying by comparing CRC32 calculations.
Verified (match: 0xb71595d3)
If not then check these instructions. As 6LBR's version of the cc2538-bsl might be behind Contiki's, you could either clone the tool repository in a different location and flash the binary manually, or you could put Orion manually in flashing mode, as described in the given link.
If you open a connection via putty
or minicom
you should see the following after the device has been flashed, and restarted:
Contiki-contiki-base-develop-20170120-2247-g0adf51e
Zolertia Orion Ethernet Router
CC2538: ID: 0xb964, rev.: PG2.0, Flash: 512 KiB, SRAM: 32 KiB, AES/SHA: 1, ECC/RSA: 1
System clock: 16000000 Hz
I/O clock: 16000000 Hz
Reset cause: WDT
Rime configured with address 00:12:4b:00:06:0d:67:ec
Net: sicslowpan
MAC: CSMA
RDC: nullrdc
NOTICE: 6LBR: Starting 6LBR version 1.5.x (Contiki-contiki-base-develop-20170120-2247-g0adf51e)
INFO: NVM: Reading 6LBR NVM
INFO: NVM: NVM Magic : 2009
INFO: NVM: NVM Version : 5
NOTICE: 6LBR: Log level: 30 (services: ffffffff)
INFO: ETH: ENC28J60 init
INFO: ETH: Eth MAC address : 06:00:06:0d:67:ec
INFO: ENC: resetting chip
INFO: ETH: ENC-28J60 Process started
INFO: LLSEC: Using 802.15.4 framer
INFO: LLSEC: Using 'nullsec' llsec driver
INFO: 6LBR: Tentative local IPv6 address fe80::212:4b00:60d:67ec
INFO: 6LBR: Tentative global IPv6 address (WSN) fd00::212:4b00:60d:67ec
INFO: 6LBR: Tentative global IPv6 address (ETH) bbbb::100
INFO: 6LBR: RA Daemon enabled
INFO: 6LBR: Checking addresses duplication
INFO: NVM: Flashing 6LBR NVM
INFO: 6LBR: Configured as DODAG Root fd00::212:4b00:60d:67ec
INFO: 6LBR: Starting IP64
Starting DHCPv4
INFO: 6LBR: Starting as RPL ROUTER
INFO: HTTP: Starting webserver on port 80
INFO: NODECFG: Node Config init
INFO: UDPS: UDP server started
INFO: DNS: DNS proxy started
INFO: 6LBR: CETIC 6LBR Started
INFO: 6LBR: Set IPv4 address : 192.168.1.4
As shown in the log above, Orion router is now advertising itself on your local network with the address bbbb::100
, this means all devices auto-configurable in your network (your laptop or computer included) are able to reach the router. Depending on your host you have to enable this as follows:
- Windows: this is set as default
- Linux: assuming your LAN interface is
eth0
:
sysctl -w net.ipv6.conf.eth0.accept_ra=1
sysctl -w net.ipv6.conf.eth0.accept_ra_rt_info_max_plen=64
- MacOS-X :
sysctl -w net.inet6.ip6.accept_rtadv=1
route add -inet6 -prefixlen 64 fd00:: bbbb::100
The fastest way to check the Orion is advertising, and your interface is auto configuring properly is by running the ifconfig
command, and checking if we have an address with the bbbb::/64
prefix:
eth0 Link encap:Ethernet HWaddr 48:d2:24:d3:08:7a
inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: bbbb::44ff:bb96:de3b:a565/64 Scope:Global
inet6 addr: bbbb::4ad2:24ff:fed3:87a/64 Scope:Global
Now ping the border router (Orion):
$ ping6 bbbb::100
PING bbbb::100(bbbb::100) 56 data bytes
64 bytes from bbbb::100: icmp_seq=1 ttl=64 time=71.4 ms
64 bytes from bbbb::100: icmp_seq=2 ttl=64 time=69.2 ms
64 bytes from bbbb::100: icmp_seq=3 ttl=64 time=69.7 ms
^C
--- bbbb::100 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 69.254/70.157/71.474/1.000 ms
If the interface is not accepting the routing advertisements, you can configure manually:
- Linux:
sudo ip -6 addr add bbbb::101/64 dev eth0
route -A inet6 add fd00::/64 gw bbbb::100
- MacOS-X:
ifconfig en0 inet6 bbbb::101/64 add
route add -inet6 -prefixlen 64 fd00:: bbbb::100
And then, as the default IPv6 prefix for the wireless devices is fd00::/64
, you should be able to ping and communicate with the devices.
Open your browser (Firefox is recommended as it has support for Copper, and write down Orion's 6LBR address: [bbbb::100]
This is the 6LBR status
page.
To configure options like IP64
, prefixes, LLSEC
(link-layer security options), and other settings, navigate to the Configuration
tab.
Configure the 6LBR border router as shown in the image below, this will enable NONCORESEC_CONF_SEC_LVL
to 6, which is the default security level used in the 6lbr-demo
.
The 6LBR address (default is bbbb::100
) and IP64 settings (IPv6 to IPv4) are configured as shown in the image below. IP64 allows the 6LoWPAN/IPv6 network to communicate with IPv4 devices and services, using the prefix ::FFFF
, followed by the IPv4 octects.
An example is the Relayr MQTT broker, which has the following addresses:
$ host mqtt.relayr.io
mqtt.relayr.io has address 52.30.47.157
mqtt.relayr.io has address 52.30.12.63
The 52.30.47.157
is translated to: ::FFFF:341E:2F9D
.
The 6lbr-demo
has the following built-in features:
- CoAP server
- LLSEC
- UDP client
- DTLS support
To compile and program another Zolertia device (like a RE-Mote or a Firefly), do the following:
cd 6lbr/examples/6lbr-demo
make TARGET=zoul BOARD=remote-revb WITH_COAPSERVER=1 WITH_LLSEC=1 RF_CHANNEL=26 6lbr-demo.upload
This will program a device with the 6lbr-demo
, if you connect via putty or serialdump, this is the output:
Contiki-contiki-base-develop-20170120-2247-g0adf51e
Zolertia RE-Mote revision B platform
CC2538: ID: 0xb964, rev.: PG2.0, Flash: 512 KiB, SRAM: 32 KiB, AES/SHA: 1, ECC/RSA: 1
System clock: 16000000 Hz
I/O clock: 16000000 Hz
Reset cause: External reset
Rime configured with address 00:12:4b:00:06:15:9f:f8
Net: sicslowpan
MAC: CSMA
RDC: nullrdc
CoAP push started
CoAP server started
RD client started
Now check in 6LBR the device is in the PAN. Remember the LLSEC
mode has to be set to 6 as described in the previous section, as we compiled with the WITH_LLSEC=1
flag. Go to 6LBR's sensors
tab:
Click on the coap
link next to the 6lbr-demo
device, it will open the Copper
CoAP client, in which you can discover and browse the resources of the built-in CoAP server running on the 6lbr-demo
device:
And of course you can ping the device:
$ ping6 fd00::212:4b00:615:9ff8PING fd00::212:4b00:615:9ff8(fd00::212:4b00:615:9ff8) 56 data bytes
64 bytes from fd00::212:4b00:615:9ff8: icmp_seq=1 ttl=63 time=90.5 ms
64 bytes from fd00::212:4b00:615:9ff8: icmp_seq=2 ttl=63 time=90.0 ms
64 bytes from fd00::212:4b00:615:9ff8: icmp_seq=3 ttl=63 time=90.3 ms
64 bytes from fd00::212:4b00:615:9ff8: icmp_seq=4 ttl=63 time=90.6 ms
^C
--- fd00::212:4b00:615:9ff8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 90.063/90.393/90.681/0.434 ms
With this alternative configuration we can enable CoAP/UDP over DTLS, for extra security. Notice instead of building the normal webserver shown above, we are using a lite version to save resources, as we just added the DTLS support, and a DTLS echo application to test this is working.
cd 6lbr/examples/6lbr
make TARGET=zoul CETIC_6LBR_ROUTER=1 WITH_TINYDTLS=1 WITH_DTLSECHO=1 WITH_DTLS_COAP=1 WITH_WEBSERVER=0 WITH_WEBSERVER_LITE=1 WITH_UDPSERVER=0 WITH_UDPCLIENT=0 cetic-6lbr.upload
If you open a console terminal over putty or serialdump:
Zolertia Orion Ethernet Router
CC2538: ID: 0xb964, rev.: PG2.0, Flash: 512 KiB, SRAM: 32 KiB, AES/SHA: 1, ECC/RSA: 1
System clock: 16000000 Hz
I/O clock: 16000000 Hz
Reset cause: External reset
Rime configured with address 00:12:4b:00:06:0d:67:ec
Net: sicslowpan
MAC: CSMA
RDC: nullrdc
NOTICE: 6LBR: Starting 6LBR version 1.5.x (Contiki-contiki-base-develop-20170120-2247-g0adf51e)
INFO: NVM: Reading 6LBR NVM
INFO: NVM: NVM Magic : 2009
INFO: NVM: NVM Version : 5
NOTICE: 6LBR: Log level: 30 (services: ffffffff)
INFO: ETH: ENC28J60 init
INFO: ETH: Eth MAC address : 06:00:06:0d:67:ec
INFO: ENC: resetting chip
INFO: ETH: ENC-28J60 Process started
INFO: LLSEC: Using 802.15.4 framer
INFO: LLSEC: Using 'nullsec' llsec driver
INFO: 6LBR: Tentative local IPv6 address fe80::212:4b00:60d:67ec
INFO: 6LBR: Tentative global IPv6 address (WSN) fd00::212:4b00:60d:67ec
INFO: 6LBR: Tentative global IPv6 address (ETH) bbbb::100
INFO: 6LBR: RA Daemon enabled
INFO: 6LBR: Checking addresses duplication
INFO: NVM: Flashing 6LBR NVM
INFO: 6LBR: Configured as DODAG Root fd00::212:4b00:60d:67ec
INFO: 6LBR: Starting IP64
Starting DHCPv4
INFO: 6LBR: Starting as RPL ROUTER
INFO: NODECFG: Node Config init
Started DTLS retransmit process
DTLS server started
INFO: DNS: DNS proxy started
INFO: 6LBR: CETIC 6LBR Started
INFO: 6LBR: Set IPv4 address : 192.168.1.4
And the webserver lite version looks as below:
Notice the lite version doesn't allow to change parameters and just shows a brief list of configured options.
To compile and program another device with the 6lbr-demo
with DTLS:
cd 6lbr/examples/6lbr-demo
make TARGET=zoul WITH_UDPCLIENT=0 WITH_COAPSERVER=1 WITH_TINYDTLS=1 WITH_DTLS_COAP=1 RF_CHANNEL=26 6lbr-demo.upload
It will show something as below:
Contiki-contiki-base-develop-20170120-2247-g0adf51e
Zolertia RE-Mote revision B platform
CC2538: ID: 0xb964, rev.: PG2.0, Flash: 512 KiB, SRAM: 32 KiB, AES/SHA: 1, ECC/RSA: 1
System clock: 16000000 Hz
I/O clock: 16000000 Hz
Reset cause: External reset
Rime configured with address 00:12:4b:00:06:15:9f:f8
Net: sicslowpan
MAC: CSMA
RDC: nullrdc
Started DTLS retransmit process
COAP-DTLS listening on port 5683
CoAP push started
CoAP server started
RD client started
- Get the Code
- Toolchain and tools
- Getting Started with Zolertia products
- Change to SubGHZ interface
- Program the Zolertia platforms
- Configure Eclipse (IDE)
- Firefly as a Sniffer
- Sensors