CN111711708B - LoRaWAN terminal equipment address allocation method - Google Patents

LoRaWAN terminal equipment address allocation method Download PDF

Info

Publication number
CN111711708B
CN111711708B CN202010362159.3A CN202010362159A CN111711708B CN 111711708 B CN111711708 B CN 111711708B CN 202010362159 A CN202010362159 A CN 202010362159A CN 111711708 B CN111711708 B CN 111711708B
Authority
CN
China
Prior art keywords
devaddr
terminal node
database
deveui
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010362159.3A
Other languages
Chinese (zh)
Other versions
CN111711708A (en
Inventor
杨鲲
梁萧
范新宇
刘强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Huijianlian Information Technology Co ltd
Original Assignee
Chengdu Huijianlian Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Huijianlian Information Technology Co ltd filed Critical Chengdu Huijianlian Information Technology Co ltd
Priority to CN202010362159.3A priority Critical patent/CN111711708B/en
Publication of CN111711708A publication Critical patent/CN111711708A/en
Application granted granted Critical
Publication of CN111711708B publication Critical patent/CN111711708B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5046Resolving address allocation conflicts; Testing of addresses

Abstract

The invention discloses a LoRaWAN terminal node equipment address allocation method, which aims at the problems that when the number of terminal nodes in a LoRaWAN network is large, equipment addresses conflict and the equipment addresses change when the network is accessed again; the invention uses the database to store the device identifier and the device address of the terminal node which has accessed the network; the network server queries the database according to the equipment identifier of the terminal node to judge whether the terminal node is equipment which is accessed to the network again or not, and the same equipment address is rapidly allocated to the equipment which is accessed to the network again; for the newly-accessed equipment, calculating and generating an equipment address of the terminal node according to the equipment identifier of the terminal node; and inquiring a database to judge whether the generated equipment addresses conflict or not, and avoiding the equipment address conflict by using multiple times of random calculation.

Description

LoRaWAN terminal equipment address allocation method
Technical Field
The invention belongs to the technical field of low-power-consumption wide area network communication, and particularly relates to an address allocation method for LoRaWAN terminal equipment.
Background
The LoRa is a LPWAN (low power wide area network) specification, and is mainly characterized by long distance, low power consumption and low cost. The LoRaWAN network is large in networking scale, and the number of terminal nodes accessed in one network can reach tens of thousands. According to the LoRaWAN protocol, the terminal node is identified by DevAddr (device address) randomly allocated by the network server every time the network is accessed. In each frame header of uplink and downlink data in the network, the DevAddr field is needed to distinguish the terminal nodes sending or receiving data.
The length of DevAddr field of terminal node in LoRaWAN is 32 bits, the high 7 bits are public NwkID (network identifier), distributed by LoRa alliance, to distinguish different network operator's territorial overlapping network and solve roaming problem. Where 0000000 is for the private network and 0000001 is for the experimental network. The lower 25 NwkAddr (network address) is freely allocated by the network administrator.
In the existing LoRaWAN network, the device address is allocated randomly by a network server when the network is accessed. The network server generates a 25-bit pseudo-random value as the lower 25-bit NwkAddr of the DevAddr field by a random function, which is combined with the fixed NwkID as the DevAddr field of the terminal node.
When the number of the terminal nodes is large, the device addresses in the network are likely to generate conflict, so that device identification errors and communication errors are caused; and when the terminal node re-accesses the network each time, the network server allocates a new device address to the terminal node, which causes communication data discontinuity and application service interruption.
In order to ensure the uniqueness of the equipment address in the same LoRaWAN network, simultaneously ensure that the terminal node is distributed to a fixed equipment address when the terminal node accesses the network again every time, and enhance the stability and the reliability of the network, the invention provides a LoRaWAN terminal node equipment address distribution method based on a terminal DevEUI (equipment identifier).
Disclosure of Invention
Aiming at the problems that when the number of terminal nodes in a network is large, equipment addresses conflict and the equipment addresses change when the network is accessed again, the invention provides an equipment address allocation method based on the equipment identifiers of the terminal nodes, optimizes and improves equipment identification and equipment address allocation modes in a LoRaWAN protocol, can avoid equipment address conflict and simultaneously ensures that the terminal nodes can obtain the same equipment addresses when the network is accessed for multiple times.
The technical scheme adopted by the invention is as follows: a LoRaWAN terminal device address allocation method, use Redis database to store the device identifier and device address of the terminal node that has already been networked; the network server acquires a DevEUI field of the terminal node in the network access request frame, judges whether the terminal node is equipment for re-network access or not by inquiring the database and rapidly allocates the same DevAddr to the equipment for re-network access; if the device is a newly network-accessed device, the DevEUI of the terminal node is used as a random seed to randomly generate a DevAddr; inquiring a database to judge whether the generated DevAddr conflicts, and avoiding the conflicts by using multiple random calculations; the method specifically comprises the following implementation processes:
firstly, a network server acquires a DevEUI field of a terminal node applying for network access, judges whether the terminal node is a device for network re-access or not by inquiring a Redis database, and distributes the same DevAddr to the device for network re-access. The method specifically comprises the following steps:
a1, the network server receives the network access request and obtains DevEUI of the terminal node;
a2, inquiring whether there is the same DevEUI in the database;
a3, if the database has the same data, the network server reads the DevAddr corresponding to DevEUI in the database as the equipment address of the current terminal node.
Secondly, generating a random seed for the terminal node newly accessed to the network according to the DevEUI, and obtaining DevAddr by using random operation; judging whether the obtained DevAddr conflicts or not by inquiring a Redis database; using a collision avoidance policy for the conflicting DevAddr; the method specifically comprises the following steps:
b1, carrying out XOR operation on the high 32 bits and the low 32 bits of DevEUI to obtain 32-bit random seeds;
b2, obtaining a 32-bit random number by using an MT19937 algorithm according to the random seed obtained in the step B1;
b3, right-shifted by 7 bits according to the random number arrived at in step B2 as the value of the lower 25 NwkAddr of the DevAddr; NetID is taken as high 7 bits, and 32 bits of DevAddr are obtained;
b4, searching whether the DevAddr obtained in step B3 has the same value in the Redis database, if the same value exists in the database, returning to step B3, and continuing to perform random operation to obtain a new DevAddr until the DevAddr obtained in step B3 does not conflict with the data in the database.
And finally, performing persistence processing on the generated DevAddr, storing the generated DevAddr in a Redis database of a network server, encapsulating the generated DevAddr into a network access receiving message, and sending the network access receiving message to a terminal node. The method comprises the following specific steps:
c1, storing DevEUI and available DevAddr of the terminal node into a Redis database; step C1 specifically includes:
c11, converting DevEUI and DevAddr of the terminal node into a character string format according to the byte order;
c12, storing the DevEUI character string as key and the DevAddr character string as value into the Redis database.
C2, encapsulating the DevAddr of the terminal node into an acceptance frame and sending to the terminal node.
The invention has the beneficial effects that: according to the LoRaWAN terminal equipment address allocation method, the conflict probability of the network server for generating the equipment address can be remarkably reduced based on the equipment address generation mode of the terminal node equipment identifier; the equipment addresses of the terminal nodes in the network can be prevented from conflicting by carrying out multiple random operations on the conflicting equipment addresses; for the re-networked terminal nodes, the network server always allocates the same device address to the re-networked terminal nodes. The method of the invention has the following advantages:
1. the device identifier and the device address of the terminal node which is accessed to the network are stored by using the database, and whether the generated device address conflicts or not can be judged at a network server side; meanwhile, the network server can judge the network access condition of the terminal node, so that the terminal node which accesses the network again can quickly obtain a fixed equipment address.
2. The Redis database is used for storing the information of the terminal nodes, so that the information of the database can be quickly inquired when the number of the terminal nodes is large, and the load of a network server is reduced to the maximum extent;
3. random seeds are generated by using the unique terminal node equipment identifier, and random numbers are obtained by using a high-performance random algorithm MT19937 algorithm, so that the collision probability of the network server generated equipment address is effectively reduced;
4. by performing random operation on the conflicting device addresses multiple times, device address conflict can be completely avoided.
Drawings
FIG. 1 is a schematic block diagram provided by an embodiment of the present invention;
fig. 2 is a flow chart provided in the embodiment of the present invention.
Detailed Description
In order to facilitate the understanding of the technical contents of the present invention by those skilled in the art, the present invention will be further explained with reference to the accompanying drawings.
As shown in fig. 1, the address assignment method for LoRaWAN terminal devices according to the present invention includes the following steps:
o1, storing DevEUI and DevAddr of the terminal nodes which are accessed to the network by using a database;
o2, the network server obtains DevEUI of the terminal node in the network access request frame, judges whether the terminal node is a device to be accessed again by inquiring the database, and distributes DevAddr corresponding to the DevEUI to the device to be accessed again;
and O3, if the device is a new network access device, randomly generating the DevAddr of the terminal node by using the DevEUI of the terminal node as a random seed, inquiring the database to judge whether the generated DevAddr is conflicted, and avoiding the conflict by using multiple times of random calculation.
Optionally, O2 is specifically:
a1, the network server receives the network access request and obtains DevEUI of the terminal node;
a2, inquiring whether there is the same DevEUI in the database;
a3, if the database has the same data, the network server reads the DevAddr corresponding to DevEUI in the database as the equipment address of the current terminal node.
Optionally, O3 is specifically:
b1, carrying out XOR operation on the high 32 bits and the low 32 bits of DevEUI to obtain 32-bit random seeds;
b2, obtaining a 32-bit random number by using an MT19937 algorithm according to the random seed obtained in the step B1;
b3, right shifting 7 bits according to the random number obtained in step B2 as the value of the lower 25 NwkAddr of the DevAddr; NetID is taken as high 7 bits, and 32 bits of DevAddr are obtained;
b4, searching whether the DevAddr obtained in step B3 has the same value in the database, if so, returning to step B3, and continuing to perform random operation to obtain a new DevAddr until the DevAddr obtained in step B3 has no conflict with the data in the database.
Optionally, the generated DevAddr is subjected to persistence processing, and the specific steps are as follows:
c1, storing DevEUI of terminal node and available DevEUI to database of network server;
c2, encapsulating the DevAddr of the terminal node into an acceptance frame and sending to the terminal node.
Optionally, step C1 is specifically:
c11, converting DevEUI and DevAddr of the terminal node into a character string format according to the byte order;
c12, storing the DevEUI character string as key and DevAddr character string as value into database.
Optionally, the database used is a Redis database, the stored data is a key value pair, the key is DevEUI of the terminal node, and the value is DevAddr of the terminal node.
As shown in fig. 2, the specific implementation flow of the present invention is as follows:
1. the network server receives the network access request message and acquires the value of the DevEUI field therein.
2. And (4) converting the DevEUI obtained in the step (1) into a character string type according to the byte sequence, and inquiring whether the same key exists in a Redis database. If so, the current terminal node is considered to be equipment for re-accessing the network, and the step 3 is executed, otherwise, the step 4 is executed.
3. And acquiring a DevAddr value corresponding to the DevEUI key in the Redis database, taking the DevAddr value as the DevAddr of the current terminal node newly accessed to the network, and turning to the step 9.
4. And carrying out XOR operation on the high 32 bits and the low 32 bits of the DevEUI obtained in the step 1 to obtain a 32-bit random seed.
5. And (4) carrying out random operation by using an MT19937 algorithm according to the random seed obtained in the step 4 to obtain a 32-bit random number.
6. Right shifting the random number obtained in the step 5 by 7 bits, and reserving the upper 25 bits as the value of NwkAddr of the lower 25 bits of the DevAddr of the terminal node; the upper 7 bits are set to the NetID assigned by the LoRa alliance, resulting in a 32-bit DevAddr.
7. Converting the DevAddr obtained in the step 6 into a character string format according to the byte sequence, inquiring a Redis database, and judging whether the database has the same value; if yes, the generated DevAddr is considered to conflict with the DevAddr used in the network, the step 5 is returned, and random operation is carried out by using the same random seed to obtain a new DevAddr; otherwise step 8 is performed.
8. And (4) forming a key value pair by taking the DevEUI of the character string type obtained in the step (2) as a key and the DevAddr of the character string type obtained in the step (7) as a value, and storing the key value pair into a Reids database.
9. And encapsulating the value of the DevAddr obtained in the step 3 or the step 6 into a DevAddr field of the received frame, and sending the DevAddr field to the terminal node.
It will be appreciated by those of ordinary skill in the art that the embodiments described herein are intended to assist the reader in understanding the principles of the invention and are to be construed as being without limitation to such specifically recited embodiments and examples. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (4)

1. A LoRaWAN terminal equipment address allocation method is characterized by comprising the following contents:
o1, storing DevEUI and DevAddr of the terminal nodes which are accessed to the network by using a database;
o2, the network server obtains DevEUI of the terminal node in the network access request frame, judges whether the terminal node is a device to be accessed again by inquiring the database, and distributes DevAddr corresponding to the DevEUI to the device to be accessed again; the method specifically comprises the following steps:
a1, the network server receives the network access request and obtains DevEUI of the terminal node;
a2, inquiring whether there is the same DevEUI in the database;
a3, if the database has the same data, the network server reads the DevAddr corresponding to DevEUI in the database as the equipment address of the current terminal node;
o3, if the device is a new network access device, randomly generating a DevAddr of the terminal node by using the DevEUI of the terminal node as a random seed, querying the database to determine whether the generated DevAddr conflicts, and avoiding the conflicts by using multiple random calculations, specifically comprising:
b1, carrying out XOR operation on the high 32 bits and the low 32 bits of DevEUI to obtain 32-bit random seeds;
b2, obtaining a 32-bit random number by using an MT19937 algorithm according to the random seed obtained in the step B1;
b3, right shifting 7 bits according to the random number obtained in step B2 as the value of the lower 25 NwkAddr of the DevAddr; NetID is taken as high 7 bits, and 32 bits of DevAddr are obtained;
b4, searching whether the DevAddr obtained in step B3 has the same value in the database, if so, returning to step B3, and continuing to perform random operation to obtain a new DevAddr until the DevAddr obtained in step B3 has no conflict with the data in the database.
2. The LoRaWAN terminal device address allocation method according to claim 1, wherein the generated DevAddr is subjected to persistence processing, and the specific steps are as follows:
c1, storing DevEUI of the terminal node and available DevAddr to the database of the network server;
c2, encapsulating the DevAddr of the terminal node into an acceptance frame and sending to the terminal node.
3. The address allocation method for the LoRaWAN terminal device according to claim 2, wherein step C1 specifically includes:
c11, converting DevEUI and DevAddr of the terminal node into a character string format according to the byte order;
c12, using DevEUI character string as key and DevAddr character string as value to form key value pair to store in database.
4. A method according to claim 1, characterized in that the used database is a Redis database, the stored data is a key-value pair, the key is the device identifier of the terminal node, and the value is the device address of the terminal node.
CN202010362159.3A 2020-04-30 2020-04-30 LoRaWAN terminal equipment address allocation method Active CN111711708B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010362159.3A CN111711708B (en) 2020-04-30 2020-04-30 LoRaWAN terminal equipment address allocation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010362159.3A CN111711708B (en) 2020-04-30 2020-04-30 LoRaWAN terminal equipment address allocation method

Publications (2)

Publication Number Publication Date
CN111711708A CN111711708A (en) 2020-09-25
CN111711708B true CN111711708B (en) 2022-08-02

Family

ID=72536616

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010362159.3A Active CN111711708B (en) 2020-04-30 2020-04-30 LoRaWAN terminal equipment address allocation method

Country Status (1)

Country Link
CN (1) CN111711708B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113543132B (en) * 2021-07-15 2022-08-05 中国电信股份有限公司 Network access method and device of node equipment, storage medium and electronic equipment
CN113438659B (en) * 2021-08-26 2021-11-16 伏诺瓦(天津)科技有限公司 Long-distance lora rapid networking power grid state collector and networking method

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101345669A (en) * 2007-07-09 2009-01-14 华为技术有限公司 Method and device for settling device address collision in UWB system
WO2019001713A1 (en) * 2017-06-29 2019-01-03 Telefonaktiebolaget Lm Ericsson (Publ) A method of authentication of a long range radio device
CN109194774A (en) * 2018-08-09 2019-01-11 中兴克拉科技(苏州)有限公司 A kind of device address extended method of LPWAN network server
CN109348479A (en) * 2018-11-21 2019-02-15 长沙理工大学 Data communications method, device, equipment and the system of electric power system
CN109412937A (en) * 2018-11-07 2019-03-01 京信通信系统(中国)有限公司 Gateway, LoRa network system, gateway operation method and storage medium
WO2019136110A1 (en) * 2018-01-05 2019-07-11 Careband Incorporated Wearable electronic device and system for tracking location and identifying changes in salient indicators of patient health
CN110278617A (en) * 2019-06-21 2019-09-24 浙江理工大学 A kind of LoRaWAN channel confliction bypassing method based on time division multiple acess
CN110519830A (en) * 2019-09-06 2019-11-29 中国机械设备工程股份有限公司 The LoRaWAN system and its terminal device of energy identification terminal equipment double sign

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180248983A1 (en) * 2016-12-21 2018-08-30 Ncore Communications, Inc. Methods and apparatus for aggregating network access within a single unified platform for a myriad of devices
FR3061618B1 (en) * 2016-12-30 2019-05-24 Idemia France METHODS IMPLEMENTED BY A DEVICE AND IN A NETWORK, ASSOCIATED ELECTRONIC ENTITY
DE102017204181A1 (en) * 2017-03-14 2018-09-20 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Transmitter for emitting signals and receiver for receiving signals

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101345669A (en) * 2007-07-09 2009-01-14 华为技术有限公司 Method and device for settling device address collision in UWB system
WO2019001713A1 (en) * 2017-06-29 2019-01-03 Telefonaktiebolaget Lm Ericsson (Publ) A method of authentication of a long range radio device
WO2019136110A1 (en) * 2018-01-05 2019-07-11 Careband Incorporated Wearable electronic device and system for tracking location and identifying changes in salient indicators of patient health
CN109194774A (en) * 2018-08-09 2019-01-11 中兴克拉科技(苏州)有限公司 A kind of device address extended method of LPWAN network server
CN109412937A (en) * 2018-11-07 2019-03-01 京信通信系统(中国)有限公司 Gateway, LoRa network system, gateway operation method and storage medium
CN109348479A (en) * 2018-11-21 2019-02-15 长沙理工大学 Data communications method, device, equipment and the system of electric power system
CN110278617A (en) * 2019-06-21 2019-09-24 浙江理工大学 A kind of LoRaWAN channel confliction bypassing method based on time division multiple acess
CN110519830A (en) * 2019-09-06 2019-11-29 中国机械设备工程股份有限公司 The LoRaWAN system and its terminal device of energy identification terminal equipment double sign

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
"Catalogue of Naming, Addressing and Discovery Schemes in IERC";M. Bauer, P. Chartier, K. Moessner, et al.;《IERC-AC2-D1》;20131231;全文 *
"Named data networking(NDN) projec";Lixia Zhang, Deborah Estrin, Jeffrey Burke, et al;<ARC Technical Report NDN-001>;20101031;全文 *
""LoRaWAN 规范1.0 (第六章部分)"";qingchuwudi;《博客园https://www.cnblogs.com/qingchuwudi/p/12077733.html》;20191221;全文 *
"DevEUI, AppEUI (JoinEUI) and AppKey";Zach Pfeffer;《https://www.centennialsoftwaresolutions.com/post/deveui-appeui-joineui-and-appkey》;20181211;全文 *
"LoRaWAN协议(四)--入网方式概述";AnswerInTheWind;《博客园 https://www.cnblogs.com/answerinthewind/p/6213027.html》;20161222;全文 *
"LoRaWAN协议分析及安全性研究现状";李彤;《单片机与嵌入式系统应用》;20181101;第21-25页 *
"基于LoRa的多油气井监控系统";岳林,梅大成,陈亚萍;《电脑知识与技术》;20200229;第264-266页 *

Also Published As

Publication number Publication date
CN111711708A (en) 2020-09-25

Similar Documents

Publication Publication Date Title
US7124102B2 (en) Method and apparatus for determining a unique communication identifier
US6532217B1 (en) System for automatically determining a network address
CN111711708B (en) LoRaWAN terminal equipment address allocation method
KR20040004925A (en) Wireless local area network system with a guarantee of users&#39; anonymity and method of guaranteeing users&#39; anonymity therein
CN104378452A (en) Method, device and system for domain name resolution
US9819641B2 (en) Method of and a processing device handling a protocol address in a network
CN113315814B (en) IPv6network boundary equipment rapid discovery method and system
US8605736B2 (en) Method, system and apparatus for heterogeneous addressing mapping
CN113076303A (en) Method and device for generating service identifier in distributed system
US20090024761A1 (en) Method, system and application for service addressing
CN105450585A (en) Information transmission method and device
Fernandes et al. An efficient filter-based addressing protocol for autoconfiguration of mobile ad hoc networks
CN111866201B (en) IPv6 multicast address generation method and device
CN106850541B (en) Method and device for determining address of node in Internet of things
CN108989173B (en) Message transmission method and device
CN114422474B (en) User IPv6 address generating method based on RADIUS server
GB2415855A (en) Variable network address lengths
CN115190101B (en) Network address management and data transmission method of equipment
CN112104764B (en) Method and system for classifying DHCP (dynamic host configuration protocol) client
CN115086274B (en) Network traffic distribution method, device, equipment and storage medium
CN115348111B (en) Centralized connection control method for high-security network
US20230315759A1 (en) A method of operating a storage device of an access point, a method of locating a device context of an end node device stored in a storage device of an access point, and an access point
WO2002044903A1 (en) An universal assigning method for the networking computer to assign computer&#39;s address with full decimal algorithm
CN117768442A (en) Quantum encryption system and method for preventing IP conflict
Li et al. Optimistic dynamic address allocation for large scale MANETs

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant