Neighbor Discovery for IPv6 over BLE Mesh Networks

: IPv6 over Bluetooth Low Energy (6LoBLE) can realize the seamless connection between Bluetooth Low Energy (BLE) devices and the Internet, solve the restrictions on Bluetooth applications as short distance communication solutions, and advance the development of applications of smart cities, such as smart buildings and smart city management. Since neighbor discovery is the ﬁrst step for BLE devices to establish a connection with each other, this paper proposes a novel neighbor discovery protocol for IPv6 over BLE mesh networks, including the structure of IPv6 over BLE mesh networks, the networking solutions, and IPv6 address auto-conﬁguration and update mechanism. Furthermore, we analyze and simulate the performance of the neighbor discovery protocol utilizing the Revierbed simulator, and the results show the effectiveness of the proposed neighbor discovery protocol even in a crowded environment.


Introduction
Bluetooth Low Energy (BLE) is a wireless personal area network technology that has been defined by the Bluetooth Special Interest Group (Bluetooth SIG) in Bluetooth Specification Version 4.0 [1]. Bluetooth has long been used with smartphones, computers, tablets and laptops as a short distance communications solution. However, this connection-oriented communications mode only supports star topology, which severely restricts the development of BLE in the Internet of things (IoT). The reason is that devices, such as smartphones, are too expensive and cannot be reliably connected for a long time, making it difficult for BLE devices to carry data access to the Internet [2]. IPv6 over BLE (6LoBLE) is an important technology to enable IPv6 packets transmission over BLE devices. Furthermore, to realize the seamless connection between BLE devices and the Internet, 6LoBLE technology completely breaks the traditional connection-oriented communications mode, leading BLE terminals to connect to the Internet only using routing devices [3]. This certainly opens new applications for Bluetooth devices, as well as provides new technical support for the development of the IoT. ABI Research expects a seven-fold growth in annual Bluetooth smart city devices shipments by 2023 [4]. These intelligent BLE devices are driving advancements in smart buildings and smart city management. They help in venues such as museums, stadiums, and airports, e.g., to guide visitors to where they need to be and provide them with a more personalized and fulfilling experience. Smart cities also leverage Bluetooth technology to boost local retail [5].
The Internet Engineering Task Force (IETF) presented the specification of IPv6 over Bluetooth Low Energy in RFC 7668 [6]. It supports IPv6 connectivity over BLE and defines stateless address auto-configuration, neighbor discovery, header compression/decompression and other interesting features. The Bluetooth SIG has made efforts to improve the communication between devices via a mesh network, and released a Bluetooth mesh network based on BLE in 2019 [7]. However, in order to profit from the advantages of BLEmesh networks, it brings new challenges to realize IPv6 over BLE mesh networks (6LoBLEmesh). One of the important issues is to improve the neighbor discovery mechanism. Neighbor discovery process (NDP), being the first step for communications between nodes, has a significant impact on the performance of communications and the reliability of networks. In RFC 7668 [6], the neighbor discovery mechanism for 6LoBLE is declared as a simple version of the protocol used in IPv6 over Low-Power Wireless Personal Area Networks (6LoWPAN), which enables IPv6 technology over IEEE 802.15.4 PHY/MAC. The reason is that the BLE star topology simplified the address registration process, without considering the routers in mesh networks. To enable an IPv6 mesh over BLE links, Gomez et al. proposed a new draft standard [8], that specified mechanisms to establish the IPv6 mesh over BLE links using the Internet Protocol Support Profile (IPSP). The standard draft provides the guidelines of neighbor discovery and stateless address auto-configuration mechanism according to RFC 7668 [6] and RFC 6775 [9], including the behavior of 6lowpan nodes, routers and border nodes. However, the details of how to realize the neighbor discovery process based on BLE 5.0 is not mentioned in the draft manuscript.
Similarly, the 6LoBLE technology also attracted attention in academia, however, most of the state-of-the-art research on the 6LoBLE technology focused on the star-topology BLE networks. Johanna et al. [3] proposed networking solutions for connecting BLE devices to the Internet, and evaluated the performance of the IP-based BLE communications between BLE devices and the Internet. However, a simplified version of 6LoWPAN ND was used for the 6LoBLE neighbor discovery due to the absence of 6LoWPAN routers. In [10], IPv6 transmission over BLE networks was implemented based on BlueZ. The design in [10] details the IPv6 address configuration mechanism for BLE nodes. However, the BLE network also follows the star topology. To enable the compression and decompression of the IPv6 header, context information is supposed to be exchanged between devices. In Wang et al. [11], the authors proposed a context management mechanism based on the implementation of 6LoBLE. Since context exchange could be initiated by either the router or the sensor node, the mechanism does not rely on the neighbor discovery process. This mechanism improves the flexibility of the network. Wondeuk et al. present an adaptive network platform to achieve the connectivity between BLE networks and the Internet, and an advertising data transmission protocol was designed to ensure the emergency data transmission in [12]. While the platform focuses on improving packet transfer, there is a limited part for the network construction.
As mentioned above, there is a lot of research on the technology of IPv6 over BLE networks. However, BLE mesh networks have not been considered yet. BLE mesh networks can support more applications of IoT and may provide more advantages than simple star topology networks. This fact motivated us to study the solutions of 6LoBLEmesh. BLE mesh networks bring new challenges to the neighbor discovery process. With the aim to apply the lightweight IPv6 technology to the neighbor discovery protocol of BLE mesh networks, this paper proposes a neighbor discovery protocol for the 6LoBLEmesh network. The main contributions of this paper are summarized as follows.

