DHCP (Dynamic Host Configuration Protocol) service detection method and device, electronic equipment and storage medium

By sending detection messages to the LAN and receiving response messages, a verification packet is constructed to detect the response status of the DHCP service, the problem of DHCP service failure detection is solved, and the timely discovery and resolution of network problems is achieved.

CN119835193AActive Publication Date: 2025-04-15CHINA TELECOM CLOUD TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411731214.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-04-15
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

The prior art is difficult to effectively detect whether DHCP services have faults, affecting the normal operation and management of the network.

Method used

By sending a probe message to the local area network, receiving a first response message, and sending a request message to the first server based on the response message, receiving a second response message, constructing a verification data packet, sending and receiving a target response message to determine the response status of the target server.

Benefits of technology

This method can simulate real network requests, detect and solve potential network problems in a timely manner by detecting the server's response status, and ensure that all devices can connect to the network normally and communicate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119835193A_ABST
    Figure CN119835193A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of network communication, and discloses a DHCP service detection method and device, electronic equipment and a storage medium, and the method comprises the steps: sending a detection message to a local area network, and receiving a first response message; sending a request message to the first server based on the first response message, and receiving a second response message generated by the first server in response to the request message; constructing a verification data packet based on the second response message, and sending the verification data packet to the target server; and receiving a target response message sent by the target server, and determining a response state of the target server based on the target response message. According to the method, a real network request is simulated, and the response state of a target server needing to be detected is detected by sending a verification data packet and corresponding target response information. By monitoring the response state of the server, related technicians can find and solve potential network problems in time, thereby ensuring that all devices can be normally connected to the network and communicate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network communication, and in particular to a detection method, device, electronic equipment and storage medium for DHCP service. Background Art

[0002] DHCP (Dynamic Host Configuration Protocol) is a network protocol for local area networks that allows network devices to automatically obtain network configuration information such as IP address (Internet Protocol Address), subnet mask, default gateway, DNS (Domain Name System) server, etc. when connected to the network. DHCP service is usually provided by one or more servers in the network. If there are equipment failures or abnormal network problems, it will affect the normal operation and management of the network. Therefore, detecting whether there are faults in the DHCP service is an urgent problem to be solved. Summary of the invention

[0003] In view of this, the present invention provides a method, device, electronic device and storage medium for detecting a DHCP service, so as to solve the problem of detecting whether a DHCP service has a fault.

[0004] In a first aspect, the present invention provides a method for detecting a DHCP service, which is applied to a detection terminal, and the method comprises:

[0005] Sending a detection message to a local area network and receiving a first response message, wherein the detection message includes at least address information of the detection terminal, and the first response message is generated by the first server in response to the detection message;

[0006] Sending a request message to the first server based on the first response message, and receiving a second response message generated by the first server in response to the request message, wherein the request message includes at least an available protocol address, address information of the detection terminal, and a lease term;

[0007] Constructing a verification data packet based on the second response message, and sending the verification data packet to the target server, wherein the verification data packet is used to perform communication verification on the target server;

[0008] A target response message sent by a target server is received, and a response status of the target server is determined based on the target response message, wherein the target response message is generated by the target server in response to the verification data packet.

[0009] In an optional implementation, sending a detection message to the local area network and receiving a first response message includes:

[0010] Constructing a detection message based on the network transmission protocol layer information;

[0011] Broadcast the detection message to the local area network, and receive the first response message.

[0012] In an optional implementation, the sending a request message to the first server based on the first response message includes:

[0013] Extracting the first response message;

[0014] A request message is generated based on the message extraction result, and the request message is sent to the first server.

[0015] In an optional implementation, the generating a request message based on the message extraction result includes:

[0016] Determine available protocol addresses and network configuration information based on the message extraction results;

[0017] The request message is generated based on the address information of the detection terminal, the available protocol address and the network configuration information, and the available protocol address is determined by the first server from a preset database in response to the detection message.

[0018] In an optional implementation, constructing a verification data packet based on the second response message includes:

[0019] matching the second response message to determine whether the second response message is valid based on a matching result;

[0020] If the second response message is valid, a verification data packet is constructed based on the target available protocol address of the target server.

[0021] In an optional implementation, matching the second response message to determine whether the second response message is valid based on a matching result includes:

