Application research on Interner access of smart home network based on 6LoWPAN

With the rapid development of Internet of things technology and the increasing diversity and number of devices connected to home Network, the technology of 6LoWPAN (IPv6 over low-power Wireless Personal Area Network) has been widely used in smart home Network. According to the actual needs of users, it will be of more practical significance to connect the smart home network to the Internet (IPv4) so that users can obtain the information in the home network instantly and realize remote control through the mobile application platform.Based on 6 lowpan overall design scheme of smart home network access to the Internet, including the system gateway hardware and software design, and combining the transition technology analysis of the 6 lowpan network access of the Internet technology difficulty, according to the current technical background, we have analyzed based on 6 lowpan technology of smart home network to access the Internet in the next generation Internet development foreground and research significance.


Application of 6LoWPAN and transition technology in smart home network
The smart home device connects the home devices used in people's daily life through the Internet technology, and connects the smart home devices into the home network through the information exchange between the devices to form an intelligent network in the family life. 6LoWPAN technology not only has a wide address space of IPv6, but also realizes the unification with the Internet at the network layer, and will have a good development prospect in the development of smart home network. The 6LoWPAN-based smart home network connects the various sensor nodes of the home network through 6LoWPAN technology, but from the perspective of market demand and development direction, the access of the smart home devices to the Internet will have more practical significance [1] , if to realize the control function of the sensor node in the smart home network to interconnect with the external Internet and realize information interaction, a communication bridge exists between the smart home sensor network and the external Internet [2] .

System gateway overall design
As the part of the home network system where the sensing device is connected to the client, the system gateway plays a key role in the smart home network system [3] . The environmental information collected by the home equipment is submitted to the gateway server via the 6LoWPAN network, and the server stores the information and accesses the Internet to provide a data interface for the user, and the user can use the software platform to view and control the home environment information in real time [4] . The 6LoWPAN-based smart home network is connected to the Internet by the gateway, and the IP layer of the two heterogeneous networks is unified through the conversion module. When the home device generates instant information and forwards it to the user control terminal through the system gateway, the device transmits the data information to the system gateway through the wireless link based on IEEE802.15.4, and the gateway integrates the 6LoWPAN protocol stack, which can implement hardware with 6LoWPAN. Communication between [5] . After the gateway accepts the data, the data is re-encapsulated and forwarded to the Internet through the protocol conversion function, and finally received by the user client. On the contrary, when the user terminal first sends out the control information, the system gateway first performs protocol conversion, and then sends the information to the home device through the radio frequency communication module integrated by the system gateway.
When the gateway receives the sensing message transmitted by the 6LoWPAN node, it is first submitted by the 6LoWPAN protocol stack integrated in the gateway to the network layer [6] , and then the protocol conversion mechanism converts the network protocol and address, and then The TCP/IP protocol stack integrated in the gateway encapsulates the converted packets, and converts the packets from the two heterogeneous networks. Finally, the system gateway forwards them.
Since the user client can be in different IPv4 networks, the 6LoWPAN data packet is encapsulated by the link layer protocol of the TCP/IP protocol stack after the protocol conversion by the system gateway, thereby implementing the system gateway through different Access to the Internet.
The system gateway needs to complete the design of the RF driver interface and the migration of the 6LoWPAN protocol stack under the Linux system to receive data from the home device and forward control messages from the IPv4 network to the home device. Secondly, the system gateway also needs to complete the design of the Ethernet card driver interface, the WiFi driver interface and the 4G communication module to complete the process of receiving and forwarding IPv4 data, thereby realizing the end-to-end communication between the smart home device and the user client.

Data conversion design
In the gateway server, a data conversion mechanism is required to perform protocol and address translation on data packets from the 6LoWPAN subnet and the Internet. The address translation is used to implement the conversion between the 6LoWPAN node address and the IPv4 network address. The protocol conversion is used to implement the mutual conversion of heterogeneous network packets. As the core part of the system gateway, the address protocol conversion module is a bridge connecting the Internet (IPv4) in the smart home wireless sensor network system. In the address translation sub-module, an address pool is formed by a part of the public IPv4 address to establish a mapping relationship with the nodes in the 6LoWPAN network to implement address translation. During the data communication process, the system gateway identifies the usage status of the IPv4 address in the address pool by using a 2-bit status identifier to implement the cyclic use of the IPv4 address. The address translation mechanism adopts the port number mapping mechanism. The port number mapping mechanism forms a unique identifier by using the application port number plus the IPv4 public address, and establishes a mapping relationship with the IPv6 address in the 6LoWPAN network to meet the number of IPv6 addresses in the smart home network environment. If required, the time-to-live is added to the address information database. The information is queried for each time in the system gateway. The time-to-live operation is performed. When the lifetime is zero, the address mapping is automatically unbound. In the ICMP packet conversion process, the unique identifier is composed of an IPv4 address and an ID number [7] . The data structure of the address mapping table is also implemented by a linked list. head null ……

