IEEE 802.15.4 stack has a capability to support multiple radio drivers, as well as multiple logical interfaces on one radio. Also, the stack includes so-called fakelb radio driver, which provides several interconnected virtual radio devices, thus making possible to implement several "virtual" radio nodes on one host. We will use this capability to demonstrate functionality of the stack without real hardware.
First, download or install the following:
- Wireshark (or tcpdump)
- a recent mainline kernel (or net-next),
- the 6LoWPAN userspace tools. Build them according to the instructions.
Build an 802.15.4-enabled Linux kernel with the following options:
CONFIG_IEEE802154=y CONFIG_IEEE802154_6LOWPAN=m CONFIG_MAC802154=m CONFIG_IEEE802154_DRIVERS=y CONFIG_IEEE802154_FAKELB=y
If you have a hardware device you may want to enable
Or if you're running the legacy kernel, or have a port of the serial driver.
Update your bootloader and boot your new kernel.
In our simulated network we will have 3 fake radios. One these radio interfaces, we will start 3 nodes which will have short addresses 0x1, 0x8001 and 0x8002. Node 0x1 will act as a coordinator and shall run izcoordinator on it, which will handle network with PAN ID 0x777. Nodes 0x8001 and 0x8002 will associate with coordinator and will receive addresses after association. We will start izchat tool on these nodes, and will use Wireshark to monitor network traffic.
Before you start you should check that everything works. If you try the following command:
# iz listphy
you should see the following output:
wpan-phy0 IEEE 802.15.4 PHY object page: 0 channel: n/a channels on page 0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 channels on page 1: 0 1 2 3 4 5 6 7 8 9 10 channels on page 2: 0 1 2 3 4 5 6 7 8 9 10 channels on page 3: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 channels on page 4: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 channels on page 5: 0 1 2 3 4 5 6 7 channels on page 6: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
By default fakelb driver registers one simulated radio. Add two more fake radio interfaces for network devices:
echo 1 > /sys/bus/platform/devices/ieee802154fakelb/adddev echo 1 > /sys/bus/platform/devices/ieee802154fakelb/adddev
Verify that there are 3 PHY objects:
# iz listphy | grep PHY wpan-phy0 IEEE 802.15.4 PHY object wpan-phy1 IEEE 802.15.4 PHY object wpan-phy2 IEEE 802.15.4 PHY object
Create 3 radio interfaces, one per each phy:
# iz add wpan-phy0 Registered new device ('wpan0') on phy wpan-phy0 # iz add wpan-phy1 Registered new device ('wpan1') on phy wpan-phy1 # iz add wpan-phy2 Registered new device ('wpan2') on phy wpan-phy2
Set distinct hw addresses:
# ip link set wpan0 address de:ad:be:af:ca:fe:ba:be # ip link set wpan1 address ca:fe:ca:fe:ca:fe:ca:fe # ip link set wpan2 address be:be:be:be:be:be:be:be
Bring up logical interfaces (by default, one logical interface is associated with each radio):
# ifconfig wpan0 up # ifconfig wpan1 up # ifconfig wpan2 up
Start wireshark to monitor traffic on the network:
wireshark -i wpan0 -k
Start coordinator (you need to do it as root as well):
# touch lease izcoordinator -d 1 -l lease -i wpan0 -p 0x777 -s 1 -c 11
If using the legacy kernel, start devices (also, shall be done by root):
# iz assoc wpan1 777 1 11 short # iz assoc wpan2 777 1 11 short
If instead using the mainline kernel, assign short addresses manually using iz set:
# iz set wpan1 777 8001 11 # iz set wpan2 777 8002 11
Start simple chat program in two different consoles/terminals (0x8001 and 0x8002 are the short addresses are received during association):
# izchat 777 8001 8002 # izchat 777 8002 8001
Bring up 6LoWPAN
# ip link add link wpan0 name lowpan0 type lowpan # ip link set lowpan0 address a0:0:0:0:0:0:0:1 # ip link set lowpan0 up # ip addr add fe80::a000:0:0:8/64 dev lowpan0 # ip link add link wpan1 name lowpan1 type lowpan # ip link set lowpan1 address a0:0:0:0:0:0:0:2 # ip link set lowpan1 up # ip addr add fe80::a000:0:0:8/64 dev lowpan1 # ip link add link wpan2 name lowpan2 type lowpan # ip link set lowpan2 address a0:0:0:0:0:0:0:3 # ip link set lowpan2 up # ip addr add fe80::a000:0:0:8/64 dev lowpan2
Ping between nodes
SSH between nodes
At this time, don't expect the Stateless Address Autoconfiguration (SLAAC) addresses to work. Manually set your own address as shown above.
Now please feel free to experiment and remember that our work is still in progress!