•
A novel architecture for IPv6 over BLE mesh networks, which includes the 6LoBLE star network and mesh network, and defines the node roles in the network domain according to the BLE mesh profile.

•
According to the BLE 5.0 standard and the 6LoWPAN ND protocol, this paper provides the networking solution, and the IPv6 address auto-configuration and update mechanism.

•
The performance of the protocol is analyzed, and the 6LoBLE simulation platform was built by Revierbed. The experiment results verify the effectiveness of the proposed protocol.
The remainder of this paper is structured as follows. Section 2 provides the networking solutions of IPv6 over BLE mesh networks, defining the domains and characters of the network. Then the detailed neighbor discovery protocol is designed in Section 3, including the device discovery mechanism, and the IPv6 address auto-configuration and update mechanism. Section 4 shows the performance simulation. Finally, in Section 6 we present our conclusions and ideas for further works.

IPv6 over BLE Mesh Networks
6LoBLEmesh enables BLE nodes in BLE mesh networks connectivity to the Internet via IPv6. One of the key advantages of 6LoBLEmesh is that it provides a solution for BLE nodes to achieve end-to-end communications with IPv6 hosts or resource data servers on the Internet, which is critical for the development of the IoT. In this section, we describe the main new features of BLE mesh networks and propose the adaptation for IPv6 over BLE mesh networks.

BLE Mesh Networks
BLE mesh networks use scanning and advertising to realize communications in the same way as the BLE technology. In a mesh network, both the flooding mechanism and the routing protocol can be used to achieve the communications between nodes. There are several features in a BLE mesh network, among which only the relay feature can forward the received packets to the other nodes. Nodes that have the relay feature are called relay nodes. Meanwhile, a BLE device that joins the BLE mesh network is called a node. The mesh node receives the packets with a 100% duty cycle to scan the channels and sends packets according to a random back-off time, instead of the advertising interval. Therefore, for those low power nodes that cannot enable a 100% duty cycle, a friend node is used to store the received message and relay the message to the network for them; this feature is called friendship. A typical BLE mesh network topology and its features are shown in Figure 1.

IPv6 over BLE
RFC 7668 specifies how IPv6 is transported over BLE connections using 6LoWPAN techniques. 6LoWPAN standards such as [9,13] provide useful functionality for reducing overhead, including link-local IPv6 addresses and stateless IPv6 address auto-configuration, Neighbor Discovery, and header compression. To apply the 6LoWPAN technology to BLE networks, this paper proposes a 6LoBLE network structure as shown in Figure 2.
Both the BLE mesh topology and the BLE star topology are considered in the network structure. In a star-topology 6LoBLE domain, central devices will act as 6LoWPAN Border Router (6LBR) and peripheral devices will act as a 6LoWPAN Node (6LN), respectively. Central and peripheral nodes perform BLE functions in the domain. In a mesh-topology 6LoBLE domain, nodes have the same features as the BLE mesh network, and the mesh gateway, relay nodes, friend nodes and nodes will act as 6LBR, 6LoWPAN Router (6LR) and 6LN, respectively. Table 1 shows the detailed mapping methods. A mesh gateway is a node that can translate messages between the mesh network and the IPv6 network.

6LoBLEmesh Neighbor Discovery
In RFC 7668, the 6LoWPAN ND was simplified to perform neighbor discovery for 6LoBLE with a star topology. Based on that, this section proposes 6LoBLEmesh ND for those nodes in the domain with BLE mesh topology. The neighbor discovery protocol based on BLE 5.0 is introduced, including link setup, address auto-configuration and address update. Different from the neighbor discovery protocol proposed in RFC 7668, the multi-hop communications and duplicate address detection mechanism are applied to the 6LoBLEmesh ND in our approach.

Neighbor Discovery Based on BLE 5.0
The neighbor discovery process is the first step for devices to establish a connection. According to the latest BLE 5.0 specification [14], the NDP includes two main events, the advertising, and the scanning event. Advertisers periodically send advertising packets on primary channels (CH37, CH38, and CH39), and scanners, within the discovery range, scan for these packets. For the purpose of neighbor discovery, once the scanner receives the ADV_EXT_IND packet from the advertiser, the related information about AUX_ADV_IND such as offset (offset37, offset38, offset39), and the channel used for packet transmission (CHx1) is obtained by the scanner. Owing to the offset, the scanner can know when AUX_ADV_IND would be sent. For AUX_ADV_IND, one of the 37 channels CHx1 (channel_index= 0, 1,..., 36) may be used for packet transmission. The scanner additionally scans on CHx1 at the time that the corresponding offset indicates. After the scanner receives the AUX_ADV_IND packet from the advertiser, it will send the connect_req to the advertiser and wait for the connect_req_ACK. As shown in Figure 3, the advertiser and the scanner can set up the connection on Channel CHx1.
A traditional BLE network turns to the connected communications mode when the neighbor discovery process is performed on channel CHx1. However, to achieve the transmission of the IPv6 packets, the IPv6 address is needed for the nodes in 6LoBLE networks. In 6LoBLEmesh ND, following the connection setup, the new joined node performs the IPv6 address auto-configuration mechanism on channel CHx2. The configuration method will be described in detail in Section 3.2. Based on BLE 5.0, the frequency hopping strategy is used to change channels after each information exchange between nodes. Therefore, CHx3 and CHx4 are used for the 6LoBLE communications and address update as shown in Figure 3.

IPv6 Address Auto-Configuration and Update Mechanism
IPv6 address auto-configuration is an important technical feature of IPv6; it can allocate a unique IPv6 address for each node in the 6LoBLEmesh, which is consistent with the design goals of 6LoBLEmesh ND. According to the structure of IPv6 address, an IPv6 address includes two parts, a prefix and an Interface Identifier (IID). There are two types of IPv6 addresses used in 6LoBLEmesh based on different prefixes. As shown in Table 2, a link-local address (LLA) is made of a prefix FE80:: and an IID, which can be used in link communications, and a global unicast address which is made of a global prefix and an IID, that can be used in end-to-end communications. Table 2. Two types of IPv6 address.