[0022] Extracting fields from the second response message, and parsing the extracted fields;

[0023] Determine whether the information in the second response message is consistent with the parameters in the request message. If the information in the second response message is consistent with the parameters in the request message, determine that the second response message is valid.

[0024] In an optional implementation, determining the response status of the target server based on the target response message includes:

[0025] Parsing the target response message to determine the corresponding first configuration information;

[0026] If the first configuration information is consistent with the network configuration information of the target server, it is determined that the target server responds correctly.

[0027] The detection method of the DHCP service provided in this embodiment includes sending a detection message to a local area network and receiving a first response message; sending a request message to a first server based on the first response message, and receiving a second response message generated by the first server in response to the request message; constructing a verification data packet based on the second response message, and sending the verification data packet to a target server; receiving a target response message sent by the target server, and determining the response status of the target server based on the target response message. This method simulates a real network request, and detects the response status of the target server to be detected by sending a verification data packet and corresponding target response information. By monitoring the response status of the server, relevant technicians can promptly discover and solve potential network problems, thereby ensuring that all devices can connect to the network and communicate normally.

[0028] In a second aspect, the present invention provides a detection device for a DHCP service, the device comprising:

[0029] A detection message sending module, used to send a detection message to the local area network and receive a first response message, wherein the detection message at least includes the address information of the detection terminal, and the first response message is generated by the first server in response to the detection message;

[0030] a request message sending module, configured to send a request message to the first server based on the first response message, and receive a second response message generated by the first server in response to the request message, wherein the request message includes at least an available protocol address, address information of the detection terminal, and a lease term;

[0031] A verification data packet sending module, used for constructing a verification data packet based on the second response message, and sending the verification data packet to the target server, wherein the verification data packet is used for performing communication verification on the target server;

[0032] The status determination module is used to receive a target response message sent by a target server and determine the response status of the target server based on the target response message, wherein the target response message is generated by the target server in response to the verification data packet.

[0033] In a third aspect, the present invention provides an electronic device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0034] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to cause a computer to execute the method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 is a flow chart of a method for detecting a DHCP service according to an embodiment of the present invention;

[0037] Figure 2 is a structural block diagram of a detection device for a DHCP service according to an embodiment of the present invention;

[0038] Figure 3 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0040] In a local area network environment, DHCP service is a key service, and is also responsible for allocating IP addresses, subnet masks, gateways, and DNS, etc. to devices on the network. In order to ensure the normal operation and management of the network, it is necessary to monitor the DHCP service in the local area network in a timely manner. Based on this, an embodiment of the present invention provides a detection method for a DHCP service, which is applied to a detection terminal, including: sending a detection message to a local area network, and receiving a first response message, the detection message at least including the address information of the detection terminal, the first response message is generated by the first server in response to the detection message; sending a request message to the first server based on the first response message, and receiving a second response message generated by the first server in response to the request message, the request message at least including an available protocol address, the address information of the detection terminal, and a lease term; constructing a verification data packet based on the second response message, and sending the verification data packet; receiving a target response message sent by a target server, and parsing the target response message to determine the response status of the target server based on the parsing result, the target response message is generated by the target server in response to the verification data packet.

[0041] According to an embodiment of the present invention, a detection method embodiment of a DHCP service is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0042] In this embodiment, a DHCP service detection method is provided, which can be used to detect a terminal. Figure 1 is a flow chart of a method for detecting a DHCP service according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0043] Step S101, sending a detection message to a local area network, and receiving a first response message.

[0044] The detection message at least includes the address information of the detection terminal, and the first response message is generated by the first server in response to the detection message.

[0045] The detection terminal is a detection device that uses a terminal device that can be connected to a local area network as a detection terminal, such as a mobile phone, a computer, etc. The detection message is broadcast to the local area network. The detection message contains relevant information of the detection terminal. For example, the detection message includes the address information, operation code, hardware type, hardware address length, hop count, transaction ID, etc. of the detection terminal, where the address information may include the IP address of the detection terminal. The message propagates in the local area network and reaches all first servers connected to the network. The first server refers to all DHCP servers in the local area network, including routers, switches and other devices.

