CN110635942B - Device discovery method, internet of things device and Internet of things server - Google Patents

Device discovery method, internet of things device and Internet of things server Download PDF

Info

Publication number
CN110635942B
CN110635942B CN201910821074.4A CN201910821074A CN110635942B CN 110635942 B CN110635942 B CN 110635942B CN 201910821074 A CN201910821074 A CN 201910821074A CN 110635942 B CN110635942 B CN 110635942B
Authority
CN
China
Prior art keywords
internet
network
things
equipment
information
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
CN201910821074.4A
Other languages
Chinese (zh)
Other versions
CN110635942A (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.)
Shanghai Sunmi Technology Group Co Ltd
Original Assignee
Shanghai Sunmi Technology Group 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 Shanghai Sunmi Technology Group Co Ltd filed Critical Shanghai Sunmi Technology Group Co Ltd
Priority to CN201910821074.4A priority Critical patent/CN110635942B/en
Publication of CN110635942A publication Critical patent/CN110635942A/en
Application granted granted Critical
Publication of CN110635942B publication Critical patent/CN110635942B/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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Abstract

An equipment discovery method, internet of things equipment and an Internet of things server comprise at least one piece of Internet of things equipment, wherein the Internet of things equipment and the Internet of things server carry out information transmission, the Internet of things equipment belongs to a sub-network, the sub-network belongs to an NAT network, and the method comprises the following steps: sending report information to an Internet of things server, wherein the report information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs; receiving all equipment information sent by the server of the Internet of things, and recording all the equipment information to form a neighbor table of the NAT network so as to establish connection according to the neighbor table; the equipment information-associated Internet of things equipment belongs to the NAT network, at least one piece of equipment information-associated Internet of things equipment does not belong to the sub-network, and the NAT network is a local area network formed by NAT equipment in an isolation mode. The technical scheme provided by the invention can discover the equipment in different local area network subnets.

Description