Type Prefix IID
Link-local address FE80:: 64 bit IID Global unicast address Prefix 64 bit IID In 6LoBLEmesh networks, all nodes generate their IID following the configuration of EUI-64 using the 48-bit Bluetooth device address. Once the LLA is set up, the nodes are ready to perform address registration and update. For the relay nodes connecting to the mesh gateway directly in the 6LoBLEmesh domain, address configuration is the same as the nodes in a star-topology BLE network; for the relay nodes having no direct connection to the mesh gateway, the address configuration is similar to the nodes in the 6LoBLEmesh domain. Meanwhile, since friend nodes and regular nodes perform the same function in 6LoBLEmesh ND, we do not make the distinction in the following section.
In Figure 4, the new node sends a multicast Router Solicitation (RS) message to the mesh gateway through relay nodes. The RS message contains a source local link option (SLLAO), including the LLA of the node. When the mesh gateway receives the RS message, it records the SLLAO and responses a Router Advertisement (RA) message to the node through a designated relay node. The designated relay node will be the default router of the node. In the RA message, there is an Authoritative Border Router Option (ABRO), a 6LoBLE Context Option (6CO), a Prefix Information Option (PIO), and an SLLAO. In the following communications, the node will check the context and prefix information with these options. Meanwhile, the node generates the global unicast IPv6 address (GUA) using the prefix information. Once the node has the GUA, the node sends a unique neighbor solicitation (Uni-NS) message to the mesh gateway through the designated relay node for address registration. When the mesh gateway receives the NS message, it performs duplicate address detection (DAD)to ensure the uniqueness of the assigned address. Address registration is successful when the node receives the neighbor advertisement (NA) message with the address registration option (ARO).
While during the DAD, the Registration Ownership Verifier (ROVR) field is used during address duplication detection, any registration for the same address but with a different ROVR will be rejected. Therefore, a possible attack during the neighbor discovery can be done by sending an NS and expecting the NA back to contain ROVR fields of the existing state. With that information, the attacker can easily increase the Transaction ID and take over the Binding. Furthermore, such a ROVR can be spoofed, and therefore, any node connected to the subnet and aware of a registered-address-to-ROVR mapping could perform address theft and impersonation attacks [8]. The proposed address configuration mechanism protects against misinterpreting a movement for a duplication, and enables to decide which mesh gateway has the freshest registration and thus most possibly the device attached to it [9].
During address registration, the mesh gateway maintains a context table for the registered nodes. The context table consists of the prefix, the context ID, and the valid lifetime of the prefix. The mesh gateway shares the context table with all the nodes in the domain. Therefore, the nodes can only perform IP header compression and decompression when they share the same context table, which is the key technology for transmitting IPv6 over BLE. For the security of BLE mesh networks, the node may use its device private address instead of the static address. The private address is suggested to change every 15 min. When the device address changes, the address update mechanism is triggered by the node. The node sends the NS and RS messages to the mesh gateway to register the new IPv6 address. Due to the same connection between the node and the relay node, unicast communications are performed during the address update. The procedure is shown in Figure 4.

Performance Analysis
In this section, we analyze the performance of neighbor discovery for 6LoBLEmesh, including the probability of successful discovery in a whole 6LoBLEmesh domain, the discovery average latency for one advertiser, and the average energy consumption for an advertiser during the discovery process. The terms used in the analysis are given in Table 3. Probability of the ADV_EXT_IND packet collision P succ_ADV Probability of the ADV_EXT_IND packet being received successfully P coll_AUX Probability of the AUX_ADV_IND packet collision P succ_AUX Probability of the AUX_ADV_IND packet being received successfully First, we investigated the probability of successful discovery for all the nodes in the 6LoBLE domain. Based on the 6LoBLEmesh ND, the collision between nodes will lead the fail of the neighbor discovery process. There are two collision situations during discovery, the ADV_EXT_IND packet collision and the AUX_ADV_IND collision. Let P coll_ADV denote the probability of collision between two ADV_EXT_IND packets. We express this probability as Considering the characters of the mesh network, one relay node may try to establish a connection with more than one node. Therefore, we have the probability of the ADV_EXT_IND packet being received successfully expressed as P succ_ADV = (1 − P coll_ADV ) N con −1 . Here, N con denotes the average number of connections with one delay node, and N con = N−N r N r . Then, we have Based on BLE 5.0, the AUX_ADV_IND packet could be transmitted on one of the secondary channels(CH0-CH36). Then, we have the probability of collision between two AUX_ADV_IND packets Similarly, the probability that the relay node can receive the AUX_ADV_IND packet successfully P succ_AUX can be derived as The probability that all the nodes in the domain are discovered at least by one relay node can be expressed as In [15], we proposed a performance analysis model for BLE neighbor discovery based on the Chinese Remainder Theory (CRT). For asynchronous neighbor discovery protocols, CRT guarantees the successful discovery between nodes in every n i n j period under the condition that n i and n j are coprime. Here, n i and n j denote the duty cycle of each node. The advertiser starts its advertising at t 0 , and the scanner starts its scanning at t 1 . Using the latency analysis method in [15], we have the CRT solution on each primary channel Then, the first acknowledged time between two nodes is x 0 = min(x 37 on , x 38 on , x 39 on ). We assume that the nodes are acknowledged at the cth advertising event. c can be expressed as Different from BLE 4.0, considering the transmission time of an AUX_ADV_IND packet, we can calculate the latency L(t 0 , t 1 ) when the nodes meet at the cth period.
To simplify the equation, let θ(t 0 , t 1 ) = x 0 − t 0 , we have At last, we assume that the advertiser and scanner initially start at any slot within [0, T ADV ] and [0, 3T SI N ] , respectively, independently and with the same probability. Then, the average discovery latency for 6LoBLEmesh L(t 0 , t 1 ) x can be expressed as

