How to unify heterogeneous networks within a home? 6LoWPAN is a good choice

How to unify heterogeneous networks within a home? 6LoWPAN is a good choice

Part 01

What is 6LoWPAN

In order to enable low-speed wireless devices to access the Internet, it is usually necessary to add an intermediate node, which translates and forwards data through application layer programs. With the advent of the era of the Internet of Everything, there are more and more smart home hardware. In this way, data needs to be unpacked, translated, assembled, and forwarded layer by layer, resulting in excessive load on the intermediate nodes and low data forwarding efficiency. In addition, when communicating between different heterogeneous networks (such as Wi-Fi, ZigBee, and BLE), the intermediate nodes need to support multiple protocols, which makes development difficult. With the popularization of IPv6, the application of 6LoWPAN technology based on low-speed wireless LAN to build an IPv6 protocol stack has become a trend. In this solution, each low-speed device is assigned a unique IP address. In the data transmission stage, the intermediate node becomes only a network channel, no longer relying on application layer programs, no longer needing to care about application layer data, only needing to route and forward messages at the network layer, so that the link layer of the heterogeneous network within the home is completely unified.

Figure 1: Adding intermediate nodes between heterogeneous network topologies

6LoWPAN (IPv6 over Low power Wireless Personal Area Network) is a low-power wireless personal area network standard based on IPv6, namely IPv6 over IEEE 802.15.4. It is the name of a working group in the Internet field of IETF. 6LoWPAN is a network layer protocol that defines encapsulation and header compression mechanisms, allowing large IPv6 data packets to be sent and received through the low-speed network of IEEE 802.15.4.

Part 02

What are the advantages of the 6LoWPAN solution?  

➤ High data accessibility and transmission efficiency: Each BLE device has a unique IP, supports end-to-end IP addressing, and only needs one router to forward data to the target node through multiple hops of intermediate nodes; and not every frame of data goes to the application layer, so the forwarding efficiency is higher.

➤ Support cross-domain mutual access, more address space and stateless automatic address configuration: Due to the application of IPv6, it can be directly located in the entire network without NAT conversion, and different network segments can directly access each other; and with a massive address space, it meets the conditions for deploying large-scale, high-density, low-speed personal area network devices; in addition, there is no need for routing allocation, and addresses can be automatically allocated in a stateless manner.

➤ Popularity and applicability: IP networks are widely used and the IP network protocol stack architecture is widely recognized. For developers at the network layer and above, they no longer need to worry about the specific link layer protocols, but can simply manage it as an IP device, which makes development simpler and more efficient.

➤ Support low power consumption: In a 6LowPAN network, leaf nodes can sleep and enter low power consumption.

➤ High flexibility: It provides comprehensive support for the physical layer, providing sufficient freedom to build networks on different frequency bands and physical media.

Part 03

The principle of building 6LoWPAN based on BLE  

As a low-speed wireless personal area network, BLE network, BLE device access to the Internet and communication between BLE network and other heterogeneous networks have always been a widely concerned issue in the industry. Below, the editor will take the application of 6LowPAN technology in BLE network as an example to illustrate the principle of 6LowPAN.

Figure 2 6LoWPAN end-to-end data communication protocol model based on BLE

As shown in Figure 2, the end-to-end data communication protocol model after the BLE device and the gateway establish a link layer and L2CAP connection. For a node, after establishing a connection with the gateway, the application layer will construct a common IP data packet when sending data and send it to the network layer. After the network layer receives the data, it will route it to a virtual network device (B) for 6LoWPAN fragmentation and encapsulation, and then forward it to the Bluetooth protocol stack one by one for L2CAP encapsulation, and finally send it out through the BLE link layer.

When receiving data, the BLE link receives the data, removes the L2TP header, and then routes it to the virtual network device (B) for 6LoWPAN decapsulation and assembly, restores the original IPv6 message, and then forwards it to the standard IP network layer.

Part 04

   How to build 6LoWPAN based on BLE on Linux system  

Since the Linux kernel has supported the Bluetooth protocol stack in its early days, the 3.2 kernel mainline version added support for 6LowPAN. Then with the release of Bluetooth 4.0, the birth of Bluetooth Low Energy BLE, the release of Bluetooth 4.2, and the support of BLE for 6LoWPAN, it has become very easy to build 6LoWPAN based on BLE on the Linux system.