[0046] After receiving the detection message, the first server replies with a first response message, providing the detection terminal with an available IP address (available protocol address) and network configuration information, including a subnet mask, a default gateway, a DNS server address, and the like.

[0047] Step S102: Send a request message to the first server based on the first response message, and receive a second response message generated by the first server in response to the request message.

[0048] After receiving the first response message, the detection terminal constructs a request message, wherein the request message includes at least the available protocol address, the address information of the detection terminal, and the lease term. The address information of the detection terminal includes the MAC address (Media Access Control Address, physical address) of the detection terminal itself. In addition, the request message may also include network configuration information, and the available protocol address and network configuration information are extracted from the first response message. The lease term indicates the lease term of the available protocol address that the detection terminal hopes to obtain.

[0049] After generating the request message, the detection terminal broadcasts the request message to all first servers. The request message can be transmitted using the UDP (User Datagram Protocol) protocol, encapsulating the detection message in a UDP data packet and sending the data packet to a specific port of the first server. After receiving the request message, the first server verifies the legitimacy of the request and replies with a second response message to confirm the allocation of available protocol addresses and other network configurations.

[0050] Step S103: construct a verification data packet based on the second response message, and send the verification data packet to the target server.

[0051] The detection terminal constructs a verification data packet by parsing the second response message, and the verification data packet is used to verify the communication with the target server. First, after receiving the second response message, the detection terminal needs to parse the second response message to confirm whether the configuration parameters obtained by the detection terminal match the configuration parameters required by it, so as to avoid configuration errors or conflicts. If it is determined that the configuration parameters match, it is determined which first server allocates the available protocol address that needs to be used, and the first server is the target server. The constructed verification data packet includes information such as Ethernet frames, IP packets, UDP packets, etc., and the verification data packet is sent to the first server. Exemplarily, the verification data packet can be sent through Python and Scapy (a Python program) library.

[0052] Step S104: receiving a target response message sent by the target server, and determining a response status of the target server based on the target response message.

[0053] The target response message is generated by the target server in response to the verification data packet.

[0054] After receiving the verification data packet, the target server generates a target response message, and the target response message has the same format as the first response message. The response status of the target server is determined according to the received target response message, and the response status may include whether the target server responds, whether the response is correct, etc.

[0055] After receiving the target response message, the detection terminal can parse the target response message and determine whether the target server response is correct based on the parameters obtained by the parsing. If the target response message is not received, it means that the target server is in an unresponsive state and troubleshooting can be carried out in time.

[0056] The detection method of the DHCP service provided in this embodiment includes sending a detection message to a local area network and receiving a first response message; sending a request message to a first server based on the first response message, and receiving a second response message generated by the first server in response to the request message; constructing a verification data packet based on the second response message, and sending the verification data packet to a target server; receiving a target response message sent by the target server, and determining the response status of the target server based on the target response message. This method simulates a real network request, and detects the response status of the target server to be detected by sending a verification data packet and corresponding target response information. By monitoring the response status of the server, relevant technicians can promptly discover and solve potential network problems, thereby ensuring that all devices can connect to the network and communicate normally.

[0057] In this embodiment, a DHCP service detection method is provided, which is applied to detecting terminals, etc. Figure 2is a flow chart of a method for detecting a DHCP service according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0058] Step S201, sending a detection message to a local area network, and receiving a first response message.

[0059] Specifically, the above step S201 includes:

[0060] Step S2011, constructing a detection message based on the network transmission protocol layer information.

[0061] The detection message constructed by the detection terminal is a message containing relevant information of the detection device so that the first server can identify and respond, including network transmission protocol layer information. The network transmission protocol layer address includes information such as the Ethernet frame header, IP header, and UDP header. Among them, the Ethernet frame header contains the source MAC address and the destination MAC address, which are used to broadcast messages in the local area network. Since the device has not yet obtained an IP address at this time, the source IP address in the IP header may be empty, and the destination IP address may also be a broadcast address. The UDP header contains the source port number and the destination port number.

[0062] Step S2012: broadcast the detection message to the local area network, and receive a first response message.

[0063] The detection message is sent through the broadcast address in the LAN to ensure that all first servers connected to the LAN can receive the message. The message propagates in the LAN and reaches all devices connected to the network. The device that receives the detection message replies with a message that provides an available protocol address (available IP address), network configuration information, etc.

