CN114584496A - Device discovery method, device, client and storage medium - Google Patents

Device discovery method, device, client and storage medium Download PDF

Info

Publication number
CN114584496A
CN114584496A CN202210190538.8A CN202210190538A CN114584496A CN 114584496 A CN114584496 A CN 114584496A CN 202210190538 A CN202210190538 A CN 202210190538A CN 114584496 A CN114584496 A CN 114584496A
Authority
CN
China
Prior art keywords
address
message
equipment
discovery
searched
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.)
Pending
Application number
CN202210190538.8A
Other languages
Chinese (zh)
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.)
Hangzhou Lianji Technology Co ltd
Original Assignee
Hangzhou Lianji 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 Hangzhou Lianji Technology Co ltd filed Critical Hangzhou Lianji Technology Co ltd
Priority to CN202210190538.8A priority Critical patent/CN114584496A/en
Publication of CN114584496A publication Critical patent/CN114584496A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/12Network monitoring probes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/16Multipoint routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • 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/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The application belongs to the field of communication and provides a device discovery method, a device, a client and a storage medium. The method comprises the following steps: sending a discovery message in a multicast and/or broadcast mode, and monitoring a response message sent by equipment according to the discovery message; analyzing first equipment information included in the response message, and updating the first equipment information to a preset equipment information list; acquiring an IP address to be searched, matching the IP address to be searched with the first equipment information list, and determining an unmatched IP address; and unicast finding messages according to the unmatched IP addresses, and according to response messages of the equipment, determining second equipment information corresponding to the unmatched IP addresses and updating the second equipment information to the equipment information list. The first equipment information is acquired in a multicast and/or broadcast mode, and the requirement for accurately discovering the equipment information in the appointed IP range can be quickly and effectively met by combining the second equipment information acquired by unicast.

Description