Device discovery method, internet of things device and Internet of things server
Technical Field
The invention relates to the technical field of communication, in particular to an equipment discovery method, internet of things equipment and an Internet of things server.
Background
With the increasing popularity of Internet of things (IOT) devices, a large number of IOT devices exist in a single main space such as a restaurant, a supermarket, and the like. Some IOT devices that need to cooperate with each other often need to first perform device discovery and then establish a connection to perform data communication. The premise for connection and data communication is that the respective IOT devices can discover each other and can acquire the IP address of the other.
Some current standard devices employ discovery protocols that discover devices via multicast or broadcast. Such as the zero configuration networking protocol Bonjour or most other proprietary discovery protocols, are implemented based on multicast or broadcast. However, if individual IOT devices are located on different local area networks and/or subnets across local area network subnets, they are typically unable to discover each other. However, in a local area network within a large mall or supermarket, there are often multiple subnets. In this case, how to discover devices in different subnets needs to be further studied.
Disclosure of Invention
The technical problem solved by the invention is how to discover devices in different subnets.
In order to solve the above technical problem, an embodiment of the present invention provides an apparatus discovery method, including at least one internet of things apparatus, where the internet of things apparatus performs information transfer with an internet of things server, the internet of things apparatus belongs to a sub-network, and the sub-network belongs to an NAT network, and the method includes: sending report information to an Internet of things server, wherein the report information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs; receiving all equipment information sent by the server of the Internet of things, and recording all the equipment information to form a neighbor table of the NAT network so as to establish connection according to the neighbor table; the equipment information-associated Internet of things equipment belongs to the NAT network, at least one piece of equipment information-associated Internet of things equipment does not belong to the sub-network, and the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
Optionally, the reporting information includes: and user account information associated with the Internet of things equipment and the IP address of the sub-network, wherein the user account information is used for identifying the NAT network.
Optionally, before sending the report information to the internet of things server, the method for discovering the internet of things device further includes: establishing a message queue telemetry transmission protocol connection with the Internet of things server; or establishing TCP connection with the Internet of things server; or establishing UDP connection with the Internet of things server.
Optionally, the device information includes one or more of the following: network identification of the NAT network, device type, device identification, IP address of the sub-network and its mask.
In order to solve the above technical problem, an embodiment of the present invention further provides a device discovery method, including at least one internet of things server and at least one NAT network controlled by the internet of things server, where the NAT network includes at least one sub-network, and the sub-network includes at least one internet of things device, the method including: receiving report information of the Internet of things equipment, wherein the report information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs; issuing equipment information belonging to the NAT network to the Internet of things equipment so that the Internet of things equipment records the equipment information to form a neighbor table of the NAT network and establishes connection according to the neighbor table; the equipment related to the equipment information belongs to the NAT network, at least one piece of equipment related to the equipment information does not belong to the sub-network, and the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
Optionally, before receiving the reported information of the internet of things device, the method for discovering the internet of things device further includes: establishing message queue telemetry transmission protocol connection with the Internet of things equipment; or establishing TCP connection with the Internet of things equipment; or establishing UDP connection with the Internet of things equipment.
Optionally, the device information includes one or more of the following: network identification of the NAT network, device type, device identification, IP address of the sub-network and its mask.
In order to solve the above technical problem, an embodiment of the present invention further provides an internet of things device, where the internet of things device performs information transfer with an internet of things server, the internet of things device belongs to a sub-network, the sub-network belongs to an NAT network, and the internet of things device includes: the sending module is used for sending reporting information to an Internet of things server, wherein the reporting information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs; the receiving module is used for receiving all equipment information sent by the Internet of things server and recording all the equipment information to form a neighbor table of the NAT network so as to establish connection according to the neighbor table; the equipment information-associated Internet of things equipment belongs to the NAT network, at least one piece of equipment information-associated Internet of things equipment does not belong to the sub-network, and the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
In order to solve the above technical problem, an embodiment of the present invention further provides an internet of things server, where the internet of things server controls at least one NAT network, the NAT network includes at least one sub-network, each sub-network includes at least one internet of things device, and the internet of things server includes: the system comprises a receiving module and a processing module, wherein the receiving module is used for receiving reported information of the equipment of the Internet of things, and the reported information comprises an IP address of a sub-network to which the equipment of the Internet of things belongs and an NAT network to which the sub-network belongs; the issuing module is used for issuing equipment information belonging to the NAT network to the Internet of things equipment so that the Internet of things equipment records the equipment information to form a neighbor table of the NAT network and establishes connection according to the neighbor table; the equipment related to the equipment information belongs to the NAT network, and at least one piece of equipment related to the equipment information does not belong to the sub-network, wherein the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
To solve the above technical problem, an embodiment of the present invention further provides a storage medium having stored thereon computer instructions, where the computer instructions execute the steps of the above method when executed.
Compared with the prior art, the technical scheme of the embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides a device discovery method, which comprises at least one device, wherein the device of the Internet of things carries out information transmission, the device of the Internet of things belongs to a sub-network, the sub-network belongs to an NAT network, and the method comprises the following steps: sending report information to an Internet of things server, wherein the report information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs; receiving all equipment information sent by the server of the Internet of things, and recording all the equipment information to form a neighbor table of the NAT network so as to establish connection according to the neighbor table; the equipment related to the equipment information belongs to the NAT network, and at least one piece of equipment related to the equipment information does not belong to the sub-network, wherein the NAT network refers to a local area network formed by NAT equipment in an isolation mode. The embodiment of the invention stores the equipment information of each equipment belonging to the same NAT network in the server of the Internet of things, the server of the Internet of things controls the equipment information of the same NAT network in a centralized way, and informs the equipment information of each equipment in the NAT network, and the equipment is stored through the neighbor table. The embodiment of the invention can discover the equipment in different subnets, does not need to carry out complex configuration on the gateway or the equipment, simplifies the equipment discovery process of the cross-subnet, and provides a simple and feasible scheme for establishing communication connection for the cross-network equipment.
Further, the reporting information includes: and user account information associated with the Internet of things equipment and the IP address of the sub-network, wherein the user account information is used for identifying the NAT network. According to the embodiment of the invention, the network is identified by the user account information associated with the equipment, so that each Internet of things equipment and the Internet of things server can know which Internet of things equipment belongs to the same account.
Further, the device information includes one or more of: network identification of the NAT network, device type, device identification, IP address of the sub-network and its mask. According to the embodiment of the invention, the equipment information issued by the server of the Internet of things enables the equipment of the Internet of things to obtain the main information of other equipment of the Internet of things, so that the communication connection establishment is possible.
Drawings
FIG. 1 is a schematic diagram of a network architecture according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a device discovery method according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating a further device discovery method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a device discovery apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another device discovery apparatus according to an embodiment of the present invention.
Detailed Description
As will be appreciated by those skilled in the art, as is known in the background art, the device discovery scheme in the prior art has the disadvantages that it is difficult to discover the cross-subnet devices, which is not conducive to communication across the subnet devices.
The inventor of the application finds, through careful research, that Bonjour cannot work across subnets under conventional configuration, and if the purpose of spanning subnets needs to be achieved, very complex configuration needs to be performed on a gateway and internet of things equipment, which requires that a user has certain network configuration capability. Furthermore, in most scenarios, a user may not have the authority to configure the gateway device within the network in which the user is located.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
The NAT network herein may comprise one lan subnet or a plurality of lan subnets. The IP address network segments of the Internet of things equipment in the NAT network can be the same, namely the IP address of the Internet of things equipment is the same as the result of the phase comparison between the subnet mask and the subsequent phase, and at the moment, the Internet of things equipment in the NAT network can communicate by using multicast and broadcast frames; the IP address network segments of the Internet of things equipment in the NAT network can also be different, and at the moment, the Internet of things equipment in the NAT network cannot communicate by using multicast and broadcast frames.
For example, a walmart supermarket only has one exit gateway, all devices in the supermarket belong to a local area network (namely, the NAT network in the text), a supermarket commodity display area belongs to a sub-network a, and the network segment is 172.16.0.1/24; the supermarket office belongs to the sub-network B, and the network segment is 172.16.1.1/24; usually speaking, the sub-networks a and B belong to a large local area network, such as a walmart supermarket, but the network segments of the devices in the sub-networks a and B are different, and cannot communicate by multicast or broadcast.
The subnet herein refers to a local area network subnet, and the IP address network segments of the internet of things devices in each subnet are the same, that is, the IP address of the internet of things device is the same as the subnet mask phase and the subsequent result. Multicast and broadcast frames may be used for communication within the subnet.
A broadcast domain in this context is the notion of an abstracted set of devices in a computer network, and refers to the set of all IOT devices in the network that can receive broadcast frames from any device. Typically, the same switch internally belongs to the same broadcast domain. Multicast, broadcast cannot be spread across broadcast domains.
The NAT network in this context is essentially a local area network defined by the NAT device. There may be multiple switch isolated broadcast domains simultaneously within a NAT network. For example, a company has two large offices, each of which uses a switch, and the two switches are connected to the same egress gateway, and at this time, the company is said to have the same NAT network inside, and the two offices respectively belong to different broadcast domains; two devices within the same NAT network can establish an IP connection with each other.
Fig. 1 is a schematic diagram of a network structure according to an embodiment of the present invention. Referring to fig. 1, the network includes a NAT network 10 and an internet of things server 20. Each NAT network 10 can include a subnet 101, a subnet 102, and a local area network NAT device 103. The sub-network 101 includes a non-NAT device 1011 (shown as device 1011) and the sub-network 102 includes a non-NAT device 1021 (shown as device 1021). The NAT network 10 is connected to the internet of things server 20 through the internet 30 via a local area network NAT device 103.
Those skilled in the art will appreciate that in practical applications, the network 1 may include one or more internet of things servers 20, and each internet of things server 20 may be connected to a plurality of NAT networks 10. Each sub-network 101 or 102 may include a plurality of non-NAT devices 1021.
Fig. 2 is a flowchart illustrating a device discovery method according to an embodiment of the present invention. The Internet of things equipment discovery method can be used for an equipment side. Specifically, the network may include at least one internet of things device, where the internet of things device performs information transfer with the internet of things server, the internet of things device belongs to a sub-network, and the sub-network belongs to a NAT network. The method for discovering the equipment of the Internet of things comprises the following steps:
step S201: sending report information, wherein the report information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs to an Internet of things server;
step S202, receiving information of each device sent by the server of the Internet of things, and recording the information of each device to form a neighbor table of the NAT network so as to establish connection according to the neighbor table;
the equipment related to the equipment information belongs to the NAT network, and at least one piece of equipment related to the equipment information does not belong to the sub-network, wherein the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
More specifically, the internet of things device may establish a communication connection with the internet of things server. In a specific implementation, the internet of things device may establish a Message Queue Telemetry Transport (MQTT) connection with the internet of things server; or establishing TCP connection with the Internet of things server; or establishing UDP connection with the Internet of things server.
Then, in step S201, the internet of things device may report information. The internet of things device may be an internet of things device in any sub-network under the NAT network. In a non-limiting example, the internet of things device may send the report information to the internet of things server after joining a sub-network. The server of the internet of things can be connected with the NAT network through the internet and stores subnet information in the NAT network and equipment information contained in the subnet.
In an embodiment, the report information may include an IP address of a sub-network to which the internet-of-things device belongs and a NAT network to which the sub-network belongs. In a specific implementation, the reported information may include user account information associated with the internet of things device and an IP address of a sub-network to which the internet of things device belongs, where the user account information is used to identify the NAT network. The user account information can be regarded as a network identifier of the NAT network and represents the NAT network. For example, all internet of things devices under the same user account information are contained in the same NAT network. All the internet of things devices in the same NAT network can adopt the same user account information to represent the NAT network.
In another embodiment, the reported information may include, in addition to the IP address of the sub-network to which the internet of things device belongs and the NAT network to which the sub-network belongs, information or device attribute information associated with a device, such as a device type of the internet of things device, a device identifier of the internet of things device, and a mask of the sub-network to which the internet of things device belongs, which is not listed here.
For example, the internet of things device registers with the internet of things server, the message subject (topic) of the registration is "/DEVICES/register/pub", the information fields are { "msg _ id":1, "params": { "shop _ id": 0x01"," device _ type ": sumi _ printer", "device _ id"; "ab1234", "subnet _ ip": 192.168.1.100"," subnet _ map ": 255.255.255.0" }. The message identifier is represented by msg _ id, the params is represented by parameters of a message pointed by the message identifier, and the shop _ id is represented by user account information bound to the internet of things device, namely the NAT network; device _ type represents a device type, device _ id represents a device identifier, subnet _ IP represents an IP address of a subnet acquired by the Internet of things device, and subnet _ mask represents a subnet mask.
And then, after receiving the reported information of the Internet of things equipment, the Internet of things server can know the NAT network to which the Internet of things equipment belongs. The internet of things server can send each piece of equipment information in the NAT network to the internet of things equipment.
In one non-limiting example, each of the device information may include one or more of: network identification of the NAT network, device type, device identification, IP address of the sub-network and its mask. It should be noted that the NAT network identifier may be identified by user account information of the internet of things device.
In one non-limiting example, the internet of things server may send device information of all internet of things devices in all sub-networks within the NAT network to the internet of things devices.
In another non-limiting example, if the internet of things server can send, to the internet of things device, device information of all the internet of things devices in all the sub-networks in the NAT network except the internet of things device that sends the report information.
In another non-limiting example, if the internet of things server can distinguish the sub-network to which the internet of things device belongs from other sub-networks of non-belonging sub-networks, the internet of things server may not send the device information of the internet of things device in the same sub-network as the internet of things device in the NAT network, but only send the device information of the internet of things device included in other sub-networks in the NAT network, so as to reduce data transmission and save device energy consumption. And the other sub-networks refer to sub-networks in the NAT network except the sub-network to which the Internet of things equipment sending the reported information belongs.
In step S202, the internet of things device may receive information of each device sent by the internet of things server, and record the information of each device. For example, the internet of things server pushes two pieces of device information to the internet of things device, where one device type is sunmi _ printer, the intranet IP address of the device type is 192.168.1.100, and the other device type is sunmi _ pos, and the intranet IP address of the device type is 192.168.1.101. In a specific implementation, the device information sent by the internet-of-things server to the internet-of-things device may be "/DEVICES/neighbor _ update/sub", and the data fields are { "msg _ id":2, "params" [ { "shop _ id": 0x01"," device _ type ": sub _ printer", device _ id ";" ab1234"," subnet _ ip ": 192.168.1.100", "subnet _ mask": 255.255.255.255.0 "}, {" shop _ id ": 0x01", "device _ type": sub _ pos "," device _ id ";" cd5678"," subnet _ ip "192.168.1.101", "subnet _ mask" } 255.255.255.0.255.
The message identifier is represented by msg _ id, the params is represented by parameters of a message pointed by the message identifier, and the shop _ id is represented by user account information bound to the internet of things device, namely the NAT network; device _ type represents a device type, device _ id represents a device identifier, subnet _ IP represents an IP address of a subnet acquired by the Internet of things device, and subnet _ mask represents a subnet mask.
In one non-limiting embodiment, the internet of things device may have a neighbor table, which may be empty at initialization. After the internet of things equipment is added into the local area network subnet, the equipment information of other internet of things equipment in the local area network subnet where the internet of things equipment is located can be obtained through receiving and sending broadcast packets or multicast packets, and can be stored in the neighbor table.
In specific implementation, the neighbor table may record device information of other internet of things devices in the NAT network to which the internet of things device belongs. Specifically, the internet of things device may send a broadcast packet to a peripheral internet of things device after joining the sub-network. The broadcast packet may carry a device type and/or an IP address. The internet of things equipment can discover other internet of things equipment in the same sub-network by sending the broadcast packet. After discovering the other internet of things devices, the internet of things devices may record the related information of the other internet of things devices in the neighbor table.
Further, the internet of things device may send report information, and after receiving the device information sent by the internet of things server, the internet of things device may record the received device information of each internet of things device in the neighbor table, so as to establish a communication connection across subnets according to the neighbor table. Specifically, when a connection requirement exists, the internet of things device may directly establish a connection to an IP address of a corresponding device according to each device information recorded in the neighbor table.
In another non-limiting embodiment, the internet of things device may have a neighbor table, which may be empty at initialization. The internet of things equipment is used as the only equipment in the local area network subnet, and the equipment information of the rest internet of things equipment in the local area network subnet cannot be obtained even if the broadcast packet is sent. Further, the internet of things device may send report information, and after receiving the device information sent by the internet of things server, the internet of things device may record the received device information of each internet of things device in the neighbor table, so as to establish a communication connection across subnets according to the neighbor table. Specifically, when a connection requirement exists, the internet of things device may directly establish a connection to an IP address of a corresponding device according to each device information recorded in the neighbor table.
In a non-limiting example, a NAT network may include a plurality of subnets, each subnet including a plurality of internet of things devices, and the neighbor table may include device information of each internet of things device connected to an internet of things server in each subnet in the NAT network. The neighbor table may include: device identification of the internet of things device, NAT network identification, device type, IP address within the sub-network, subnet mask, etc. In a specific implementation, the NAT network identification is user account information. For example, it is assumed that the neighbor table includes 4 internet of things devices, and device information of the internet of things devices is specifically shown in table 1. The internet of things devices with the device identifiers 1, 4 and 7 belong to the same sub-network, the device identifier 2 belongs to another sub-network, and the internet of things devices belong to the same NAT network.
TABLE 1
Figure 660519DEST_PATH_IMAGE001
Fig. 3 is a flowchart illustrating another device discovery method according to an embodiment of the present invention. The Internet of things equipment discovery method can be applied to the server side. In a specific implementation, the network may include at least one internet of things server, and at least one NAT network controlled by the internet of things server, where the NAT network includes two or more sub-networks, and each sub-network includes at least one internet of things device. Specifically, referring to fig. 3, the method for discovering the internet of things device may include the following steps:
step S301: receiving reported information of the Internet of things equipment, wherein the reported information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs;
step S302: and issuing equipment information belonging to the NAT network to the Internet of things equipment so that the Internet of things equipment records the equipment information to form a neighbor table of the NAT network and establishes connection according to the neighbor table.
The equipment information-associated Internet of things equipment belongs to the NAT network, at least one piece of equipment information-associated Internet of things equipment does not belong to the sub-network, and the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
Specifically, before receiving the report information of the device, the internet of things server may establish a communication connection with the internet of things device. In a specific implementation, the internet of things server may establish an MQTT connection with the internet of things device; or the internet of things server may establish a TCP connection with the internet of things device; or the internet of things server may establish a UDP connection with the internet of things device.
Then, in step S301, the internet of things server may receive the report information of the internet of things device. The reported information may include an IP address of a sub-network to which the internet of things device belongs and an NAT network to which the sub-network belongs.
In a non-limiting example, the reported information of the internet of things device may include user account information associated with the internet of things device and an IP address of the sub-network. The user account information may be used to represent the NAT network, and the user account information is used to identify the NAT network.
In step S302, the internet of things server may issue, to the internet of things device, information of each device belonging to the NAT network, so that the internet of things device records the information of each device to form a neighbor table of the NAT network, and establishes a communication connection with the internet of things device according to the neighbor table.
In one embodiment, the device information may include one or more of: the method comprises the steps of obtaining an IP address and a mask of a sub-network to which the Internet of things equipment belongs, an NAT network identifier to which the sub-network belongs, the equipment type of the Internet of things equipment and the equipment identifier of the Internet of things equipment. It should be noted that the NAT network identifier may be represented by user account information of the internet of things device.
Those skilled in the art understand that the steps S301 to S302 can be regarded as execution steps corresponding to the steps S201 to S202 described in the above embodiment shown in fig. 2, and the two steps are complementary in terms of specific implementation principle and logic. Therefore, for the device discovery method on the server side, reference may be made to the related description of the embodiment shown in fig. 2, which is not described herein again.
A specific flow of the device discovery method according to the embodiment of the present invention is described below by taking a typical application scenario as an example.
In a typical application scenario, for an internet of things device, firstly, in the same subnet, the internet of things device may discover each other in a UDP broadcast manner. Specifically, after entering the local area network, the device a may send a broadcast probe message discovery request (discovery request) of 255.255.255.255.255 by using a UDP protocol, where the broadcast probe message discovery request may carry information such as a device type and/or an IP address of the device a itself.
For other internet of things devices in the same subnet, after receiving the broadcast detection message discovery request, a discovery response (discovery response) message may be replied to device a, where the discovery response message may carry information such as a device type and/or an IP address of the device itself. Each of the other devices may further record device information, such as an IP address and/or a device type of the device a, and the device information may be recorded in a neighbor table of the other device. Similarly, each other device may obtain information of other devices in the same subnet in the same or similar manner, and may further form a neighbor table on all devices in the entire subnet. At this time, the neighbor table only contains the device information of the internet of things devices in the same subnet.
Further, for the case of crossing subnets, accounts can be bound for the internet of things devices in advance, and it is ensured that all the internet of things devices under each account are in the same NAT network. If the condition is not met, the condition may be met by creating more associated sub-accounts.
Further, the internet of things equipment can establish MQTT connection with the internet of things server. When the internet of things equipment is connected and registered, the information such as the account information, the equipment type and the IP address of the internet of things equipment bound by the internet of things equipment can be transmitted to the internet of things server as the report information. The internet of things server stores the information of all connected internet of things equipment of the same account to form an equipment information table. And updating the equipment information table when new Internet of things equipment is registered through MQTT or connected Internet of things equipment is disconnected. And the internet of things server issues each piece of equipment information to each piece of internet of things equipment under the associated account in the form of an equipment information table.
Further, after the internet of things equipment is connected with the internet of things server for registration or re-registration, the equipment information table issued by the internet of things server and the existing neighbor table of the internet of things server are combined, the neighbor information of the whole network is updated and perfected, and the neighbor table of the equipment is also updated. The registered equipment can monitor the equipment information table issued by the server of the Internet of things at any time to update the neighbor table stored in the equipment information table. In this way, the devices in the whole network (e.g., NAT network) can store a complete neighbor table, and when there is a connection requirement, the connection can be directly established to the IP address of the corresponding device.
The technical personnel in the field understand that the internet of things equipment adopting the MQTT protocol informs the internet of things server by adopting a registered message every time the internet of things equipment is connected with the server online, and acquires various information files transmitted by the internet of things server.
Therefore, through the technical scheme provided by the embodiment of the invention, the devices among a plurality of subnetworks in the same NAT network can be mutually discovered and connected.
Fig. 4 is a schematic structural diagram of an internet of things device according to an embodiment of the present invention. The internet of things device may be applied to a terminal device side, and those skilled in the art understand that the embodiment of the present invention may be used to implement the technical solution of the method shown in fig. 2.
In a specific implementation, the internet of things device performs information transmission with the internet of things server, the internet of things device belongs to a sub-network, the sub-network belongs to a NAT network, and the internet of things device may include: a sending module 41, configured to send report information to an internet of things server, where the report information includes an IP address of a sub-network to which the internet of things device belongs and an NAT network to which the sub-network belongs; a receiving module 42, configured to receive information of each device sent by the internet of things server, and record the information of each device to form a neighbor table of the NAT network, so as to establish a connection according to the neighbor table; and the equipment related to the equipment information belongs to the NAT network, at least one piece of equipment related to the equipment information does not belong to the sub-network, and the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
For more contents of the working principle and the working mode of the internet of things device, reference may be made to the related description in fig. 2, which is not described herein again.
Fig. 5 is a schematic structural diagram of an internet of things server according to an embodiment of the present invention. The internet of things server may be applied to a server side, and those skilled in the art understand that the embodiment of the present invention may be used to implement the technical solution of the method shown in fig. 3.
In a specific implementation, the internet of things server controls at least one NAT network, and the NAT network comprises at least one sub-network, and each sub-network comprises at least one internet of things device.
In a specific implementation, the internet of things server may include: a receiving module 51, configured to receive report information of a device, where the report information includes an IP address of a sub-network to which the internet of things device belongs and an NAT network to which the sub-network belongs; the issuing module 52 is configured to issue each piece of device information belonging to the NAT network to the internet of things device, so that the internet of things device records each piece of device information to form a neighbor table of the NAT network, and establishes a connection with the internet of things device according to the neighbor table; the equipment related to the equipment information belongs to the NAT network, and at least one piece of equipment related to the equipment information does not belong to the sub-network, wherein the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
For more contents of the working principle and the working mode of the internet of things server, reference may be made to the related description in fig. 3, which is not described herein again.
Further, the embodiment of the present invention also discloses a storage medium, on which computer instructions are stored, and when the computer instructions are executed, the technical solutions of the methods in the embodiments shown in fig. 2 and fig. 3 are executed. Preferably, the storage medium may include a computer-readable storage medium. Preferably, the storage medium may include a computer-readable storage medium such as a non-volatile (non-volatile) memory or a non-transitory (non-transient) memory. The computer readable storage medium may include ROM, RAM, magnetic or optical disks, and the like.
Further, an embodiment of the present invention further discloses a terminal, which includes a memory and a processor, where the memory stores a computer instruction capable of running on the processor, and the processor executes the technical solution of the method in the embodiment shown in fig. 2 when running the computer instruction. Preferably, the terminal may be a personal computer, and may be a printer, a facsimile machine, or the like capable of wireless or wired communication.
Further, an embodiment of the present invention further discloses a server, which includes a memory and a processor, where the memory stores a computer instruction that can be executed on the processor, and the processor executes the technical solution of the method in the embodiment shown in fig. 3 when executing the computer instruction. Specifically, the server may be an internet of things server.
Although the present invention is disclosed above, the present invention is not limited thereto. Various changes and modifications may be effected therein by one skilled in the art without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (7)

1. A device discovery method is characterized by comprising at least one Internet of things device, wherein the Internet of things device is in information transfer with an Internet of things server, the Internet of things device belongs to a sub-network, the sub-network belongs to a NAT network, the NAT network comprises a plurality of sub-networks, and each sub-network comprises a plurality of Internet of things devices, and the method comprises the following steps:
establishing a message queue telemetry transmission protocol connection with the Internet of things server;
sending report information to the internet of things server, wherein the report information comprises an IP address of a sub-network to which the internet of things equipment belongs and an NAT network to which the sub-network belongs, and the report information also comprises user account information related to the internet of things equipment, wherein the user account information is used for identifying the NAT network, and the equipment information comprises a network identification of the NAT network, the IP address of the sub-network and a mask thereof;
receiving equipment information sent by the Internet of things server, recording the equipment information to form a neighbor table of the NAT network, and establishing connection according to the neighbor table, wherein the neighbor table comprises the equipment information of all Internet of things equipment which are connected with the Internet of things server in each sub-network in the NAT network;
the equipment information-associated Internet of things equipment belongs to the NAT network, at least one piece of equipment information-associated Internet of things equipment does not belong to the sub-network, and the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
2. The device discovery method of claim 1, wherein the device information further comprises one or more of: the device type and the device identification.
3. A device discovery method, comprising at least one Internet of things server and at least one NAT network controlled by the Internet of things server, wherein the NAT network comprises a plurality of sub-networks, and each sub-network comprises a plurality of Internet of things devices, the method comprising:
establishing message queue telemetry transmission protocol connection with the Internet of things equipment;
receiving report information of the internet of things equipment, wherein the report information comprises an IP address of a sub-network to which the internet of things equipment belongs and an NAT network to which the sub-network belongs, and the report information also comprises user account information related to the internet of things equipment, wherein the user account information is used for identifying the NAT network, and the equipment information comprises a network identification of the NAT network, the IP address of the sub-network and a mask thereof;
issuing equipment information belonging to the NAT network to the Internet of things equipment so that the Internet of things equipment records the equipment information to form a neighbor table of the NAT network and establishes connection according to the neighbor table, wherein the neighbor table comprises the equipment information of the Internet of things equipment which is connected with the Internet of things server in each sub-network in the NAT network;
the equipment related to the equipment information belongs to the NAT network, at least one piece of equipment related to the equipment information does not belong to the sub-network, and the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
4. The device discovery method of claim 3, wherein said device information further comprises one or more of: the device type and the device identification.
5. An internet of things device, wherein the internet of things device performs information transmission with an internet of things server, the internet of things device belongs to a sub-network, the sub-network belongs to an NAT network, wherein the NAT network includes a plurality of sub-networks, each sub-network includes a plurality of internet of things devices, the internet of things device includes:
means for establishing a message queue telemetry transport protocol connection with the internet of things server;
the system comprises a sending module and an Internet of things server, wherein the sending module is used for sending reported information to the Internet of things server, the reported information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs, and the reported information also comprises user account information related to the Internet of things equipment, the user account information is used for identifying the NAT network, and the equipment information comprises a network identification of the NAT network, the IP address of the sub-network and a mask thereof;
the receiving module is used for receiving all equipment information sent by the Internet of things server and recording all the equipment information to form a neighbor table of the NAT network so as to establish connection according to the neighbor table, and the neighbor table comprises the equipment information of all Internet of things equipment of which each subnet network in the NAT network is connected with the Internet of things server;
the equipment information-associated Internet of things equipment belongs to the NAT network, at least one piece of equipment information-associated Internet of things equipment does not belong to the sub-network, and the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
6. An internet of things server, the internet of things server controlling at least one NAT network, wherein the one NAT network includes a plurality of sub-networks, each sub-network including a plurality of internet of things devices, the internet of things server comprising:
means for establishing a message queue telemetry transport protocol connection with the Internet of things device;
the system comprises a receiving module and a processing module, wherein the receiving module is used for receiving reported information of the Internet of things equipment, the reported information comprises an IP address of a sub-network to which the Internet of things equipment belongs and an NAT network to which the sub-network belongs, and the reported information also comprises user account information related to the Internet of things equipment, the user account information is used for identifying the NAT network, and the equipment information comprises a network identification of the NAT network, the IP address of the sub-network and a mask thereof;
the issuing module is used for issuing equipment information belonging to the NAT network to the Internet of things equipment so that the Internet of things equipment records the equipment information to form a neighbor table of the NAT network and establishes connection according to the neighbor table, and the neighbor table comprises the equipment information of the Internet of things equipment which is connected with the Internet of things server in each sub-network in the NAT network;
the equipment related to the equipment information belongs to the NAT network, and at least one piece of equipment related to the equipment information does not belong to the sub-network, wherein the NAT network refers to a local area network formed by NAT equipment in an isolation mode.
7. A storage medium having stored thereon computer instructions, characterized in that the computer instructions are operative to perform the steps of the method of any one of claims 1 to 4.
CN201910821074.4A 2019-09-02 2019-09-02 Device discovery method, internet of things device and Internet of things server Active CN110635942B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910821074.4A CN110635942B (en) 2019-09-02 2019-09-02 Device discovery method, internet of things device and Internet of things server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910821074.4A CN110635942B (en) 2019-09-02 2019-09-02 Device discovery method, internet of things device and Internet of things server

Publications (2)

Publication Number Publication Date
CN110635942A CN110635942A (en) 2019-12-31
CN110635942B true CN110635942B (en) 2022-11-04

Family

ID=68969778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910821074.4A Active CN110635942B (en) 2019-09-02 2019-09-02 Device discovery method, internet of things device and Internet of things server

Country Status (1)

Country Link
CN (1) CN110635942B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114980302B (en) * 2021-07-21 2024-02-06 广州地铁集团有限公司 Method and system for access and management of equipment reverse integration and computer equipment
CN114679485A (en) * 2022-03-28 2022-06-28 深圳市思为软件技术有限公司 Network connection method and device
WO2023184263A1 (en) * 2022-03-30 2023-10-05 北京小米移动软件有限公司 Method and apparatus for establishing user datagram protocol (udp) transmission channel

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6393488B1 (en) * 1999-05-27 2002-05-21 3Com Corporation System and method for supporting internet protocol subnets with network address translators
CN101951597A (en) * 2010-08-13 2011-01-19 北京邮电大学 Method, device and system for communicating among different types of networks
CN103516567A (en) * 2012-06-26 2014-01-15 腾讯科技(深圳)有限公司 Method and system for equipment discovery and server
CN106453678A (en) * 2016-09-29 2017-02-22 北京东土科技股份有限公司 IP address allocation method and system
CN108200567A (en) * 2018-01-18 2018-06-22 浙江大华技术股份有限公司 A kind of method for discovering equipment and equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6393488B1 (en) * 1999-05-27 2002-05-21 3Com Corporation System and method for supporting internet protocol subnets with network address translators
CN101951597A (en) * 2010-08-13 2011-01-19 北京邮电大学 Method, device and system for communicating among different types of networks
CN103516567A (en) * 2012-06-26 2014-01-15 腾讯科技(深圳)有限公司 Method and system for equipment discovery and server
CN106453678A (en) * 2016-09-29 2017-02-22 北京东土科技股份有限公司 IP address allocation method and system
CN108200567A (en) * 2018-01-18 2018-06-22 浙江大华技术股份有限公司 A kind of method for discovering equipment and equipment

Also Published As

Publication number Publication date
CN110635942A (en) 2019-12-31

Similar Documents

Publication Publication Date Title
CN110635942B (en) Device discovery method, internet of things device and Internet of things server
US9798572B2 (en) Virtual machine migration method, switch, and virtual machine system
WO2018208295A1 (en) Iot device connectivity, discovery, and networking
WO2019184752A1 (en) Network device management method, apparatus and system
EP3854064B1 (en) Unique identities of endpoints across layer 3 networks
EP2252093B1 (en) Method for enabling mobility of client devices in large scale unified networks
EP2922246B1 (en) Method and data center network for cross-service zone communication
CN105144652A (en) Address resolution in software-defined networks
US10880380B2 (en) Synchronization of routing information in an edge system cluster
WO2018214809A1 (en) Message transmission method and device, and storage medium
CN110572808B (en) Bluetooth Mesh network system, establishing method, network distributor, equipment and medium
CN108123912B (en) Micro service system supporting P2P
EP2218214A1 (en) Network location service
CN112491638A (en) Tunnel BFD session establishment method and device
US20210367926A1 (en) Methods and Apparatus for Operating and Managing a Constrained Device within a Network
WO2015070763A1 (en) Self-establishing method and apparatus for x2 interface
CN116719868A (en) Network asset identification method, device and equipment
CN110753135A (en) IP address configuration method, configuration equipment and storage medium
CN109510751A (en) A kind of message forwarding method and routing device
EP3817341B1 (en) Bulk configuration of devices behind a network address translation device
US9763135B1 (en) Load balancing with mobile resources
JP6002642B2 (en) Communication node, network system, and device control method
EP3562101A1 (en) Bras management method, packet forwarding method, packet forwarding controller, and bras
US11546432B2 (en) Horizontal scaling for a software defined wide area network (SD-WAN)
US11778043B2 (en) Horizontal scaling for a software defined wide area network (SD-WAN)

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