In this section, the author will use two Ubuntu PCs and two BLE Bluetooth dongles to teach you how to build 6LoWPAN based on BLE on a Linux system. Finally, the IP message exchange between the two BLE devices is completed through the BLE link to verify whether 6LoWPAN is successfully built.

Note: In this experiment, the Ubuntu version used is 14.04, of which the kernel version is 3.8.4; the BLE Bluetooth dongle uses the CSR8510 BT5.0 version.

4.1 BLE slave configuration

1) Confirm that the Bluetooth driver is successfully installed on the system

Figure 3 Detailed information of the Bluetooth device on the slave

2) Load the 6lowpan kernel module that supports BLE

 modprobe

Note: If this kernel module does not exist in the system, please reconfigure and compile the kernel.

3) Enable the 6lowpan function and allow Bluetooth devices to multiplex and support this new protocol

 echo 62 > /sys/kernel/debug/bluetooth/6lowpan_psm

4) As a slave, start broadcast notification and periodically broadcast data to surrounding advertisements

 hciconfig hci0 leadv 0

4.2 BLE host configuration

1) Confirm that the Bluetooth driver is successfully installed on the system

Figure 4 Detailed information of Bluetooth device on the host


2) Load the 6lowpan kernel that supports BLE

 modprobe

3) Enable the 6lowpan function and allow Bluetooth devices to multiplex and support this new protocol

 echo 62 > /sys/kernel/debug/bluetooth/6lowpan_psm

4.3 BLE host scans and connects to slave devices

1) Scan the device and obtain the mac address of the slave device

 hcitool

2) Connect to the slave device

 echo "connect 8C:88:2B:42:3F:17 1" >/sys/kernel/debug/bluetooth/6lowpan_control

Among them, 1 is the Bluetooth address type, 1 means public address; 2 means random address.

8C:88:2B:42:3F:17 is the slave device MAC address obtained in the first step.

3) How to judge whether the device is connected successfully

Once 6lowpan is successfully established, type the ifconfig command on the master and slave machines, and you will find that a virtual network device named bt0 has been added to the system.

As shown below:

Slave network port

Figure 5 bt0 virtual network device information on the slave

Host network port

Figure 6 bt0 virtual network device information on the host

4.4 The slave uses the ping command to verify the IPv6 connectivity between the two BLE

 ping6 -I bt0 fe80::8e88:2bff:fe21:b552 

Figure 7 Ping6 communication between master and slave

It can be seen that the master and slave machines can exchange IPv6 messages through the BLE link; thus, it can be seen that building 6LoWPAN based on BLE on the Linux system is successful.

4.5 Kernel log of successful/failed connection

When performing the connection operation, view the kernel log through tail -f /var/log/syslog.

4.6 BLE host actively disconnects

 echo "disconnect 8C:88:2B:42:3F:17" > /sys/kernel/debug/bluetooth/6lowpan_control

Part 05

Summarize  

In summary, it is very easy to build 6LoWPAN based on BLE on the Linux system. The principle of building 6LoWPAN based on other low-speed wireless LANs is the same. Therefore, by building 6LoWPAN between multiple heterogeneous networks, the link layer between heterogeneous networks within the home can be completely unified, which has strong operability. I believe that with the advent of the Internet of Everything and the popularization of IPv6, the importance of 6LoWPAN in home networks will become more apparent and its application will become more extensive.

<<:  In the 5G era, how can telecom operators lead the future through IoT services?

>>:  IPC Streaming Media Transport Protocol (Part 2) - SRT

Recommend

...

Why are IDC companies keen on entering the broadband access network field?

Since the country launched the pilot business of ...

DogYun Hong Kong MG Data Center BGP Line Classic Cloud Server Simple Test

The tribe has shared information about different ...

Internet speed is getting slower and slower? The router is the key!

Internet speed is getting slower and slower? The ...

Driven by the new infrastructure, will data center construction be "rushed"?

The data center construction trend has not yet st...

Karamay: Huawei's first cloud strategic cooperation city in the world

Karamay is a desert city that was born and prospe...

How does 5G use spectrum? This article tells you everything!

As we all know, wireless spectrum resources are t...

The third generation of SD-WAN security

If local Internet access is not provided to branc...

Smart home, a bone that will eventually be chewed by NB-IoT?

As for the huge scale of the smart home market, w...

How Open RAN and 5G impact sustainability

Mobile service providers, infrastructure manufact...