Method for realizing management and statistics of local area network equipment based on DHCP service
By setting device feature tag matching strategies and service areas in DHCP service, the problems of complex user operations and difficult device information statistics in LAN equipment management are solved, and the access control and quantity statistics of device types are realized. It is suitable for the management of IPv4 and IPv6 devices, and supports load balancing and capacity expansion of multi-scale LANs.
Patent Information
- Application Number
- CN202510501464.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-04-21
AI Technical Summary
In the management of local area network equipment, the existing technology has problems such as complex user operations, high software and hardware costs, inability to provide device information statistics functions, and the static IP address cannot bind the device MAC address under IPv6 address allocation. Especially in the context of IPv6 migration, traditional DHCP solutions cannot issue different configurations according to the device type.
By setting the device feature tag matching policy and DHCP service area, matching the device tag according to the characteristics and MAC address of the DHCP request, controlling access permissions, and recording the device type and number, providing different configurations, supporting the management and statistics of IPv4 and IPv6 devices.
It realizes a simplified device management process, supports access control and statistics of different device types, adopts standard DHCP protocol, is suitable for local area networks of all sizes, has load balancing and capacity expansion capabilities, and is simple and standardized in deployment.
Smart Images

Figure CN120342876A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer networks, and in particular, to a method for implementing local area network device management and statistics based on DHCP services. Background Art
[0002] With the rapid development of Internet of Things technology, there are more and more devices accessing the network. A variety of networked devices are consuming more and more network resources and bringing various security problems. How to effectively manage and count the devices within a local area network has become a research hotspot.
[0003] In recent years, with the exhaustion of the allocation of global IPv4 (Internet Protocol version 4) addresses, the Internet has begun to migrate from IPv4 to IPv6 (Internet Protocol version 6). More and more Internet of Things devices begin to support IPv6. For the huge address space of IPv6, the address management and allocation of IPv6 devices within a local area network have become a new problem.
[0004] Currently, traditional local area network device management solutions mostly manage according to wired network ports, or require users to authenticate, or need to analyze the data packets within the entire local area network, which have problems such as complex user operations, high software and hardware costs. At the same time, traditional local area network DHCP (Dynamic Host Configuration Protocol) address allocation solutions cannot provide device information statistics functions, cannot issue different configurations according to device types, and in the case of IPv6 address allocation, static IP (Internet Protocol) addresses can only be bound to device DUIDs (DHCP Unique Identifiers), and cannot be bound to device MAC addresses (Media Access Control Addresses), etc. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a method for implementing local area network device management and statistics based on DHCP services. While providing DHCP services, it can control whether to allow a client to access according to the DHCP request characteristics or MAC address of the client, and control the DHCP parameters issued to the client. At the same time, it can also statistically display the types and quantities of clients.
[0006] In a first aspect, an embodiment of the present invention provides a method for implementing local area network device management and statistics based on a DHCP service. The method includes: setting a device feature tag matching policy and a DHCP service area; receiving a DHCP request sent by a client and determining the DHCP service area corresponding to the DHCP request; if the DHCP request is a DHCPv6 request, looking up the MAC address corresponding to the source IPv6 address in the IPv6 neighbor table of the operating system according to the source IPv6 address in the DHCP request packet; matching the device feature tags included in the DHCP request according to the DHCP request data, the MAC address, and the device feature tag matching policy; determining whether to allow the device to access according to the service area corresponding to the DHCP request, and the access rules and configuration list of the service area; if allowing the device to access, continuing to determine the DHCP response data; sending the DHCP response data to the client; recording the DHCP request data, the device feature tags included in the DHCP request, the information indicating whether to allow the device to access, and the DHCP response data into a database.
[0007] In an alternative embodiment of the present application, the above-mentioned DHCP service area includes an IP address segment, a corresponding network interface, and the access rules and the issued configuration list determined according to the device feature tags in the DHCP service area.
[0008] In an alternative embodiment of the present application, the step of receiving a DHCP request sent by a client and determining the DHCP service area corresponding to the DHCP request includes: receiving a DHCP request sent by a client and determining the DHCP service area corresponding to the DHCP request based on the source network interface.
[0009] In an alternative embodiment of the present application, the above-mentioned method further includes: determining whether the DHCP request is a DHCPv4 request or a DHCPv6 request based on the DHCP request protocol version.
[0010] In an alternative embodiment of the present application, the step of matching the device feature tags included in the DHCP request according to the DHCP request data, the MAC address, and the device feature tag matching policy includes: parsing the DHCP Option data in the DHCP request packet according to the DHCP request protocol version; matching the device feature tags included in the DHCP request in the device feature tag matching policy according to the DHCP Option data and the MAC address.
[0011] In an alternative embodiment of the present application, the step of determining whether to allow a device to access according to the service area corresponding to the DHCP request, as well as the access rules and configuration list of the service area, includes: reading the access rules and configuration list of the DHCP service area; determining whether it conforms to the access rules in the access rules of the DHCP service area according to the device feature tags included in the DHCP request; if it conforms to the access rules, matching eligible configuration items in the configuration list of the DHCP service area according to the device feature tags included in the DHCP request; determining to allow the device to access.
[0012] In an alternative embodiment of the present application, the step of continuing to determine the DHCP response data if the device is allowed to access includes: setting the DHCP Option and value included in the DHCP response data according to the eligible configuration items.
[0013] In a second aspect, an embodiment of the present invention further provides a device for implementing local area network device management and statistics based on DHCP services. The device includes: a feature tag matching policy setting module for setting device feature tag matching policies and DHCP service areas; a DHCP request receiving module for receiving DHCP requests sent by clients and determining the DHCP service area corresponding to the DHCP requests; a DHCP request processing module for, if the DHCP request is a DHCPv6 request, looking up the MAC address corresponding to the source IPv6 address in the IPv6 neighbor table of the operating system according to the source IPv6 address in the DHCP request packet; a device feature tag determining module for matching the device feature tags included in the DHCP request according to the DHCP request data, MAC address, and device feature tag matching policies; a DHCP response data determining module for determining whether to allow the device to access according to the service area corresponding to the DHCP request, as well as the access rules and configuration list of the service area; if the device is allowed to access, continuing to determine the DHCP response data; a DHCP response data sending module for sending the DHCP response data to the client; a database recording module for recording the DHCP request data, the device feature tags included in the DHCP request, information indicating whether the device is allowed to access, and the DHCP response data into the database.
[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for implementing local area network device management and statistics based on DHCP services as described above.
[0015] Fourthly, an embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions, which, when called and executed by a processor, cause the processor to implement the method for realizing the management and statistics of LAN devices based on the DHCP service as described above.
[0016] The embodiments of the present invention bring the following beneficial effects:
[0017] The embodiment of the present invention provides a method for realizing the management and statistics of LAN devices based on the DHCP service. By matching the characteristics of the DHCP requests of clients, the types of clients are marked, and on this basis, functions such as access control, issuing different configurations for different client types, and counting the number of client types are provided; the standard DHCP protocol is adopted, the deployment is simple, most existing network devices are supported, and LANs of various scales are supported; the distributed deployment implementation scheme supports system load balancing, disaster tolerance, and smooth expansion, with standard specifications and perfect implementation basic conditions.
[0018] Other features and advantages of the present disclosure will be described in the following description, or some features and advantages can be inferred from the description or determined without doubt, or can be learned by implementing the above technologies of the present disclosure.
[0019] To make the above objects, features, and advantages of the present disclosure more obvious and understandable, the following specific preferred embodiments are given, and detailed descriptions are made in conjunction with the accompanying drawings as follows. Description of the Drawings
[0020] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0021] Figure 1 It is a flowchart of a method for realizing the management and statistics of LAN devices based on the DHCP service provided by an embodiment of the present invention;
[0022] Figure 2 It is a schematic diagram of a method for realizing the management and statistics of LAN devices based on the DHCP service provided by an embodiment of the present invention;
[0023] Figure 3 It is a schematic structural diagram of a device for realizing the management and statistics of LAN devices based on the DHCP service provided by an embodiment of the present invention;
[0024] Figure 4A schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0026] Currently, in traditional local area network (LAN) device management solutions, most are based on wired network port management, or require users to perform identity authentication, or need to analyze data packets within the entire LAN, which have problems such as complex user operations and high software and hardware costs. At the same time, traditional LAN DHCP address allocation solutions have problems such as being unable to provide device information statistics functions, unable to issue different configurations according to device types, and in the IPv6 address allocation scenario, static IP addresses can only be bound to device DUIDs and cannot be bound to device MAC addresses.
[0027] Based on this, an embodiment of the present invention provides a method for realizing LAN device management and statistics based on the DHCP service, which provides DHCP services for both IPv6 and IPv4 devices, and can distinguish different device types through the DHCP request characteristics sent by the devices, issue different configurations according to the types, and perform statistics.
[0028] To facilitate the understanding of this embodiment, first, a method for realizing LAN device management and statistics based on the DHCP service disclosed in the embodiments of the present invention will be introduced in detail.
[0029] Embodiment 1:
[0030] An embodiment of the present invention provides a method for realizing LAN device management and statistics based on the DHCP service. Refer to Figure 1 The flowchart of a method for realizing LAN device management and statistics based on the DHCP service shown. The method for realizing LAN device management and statistics based on the DHCP service includes the following steps:
[0031] Step S102, set the device feature label matching policy and the DHCP service area.
[0032] In this embodiment, the device feature label matching policy and the DHCP service area can be set.
[0033] In some embodiments, the above DHCP service area includes an IP address segment, the corresponding network interface, and the access rules and the issued configuration list determined according to the device feature labels under this DHCP service area.
[0034] When setting up a DHCP service area, a DHCP service area includes an IP address segment, a corresponding network interface, and an access rule and a configured list issued according to device characteristic tags in this area;
[0035] Step S104: Receive a DHCP request sent by a client and determine the DHCP service area corresponding to the DHCP request.
[0036] In some embodiments, a DHCP request sent by a client can be received, and the DHCP service area corresponding to the DHCP request can be determined based on the source network interface.
[0037] This embodiment can receive a DHCP request from a client and determine the corresponding DHCP service area according to the source network interface.
[0038] Step S106: If the DHCP request is a DHCPv6 request, look up the MAC address corresponding to the source IPv6 address in the IPv6 neighbor table of the operating system according to the source IPv6 address in the DHCP request message.
[0039] In some embodiments, it can also be determined whether the DHCP request is a DHCPv4 request or a DHCPv6 request based on the DHCP request protocol version.
[0040] This embodiment can distinguish whether the DHCP request is a DHCPv4 (IPv4 Dynamic Host Configuration Protocol) request or a DHCPv6 (IPv6 Dynamic Host Configuration Protocol) request according to the DHCP request protocol version of the client in the foregoing steps; if it is a DHCPv6 request, look up the MAC address corresponding to the above source IPv6 address in the IPv6 neighbor table of the operating system according to the source IPv6 address in the request message.
[0041] Step S108: Match the device characteristic tags included in the DHCP request according to the DHCP request data, the MAC address, and the device characteristic tag matching policy.
[0042] This embodiment can match the device characteristic tags included in the DHCP request according to the DHCP request data in the foregoing steps, the MAC address in the foregoing steps, and the device characteristic tag matching policy in the foregoing steps.
[0043] In some embodiments, the following service processes can be included:
[0044] Step A1: Analyze the DHCP Option data in the DHCP request message according to the DHCP request protocol version.
[0045] This embodiment can parse the DHCP Option data in the request message according to the DHCP request protocol version of the foregoing steps. The Options field in the DHCP message can be used to store control information and parameters not defined in the ordinary protocol. If the user configures the Options field on the DHCP server side, when the DHCP client applies for an IP address, it will obtain the configuration information in the Options field through the DHCP message responded by the server side.
[0046] Step A2: According to the DHCP Option data and the MAC address, match the device feature tags included in the DHCP request in the device feature tag matching policy.
[0047] This embodiment can, according to the parsed DHCP Option data and the MAC address of the foregoing steps, match the device feature tags included in the DHCP request in the device feature tag matching policy of the foregoing steps.
[0048] Step S110, determine whether to allow the device to access according to the service area corresponding to the DHCP request, and the access rules and configuration list of the service area; if the device is allowed to access, continue to determine the DHCP response data.
[0049] This embodiment can determine whether to allow the device to access according to the service area corresponding to the DHCP request of the foregoing steps, and the access rules and configuration list of the service area. If access is allowed, continue to determine the DHCP response data.
[0050] In some embodiments, the following service processes may be included:
[0051] Step B1: Read the access rules and configuration list of the DHCP service area.
[0052] This embodiment can read the access rules and configuration list of the DHCP service area of the foregoing steps.
[0053] Step B2: According to the device feature tags included in the DHCP request, determine whether it conforms to the access rules in the access rules of the DHCP service area.
[0054] This embodiment can determine whether it conforms to the access rules in the access rules of the DHCP service area according to the device feature tags included in the DHCP request of the foregoing steps.
[0055] Step B3: If it conforms to the access rules, according to the device feature tags included in the DHCP request, match the eligible configuration items in the configuration list of the DHCP service area; determine that the device is allowed to access.
[0056] If the access rules are met, this embodiment can match the eligible configuration items in the configuration list of the DHCP service area in the previous step according to the device feature tags included in the DHCP request in the previous step;
[0057] Step B4: Set the DHCP Option and value included in the DHCP response data according to the eligible configuration items.
[0058] This embodiment can set the DHCP Option and value included in the DHCP response data according to the eligible configuration items in the previous step.
[0059] Step S112: Send the DHCP response data to the client.
[0060] If the previous step allows the client to access, this embodiment can send the DHCP response data in the previous step to the client in the previous step.
[0061] Step S114: Record the DHCP request data, the device feature tags included in the DHCP request, the information indicating whether the device is allowed to access, and the DHCP response data into the database.
[0062] This embodiment can record the DHCP request data in the previous step, the device feature tags included in the DHCP request in the previous step, whether the device is allowed to access in the previous step, and the DHCP response data into the database.
[0063] The embodiment of the present invention provides a method for realizing local area network device management and statistics based on DHCP service. By matching the characteristics of the client DHCP request, the type of the client is marked, and on this basis, functions such as access control, issuing different configurations for different client types, and counting the number of client types are provided; using the standard DHCP protocol, the deployment is simple, supporting most existing network devices and local area networks of various scales; the support for distributed deployment implementation solutions can achieve system load balancing, disaster tolerance, and smooth expansion, with standard specifications and perfect implementation basic conditions.
[0064] Embodiment 2:
[0065] This embodiment provides another method for realizing local area network device management and statistics based on DHCP service. This method is implemented on the basis of the above embodiment, and specifically describes the specific implementation manner of a method for realizing local area network device management and statistics based on DHCP service.
[0066] It can be referred to Figure 2Schematic diagram of a method for implementing local area network device management and statistics based on DHCP service. The method for implementing local area network device management and statistics based on DHCP service includes the following steps S1 - S8:
[0067] Step S1, set the device feature label matching policy. The administrator sets any number of device feature label matching policies through the background management interface; each policy consists of a protocol version, a feature label name, and one or more matching rules; the protocol version is used to determine whether the rule takes effect for the DHCPv4 or DHCPv6 protocol, because the meanings of DHCPOptions for DHCPv4 and DHCPv6 are different and need to be distinguished; the feature label name is used to be displayed to the user after statistical analysis; a single matching rule is matched according to the DHCP Option, and multiple matching rules are connected by logical symbols.
[0068] For example, a device feature label matching policy can be: Protocol version: DHCPv6; Feature label name: Windows IPv6 device; Matching rule: The value of "vendor - class.enterprise - number" (vendor class. enterprise number) is 311; and the value of "vendor - class.data" (vendor class. data) is "MSFT 5.0".
[0069] Step S2, set the DHCP service area. The administrator sets one or more DHCP service areas through the background management interface; each DHCP service area consists of a name, a network interface, an assigned IP address segment, an access rule list, and a configuration list; the network interface and the DHCP service area are in a one - to - one relationship; the access rule list consists of multiple access rules, each access rule contains a device feature label matching rule and a permission; the configuration list consists of multiple configuration items, each configuration item contains a device feature label matching rule and a DHCP Option list; the device feature label matching rules in the above - mentioned access rules and configuration items can contain any number of device feature labels, and the device feature labels are connected by logical symbols. When the rule is empty, it means matching any DHCP request.
[0070] For example, a DHCP service area configuration can be: Name: Office area; Assigned IP address segment: IPv4: 192.168.1.100 - 192.168.1.200; IPv6: fd00::100 - fd00::200;
[0071] Access rule list: 1. Device feature label matching rule: empty, whether to allow: reject; 2. Device feature label matching rule: contains "Windows IPv4 device" or contains "Windows IPv6 device", whether to allow: allow; Configuration list: 1. Device feature label matching rule: empty, DHCP Option list: 1. DNS server = 1.1.1.1, 2. Lease time = 12 hours.
[0072] Step S3: Receive the DHCP request from the client, and determine the corresponding DHCP service area according to the network interface where the request comes from and the one-to-one relationship between the network interface and the DHCP service area.
[0073] Step S4: Distinguish the DHCP request protocol version of the client in Step S3, whether it is a DHCPv4 request or a DHCPv6 request; if it is a DHCPv6 request, look up the MAC address corresponding to the above source IPv6 address in the IPv6 neighbor table (IPv6Neighbor Table) of the operating system according to the source IPv6 address in the request packet.
[0074] Step S5: According to the DHCP request protocol version in S4, parse the DHCP Option data in the request packet, and match the device feature label included in the DHCP request in the device feature label matching policy in Step S1 according to the parsed DHCP Option data and the MAC address in Step S4.
[0075] Step S6: Read the access rules and configuration list of the DHCP service area in Step S3, and determine whether it meets the access rules according to the device feature label included in the DHCP request in Step S5 and the access rule list; if it meets the access rules, match the eligible configuration items in the configuration list according to the device feature label included in the DHCP request in Step S5.
[0076] Step S7: If it meets the access rules in Step S6, send the DHCP response data in Step S6 to the client in Step S3.
[0077] Step S8: Record the DHCP request data in Step S3, the device feature label included in the DHCP request in Step S5, whether the device is allowed to access in Step S6, and the DHCP response data into the database for subsequent statistical display.
[0078] In summary, the above method provided by the embodiments of the present invention can mark the client type by matching the characteristics of the client DHCP request, and on this basis, provide functions such as access control, issuing different configurations for different client types, and counting the number of client types; adopt the standard DHCP protocol, with simple deployment, support for most existing network devices, and support for local area networks of various scales; support for distributed deployment implementation plans can achieve system load balancing, disaster tolerance, and smooth expansion, with standard specifications and perfect implementation basic conditions.
[0079] Embodiment 3:
[0080] Corresponding to the above method embodiment, an embodiment of the present invention provides a device for implementing local area network device management and statistics based on DHCP service. Refer to Figure 3 the structural schematic diagram of a device for implementing local area network device management and statistics based on DHCP service shown in
[0081] A feature label matching policy setting module 31, configured to set a device feature label matching policy and a DHCP service area;
[0082] A DHCP request receiving module 32, configured to receive a DHCP request sent by a client and determine the DHCP service area corresponding to the DHCP request;
[0083] A DHCP request processing module 33, configured to, if the DHCP request is a DHCPv6 request, look up the MAC address corresponding to the source IPv6 address in the IPv6 neighbor table of the operating system according to the source IPv6 address in the DHCP request packet;
[0084] A device feature label determining module 34, configured to match the device feature label included in the DHCP request according to the DHCP request data, the MAC address, and the device feature label matching policy;
[0085] A DHCP response data determining module 35, configured to determine whether to allow the device to access according to the service area corresponding to the DHCP request, and the access rules and configuration list of the service area; if the device is allowed to access, continue to determine the DHCP response data;
[0086] A DHCP response data sending module 36, configured to send the DHCP response data to the client;
[0087] A database recording module 37, configured to record the DHCP request data, the device feature label included in the DHCP request, the information indicating whether the device is allowed to access, and the DHCP response data into the database.
[0088] An embodiment of the present invention provides a device for implementing local area network device management and statistics based on the DHCP service. By matching the characteristics of the DHCP requests of the client, the type of the client is marked, and on this basis, functions such as access control, issuing different configurations for different client types, and counting the number of client types are provided; the standard DHCP protocol is adopted, the deployment is simple, most existing network devices are supported, and local area networks of various scales are supported; the distributed deployment implementation scheme supports system load balancing, disaster tolerance, and smooth expansion, with standard specifications and perfect implementation basic conditions.
[0089] The above DHCP service area includes an IP address segment, a corresponding network interface, as well as an access rule determined according to the device characteristic label and a configuration list issued under this DHCP service area.
[0090] The above DHCP request receiving module is used to receive the DHCP request sent by the client and determine the DHCP service area corresponding to the DHCP request based on the source network interface.
[0091] The above device further includes: a DHCP request version judgment module, which is used to determine whether the DHCP request is a DHCPv4 request or a DHCPv6 request based on the DHCP request protocol version.
[0092] The above device characteristic label determination module is used to parse the DHCP Option data in the DHCP request message according to the DHCP request protocol version; according to the DHCP Option data and the MAC address, match the device characteristic label included in the DHCP request in the device characteristic label matching strategy.
[0093] The above DHCP response data determination module is used to read the access rule and the configuration list of the DHCP service area; according to the device characteristic label included in the DHCP request, determine whether it conforms to the access rule in the access rule of the DHCP service area; if it conforms to the access rule, according to the device characteristic label included in the DHCP request, match the eligible configuration item in the configuration list of the DHCP service area; determine that the device is allowed to access.
[0094] The above DHCP response data determination module is further used to set the DHCP Option and value included in the DHCP response data according to the eligible configuration item.
[0095] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working process of the above-described device for implementing local area network device management and statistics based on the DHCP service can refer to the corresponding process in the embodiment of the method for implementing local area network device management and statistics based on the DHCP service described above, and will not be repeated here.
[0096] Embodiment 4:
[0097] The embodiment of the present invention further provides an electronic device for running the method for realizing the management and statistics of local area network devices based on the DHCP service as described above; refer to Figure 4 the structural schematic diagram of an electronic device as shown. The electronic device includes a memory 100 and a processor 101. Among them, the memory 100 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 101 to realize the method for realizing the management and statistics of local area network devices based on the DHCP service as described above.
[0098] Furthermore, Figure 4 the electronic device as shown further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103, and the memory 100 are connected through the bus 102.
[0099] Among them, the memory 100 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory, such as at least one disk memory. Through at least one communication interface 103 (which can be wired or wireless), a communication connection is realized between the system network element and at least one other network element, and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 4 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0100] The processor 101 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 101 or the instructions in the form of software. The above-mentioned processor 101 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and combines its hardware to complete the steps of the method in the foregoing embodiments.
[0101] The embodiments of the present invention also provide a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the method for implementing local area network device management and statistics based on the DHCP service. For the specific implementation, reference may be made to the method embodiments, and details are not described herein again.
[0102] The computer program product of the method for implementing local area network device management and statistics based on the DHCP service provided by the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method in the foregoing method embodiments. For the specific implementation, reference may be made to the method embodiments, and details are not described herein again.
[0103] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described system and / or device can refer to the corresponding processes in the foregoing method embodiments, and details are not described herein again.
[0104] In addition, in the description of the embodiments of the present invention, unless otherwise clearly defined and limited, the terms "installation", "connection", and "coupling" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.
[0105] If a function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0106] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0107] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting it. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the art within the technical scope disclosed by the present invention can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements for some of the technical features; and these modifications, changes, or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for implementing local area network device management and statistics based on DHCP service, characterized in that The method includes: Setting a device feature label matching policy and a DHCP service area; Receiving a DHCP request sent by a client and determining the DHCP service area corresponding to the DHCP request; If the DHCP request is a DHCPv6 request, looking up the MAC address corresponding to the source IPv6 address in the IPv6 neighbor table of the operating system according to the source IPv6 address in the DHCP request packet; Matching the device feature label included in the DHCP request according to the DHCP request data, the MAC address, and the device feature label matching policy; Determining whether to allow the device to access according to the service area corresponding to the DHCP request, and the access rules and configuration list of the service area; if the device is allowed to access, continue to determine the DHCP response data; Sending the DHCP response data to the client; Recording the DHCP request data, the device feature label included in the DHCP request, the information indicating whether the device is allowed to access, and the DHCP response data into a database.
2. The method according to claim 1, wherein The DHCP service area includes an IP address segment, a corresponding network interface, and the access rules and the issued configuration list determined according to the device feature label in the DHCP service area.
3. The method according to claim 1, characterized in that, The step of receiving a DHCP request sent by a client and determining the DHCP service area corresponding to the DHCP request includes: Receiving a DHCP request sent by a client and determining the DHCP service area corresponding to the DHCP request based on the source network interface.
4. The method according to claim 1, characterized in that, The method further includes: Determining whether the DHCP request is a DHCPv4 request or a DHCPv6 request based on the DHCP request protocol version.
5. The method according to claim 4, wherein The step of matching the device feature label included in the DHCP request according to the DHCP request data, the MAC address, and the device feature label matching policy includes: Parsing the DHCP Option data in the DHCP request packet according to the DHCP request protocol version; Matching the device feature label included in the DHCP request in the device feature label matching policy according to the DHCP Option data and the MAC address.
6. The method according to claim 5, wherein The step of determining whether to allow the device to access according to the service area corresponding to the DHCP request, and the access rules and configuration list of the service area includes: Reading the access rules and configuration list of the DHCP service area; Determining whether it conforms to the access rules in the access rules of the DHCP service area according to the device feature label included in the DHCP request; If it conforms to the access rules, matching the eligible configuration items in the configuration list of the DHCP service area according to the device feature label included in the DHCP request; determining that the device is allowed to access.
7. The method according to claim 6, wherein If the device is allowed to access, the step of continuing to determine the DHCP response data includes: Setting the DHCP Option and value included in the DHCP response data according to the eligible configuration items.
8. A device for realizing the management and statistics of local area network devices based on DHCP service, characterized in that, The device includes: A feature label matching policy setting module, configured to set a device feature label matching policy and a DHCP service area; A DHCP request receiving module, configured to receive a DHCP request sent by a client and determine the DHCP service area corresponding to the DHCP request; A DHCP request processing module, configured to, when the DHCP request is a DHCPv6 request, look up the MAC address corresponding to the source IPv6 address in the IPv6 neighbor table of the operating system according to the source IPv6 address in the DHCP request packet; A device feature label determining module, configured to match the device feature label included in the DHCP request according to the DHCP request data, the MAC address, and the device feature label matching policy; A DHCP response data determining module, configured to determine whether to allow a device to access according to the service area corresponding to the DHCP request, and the access rules and configuration list of the service area; if the device is allowed to access, continue to determine the DHCP response data; A DHCP response data sending module, configured to send the DHCP response data to the client; A database recording module, configured to record the DHCP request data, the device feature label included in the DHCP request, the information indicating whether the device is allowed to access, and the DHCP response data into a database.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method for realizing local area network device management and statistics based on DHCP service according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer executable instructions, and when the computer executable instructions are called and executed by a processor, the computer executable instructions cause the processor to implement the method for realizing local area network device management and statistics based on DHCP service according to any one of claims 1 to 7.
Citation Information
Patent Citations
Dynamic address allocation method for dynamic host configuration protocol (DHCP) and system
CN102307247A
Method of gateway equipment for automatically identifying access equipment type and optimizing service
CN102984015A
Method for achieving automatic discovery through network device on basis of DHCP extension label
CN103905429A
Management method and device of dynamic host configuration protocol server and relay
CN104468159A
Address allocation method and device
CN113132503A