Device discovery method, device, client and storage medium
Technical Field
The present application relates to the field of communications, and in particular, to a device discovery method, apparatus, client, and storage medium.
Background
In the security area, there may be thousands of devices in a network environment. These devices may exist in different network segments, and in daily device configuration or maintenance management, it is often necessary to search for or discover a device corresponding to an IP address. The current device lookup approach generally includes:
the method I comprises the following steps: based on an onvif (English is called Open Network Video Interface Forum, Chinese is called Open Network Video Interface Forum) Protocol, a proprietary Protocol of each manufacturer, multicasting and broadcasting UDP (User data Protocol, Chinese is called User data packet Protocol) discovery request messages, so that equipment receiving the discovery request messages unicasts UDP response messages, and a client or a server discovers equipment in a Network and then configures the equipment.
The second method comprises the following steps: the equipment terminal sends an ARP (Address Resolution Protocol) request packet to the server terminal, analyzes the IP Address of the server terminal from the response packet, and judges whether the equipment terminal and the server are in the same network segment according to the IP Address. If not, setting the self IP address, the gateway and the subnet mask, enabling the equipment end and the server end to be in the same network segment, then monitoring the server end onvif multicast packet, and if so, directly monitoring the server end onvif multicast packet to discover the equipment in the networking.
The third method comprises the following steps: the method comprises the steps of broadcasting RARP (English is called Reverse Address Protocol all the time, Chinese is called Reverse Address conversion Protocol all the time), receiving RARP response messages, and acquiring IP addresses of equipment of response message sending parties according to the RARP response messages.
The method can meet the device discovery requirement of general networking. However, when the gateway device partitions the VLANs, it typically masks the broadcast and multicast packets. Because the above-mentioned method relies on the gateway device to support multicast and/or broadcast, only the devices in the same network segment can be found, and the accurate discovery requirement of the devices in the group network after the VLAN is divided cannot be satisfied.
Disclosure of Invention
In view of this, embodiments of the present application provide a device discovery method, an apparatus, a client, and a storage medium, so as to solve the problem that, in the prior art, only devices in the same network segment can be discovered by relying on a gateway device to support multicast and/or broadcast, and the requirement for accurate discovery of devices in a network after a VLAN is divided cannot be met.
A first aspect of an embodiment of the present application provides a device discovery method, where the method includes:
sending a discovery message in a multicast and/or broadcast mode, and monitoring a response message sent by equipment according to the discovery message;
analyzing first equipment information included in the response message, and updating the first equipment information to a preset equipment information list;
acquiring an IP address to be searched, matching the IP address to be searched with the first equipment information list, and determining an unmatched IP address in the IP address to be searched;
and unicast discovery messages according to the unmatched IP addresses, and determine second equipment information corresponding to the unmatched IP addresses according to response messages of equipment to the unicast discovery messages, and update the second equipment information to the equipment information list.
With reference to the first aspect, in a first possible implementation manner of the first aspect, after updating the second device information to the device information list, the method further includes:
receiving an IP address modification instruction, wherein the IP address modification instruction comprises a modified new IP address;
broadcasting the ARP request comprising the new IP address to a local area network where the target equipment is located;
and when the message returned by the broadcast is not received within the preset time after the broadcast, sending an IP address updating message to the target equipment, wherein the IP address updating message is used for being analyzed by the target equipment and automatically modified into the new IP address.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, after broadcasting the ARP request that includes the new IP address to a local area network where the target device is located, the method further includes:
and when the message returned by the broadcast is received within the preset time length after the broadcast, updating the new IP address in the IP address modification instruction according to a preset new IP address updating rule and re-broadcasting the new IP address until the message returned by the broadcast is not received within the preset time length after the broadcast.
With reference to the first aspect of the first aspect or the second aspect of the first aspect, in a third possible implementation manner of the first aspect, the sending an IP address update packet to a target device includes:
acquiring the MAC address of the target equipment according to the equipment information list;
determining a gateway address and a subnet mask of the target device according to the new IP address;
and sending an address updating message comprising a new IP address, an MAC address, a gateway address and a subnet mask to the target equipment.
With reference to the first aspect, in a fourth possible implementation manner of the first aspect, the matching the to-be-searched IP address with the first device information list, and determining an unmatched IP address in the to-be-searched IP address includes:
acquiring a first IP address list in the first equipment information list;
matching the first IP address list with the IP addresses to be searched, and determining the IP addresses matched with the first IP address list in the IP addresses to be searched;
and filtering out matched IP addresses from the IP addresses to be searched to obtain the unmatched IP addresses after filtering.
With reference to the first aspect, in a fifth possible implementation manner of the first aspect, the sending the discovery packet in a multicast and/or broadcast manner includes:
receiving a key instruction to trigger the sending of the discovery message in a multicast and/or broadcast mode;
or, according to a preset trigger period, sending the discovery message in a multicast and/or broadcast mode by timing trigger;
based on the unmatched IP address unicast discovery message, the method comprises the following steps:
receiving a key instruction to trigger unicast discovery messages based on the unmatched IP addresses;
or, according to a preset trigger period, periodically triggering the unicast discovery message based on the unmatched IP address.
With reference to the first aspect, in a sixth possible implementation manner of the first aspect, the obtaining an IP address to be searched includes:
acquiring an IP address range input by a user;
and resolving the IP address range into non-repeated IP addresses to obtain the IP address to be searched.
A second aspect of embodiments of the present application provides an apparatus for device discovery, where the apparatus includes:
the first message receiving and sending unit is used for sending a discovery message in a multicast and/or broadcast mode and monitoring a response message sent by equipment according to the discovery message;
a first device information obtaining unit, configured to analyze first device information included in the response packet, and update the first device information to a preset device information list;
the second message receiving and sending unit is used for acquiring an IP address to be searched, matching the IP address to be searched with the first equipment information list and determining an unmatched IP address in the IP address to be searched;
and the second equipment information acquisition unit is used for unicasting a discovery message according to the unmatched IP address, determining second equipment information corresponding to the unmatched IP address according to a response message of equipment to the unicasting discovery message, and updating the second equipment information to the equipment information list.
A third aspect of embodiments of the present application provides a client, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method according to any one of the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, in which a computer program is stored, which, when executed by a processor, performs the steps of the method according to any one of the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that: the method and the device for finding the device information in the specified IP range can rapidly and effectively meet the requirement for accurately finding the device information in the specified IP range through the first device information and the second device information.
In addition, in a further implementation mode, when the IP address of the equipment is modified, the method can broadcast a new IP address in an ARP request mode, send an IP address updating message when a message returned by broadcasting is not received, and analyze the message through the target equipment, so that the automatic modification of the IP address of the target equipment is realized, the IP conflict caused by the repetition of the modified new IP address and the existing IP address in the local area network can be effectively avoided, and the communication reliability of the equipment after the IP is modified can be favorably ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic view of an implementation scenario of a device discovery method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of an implementation flow of a device discovery method provided in an embodiment of the present application;
fig. 3 is a schematic diagram of an implementation flow of modifying an IP address of a device according to an embodiment of the present application;
fig. 4 is a schematic diagram of a device discovery apparatus according to an embodiment of the present application;
fig. 5 is a schematic diagram of a client provided in an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
Fig. 1 is a schematic view of an implementation scenario of a device discovery method provided in an embodiment of the present application, as shown in fig. 1, in a network composed of a switch 0, a switch 1, and a switch 2, a computer 0, a computer 1, and a computer 2 are connected to the switch 0, a computer 3, a computer 4, and a computer 5 are connected to the switch 1, and the switch 0 and the switch 1 are connected through the switch 3. Wherein, the computer 0, the computer 1, the computer 3 and the computer 4 are configured to belong to the same Virtual Local Area Network (VLAN for short), and the computer 2 and the computer 5 are configured to belong to the same Virtual Local Area Network. When a device corresponding to a certain IP address or a certain IP address range in a network needs to be accurately discovered, if an onvif protocol or a proprietary protocol of each manufacturer is used, and device information is obtained by multicasting and broadcasting a UDP request packet, or sending an ARP request packet, or broadcasting a reverse address translation protocol request packet, the gateway device usually shields broadcast and multicast packets after the gateway device divides a VLAN. Communication among different VLANs cannot be realized in a multicast or broadcast mode, only equipment in the same network segment can be found, and the requirement for finding equipment information in a specified IP range cannot be met.
In order to solve the above problem, an embodiment of the present application provides a device discovery method. Fig. 2 is a schematic flow chart illustrating an implementation process of a device discovery method provided in an embodiment of the present application, where the method includes:
in S201, a discovery packet is sent in a multicast and/or broadcast manner, and a monitoring device sends a response packet according to the discovery packet.
The discovery packet described in this embodiment of the present application may include a discovery packet based on an onvif protocol, a discovery packet implemented by a UDP based on a vendor private protocol, or a discovery packet based on a two-layer ethernet transport protocol.
In a possible implementation, two threads may be started by a discovery module in an electronic device (such as a client) for discovering a device, for multicasting and broadcasting discovery messages based on an onvif protocol, respectively. The triggering mode of the client starting multicast and broadcasting discovery messages based on the onvif protocol can include triggering according to a key or triggering according to a preset triggering period. For example, the trigger period of the discovery packet in the network may be set correspondingly according to the device update period or the update habit. When the devices in the network are updated, the multicast and broadcast discovery messages can be triggered by keys.
In this embodiment of the present application, the multicast IP address based on the onvif protocol may be 239.255.255.250, and the port number may be 3702. The broadcast IP address based on the onvif protocol may be 255.255.255.255 and the port number may be 3702.
The discovery message based on the onvif protocol is not limited to be sent in a multicast and broadcast manner, and may also be sent in a multicast manner or in a broadcast manner.
Or, the client may also start another two threads through the discovery module, and broadcast the discovery packet implemented based on the UDP and the discovery packet based on the two-layer ethernet protocol based on the private protocol of each vendor. The IP address of the discovery message broadcast realized based on the UDP is 255.255.255.255, and the port number can be agreed by the client and the equipment end of each manufacturer; the MAC (Media Access Control Address in English and Media Access Control Address in Chinese) Address of the discovery message broadcast based on the two-layer Ethernet transmission protocol is FF: FF: FF: FF: FF, and the protocol type field in the Ethernet package can be agreed by respective manufacturers.
Correspondingly, the client starts to broadcast the discovery message realized based on the UDP and the triggering mode of the discovery message based on the two-layer ethernet protocol may include triggering according to a key or according to a preset triggering period. For example, the trigger period of the discovery packet in the network may be set correspondingly according to the device update period or the update habit. When the devices in the network are updated, the multicast and broadcast discovery messages can be triggered by keys.
In S202, the first device information included in the response packet is analyzed, and the first device information is updated to a preset device information list.
The discovery message monitoring module may be started at the device side, and the discovery message of the client side may be monitored by the discovery message monitoring module, where the discovery message includes a discovery message based on an onvif protocol, a multicast message and a broadcast message based on a manufacturer private protocol, and a unicast discovery message in S204.
When the discovery message monitoring module of the equipment end monitors the multicast and broadcast discovery messages of the client, the equipment end packages and responds to the relevant information of the equipment and sends the relevant information of the equipment to the client in a response message mode. The device-related information may include one or more items of information such as a device name, a device model, a device software version number, and device vendor information.
And the discovery module in the client receives and analyzes the response message. The client may analyze one or more items of information such as a device name, a device model, a device software version number, device manufacturer information, and the like in the device-related information, or may analyze an IP address of the device to obtain the first device information, in addition to the MAC address of the device.
When the client receives a response message returned by one or more equipment terminals, the response message can be analyzed to obtain one or more pieces of equipment information, and first equipment information is generated. The first device information discovered by multicast or broadcast may be updated or added to a preset device information list.
The device information list may be used to store device information discovered in the network, including a correspondence between an IP address and device-related information.
In S203, an IP address to be searched is obtained, the IP address to be searched is matched with the first device information list, and an unmatched IP address in the IP address to be searched is determined.
The IP address to be looked up may include one or more IP addresses. For example, an IP address range to be searched input by a user may be received, and the IP address range may be resolved into non-duplicate IP addresses included in the IP address range, so as to obtain the IP address to be searched. The IP address range may comprise a continuous range or may comprise a plurality of discontinuous ranges.
After the first device information is discovered by multicast and/or broadcast, the unmasked devices in the network may be discovered. In the discovered unmasked device, the unmasked device information in the IP address to be searched may be determined according to the parsed first device information. And through the multicast or broadcast mode, unmasked devices in the network, such as devices which do not mask multicast and broadcast through the VLAN, can be efficiently discovered.
Consider that there may be devices in the network that are screening multicast and broadcast that are not discovered. In order to accurately discover device information of a specified IP address in a network, a device discovery operation needs to be further performed. The method and the device can determine the IP address in the IP address to be searched and the matching information of the IP address in the first device information by matching the IP address to be searched with the first device information. And if the IP address in the IP address to be searched is matched with or the same as the IP address in the first equipment information, screening the IP address to be searched, or filtering the IP address. And after matching all the equipment information in the equipment information list with the IP address to be searched, obtaining an unmatched IP address obtained after filtering or screening is completed. Further discovery of device information corresponding to the unmatched IP address is required.
In S204, unicast a discovery message according to the unmatched IP address, and determine second device information corresponding to the unmatched IP address according to a response message of the device to the unicast discovery message, and update the second device information to the device information list.
After partial device information in the IP address to be searched is found in a multicast or broadcast mode, the discovery message is further unicast based on the unmatched IP address, so that the device end corresponding to the unmatched IP address can receive the discovery message unicast by the client.
The discovery module of the client may initiate a thread for each unmatched IP address to unicast discovery messages. For example, the onvif protocol based discovery message and the vendor protocol based discovery message may be unicast for each of the filtered unmatched IP addresses. The port number of the discovery packet unicast based on the onvif protocol is 3702, and the port numbers of the discovery packets unicast based on the respective vendor protocols may be agreed by the respective vendors.
When receiving a discovery message unicast by the client, a discovery message monitoring module of the device end packages and responds the relevant information of the device and sends the relevant information of the device to the client through a response message. The device-related information may include one or more of a device name, a device model number, a device software version number, and device vendor information.
The client discovery module waits for and analyzes the response message of the equipment terminal. The client discovery module may analyze the response messages to obtain second device information, where the second device information includes a device IP address of a device end that sends the response message, and one or more of a device MAC address, a device name, a device model, a device software version number, and device manufacturer information. The second device information may be added to a device information list of the client.
Based on the response message returned by the broadcast and/or multicast discovery message, the first device information of the unmasked device in the network can be discovered, the discovery message can be unicast to each unmatched IP address through IP address comparison, the second device information corresponding to the unmatched IP address is analyzed according to the returned response message, and the device information of the IP address to be searched can be accurately discovered by combining the first device information and the second device information without being influenced by the shielding of multicast and broadcast packets.
It can be understood that a main body executing the device discovery method in the embodiment of the present application may be a client, and may also be other electronic devices.
In the embodiment of the present application, after the updated device information list is obtained, the IP address of the device in the device information list may be automatically modified. The specific process may be as shown in fig. 3, and includes:
in S301, an IP address modification instruction is received, the IP address modification instruction including a modified new IP address.
In this embodiment of the application, the device that receives the IP address modification instruction may modify the IP address of any device in the device information list, that is, the target device, based on the modification instruction. For example, the IP address of the target device is modified from IP address a to IP address B.
The device receiving the IP address modification instruction may be determined according to the IP address of the target device. That is, according to the IP address of the target device, a device in the same local area network as the target device may be selected as the device that receives the IP address modification instruction.
Or, in a possible implementation manner, the IP address modification instruction may also be received by any device, and according to the IP address of the target device in the IP address modification instruction, a device in the same local area network as the target device is searched in a predetermined device information list, and the IP address modification instruction is sent to the searched device, or the IP address modification instruction is directly sent to the target device itself.
In S302, the ARP request including the new IP address is broadcast to the local area network where the target device is located.
Considering that a new device may be added to the local area network where the target device is located at any time, the ARP request including the new IP address may be broadcasted to all hosts in the local area network where the target device is located by ARP (collectively referred to as address resolution protocol in chinese) based on the received IP address modification instruction. The broadcast device of the broadcast is any device of the local area network where the target device is located, or may be the target device itself.
By broadcasting an ARP request including a new IP address to a local area network, it is possible to detect whether a device including the new IP address is present in the local area network. If the device corresponding to the new IP address is included, the message returned by the device corresponding to the new IP address may be received within a certain period of time after the ARP request is broadcast.
If the message returned by the device corresponding to the new IP address is received within the preset time period, the new IP address needs to be modified or updated. The new IP address may be updated according to a preset update rule. For example, the updating may be performed according to a predetermined adding rule, including, for example, adding a value each time, that is, selecting an IP address after the new IP address as the modified new IP address. For example, the new IP address is 192.168.1.1, and if the IP address conflicts with the IP address of the device in the local area network where the target device is located, it can be modified to 192.168.1.2.
After updating, the IP address may be compared with the IP address in the device information list to determine whether the modified new IP address exists in the local area network. If so, the new IP address can be further modified until the modified new IP address is different from the IP address of the device in the local area network where the target device is located.
The predetermined time duration may be determined according to the accuracy of determining whether there is an IP address conflict by a device in the local area network. Generally, the shorter the time, the lower the accuracy of the judgment, and the longer the time, the higher the accuracy of the judgment. The size of the predetermined length of time may be determined based on statistical data. To balance efficiency and accuracy, 2-4 seconds may typically be chosen.
In S303, when the message returned by the broadcast is not received within the predetermined time after the broadcast, an IP address update message is sent to the target device, where the IP address update message is used for being analyzed by the target device and automatically modified into the new IP address.
If the message returned by the broadcast is not received within the preset time, the local area network does not have the equipment conflicting with the new IP address, and the IP address updating message can be sent to the target equipment based on the two-layer Ethernet transmission protocol. After receiving the IP address update packet, the target device may obtain information, such as a new IP address, an MAC address, a gateway address, and a subnet mask, included in the IP address update packet by parsing. Based on the parsed information, the target device automatically performs an update of the IP address.
The MAC address in the IP address update message may be found in the device information list obtained by the method shown in fig. 1, and the gateway address and the subnet mask may be obtained based on the new IP address. For example, if the new IP address is 192.168.1.1, the gateway address may be 192.168.1.1, i.e., the first three values are unchanged, and the fourth value is 1. The subnet mask is typically fixed to 255.255.255.0.
In the method shown in fig. 3, when the IP address is updated, it is predetermined that the modified new IP address does not conflict with the IP address of the device in the local area network, so that the reliability of communication of the target device with the modified IP address can be effectively ensured.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Fig. 4 is a schematic diagram of an apparatus discovery device according to an embodiment of the present application, and as shown in fig. 3, the apparatus includes:
a first message transceiver unit 401, configured to send a discovery message in a multicast and/or broadcast manner, and monitor a response message sent by a device according to the discovery message;
a first device information obtaining unit 402, configured to analyze first device information included in the response packet, and update the first device information to a preset device information list;
a second message transceiving unit 403, configured to acquire an IP address to be searched, match the IP address to be searched with the first device information list, and determine an unmatched IP address in the IP address to be searched;
a second device information obtaining unit 404, configured to unicast a discovery packet according to the unmatched IP address, determine, according to a response packet of a device to the unicast discovery packet, second device information corresponding to the unmatched IP address, and update the second device information to the device information list.
The device discovery apparatus shown in fig. 4 corresponds to the device discovery method shown in fig. 2.
Fig. 5 is a schematic diagram of a client according to an embodiment of the present application. As shown in fig. 5, the client 5 of this embodiment includes: a processor 50, a memory 51 and a computer program 52, such as a client program, stored in said memory 51 and executable on said processor 50. The processor 50 implements the steps in the various client method embodiments described above when executing the computer program 52. Alternatively, the processor 50 implements the functions of the modules/units in the above-described device embodiments when executing the computer program 52.
Illustratively, the computer program 52 may be partitioned into one or more modules/units, which are stored in the memory 51 and executed by the processor 50 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 52 in the client 5.
The client may include, but is not limited to, a processor 50, a memory 51. Those skilled in the art will appreciate that fig. 5 is merely an example of a client 5 and does not constitute a limitation of client 5, and may include more or fewer components than shown, or some components in combination, or different components, e.g., the client may also include input-output devices, network access devices, buses, etc.
The Processor 50 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the client 5, such as a hard disk or a memory of the client 5. The memory 51 may also be an external storage device of the client 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the client 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the client 5. The memory 51 is used for storing the computer program and other programs and data required by the client. The memory 51 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of the methods described above can be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media which may not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method of device discovery, the method comprising:
sending a discovery message in a multicast and/or broadcast mode, and monitoring a response message sent by equipment according to the discovery message;
analyzing first equipment information included in the response message, and updating the first equipment information to a preset equipment information list;
acquiring an IP address to be searched, matching the IP address to be searched with the first equipment information list, and determining an unmatched IP address in the IP address to be searched;
and unicast discovery messages according to the unmatched IP addresses, and determine second equipment information corresponding to the unmatched IP addresses according to response messages of equipment to the unicast discovery messages, and update the second equipment information to the equipment information list.
2. The method of claim 1, wherein after updating the second device information to the device information list, the method further comprises:
receiving an IP address modification instruction, wherein the IP address modification instruction comprises a modified new IP address;
broadcasting the ARP request comprising the new IP address to a local area network where the target equipment is located;
and when the message returned by the broadcast is not received within the preset time after the broadcast, sending an IP address updating message to the target equipment, wherein the IP address updating message is used for being analyzed by the target equipment and automatically modified into the new IP address.
3. The method of claim 2, wherein after broadcasting the ARP request including the new IP address to the local area network where the target device is located, the method further comprises:
and when the message returned by the broadcast is received within the preset time length after the broadcast, updating the new IP address in the IP address modification instruction according to a preset new IP address updating rule and re-broadcasting the new IP address until the message returned by the broadcast is not received within the preset time length after the broadcast.
4. The method of claim 2 or 3, wherein sending an IP address update message to the target device comprises:
acquiring the MAC address of the target equipment according to the equipment information list;
determining a gateway address and a subnet mask of the target device according to the new IP address;
and sending an address updating message comprising a new IP address, an MAC address, a gateway address and a subnet mask to the target equipment.
5. The method of claim 1, wherein matching the to-be-searched IP address with the first device information list and determining an unmatched IP address of the to-be-searched IP addresses comprises:
acquiring a first IP address list in the first equipment information list;
matching the first IP address list with the IP addresses to be searched, and determining the IP addresses matched with the first IP address list in the IP addresses to be searched;
and filtering out matched IP addresses from the IP addresses to be searched to obtain the unmatched IP addresses after filtering.
6. The method of claim 1, wherein transmitting the discovery message by multicast and/or broadcast comprises:
receiving a key instruction to trigger the sending of the discovery message in a multicast and/or broadcast mode;
or, according to a preset trigger period, sending the discovery message in a multicast and/or broadcast mode by timing trigger;
based on the unmatched IP address unicast discovery message, the method comprises the following steps:
receiving a key instruction to trigger unicast discovery messages based on the unmatched IP addresses;
or, according to a preset trigger period, periodically triggering the unicast discovery message based on the unmatched IP address.
7. The method of claim 1, wherein obtaining the IP address to be searched comprises:
acquiring an IP address range input by a user;
and resolving the IP address range into non-repeated IP addresses to obtain the IP address to be searched.
8. An apparatus for device discovery, the apparatus comprising:
the first message receiving and sending unit is used for sending a discovery message in a multicast and/or broadcast mode and monitoring a response message sent by equipment according to the discovery message;
a first device information obtaining unit, configured to analyze first device information included in the response packet, and update the first device information to a preset device information list;
the second message receiving and sending unit is used for acquiring an IP address to be searched, matching the IP address to be searched with the first equipment information list and determining an unmatched IP address in the IP address to be searched;
and the second equipment information acquisition unit is used for unicasting a discovery message according to the unmatched IP address, determining second equipment information corresponding to the unmatched IP address according to a response message of equipment to the unicasting discovery message, and updating the second equipment information to the equipment information list.
9. A client comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202210190538.8A 2022-02-28 2022-02-28 Device discovery method, device, client and storage medium Pending CN114584496A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210190538.8A CN114584496A (en) 2022-02-28 2022-02-28 Device discovery method, device, client and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210190538.8A CN114584496A (en) 2022-02-28 2022-02-28 Device discovery method, device, client and storage medium