[0064] When the detection terminal requests an IP address, the first server will quickly search and allocate a response IP address and network configuration information, thereby generating a first response message and sending it to the detection terminal.

[0065] Step S202: Send a request message to the first server based on the first response message, and receive a second response message generated by the first server in response to the request message.

[0066] Specifically, sending a request message to the first server based on the first response message in the above step S202 includes:

[0067] Step S2021, extracting the first response message.

[0068] After receiving the first response message, the detection terminal extracts the message, extracts key information such as the subnet mask, default gateway, DNS server address, etc., and records it locally or on the DHCP server.

[0069] Step S2022: Generate a request message based on the message extraction result, and send the request message to the first server.

[0070] The request message is constructed according to the extracted message, and the detection terminal sends the request message to the corresponding first server according to the extracted IP address of the first server. The request message is encapsulated in a UDP data packet and transmitted using the UDP protocol, so as to be sent to a specific port of the first server.

[0071] In some optional implementations, the above step S2022 includes:

[0072] Step a1: Determine available protocol addresses and network configuration information based on the message extraction result.

[0073] After the message extraction operation, the available protocol address and network configuration information can be determined from the first response message, wherein the available protocol address is determined by the first server from a preset database in response to the detection message. When the detection terminal requests an IP address, the first server will quickly search and allocate the available protocol address and network configuration information from the preset database.

[0074] Step a2: generating a request message based on the address information of the detection terminal, the available protocol address and the network configuration information.

[0075] The generated request information at least includes the physical address of the detection terminal, the allocated available protocol address and the network configuration information.

[0076] Step S203, constructing a verification data packet based on the second response message, and sending the verification data packet to the target server;

[0077] Specifically, in the above step S203, constructing a verification data packet based on the second response message includes:

[0078] Step S2031, matching the second response message to determine whether the second response message is valid based on the matching result.

[0079] Parse the second response message, extract the fields and parameters contained in the second response message, compare the fields and parameters in the second response message with the parameters in the sent request message to obtain a comparison result, and determine whether the second response message is valid based on the comparison result.

[0080] In some optional implementations, step S2031 includes:

[0081] Step b1, extracting fields from the second response message and parsing the extracted fields.

[0082] Since the second response message can be transmitted in binary format, it can be converted into a string format for processing, and the values ​​of fields and options can be extracted by string segmentation, regular expressions, etc. According to the field length and offset of the DHCP protocol specification, the corresponding part is intercepted from the string and the value of the field is parsed. The field types include but are not limited to subnet mask, MAC address, default gateway, DNS server, IP address of NTP (Network Time Protocol) server, domain name search list and other information.

[0083] Step b2, determining whether the information in the second response message is consistent with the parameters in the request message; if the information in the second response message is consistent with the parameters in the request message, determining that the second response message is valid.

[0084] After parsing, it is determined whether the parameters such as the available protocol address and the physical address of the detection terminal provided in the second response message are consistent with the parameters in the request message. If they are consistent, it means that the second response message is valid.

[0085] Step S2032: If the second response message is valid, construct a verification data packet based on the target available protocol address of the target server.

[0086] When the second response message is determined to be valid, the detection terminal will use the allocated available protocol address and network configuration information to configure its own network connection and construct a corresponding verification data packet. The verification data packet may include Ethernet frames, IP packets and UDP packets, wherein the Ethernet frame includes information such as the source MAC address and the destination MAC address; the IP packet is the protocol header for transmitting data in the network, including the source IP address and the destination IP address; the UDP packet is the protocol header for datagram-oriented communication, including the source port number and the destination port number.

[0087] Step S204: receiving a target response message sent by the target server, and determining a response status of the target server based on the target response message.

[0088] Specifically, the above step S204 includes:

[0089] Step S2041, parse the target response message to determine the corresponding first configuration information.

[0090] All data in the target response message are traversed and the DHCP options therein are parsed. The DHCP options are the first configuration information provided by the target server in the target response message, which may specifically include a subnet mask, a DNS server, a DNS domain name, etc.

[0091] Step S2042: If the first configuration information is consistent with the network configuration information of the target server, it is determined that the target server responds correctly.

[0092] In the foregoing, the target configuration information of the target server has been received. If it is determined through comparison that the first configuration information is consistent with the target configuration information, it means that there is no problem with the response of the target server.

