CN114079620B - Method and device for determining online state of network equipment - Google Patents

Method and device for determining online state of network equipment Download PDF

Info

Publication number
CN114079620B
CN114079620B CN202010781465.0A CN202010781465A CN114079620B CN 114079620 B CN114079620 B CN 114079620B CN 202010781465 A CN202010781465 A CN 202010781465A CN 114079620 B CN114079620 B CN 114079620B
Authority
CN
China
Prior art keywords
detection
sending
address
packet
function library
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
CN202010781465.0A
Other languages
Chinese (zh)
Other versions
CN114079620A (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.)
Bnc Technologies Co ltd
Original Assignee
Bnc Technologies 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 Bnc Technologies Co ltd filed Critical Bnc Technologies Co ltd
Priority to CN202010781465.0A priority Critical patent/CN114079620B/en
Publication of CN114079620A publication Critical patent/CN114079620A/en
Application granted granted Critical
Publication of CN114079620B publication Critical patent/CN114079620B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • 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/02Standardisation; Integration
    • H04L41/0213Standardised network management protocols, e.g. simple network management protocol [SNMP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method for determining the online state of network equipment, which comprises the following steps: under the condition that an instruction for detecting the online state of network equipment is received, acquiring a first IP address set of the network equipment; invoking a function library which is independently packaged based on an ICMP protocol, wherein the function library comprises configurable detection parameters, and the detection parameters comprise the detection timeout time length; according to the detection parameters and the first IP address set, sending detection packets to the network equipment corresponding to the first IP address set by a sending thread of the function library; receiving a response packet of the network device responding to the detection packet at a receiving thread of the function library; judging whether the executed time length of the current detection is greater than or equal to the detection timeout time length; and if the judgment result is yes, determining the online state of the network equipment according to the received response packet. The invention also discloses a device for determining the online state of the network equipment.

Description

Method and device for determining online state of network equipment
Technical Field
The invention relates to the technical field of the Internet of things, in particular to a method and a device for determining the online state of network equipment.
Background
With the continuous development and application of the internet of things technology, in platform type internet of things equipment management such as public cloud, private cloud and the like, for example, internet of things equipment management of home, company and group organization local area networks, equipment and equipment types based on an IP layer network protocol are more and more, and network deployment is more and more complex; how to quickly discover the online status of a network device becomes an increasingly urgent problem to be solved.
Currently, online states of internet of things devices are usually detected by means of ping tools of Windows and Linux, tenet tools, tracert tools, SNMP supported by standard devices, onvif protocols and the like; specifically, an application program for detecting the on-line state of equipment firstly acquires an IP address set corresponding to network equipment in a local area network, creates a thread pool and sets the number of working threads; and then calling a ping tool of the system, distributing an independent IP address and an independent working thread for each ping tool, operating equipment ping packet detection by each thread, waiting for equipment response, continuing to send ping packet detection to next equipment after the equipment response, and finally counting the equipment state after all detection tasks of the threads are executed.
In the related art, the online state of the network equipment is detected through a ping tool of the system, each thread can detect the next network equipment after waiting for the response of the network equipment, so that the detection time delay is long, the judgment time is long, the detection efficiency is low, the occupation of system hardware resources is large, and the detection requirement of online detection of a large number of network equipment cannot be met.
Disclosure of Invention
In view of the above, the present invention provides a method and apparatus for determining the online status of a network device, so as to solve the problems of long detection time delay, long judgment time, low detection efficiency, large occupation of system hardware resources, and inability to meet the requirement of online detection of a large number of network devices in the related art.
To achieve the above object, according to a first aspect of the present invention, a method for determining an online status of a network device includes:
under the condition that an instruction for detecting the online state of network equipment is received, acquiring a first IP address set of the network equipment;
invoking a function library which is independently packaged based on an ICMP protocol, wherein the function library comprises configurable detection parameters, and the detection parameters comprise the detection timeout time length;
according to the detection parameters and the first IP address set, sending detection packets to the network equipment corresponding to the first IP address set by a sending thread of the function library;
receiving a response packet of the network device responding to the detection packet at a receiving thread of the function library;
judging whether the executed time length of the current detection is greater than or equal to the detection timeout time length;
and if the judgment result is yes, determining the online state of the network equipment according to the received response packet.
In an alternative embodiment, before said obtaining the first set of IP addresses of the network device, the method further comprises:
based on the ICMP protocol, a library of individually packaged functions comprising at least one of the following configurable probe parameters:
detecting a first IP address set, the number of sending threads, the number of receiving threads, the time interval for sending the detection packet, the first times for sending the detection packet aiming at the same IP address, the detection timeout time length and the detection packet size.
In an alternative embodiment, before said obtaining the first set of IP addresses of the network device, the method further comprises:
under the condition that a configuration instruction for the number of sending threads is received, configuring the number of the current probing sending threads of the independent packaging function library;
and sending, by the sending thread of the function library, a probe packet to the network device corresponding to the first IP address set according to the probe parameter and the first IP address set, where the sending thread includes:
dividing the first IP address set in equal quantity according to the number of the sending threads to obtain a plurality of equal quantity second IP address sets, and simultaneously designating a unique sending thread for each second IP address set;
and sending the detection packet to the network equipment corresponding to the corresponding second IP address set by the specified unique sending thread of the function library.
In an alternative embodiment, before said obtaining the first set of IP addresses of the network device, the method further comprises:
configuring the independent encapsulation function library to transmit the first number of the probe packets for each of the IP addresses under the condition that a configuration instruction for transmitting the first number of the probe packets for the same IP address is received;
before the judging whether the executed time length of the current detection is greater than or equal to the detection timeout time length, the method further comprises:
judging whether the second times of sending the detection packet aiming at the network equipment corresponding to the current IP address is smaller than the first times;
if the judgment result is yes, determining whether the network equipment corresponding to the IP address responds to the detection packet or not according to the response packet received by the receiving thread;
and under the condition that the network equipment corresponding to the current IP address does not respond to the detection packet, continuing to send the detection packet to the network equipment corresponding to the current IP address by the sending thread until the second time is equal to the first time.
In an alternative embodiment, the receiving, at the receiving thread of the function library, a reply packet that the network device responds to the probe packet includes:
and under the condition that the receiving thread receives the response packet, recording the IP address corresponding to the response packet and the response time of the IP address.
According to a second aspect of the present invention, there is provided a device for determining the presence status of a network device, including:
the acquisition module is used for acquiring a first IP address set of the network equipment under the condition of receiving an instruction for detecting the online state of the network equipment;
the calling module is used for calling a function library which is independently packaged based on the ICMP protocol, wherein the function library comprises configurable detection parameters, and the detection parameters comprise the detection timeout time length;
the sending module is used for sending a detection packet to the network equipment corresponding to the first IP address set at a sending thread of the function library according to the detection parameter and the first IP address set;
the receiving module is used for receiving a response packet of the network equipment responding to the detection packet at a receiving thread of the function library;
the first judging module is used for judging whether the executed time length of the detection is greater than or equal to the detection timeout time length;
and the first determining module is used for determining the online state of the network equipment according to the received response packet under the condition that the judging result is yes.
In an alternative embodiment, the apparatus further comprises:
the packaging module is used for independently packaging a function library based on the ICMP protocol, and the function library of independent packaging comprises at least one of the following configurable detection parameters:
detecting a first IP address set, the number of sending threads, the number of receiving threads, the time interval for sending the detection packet, the first times for sending the detection packet aiming at the same IP address, the detection timeout time length and the detection packet size.
In an alternative embodiment, the apparatus further comprises:
the first configuration module is used for configuring the number of the detection sending threads of the independent encapsulation function library under the condition that a configuration instruction for the number of the sending threads is received;
the sending module comprises:
the segmentation unit is used for equally segmenting the first IP address sets according to the number of the sending threads to obtain a plurality of equal second IP address sets, and simultaneously assigning a unique sending thread for each second IP set;
and sending the detection packet to the network equipment corresponding to the corresponding second IP address set by the specified unique sending thread of the function library.
In an alternative embodiment, the apparatus further comprises:
the second configuration module is used for configuring the independent encapsulation function library to send the first times of the probe packets for each IP address under the condition that a configuration instruction for sending the first times of the probe packets for the same IP address is received;
the second judging module is used for judging whether the second times of sending the detection packet aiming at the network equipment corresponding to the current IP address is smaller than the first times;
the second determining module is used for determining whether the network device corresponding to the current IP address responds to the detection packet according to the response packet received by the receiving thread when the judging result is yes;
and the sending module is further configured to, when the network device corresponding to the current IP address does not respond to the probe packet, continue sending the probe packet to the network device corresponding to the current IP address by the sending thread until the second number of times is equal to the first number of times.
In an alternative embodiment, the receiving module includes:
and the recording unit is used for recording the IP address corresponding to the response packet and the response time of the IP address under the condition that the receiving thread receives the response packet.
Compared with the prior art, the method and the device for determining the online state of the network equipment provided by the invention have the advantages that the ICMP protocol is used for independently encapsulating the function library, when the online state of the network equipment is detected, the independent encapsulating function library is called, the sending thread in the function library sends the detection packet to all network equipment needing to be detected at one time, and the receiving thread in the function library receives the response packet of the network equipment for responding to the detection packet; compared with the prior art that the sending thread can send the next detection packet after waiting for the response of the network equipment after sending one detection packet, the method and the device adopt the independent sending thread in the independent encapsulation function to send the detection packet without waiting for the response of the network equipment, can send the detection packet to all network equipment in batches at one time, save the detection time for detecting the network equipment, improve the detection efficiency, and solve the problems that the detection time delay of the network equipment is longer, the judgment time is long, the detection efficiency is low, and the detection requirement for detecting a large number of network equipment cannot be met in the related art.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures.
Fig. 1 is a flowchart of an implementation of a method for determining an online status of a network device according to an embodiment of the present invention;
fig. 2 is a flowchart of an implementation of a method for determining a presence status of a network device according to another embodiment of the present invention;
fig. 3 is a block diagram of a device for determining an online status of a network device according to an embodiment of the present invention;
FIG. 4 is a block diagram of a transmission module in an embodiment of the invention;
fig. 5 is a block diagram of a receiving module in an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
In the description of embodiments of the present invention, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
Fig. 1 is a flowchart of an implementation method for determining an online status of a network device according to an embodiment of the present invention.
Referring to fig. 1, the method for determining the online status of the network device according to the embodiment of the present invention may be applied to detecting the online status of the internet of things device in a public cloud, private cloud, home, company or group organization local area network, and may be specifically applied to electronic devices such as a computer, a notebook computer, a personal digital assistant, a PAD, etc.; the method comprises the following steps:
step 101, under the condition that an instruction for detecting the online state of the network equipment is received, acquiring a first IP address set of the network equipment.
Specifically, in the embodiment of the present invention, the detection of the online status of the network device may be an application program in the electronic device. After the application program is started, the testers perform asset entry of the whole network IP equipment, specifically, the IP addresses of all the Internet of things equipment in the local area network are entered, so that a first IP address set corresponding to all the network equipment in the local area network is formed. Specifically, in the embodiment of the present application, under the condition that a probe instruction for starting probing is received, an application program obtains a first IP address set of all network devices in a local area network.
Step 102, calling a function library independently packaged based on ICMP protocol.
The function library comprises configurable detection parameters, and the detection parameters comprise the detection timeout time length.
Specifically, the Internet control message protocol (Internet Control Message Protocol, ICMP) is a sub-protocol of the TCP/IP protocol family for passing control messages between IP hosts and routers. The control message refers to a message of the network itself such as a network is not connected, whether a host is reachable, whether a route is available, and the like. Specifically, the overall timeout length of the detection is a delay length for allowing the network device degree detection packets corresponding to all the current IP addresses to answer.
And step 103, according to the detection parameters and the first IP address set, sending a detection packet to the network equipment corresponding to the first IP address set by a sending thread of the function library.
Specifically, in the embodiment of the present invention, the size of the probe packet sent to the network device corresponding to each IP address may be the same, and the unit is Byte.
It should be noted that, in the embodiment of the present application, the probe packet may be sent to all network devices corresponding to the first IP address set at one time through a sending thread of the function library; in some possible examples, the probe packet may be sent with a partial IP address according to actual needs. For example, in some specific examples, the address sets of IPV4, IPV6 may be organized in advance and probe packets may be sent only to network devices corresponding to the address sets of IPV4, IPV 6. This is not particularly limited in the embodiment of the present invention.
Step 104, receiving a response packet of the network device responding to the probe packet at a receiving thread of the function library.
Specifically, in the embodiment of the present invention, the receiving thread and the sending thread of the function library are different threads and may be multiple but at least one of each thread, and after the network device receives the probe packet sent by the sending thread of the function library, the network device responds to the probe packet and returns a response packet. In particular, the reply packet may include an IP address of the corresponding network device and a response time of the network device to respond to the probe packet.
Step 105, judging whether the executed time length of the current detection is greater than or equal to the detection timeout time length.
Specifically, in the embodiment of the present invention, timing may be performed when a probe packet is sent, timing may be performed again when each response packet is received, and then all timings of the received response packets may be accumulated. The accumulated time is the executed time length of the current detection.
And step 106, if the judgment result is yes, determining the online state of the network equipment according to the received response packet.
Specifically, in the embodiment of the present invention, after the accumulated time length is greater than or equal to the probe timeout time length, no matter whether the reply packet can be further received later, the network device that does not respond or returns the reply packet after exceeding the probe timeout time length is regarded as not being online. In a specific example, a probe timeout length of 5s and 1000 network devices are taken as an example for illustration; and within the detection timeout time length of 5s, 800 network devices return response packets, and the other 200 network devices return response packets after exceeding 5s, so that the state of the 200 network devices returning the response packets after exceeding 5s is determined to be offline.
According to the method for determining the online state of the network equipment, the ICMP protocol is used for independently encapsulating the function library, when the online state of the network equipment is detected, the independent encapsulating function library is called, a sending thread in the function library sends detection packets to all network equipment needing detection at one time, and a receiving thread in the function library receives response packets of the network equipment responding to the detection packets; the detection packets are sent by adopting the independent sending threads in the independent packaging function, so that the detection packets can be sent to all network devices in batches at one time without waiting for the response of the network devices, the detection time for detecting the network devices is saved, and the detection efficiency is improved.
Fig. 2 is a flowchart of an implementation of a method for determining a presence status of a network device according to another embodiment of the present invention.
Based on the foregoing embodiments, referring to fig. 2, a method for determining an online status of a network device according to another embodiment of the present invention includes the following steps:
step 201, based on ICMP protocol, the function library is independently packaged.
Wherein the independently packaged function library comprises at least one of the following configurable probing parameters: detecting a first IP address set, the number of sending threads, the number of receiving threads, the time interval for sending the detection packet, the first times for sending the detection packet aiming at the same IP address, the detection timeout time length and the detection packet size.
Step 202, under the condition that a configuration instruction for the number of sending threads is received, configuring the number of the sending threads of the probing of the independent encapsulation function library.
Specifically, in the embodiment of the present invention, before detecting the network device, the number of sending threads and the number of receiving threads of the encapsulation function library may be configured; specifically, the number of sending threads and the number of receiving threads may be determined according to the number of network devices, the resource occupancy rate of a central processing unit (central processing unit, CPU) of the probe device, and the like.
Step 203, acquiring a first IP address set of the network device when a detection instruction for detecting the online state of the network device is received.
Step 204, calling a function library independently packaged based on ICMP protocol.
Step 205, dividing the first IP address set equally according to the number of the sending threads to obtain a plurality of second IP address sets equally, and simultaneously, assigning a unique sending thread to each second IP address set.
Specifically, in the present embodiment, the number of transmission threads is p, and Sn IP addresses in the first IP address set are taken as an example, and the second IP address set sr=sn/p.
And 206, transmitting the probe packet to the network equipment corresponding to the corresponding second IP address set at the specified unique transmission thread of the function library.
In the embodiment of the application, the plurality of sending threads are established, the first IP address set is split equally through the plurality of sending threads, and the detection packet is sent to the network device corresponding to the second IP address set in an equal amount in each sending thread, so that the sending efficiency of the detection packet is further improved, and the detection requirement for detecting network devices in a larger order of magnitude, such as millions, can be met.
Step 207, receiving, at a receiving thread of the function library, a reply packet of the network device responding to the probe packet.
Specifically, when the receiving thread receives the response packet, the IP address corresponding to the response packet and the response time of the IP address are recorded.
Step 208, determining whether the executed time length of the current detection is greater than or equal to the detection timeout time length.
Step 209, if the determination result is yes, determining the online state of the network device according to the received response packet.
In some optional implementations, the method for detecting the online status of the network device provided by the embodiment of the present invention further includes:
and under the condition that a configuration instruction for transmitting the first number of the probe packets for the same IP address is received, configuring the independent encapsulation function library to transmit the first number of the probe packets for each IP address.
Specifically, the network device corresponding to the same IP address may perform one-time detection or may perform multiple-time detection. When the number of probing for the same IP address is configured, the time interval of each probing, that is, the length of time interval for transmitting the probing packet to the same IP address may be also configured. In the embodiment of the invention, the specific length of the interval time is not limited.
And judging whether the second times of sending the detection packet aiming at the network equipment corresponding to the current IP address is smaller than the first times.
And if the judgment result is yes, determining whether the network equipment corresponding to the current IP address responds to the detection packet according to the response packet received by the receiving thread.
Specifically, when the number of times of sending the probe packet to the network device corresponding to a certain IP address is smaller than the first number of times, it may be first determined whether the IP address receiving thread receives the response packet responding to the IP address, and if the IP address has responded to the probe packet, the probe packet does not need to be sent to the IP address again, thereby greatly reducing the number of IP addresses for sending the probe packet again and improving the probe efficiency.
And under the condition that the network equipment corresponding to the current IP address does not respond to the detection packet, continuing to send the detection packet to the network equipment corresponding to the current IP address by the sending thread until the second time is equal to the first time.
Specifically, after the number of times of sending the probe packet to a certain IP address is equal to the first number of times, if a response packet of the IP address to the response of the probe packet is still not received, it is confirmed that the online state of the network device corresponding to the IP address is not online.
In some alternative examples, after receiving the reply packet, presence identification information may be added to the IP address to which the reply packet corresponds, where the presence identification information may include "1", "0", etc., where "1" may indicate presence and "0" may indicate absence. In some possible examples, the presence status identifying information may also be "Y", "N", where "Y" indicates presence and "N" indicates absence of presence.
In some possible examples, the method for determining the online status of a network device according to the embodiments of the present invention may further include configuring a time interval for sending a probe packet for each IP address, where the time interval may be configured according to actual needs, for example, 1ms, 3ms, 5ms, and so on; where 0ms is denoted as continuous transmission.
Fig. 3 is a block diagram of a device for determining an online status of a network device according to an embodiment of the present invention. Fig. 4 is a block diagram of a transmission module in an embodiment of the present invention. Fig. 5 is a block diagram of a receiving module in an embodiment of the present invention.
Based on the foregoing embodiments, referring to fig. 3 to 5, a device 30 for determining an online status of a network device according to an embodiment of the present invention includes:
an obtaining module 31, configured to obtain a first IP address set of a network device when an instruction for detecting an online state of the network device is received;
a calling module 32, configured to call a function library independently packaged based on an ICMP protocol, where the function library includes configurable detection parameters, and the detection parameters include a detection timeout time length;
a sending module 33, configured to send, according to the detection parameter in the function library called by the calling module 32 and the first IP address set acquired by the acquiring module 31, a detection packet to the network device corresponding to the first IP address set at a sending thread of the function library;
a receiving module 34, configured to receive, at the receiving thread of the function library called by the calling module 32, a reply packet that the network device responds to the probe packet of the sending module 33;
a first judging module 35, configured to judge whether the length of time that the current detection has been performed is greater than or equal to the detection timeout length;
the first determining module 36 is configured to determine, when the determination result of the first determining module 35 is yes, an online state of the network device according to the response packet received by the receiving module 34.
In an alternative example, the apparatus 30 further includes:
encapsulation module 37 for independently encapsulating a library of functions based on ICMP protocol, said library of functions comprising at least one of the following configurable probing parameters: detecting a first IP address set, the number of sending threads, the number of receiving threads, the time interval for sending the detection packet, the first times for sending the detection packet aiming at the same IP address, the detection timeout time length and the detection packet size.
In an alternative example, the apparatus 30 further includes:
a first configuration module 38, configured to configure the number of current probing sending threads of the independent encapsulation function library when receiving a configuration instruction for the number of sending threads;
the transmitting module 33 includes:
the splitting unit 331 is configured to split the first IP address sets equally according to the number of the sending threads configured by the first configuration module 38, to obtain a plurality of second IP address sets with equal amounts, and simultaneously designate a unique sending thread for each second IP address set;
and the sub-sending unit 332 sends the probe packet to the network device corresponding to the second IP address set split by the corresponding splitting unit 331 in the specified unique sending thread of the function library.
In an alternative, the apparatus 30 further comprises:
a second configuration module 39, configured to configure the independent encapsulation function library to send the first number of times of the probe packet for each of the IP addresses, when receiving a configuration instruction to send the first number of times of the probe packet for the same IP address;
a second determining module 310, configured to determine whether a second number of times of sending the probe packet for the network device corresponding to the current IP address is smaller than the first number of times configured by the second configuring module 39;
a second determining module 311, configured to determine, according to the response packet received by the receiving thread, whether a network device corresponding to the current IP address responds to the probe packet if the determination result of the second determining module 310 is yes;
the sending module 33 is further configured to, when the second determining module 311 determines that the network device corresponding to the current IP address does not respond to the probe packet, continue sending, by the sending thread, the probe packet to the network device corresponding to the current IP address until the second number of times is equal to the first number of times.
In one alternative, the receiving module 34 includes:
and a recording unit 341, configured to record, when the receiving thread receives the response packet, an IP address corresponding to the response packet and a response time of the IP address.
It should be noted that the embodiments of the apparatus and the method embodiments of the present application have the same or similar technical effects, and the description of this embodiment is omitted.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not described in detail herein.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a method and apparatus for determining the presence of a network device according to embodiments of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (e.g., a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program embodying the present invention may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.

Claims (6)

1. A method for determining the presence status of a network device, comprising:
based on the ICMP protocol, a library of individually packaged functions comprising at least one of the following configurable probe parameters:
detecting a first IP address set, the number of sending threads, the number of receiving threads, the time interval for sending the detection packet, the first times for sending the detection packet aiming at the same IP address, the detection timeout time length and the detection packet size;
in the case of receiving an instruction for detecting the online state of the network device, acquiring a first IP address set of the network device, and before the acquiring the first IP address set of the network device, the method further includes: under the condition that a configuration instruction for the number of sending threads is received, configuring the number of the current probing sending threads of the independent packaging function library;
invoking a function library which is independently packaged based on an ICMP protocol, wherein the function library comprises configurable detection parameters, and the detection parameters comprise the detection timeout time length;
according to the detection parameter and the first IP address set, sending, by a sending thread of the function library, a detection packet to the network device corresponding to the first IP address set, where according to the detection parameter and the first IP address set, sending, by the sending thread of the function library, the detection packet to the network device corresponding to the first IP address set includes: dividing the first IP address set in equal quantity according to the number of the sending threads to obtain a plurality of equal quantity second IP address sets, and simultaneously designating a unique sending thread for each second IP address set; transmitting the detection packet to the network equipment corresponding to the corresponding second IP address set at the specified unique transmission thread of the function library;
receiving a response packet of the network device responding to the detection packet at a receiving thread of the function library;
judging whether the executed time length of the current detection is greater than or equal to the detection timeout time length;
and if the judgment result is yes, determining the online state of the network equipment according to the received response packet.
2. The method of claim 1, wherein prior to the obtaining the first set of IP addresses for the network device, the method further comprises:
configuring the independent encapsulation function library to transmit the first number of the probe packets for each of the IP addresses under the condition that a configuration instruction for transmitting the first number of the probe packets for the same IP address is received;
before the judging whether the executed time length of the current detection is greater than or equal to the detection timeout time length, the method further comprises:
judging whether the second times of sending the detection packet aiming at the network equipment corresponding to the current IP address is smaller than the first times;
if the judgment result is yes, determining whether the network equipment corresponding to the IP address responds to the detection packet or not according to the response packet received by the receiving thread;
and under the condition that the network equipment corresponding to the current IP address does not respond to the detection packet, continuing to send the detection packet to the network equipment corresponding to the current IP address by the sending thread until the second time is equal to the first time.
3. The method according to any of claims 1-2, wherein the receiving, at the receiving thread of the function library, a reply packet that the network device responds to the probe packet comprises:
and under the condition that the receiving thread receives the response packet, recording the IP address corresponding to the response packet and the response time of the IP address.
4. A device for determining the presence status of a network device, comprising:
the packaging module is used for independently packaging a function library based on the ICMP protocol, and the function library of independent packaging comprises at least one of the following configurable detection parameters:
detecting a first IP address set, the number of sending threads, the number of receiving threads, the time interval for sending the detection packet, the first times for sending the detection packet aiming at the same IP address, the detection timeout time length and the detection packet size;
the device comprises an acquisition module, a detection module and a control module, wherein the acquisition module is used for acquiring a first IP address set of the network equipment under the condition of receiving an instruction for detecting the online state of the network equipment, and before acquiring the first IP address set of the network equipment, the device further comprises: the first configuration module is used for configuring the number of the detection sending threads of the independent encapsulation function library under the condition that a configuration instruction for the number of the sending threads is received;
the calling module is used for calling a function library which is independently packaged based on the ICMP protocol, wherein the function library comprises configurable detection parameters, and the detection parameters comprise the detection timeout time length;
a sending module, configured to send, according to the probe parameter and the first IP address set, a probe packet to the network device corresponding to the first IP address set at a sending thread of the function library, where the sending module includes: the segmentation unit is used for equally segmenting the first IP address sets according to the number of the sending threads to obtain a plurality of equal second IP address sets, and simultaneously assigning a unique sending thread for each second IP address set; a sub-sending unit, configured to send the probe packet to a network device corresponding to the second IP address set corresponding to the specified unique sending thread of the function library;
the receiving module is used for receiving a response packet of the network equipment responding to the detection packet at a receiving thread of the function library;
the first judging module is used for judging whether the executed time length of the detection is greater than or equal to the detection timeout time length;
and the first determining module is used for determining the online state of the network equipment according to the received response packet under the condition that the judging result is yes.
5. The apparatus of claim 4, wherein the apparatus further comprises:
the second configuration module is used for configuring the independent encapsulation function library to send the first times of the probe packets for each IP address under the condition that a configuration instruction for sending the first times of the probe packets for the same IP address is received;
the second judging module is used for judging whether the second times of sending the detection packet aiming at the network equipment corresponding to the current IP address is smaller than the first times;
the second determining module is used for determining whether the network device corresponding to the current IP address responds to the detection packet according to the response packet received by the receiving thread when the judging result is yes;
and the sending module is further configured to, when the network device corresponding to the current IP address does not respond to the probe packet, continue sending the probe packet to the network device corresponding to the current IP address by the sending thread until the second number of times is equal to the first number of times.
6. The apparatus of any of claims 4-5, wherein the receiving module comprises:
and the recording unit is used for recording the IP address corresponding to the response packet and the response time of the IP address under the condition that the receiving thread receives the response packet.
CN202010781465.0A 2020-08-06 2020-08-06 Method and device for determining online state of network equipment Active CN114079620B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010781465.0A CN114079620B (en) 2020-08-06 2020-08-06 Method and device for determining online state of network equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010781465.0A CN114079620B (en) 2020-08-06 2020-08-06 Method and device for determining online state of network equipment

Publications (2)

Publication Number Publication Date
CN114079620A CN114079620A (en) 2022-02-22
CN114079620B true CN114079620B (en) 2024-02-27

Family

ID=80279592

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010781465.0A Active CN114079620B (en) 2020-08-06 2020-08-06 Method and device for determining online state of network equipment

Country Status (1)

Country Link
CN (1) CN114079620B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102098188A (en) * 2011-01-11 2011-06-15 深圳创维-Rgb电子有限公司 Method and system for detecting IP (Internet Protocol) connection
CN104468781A (en) * 2014-12-05 2015-03-25 谢勇 Network device fast searching system having filtering function and method
WO2015070614A1 (en) * 2013-11-13 2015-05-21 中兴通讯股份有限公司 Method and device for detecting connectivity of user side interfaces of l2vpn
CN104980319A (en) * 2015-06-25 2015-10-14 中国人民解放军理工大学 Serial-parallel combination efficient multi-target IP end performance monitoring and scheduling method
WO2016082588A1 (en) * 2014-11-26 2016-06-02 中兴通讯股份有限公司 Link connectivity checking method and apparatus
CN106559288A (en) * 2016-11-23 2017-04-05 北京航天自动控制研究所 A kind of quick fault testing method based on icmp packet
CN107733976A (en) * 2017-08-31 2018-02-23 国网安徽省电力公司芜湖供电公司 A kind of dispatching method for being used to gather grid automation operation system state
CN108777640A (en) * 2018-06-04 2018-11-09 腾讯科技(深圳)有限公司 A kind of server detection method, device, system and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102098188A (en) * 2011-01-11 2011-06-15 深圳创维-Rgb电子有限公司 Method and system for detecting IP (Internet Protocol) connection
WO2015070614A1 (en) * 2013-11-13 2015-05-21 中兴通讯股份有限公司 Method and device for detecting connectivity of user side interfaces of l2vpn
WO2016082588A1 (en) * 2014-11-26 2016-06-02 中兴通讯股份有限公司 Link connectivity checking method and apparatus
CN104468781A (en) * 2014-12-05 2015-03-25 谢勇 Network device fast searching system having filtering function and method
CN104980319A (en) * 2015-06-25 2015-10-14 中国人民解放军理工大学 Serial-parallel combination efficient multi-target IP end performance monitoring and scheduling method
CN106559288A (en) * 2016-11-23 2017-04-05 北京航天自动控制研究所 A kind of quick fault testing method based on icmp packet
CN107733976A (en) * 2017-08-31 2018-02-23 国网安徽省电力公司芜湖供电公司 A kind of dispatching method for being used to gather grid automation operation system state
CN108777640A (en) * 2018-06-04 2018-11-09 腾讯科技(深圳)有限公司 A kind of server detection method, device, system and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《安阳师范学院学报》;王天林,王瑞庆;《PB 环境下利用ICMP 函数实现网络连通测试》;20041030;第65-66页 *

Also Published As

Publication number Publication date
CN114079620A (en) 2022-02-22

Similar Documents

Publication Publication Date Title
CN110445770B (en) Network attack source positioning and protecting method, electronic equipment and computer storage medium
EP2201738B1 (en) Router detection
CN108268328B (en) Data processing device and computer
CN111431758B (en) Cloud network equipment testing method and device, storage medium and computer equipment
CN108924005B (en) Network detection method, network detection apparatus, medium, and device
CN107547505A (en) A kind of message processing method and device
CN111917682B (en) Access behavior identification method, performance detection method, device, equipment and system
CN108429703B (en) DHCP client-side online method and device
CN114079620B (en) Method and device for determining online state of network equipment
EP3097662B1 (en) Methods, systems and computer readable media for testing network devices using simulated application traffic
CN109639555B (en) Link layer message generation method, link layer message generation device and terminal equipment
CN111371668A (en) Periodic transmission method, device, equipment and storage medium based on gratuitous ARP
CN109302390A (en) A kind of leak detection method and device
CN105763347A (en) Method for obtaining parameter, network equipment and system
CN112152927B (en) Message forwarding method, system, network card and storage medium
CN114095398A (en) Method and device for determining detection time delay, electronic equipment and storage medium
CN111614790B (en) Virtual machine address configuration system, method and device
CN115242693A (en) Network detection method, device, equipment and storage medium
CN105516017A (en) Directed acceleration method and device, and terminal equipment
US20160020971A1 (en) Node information detection apparatus, node information detection method, and program
CN106888198B (en) A kind of configuration method of Packet Filtering rule, apparatus and system
CN116260855B (en) Communication method, communication device, electronic equipment and storage medium
CN113708984B (en) Network quality detection method, device, computing equipment and computer storage medium
CN111443683B (en) Electronic control unit testing method and device based on vehicle CAN bus structure
CN110147344B (en) Method, apparatus, storage medium, and system for communicating between multiple physical machines

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