Publications (1)

Publication Number Publication Date
CN114584496A true CN114584496A (en) 2022-06-03

Family

ID=81772491

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210190538.8A Pending CN114584496A (en) 2022-02-28 2022-02-28 Device discovery method, device, client and storage medium

Country Status (1)

Country Link
CN (1) CN114584496A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086271A (en) * 2022-06-17 2022-09-20 杭州云合智网技术有限公司 Method for searching equipment in local area network

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086271A (en) * 2022-06-17 2022-09-20 杭州云合智网技术有限公司 Method for searching equipment in local area network
CN115086271B (en) * 2022-06-17 2023-09-26 杭州云合智网技术有限公司 Method for searching equipment in local area network

Similar Documents

Publication Publication Date Title
CN110401568B (en) Network topology discovery method and equipment
US20070283045A1 (en) Method and apparatus for determining the switch port to which an end-node device is connected
CN111182659B (en) Mode switching method and mode switching device of Mesh equipment and Mesh equipment
US8189580B2 (en) Method for blocking host in IPv6 network
CN111865736B (en) Equipment control method and device
CN112654049B (en) Method, system, node and medium for configuring a wireless communication coverage extension system
US20210203591A1 (en) Method for determining route flapping information and related device
CN107204924B (en) Link discovery method and device
US20030018804A1 (en) Method and apparatus for deriving a standard MAC address from physical location
CN114584496A (en) Device discovery method, device, client and storage medium
CN114980273A (en) Wireless network configuration method and device, readable storage medium and terminal equipment
WO2003055180A1 (en) Address duplication detection in a network
CN107528929B (en) ARP (Address resolution protocol) entry processing method and device
CN111064825B (en) Method and device for realizing DPI data acquisition and control based on ARP
CN115242892B (en) Stream identifier acquisition method, device, equipment and medium
CN108989173B (en) Message transmission method and device
CN110505075B (en) Device management method and related device
CN116260726A (en) Topology discovery method, device, terminal and storage medium
CN115766252A (en) Flow abnormity detection method and device, electronic equipment and storage medium
CN112511440B (en) Message forwarding method, system, storage medium and electronic equipment
US8015314B1 (en) Method for configuring a network element having an unknown protocol address
CN112039792B (en) Network scanning scheduling method for avoiding congestion
US10938772B2 (en) Access device for analysis of physical links and method thereof
CN114584533A (en) Address conflict detection method, address conflict detection device and electronic equipment
CN112994932A (en) Automatic configuration method and device for network parameters of equipment in local area network and equipment

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