[0093] In some optional implementations, the detection message is a DHCP Discover message, the first response message is a DHCP Offer message, the request message is a DHCP Request message, and the second response message is a DHCP Acknowledge message.

[0094] DHCP Discover is a type of network message used in the Dynamic Host Configuration Protocol (DHCP), which is broadcasted by a detection terminal in the network to discover available DHCP servers and request network configuration information.

[0095] DHCP Offer is a type of network message used in the Dynamic Host Configuration Protocol (DHCP). It is a message sent by the DHCP server to the detection terminal in response to the DHCP Discover message.

[0096] DHCP Request is a type of network message used in the Dynamic Host Configuration Protocol (DHCP). It is a message sent by the detection terminal to the DHCP server after receiving the DHCP Offer message, and is used to request specific network configuration.

[0097] DHCP Acknowledgement is a type of network message used in the Dynamic Host Configuration Protocol (DHCP). It is a message sent by the DHCP server in response to a DHCP Request message sent by a detection terminal. The DHCPAcknowledgment message is used to confirm and notify the detection terminal that its requested network configuration has been accepted and completed.

[0098] In this solution, the status of the DHCP service can be monitored and detected regularly by sending detection messages regularly. By quickly and reliably detecting the effective DHCP server in the LAN, the efficiency of network configuration can be improved. The device can obtain the correct IP address and other network configuration parameters more quickly, reduce the network connection time and the possibility of configuration errors, and improve the overall performance and stability of the network. On the other hand, the user experience when using the DHCP service in the LAN is improved. The user does not need to manually configure the network parameters, but automatically detects and obtains the configuration information provided by the DHCP server, which simplifies the steps of network setting and provides a more convenient user experience. By recording the IP addresses and related information of the effective DHCP server, the network administrator can better understand and manage the DHCP service in the LAN. This helps to troubleshoot, monitor network performance, and make appropriate configurations and optimizations to improve the efficiency and accuracy of network management.

[0099] In this embodiment, a detection device for DHCP service is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0100] This embodiment provides a detection device for a DHCP service, such as Figure 2 As shown, including:

[0101] A detection message sending module 301 is used to send a detection message to a local area network and receive a first response message, wherein the detection message at least includes the address information of the detection terminal, and the first response message is generated by the first server in response to the detection message;

[0102] A request message sending module 302, configured to send a request message to the first server based on the first response message, and receive a second response message generated by the first server in response to the request message, wherein the request message includes at least an available protocol address, address information of the detection terminal, and a lease term;

[0103] A verification data packet sending module 303 is used to construct a verification data packet based on the second response message, and send the verification data packet to the target server, wherein the verification data packet is used to perform communication verification on the target server;

[0104] The status determination module 304 is configured to receive a target response message sent by a target server and determine a response status of the target server based on the target response message, wherein the target response message is generated by the target server in response to the verification data packet.

[0105] In some optional implementations, the detection message sending module 301 includes:

[0106] A detection message construction unit, used to construct a detection message based on network transmission protocol layer information;

[0107] A message broadcasting unit is used to broadcast the detection message to the local area network and receive the first response message.

[0108] In some optional implementations, the request message sending module 302 includes:

[0109] A message extraction unit, used to extract the first response message;

[0110] A message sending unit is used to generate a request message based on the message extraction result and send the request message to the first server.

[0111] In some optional implementations, the message sending unit includes:

[0112] An information determination subunit, used to determine available protocol addresses and network configuration information based on the message extraction result;

[0113] The request message generating subunit is used to generate the request message based on the address information of the detection terminal, the available protocol address and the network configuration information, wherein the available protocol address is determined by the first server from a preset database in response to the detection message.

[0114] In some optional implementations, the verification data packet sending module 303 includes:

[0115] a message matching unit, configured to match the second response message to determine whether the second response message is valid based on a matching result;

[0116] A data packet construction unit is used to construct a verification data packet based on a target available protocol address of a target server if the second response message is valid.

[0117] In some optional implementations, the message matching unit includes:

[0118] A field extraction subunit, configured to extract fields from the second response message and parse the extracted fields;