Experiments
In order to validate the proposed neighbor discovery protocol for 6LoBLEmesh networks, a Revierbed modeling simulator was used to simulate and test the 6LoBLEmesh ND according to BLE 5.0 protocol standard. Based on the specification of BLE mesh networks, we set the scanning events in continuous scanning mode, where the value of ScanWindow is equal to the ScanInterval. The advertising event adopts the random fallback mechanism, and the broadcast packet is sent with random waiting time. The start times of the advertisers and the scanner are independent. The start time of the scanner is chosen randomly between [0, 3T SI N ], and the advertisers are set randomly between [0, T ADV ]. The parameter settings are list in Table 4. In the simulation, there are N nodes in a 6LoBLEmesh network, including nodes(friend nodes) and relay nodes. Meanwhile, a mesh gateway node is deployed as well.  Figure 5 compares the analytical latency results and the simulation results for all nodes joining the network. The analytical results show the close patterns as the simulation results. Figure 5 shows that the number of relay nodes has a certain influence on the discovery delay of nodes in the network. First, up to 500 nodes are deployed in the network domain, using the 6LoBLEmesh neighbor discovery protocol, and the overall average discovery latency can be maintained within 120 s. Next, if the number of relay nodes is sufficient, the discovery latency of the network can be greatly reduced. In particular, if the average number of connectable relay nodes is less than 25, the discovery delay in the network domain can be maintained within 60 s. Generally, an increase in the number of relay nodes that can be connected reduces the discovery latency of nodes in the network domain. Figure 6 shows the discovery probability for the different number of nodes N and the different number of relay nodes N r . In Figure 6, when N : N r remained at 10:1, we can see that the discovery probability is close to 1. However, as the ratio of the number of nodes to the number of relay nodes increases, the discovery probability drops rapidly. When N increases from 100 to 500, the discovery probability drops to the lowest at the ratio of 15:1. For the case that N increases from 400 to 500, the discovery probability drops more sharply than the less crowded situation. When the ratio reaches to 11:1, the discovery probability declines to its lowest value. The average latency  Figure 6. The discovery probability respect to advertiser numbers. Figure 7 shows the Cumulative Density Function (CDF) of the discovery latency for different numbers of advertiser nodes. It can be seen that for fewer advertiser nodes, the discovery latency does not vary much between the best and worst cases. While even for 500 advertiser nodes, the proposed neighbor discovery process could promise the latency less than 35 s with a high probability. To test the impact of the IPv6 address configuration mechanism on energy consumption, in the simulation, we set the number of relay nodes to 10, and also conducted neighbor discovery simulation for 50 advertiser nodes deployed in the network domain. The average energy consumption of a single node is tested under three conditions: no address configuration mechanism, static address configuration, and devices' private address configuration for nodes. The results are shown in Figure 8. Since the standard neighbor discovery process of BLE 4.2 does not perform address configuration mechanism, here we use the standard protocol to perform the situation without address configuration mechanism. Furthermore, the address configuration mechanism with static address and devices' private address are simulated to compare with each other.
It can be seen from the results that the protocol without address configuration mechanism has less information interactions among the node and the relay node and the mesh gateway, thus consuming less energy of the node. The low-power nodes in the 6LoBLEmesh network do not need to be assigned a unique IPv6 address due to the existence of the friend nodes, so less power consumption is required during the neighbor discovery process. However, there is no significant difference between the static address configuration and the device private address configuration from the perspective of energy consumption. The private address is variable and has higher security. There is no difference between the effect of a static address in the address configuration phase and the node in the subsequent communication phase, but the node needs to consume slightly more energy for the address update mechanism. In addition, due to the increase in the number of nodes, the access number of relay nodes increases, which increases the network discovery delay, resulting in an upward trend in the average energy consumption of a single node.

Conclusions
Based on the BLE mesh network, this paper proposed a neighbor discovery protocol for 6LoBLEmesh networks according to 6LoWPAN ND. The protocol defines the network architecture of the 6LoBLEmesh network, the neighbor discovery process based on BLE 5.0, and the IPv6 address auto-configuration and update mechanism. Performance analysis and simulation experiments were discussed to verify the effectiveness of the protocol. However, performance analysis of the protocol in this paper is only limited to the impact of the number of nodes, and the selection of protocol parameters has also an important impact on the performance of neighbor discovery, which will be our future research direction.