IPv4 address
Bind an IPv6 transport address Survival time Figure 3 address binding information storage structure. When the 6LoWPAN node enters the gateway for the first time, the address translation unit in the gateway obtains an idle IPv4 address from the address pool. At this time, the IPv4 address is set to the occupied state by the free state, and the address conversion unit establishes a mapping relationship for address translation. . After the address information conversion is completed, the gateway forwards the data packet. If the forwarding fails, the IPv4 address status changes from occupied to free; if the forwarding succeeds, the occupied becomes the boundary state, and the mapping relationship record is saved to the address information database. Until the time to survival is 0, the address returns to the free state, which can be reassigned by the address management module.
After the address translation is completed, the IP data packet entering the system gateway by the 6LoWPAN network is still unable to be transmitted in the IPv4 network, so the protocol conversion sub-module still needs to perform protocol conversion on the data packet. When the IPv4 user control terminal communicates with the home network node, the system gateway first converts the request, converts it into a sensor node query, and then modifies the IP packet header through network protocol conversion, so that the data packet can be in the heterogeneous network. Route forwarding is performed, which is implemented by the SIIT algorithm [8] .

Data flow control mechanism design
The smart home network has a complicated working environment, and the smart home devices are diverse, and will increase greatly with the change of the living environment. When multiple data streams enter the gateway at the same time, it will inevitably lead to crowding and collision of data flows in the system gateway, and even causes the gateway system to crash. Therefore, this paper is based on the Netfilter firewall under Linux system design system data flow control mechanism [9] , register the module in the kernel and mount the hook function at the mount point through NF_HOOK() to filter the data packet. After the data packet sent by the IPv4 node in the Internet enters the system gateway, the data packet enters the Netfilter framework at the network layer.  Figure 4 The hook point of the Netfilter framework in the protocol stack. In the system gateway, the Netfilter framework applies the Nf_conntrack module to mount the corresponding function at the hook point, and first defines the filtering rules for the connection in the function, and tracks and records the connection information of the passed data packets.
After Netfilter marks the packets entering the system gateway, it can set the traffic priority and limit the bandwidth through the service control mechanism in the Linux kernel [10] , so as to facilitate the path to multiple data flows entering the system gateway. Planning and offloading, by setting different data packets to enter the limit of the maximum bandwidth of the system occupied by the system gateway to achieve reasonable control of multiple data streams, and by means of priority setting to achieve idle bandwidth borrowing.
Through the design and implementation of the data flow control mechanism in this section, the system bandwidth and service traffic of different service types of devices and clients in the smart home network system can be identified, and the tag values can be reasonably distinguished by using no service connection. The traffic control mechanism allocates bandwidth to the data service to limit the limitation of system bandwidth of different nodes in the system network, and avoids the continuous occupation of bandwidth by the same node and the same service in the system [11] .

Test analysis
In order to ensure the function realization of the system gateway and realize the intelligent home network access to the Internet (IPv4) and end-to-end information interaction, connectivity testing between the 6LoWPAN network and the Internet (IPv4) is required. On the 6LoWPAN node, use the ping command to verify the data forwarding process and connectivity of the 6LoWPAN node and the IPv4 node. At the same time, use the Wireshark software to capture the ping command on the PC. This paper also tests the traffic test mechanism implemented in the system gateway, and simultaneously accesses multiple IPv4 nodes to the gateway. At the same time, accessing 6LoWPAN nodes in multiple smart home networks, the test results show that when multiple devices in the smart home network communicate with IPv4 nodes at the same time, the system gateway can implement reasonable path planning for the passed data packets, and flow control to ensure the normal operation of the smart home system.

Conclusion
Aiming at the development background and trend of current smart home network, this paper designs a 6LoWPAN-based smart home network access Internet (IPv4) transition plan, introduces the gateway software design and implementation environment, and introduces 6LoWPAN technology and protocol conversion technology. It is applied in the smart home network environment to realize the end-to-end connection between the home network and the Internet. Based on the Netfilter framework, the data flow control mechanism for the smart home network system is designed to ensure that the system gateway can still be normal when accessing multiple points. The operation has a broader development space than the traditional smart home network products, and has a good application value in the future development of the smart home.