[0119] The parameter judgment subunit is used to judge whether the information in the second response message is consistent with the parameters in the request message. If the information in the second response message is consistent with the parameters in the request message, it is determined that the second response message is valid.

[0120] In some optional implementations, the state determination module 304 includes:

[0121] A message parsing unit, configured to parse the target response message and determine the corresponding first configuration information;

[0122] A status judgment unit is used to determine that the target server responds correctly if the first configuration information is consistent with the network configuration information of the target server.

[0123] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0124] The DHCP service detection device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0125] The embodiment of the present invention also provides an electronic device having the above Figure 2 The DHCP service detection device is shown.

[0126] See also Figure 3 , Figure 3 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Figure 3 As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 3 A processor 10 is taken as an example.

[0127] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0128] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0129] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0130] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0131] The electronic device further comprises a communication interface 30 for the electronic device to communicate with other devices or a communication network.

[0132] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0133] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the present invention.

Claims

1. A method for detecting a DHCP service, characterized in that: Applied to a detection terminal, the method comprises: Sending a detection message to a local area network and receiving a first response message, wherein the detection message at least includes address information of the detection terminal, and the first response message is generated by the first server in response to the detection message; Sending a request message to the first server based on the first response message, and receiving a second response message generated by the first server in response to the request message, wherein the request message includes at least an available protocol address, address information of the detection terminal, and a lease term; Constructing a verification data packet based on the second response message, and sending the verification data packet to the target server, wherein the verification data packet is used to perform communication verification on the target server; A target response message sent by a target server is received, and a response status of the target server is determined based on the target response message, wherein the target response message is generated by the target server in response to the verification data packet.

2. The method according to claim 1, characterized in that The sending of a detection message to the local area network and receiving a first response message includes: Constructing a detection message based on the network transmission protocol layer information; Broadcast the detection message to the local area network, and receive the first response message.

3. The method according to claim 1, characterized in that The sending a request message to the first server based on the first response message includes: Extracting the first response message; A request message is generated based on the message extraction result, and the request message is sent to the first server.

4. The method according to claim 3, characterized in that The generating a request message based on the message extraction result includes: Determine available protocol addresses and network configuration information based on the message extraction results; The request message is generated based on the address information of the detection terminal, the available protocol address and the network configuration information, and the available protocol address is determined by the first server from a preset database in response to the detection message.

5. The method according to claim 1, characterized in that The constructing a verification data packet based on the second response message includes: matching the second response message to determine whether the second response message is valid based on a matching result; If the second response message is valid, a verification data packet is constructed based on the target available protocol address of the target server.

6. The method according to claim 5, characterized in that The matching the second response message to determine whether the second response message is valid based on a matching result includes: Extracting fields from the second response message, and parsing the extracted fields; Determine whether the information in the second response message is consistent with the parameters in the request message. If the information in the second response message is consistent with the parameters in the request message, determine that the second response message is valid.

7. The method according to claim 1, characterized in that The determining the response status of the target server based on the target response message includes: Parsing the target response message to determine the corresponding first configuration information; If the first configuration information is consistent with the network configuration information of the target server, it is determined that the target server responds correctly.

8. A detection device for DHCP service, characterized in that: The device comprises: A detection message sending module, used to send a detection message to the local area network and receive a first response message, wherein the detection message at least includes address information of the detection terminal, and the first response message is generated by the first server in response to the detection message; a request message sending module, configured to send a request message to the first server based on the first response message, and receive a second response message generated by the first server in response to the request message, wherein the request message includes at least an available protocol address, address information of the detection terminal, and a lease term; A verification data packet sending module, used for constructing a verification data packet based on the second response message, and sending the verification data packet to the target server, wherein the verification data packet is used for performing communication verification on the target server; The status determination module is used to receive a target response message sent by a target server and determine the response status of the target server based on the target response message, wherein the target response message is generated by the target server in response to the verification data packet.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the DHCP service detection method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the DHCP service detection method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method, device, equipment and system for detecting server state and storage medium

    CN115208783A

  • Method for relaying DHCP (Dynamic Host Configuration Protocol) strategy under network equipment

    CN116527635A

  • Method, system and device for determining network link quality

    CN118075160A

  • Method and system for monitoring dynamic host configuration protocol (DHCP) service in an internet protocol network

    EP1073244A1