Method for realizing local area network device management and statistics based on DHCP service
By using the device feature tag matching strategy of DHCP service, the complexity and high cost of traditional LAN device management solutions are solved. Device type marking and statistics are realized, and access control and configuration management of IPv4 and IPv6 devices are supported.
Patent Information
- Application Number
- CN202510501464.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-04-21
AI Technical Summary
Traditional LAN device management solutions are complex to operate, costly, and cannot effectively manage IPv6 devices, cannot distribute different configurations according to device type, and cannot bind device MAC addresses.
By using a device feature tag matching policy based on DHCP service, device types are distinguished, and access control and statistical functions are provided. It supports IPv4 and IPv6 devices, and determines whether access is allowed and issues the corresponding configuration based on the device feature tag matching policy.
It enables device type labeling and quantity statistics, provides access control, supports LANs of various sizes, is easy to deploy, has strong load balancing and expansion capabilities, and is standardized.
Smart Images

Figure CN120342876B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer network, in particular to a method for realizing local area network device management and statistics based on DHCP service. BACKGROUND
[0002] With the rapid development of Internet of Things technology, more and more devices are connected to the network, and various networked devices are consuming more and more network resources and causing various security problems, so how to effectively manage and count the devices in the local area network has become a research hotspot.
[0003] In recent years, with the exhaustion of global IPv4(Internet Protocol version 4, Internet communication protocol version 4) address allocation, the Internet has begun to migrate from IPv4 to IPv6(Internet Protocol version 6, Internet communication protocol version 6), and 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 in the local area network have become a new problem.
[0004] At present, the traditional local area network device management scheme is mostly based on wired network port management, or requires user identity authentication, or needs to analyze the data packets in the entire local area network, which has the problems of complex user operation, high software and hardware cost. At the same time, the traditional local area network DHCP(Dynamic Host Configuration Protocol, dynamic host configuration protocol) address allocation scheme has the problems of not being able to provide device information statistics function, not being able to issue different configurations according to device type, and static IP(Internet Protocol, Internet Protocol) address in IPv6 address allocation scene only being able to bind device DUID(DHCP Unique Identifier, DHCP unique device identifier) and not being able to bind device MAC address(Media Access Control Address, media access control address). SUMMARY
[0005] Therefore, the purpose of the present application is to provide a method for realizing local area network device management and statistics based on DHCP service, which can provide DHCP service, control whether to allow the client to access according to the client DHCP request characteristics or MAC address, control the DHCP parameters issued to the client, and also can count and display the type and quantity of the client.
[0006] In a first aspect, the embodiments of the present application provide a method for realizing LAN device management and statistics based on a DHCP service, which comprises: setting a device characteristic label matching strategy and a DHCP service area; receiving a DHCP request sent by a client, determining a DHCP service area corresponding to the DHCP request; if the DHCP request is a DHCPv6 request, finding a MAC address corresponding to a source IPv6 address in an IPv6 neighbor table of an operating system according to the source IPv6 address in the DHCP request message; matching a device characteristic label contained in the DHCP request according to the DHCP request data, the MAC address and the device characteristic label matching strategy; determining whether to allow the device to access according to the service area corresponding to the DHCP request and an access rule and a configuration list of the service area; if the device is allowed to access, continuing to determine DHCP response data; sending the DHCP response data to the client; and recording the DHCP request data, the device characteristic label contained in the DHCP request, information representing whether to allow the device to access and the DHCP response data to a database.
[0007] In an optional embodiment of the present application, the DHCP service area contains an IP address segment, a corresponding network interface, an access rule determined according to a device characteristic label and a configuration list issued under the DHCP service area.
[0008] In an optional embodiment of the present application, the step of receiving a DHCP request sent by a client and determining a DHCP service area corresponding to the DHCP request comprises: receiving a DHCP request sent by a client, and determining a DHCP service area corresponding to the DHCP request based on a source network interface.
[0009] In an optional embodiment of the present application, the method further comprises: determining whether the DHCP request is a DHCPv4 request or a DHCPv6 request based on a DHCP request protocol version.
[0010] In an optional embodiment of the present application, the step of matching a device characteristic label contained in the DHCP request according to the DHCP request data, the MAC address and the device characteristic label matching strategy comprises: parsing DHCP Option data in the DHCP request message according to a DHCP request protocol version; and matching the device characteristic label contained in the DHCP request in the device characteristic label matching strategy according to the DHCP Option data and the MAC address.
[0011] In an optional embodiment of the present application, the step of determining whether to allow the device to access according to the service area corresponding to the DHCP request and the access rule and the configuration list of the service area comprises: reading the access rule and the configuration list of the DHCP service area; determining whether the device feature tag contained in the DHCP request meets the access rule according to the device feature tag; if the device feature tag meets the access rule, matching the configuration item meeting the condition in the configuration list of the DHCP service area according to the device feature tag contained in the DHCP request; and determining to allow the device to access.
[0012] In an optional embodiment of the present application, the step of continuing to determine the DHCP response data if the device is allowed to access comprises: setting the DHCP Option and the value contained in the DHCP response data according to the configuration item meeting the condition.
[0013] In a second aspect, the embodiments of the present application further provide a device for implementing local area network device management and statistics based on a DHCP service, which comprises: a feature tag matching strategy setting module, configured to set a device feature tag matching strategy and a DHCP service area; a DHCP request receiving module, configured to receive a DHCP request sent by a client and determine a DHCP service area corresponding to the DHCP request; a DHCP request processing module, configured to, if the DHCP request is a DHCPv6 request, find a MAC address corresponding to a source IPv6 address in an IPv6 neighbor table of an operating system according to the source IPv6 address in the DHCP request message; a device feature tag determining module, configured to match a device feature tag contained in the DHCP request according to the DHCP request data, the MAC address and the device feature tag matching strategy; a DHCP response data determining module, configured to determine whether to allow the device to access according to the service area corresponding to the DHCP request and the access rule and the configuration list of the service area; continue to determine the DHCP response data if the device is allowed to access; a DHCP response data sending module, configured to send the DHCP response data to the client; and a database recording module, configured to record the DHCP request data, the device feature tag contained in the DHCP request, information representing whether to allow the device to access and the DHCP response data to a database.
[0014] In a third aspect, the embodiments of the present application further provide an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions capable of being 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 a DHCP service.
[0015] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions, when invoked and executed by a processor, cause the processor to implement the method for realizing local area network device management and statistics based on a DHCP service.
[0016] The embodiments of the present application bring the following beneficial effects:
[0017] The embodiments of the present application provide a method for realizing local area network device management and statistics based on a DHCP service, which realizes marking of client types by matching client DHCP request features, and provides access control, different configuration issuing for different client types, and client type quantity statistics on this basis; the standard DHCP protocol is adopted, deployment is simple, most of the existing network devices are supported, and various scales of local area networks are supported; the distributed deployment implementation scheme can realize system load balancing, disaster recovery and smooth capacity expansion, and the standard specification is perfect in implementation basis.
[0018] Other features and advantages of the present disclosure will be described in the following description, or can be inferred or determined without doubt from the description, or can be known by implementing the above-mentioned technologies of the present disclosure.
[0019] In order to make the above-mentioned purposes, features and advantages of the present disclosure more obvious and easy to understand, the following preferred embodiments are specifically described, and the accompanying drawings are described in detail as follows. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0021] Figure 1 A flow chart of a method for realizing local area network device management and statistics based on a DHCP service provided by the embodiments of the present application;
[0022] Figure 2 A schematic diagram of a method for realizing local area network device management and statistics based on a DHCP service provided by the embodiments of the present application;
[0023] Figure 3 A structural schematic diagram of a device for realizing local area network device management and statistics based on a DHCP service provided by the embodiments of the present application;
[0024] Figure 4A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.
[0026] At present, the traditional local area network device management scheme is mostly based on wired network port management, or requires user identity authentication, or needs to analyze data packets in the whole local area network, and has problems of complex user operation, high software and hardware cost. Meanwhile, the traditional local area network DHCP address allocation scheme has problems of incapability of providing device information statistical function, incapability of issuing different configurations according to device types, incapability of binding device DUID but not device MAC address in the static IP address allocation scene of IPv6 address.
[0027] Based on this, the embodiment of the present application provides a method for realizing local area network device management and statistics based on DHCP service, which provides DHCP service for 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] In order to facilitate the understanding of the present embodiment, first, a method for realizing local area network device management and statistics based on DHCP service disclosed by the present embodiment is introduced in detail.
[0029] Embodiment one:
[0030] The embodiment of the present application provides a method for realizing local area network device management and statistics based on DHCP service, referring to a flowchart of the method for realizing local area network device management and statistics based on DHCP service shown in FIG. 1, which comprises the following steps: Figure 1
[0031] Step S102, setting device characteristic label matching strategy and DHCP service area.
[0032] In the present embodiment, the device characteristic label matching strategy and the DHCP service area can be set.
[0033] In some embodiments, the DHCP service area contains an IP address segment, a corresponding network interface, and an admission rule and a configuration list issued according to the device characteristic label in the DHCP service area.
[0034] In setting the DHCP service area, one DHCP service area contains an IP address segment, a corresponding network interface, and an admission rule and a configuration list issued according to a device feature tag in the area;
[0035] Step S104, receiving the DHCP request sent by the client, and determining the DHCP service area corresponding to the DHCP request.
[0036] In some embodiments, the DHCP request sent by the 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 the DHCP request from the 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, finding 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, the DHCP request can also be determined to be a DHCPv4 request or a DHCPv6 request based on the protocol version of the DHCP request.
[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 protocol version of the DHCP request of the client in the foregoing step; if it is a DHCPv6 request, finding 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 request message.
[0041] Step S108, matching the device feature tag contained in the DHCP request according to the DHCP request data, the MAC address, and the device feature tag matching strategy.
[0042] This embodiment can match the device feature tag contained in the DHCP request according to the DHCP request data in the foregoing step, the MAC address in the foregoing step, and the device feature tag matching strategy in the foregoing step.
[0043] In some embodiments, the following business process can be included:
[0044] Step A1: parsing the DHCP Option data in the DHCP request message according to the protocol version of the DHCP request.
[0045] The embodiment can parse the DHCP Option data in the request message according to the DHCP request protocol version of the foregoing step. The Options field in the DHCP message can be used to store control information and parameters that are not defined in the general protocol. If the user configures the Options field on the DHCP server side, the DHCP client can obtain the configuration information in the Options field through the DHCP response message from the server when applying for an IP address.
[0046] Step A2: According to the DHCP Option data and the MAC address, the device feature label contained in the DHCP request is matched in the device feature label matching strategy.
[0047] The embodiment can match the device feature label contained in the DHCP request in the device feature label matching strategy according to the parsed DHCP Option data and the MAC address of the foregoing step.
[0048] Step S110: According to the service area corresponding to the DHCP request and the access rule and the configuration list of the service area, it is determined whether the device is allowed to access; if the device is allowed to access, the DHCP response data is continued to be determined.
[0049] The embodiment can determine whether the device is allowed to access according to the service area corresponding to the DHCP request and the access rule and the configuration list of the service area of the foregoing step. If the access is allowed, the DHCP response data is continued to be determined.
[0050] In some embodiments, the following business process can be included:
[0051] Step B1: The access rule and the configuration list of the DHCP service area are read.
[0052] The embodiment can read the access rule and the configuration list of the DHCP service area of the foregoing step.
[0053] Step B2: According to the device feature label contained in the DHCP request, it is determined whether the access rule is met in the access rule of the DHCP service area.
[0054] The embodiment can determine whether the access rule is met in the access rule of the DHCP service area of the foregoing step according to the device feature label contained in the DHCP request of the foregoing step.
[0055] Step B3: If the access rule is met, the configuration item meeting the condition is matched in the configuration list of the DHCP service area according to the device feature label contained in the DHCP request; it is determined that the device is allowed to access.
[0056] If the access rule is met, the embodiment can match the eligible configuration item in the configuration list of the DHCP service area of the previous step according to the device feature tag contained in the DHCP request of the previous step.
[0057] Step B4: setting the DHCP Option and value contained in the DHCP response data according to the eligible configuration item.
[0058] The embodiment can set the DHCP Option and value contained in the DHCP response data according to the eligible configuration item of the previous step.
[0059] Step S112: sending the DHCP response data to the client.
[0060] If the client is allowed to access in the previous step, the embodiment can send the DHCP response data of the previous step to the client of the previous step.
[0061] Step S114: recording the DHCP request data, the device feature tag contained in the DHCP request, the information representing whether the device is allowed to access, and the DHCP response data to the database.
[0062] The embodiment can record the DHCP request data of the previous step, the device feature tag contained in the DHCP request of the previous step, whether the device is allowed to access of the previous step, and the DHCP response data to the database.
[0063] The embodiment provides a method for realizing local area network device management and statistics based on DHCP service, which realizes the marking of the client type by matching the client DHCP request features, and provides the access control, different configuration under different client types, and client type quantity statistics on this basis; the standard DHCP protocol is adopted, the deployment is simple, most of the existing network devices are supported, and various scales of local area networks are supported; the distributed deployment implementation scheme can realize system load balancing, disaster recovery, and smooth expansion, the standard specification is perfect, and the implementation foundation is perfect.
[0064] Embodiment two:
[0065] The embodiment provides another method for realizing local area network device management and statistics based on DHCP service, which is realized on the basis of the above-mentioned embodiment, and specifically describes a specific implementation of the method for realizing local area network device management and statistics based on DHCP service.
[0066] For details, please refer to Figure 2A schematic diagram of a method for implementing LAN device management and statistics based on a DHCP service is shown. The method for implementing LAN device management and statistics based on a DHCP service includes the following steps S1-S8.
[0067] Step S1, setting device feature tag matching strategy, the administrator sets any number of device feature tag matching strategies through a background management interface; each strategy is composed of a protocol version, a feature tag name, and one or more matching rules; the protocol version is used to determine whether the rule is effective for DHCPv4 or DHCPv6 protocol, because the meanings of DHCP options of DHCPv4 and DHCPv6 are not the same, and need to be distinguished; the feature tag name is used to show 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 tag matching strategy can be: protocol version: DHCPv6; feature tag name: Windows IPv6 device; matching rule: "vendor-class.enterprise-number" (vendor class. Enterprise number) value is 311; and "vendor-class.data" (vendor class. Data) value is "MSFT 5.0".
[0069] Step S2, setting a DHCP service area, the administrator sets one or more DHCP service areas through a background management interface; each DHCP service area is composed of a name, a network interface, an IP address segment, an admission rule list, and a configuration list; the network interface has a one-to-one relationship with the DHCP service area; the admission rule list is composed of multiple admission rules, each admission rule contains a device feature tag matching rule and whether to allow; the configuration list is composed of multiple configuration items, each configuration item contains a device feature tag matching rule and a DHCP option list; the device feature tag matching rules in the above admission rules and configuration items can contain any number of device feature tags, and the device feature tags are connected by logical symbols, and the rule is empty. When it represents matching any DHCP request.
[0070] For example, a DHCP service area configuration can be: name: office area; IP address segment: IPv4: 192.168.1.100-192.168.1.200; IPv6: fd00::100-fd00::200;
[0071] Admission rule list: 1. Device feature tag matching rule: empty, whether to allow: reject; 2. Device feature tag matching rule: contains "Windows IPv4 device" or contains "Windows IPv6 device", whether to allow: allow; Configuration list: 1. Device feature tag matching rule: empty, DHCP Option list: 1. DNS server = 1.1.1.1, 2. Lease time = 12 hours.
[0072] Step S3, receiving the DHCP request from the client, determining the corresponding DHCP service area according to the network interface from which the request comes and the one-to-one relationship between the network interface and the DHCP service area.
[0073] Step S4, distinguishing whether the DHCP request protocol version of the client in step S3 is a DHCPv4 request or a DHCPv6 request; if it is a DHCPv6 request, finding 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 request message.
[0074] Step S5, according to the DHCP request protocol version in S4, parsing the DHCP Option data in the request message, and according to the parsed DHCP Option data and the MAC address in step S4, matching the device feature tag contained in the DHCP request in the device feature tag matching strategy in step S1.
[0075] Step S6, reading the admission rule and configuration list of the DHCP service area in step S3, determining whether it meets the admission rule according to the device feature tag contained in the DHCP request in step S5 and the admission rule list; if it meets the admission rule, matching the configuration item that meets the condition in the configuration list according to the device feature tag contained in the DHCP request in step S5.
[0076] Step S7, if the admission rule in step S6 is met, sending the DHCP response data in step S6 to the client in step S3.
[0077] Step S8, recording the DHCP request data in step S3, the device feature tag contained in the DHCP request in step S5, whether to allow the device to access in step S6, and the DHCP response data to the database for subsequent statistical display.
[0078] In summary, the method provided by the embodiment of the application can mark the type of a client by matching the characteristics of a client DHCP request, and provide access control, different configurations for different client types, and client type quantity statistics on this basis; the standard DHCP protocol is adopted, deployment is simple, most of the existing network devices are supported, and various sizes of LANs are supported; a distributed deployment implementation scheme can realize system load balancing, disaster recovery, and smooth capacity expansion, and the implementation basis is perfect.
[0079] Embodiment three
[0080] Corresponding to the method embodiments, the embodiment of the application provides a device for realizing LAN device management and statistics based on a DHCP service, referring to a structural schematic diagram of a device for realizing LAN device management and statistics based on a DHCP service shown in Figure 3 The device for realizing LAN device management and statistics based on a DHCP service comprises:
[0081] A feature tag matching strategy setting module 31 is configured to set a device feature tag matching strategy and a DHCP service area;
[0082] A DHCP request receiving module 32 is configured to receive a DHCP request sent by a client, and determine a DHCP service area corresponding to the DHCP request;
[0083] A DHCP request processing module 33 is configured to, if the DHCP request is a DHCPv6 request, find a MAC address corresponding to a source IPv6 address in an operating system IPv6 neighbor table according to the source IPv6 address in the DHCP request message;
[0084] A device feature tag determining module 34 is configured to match a device feature tag contained in the DHCP request according to the DHCP request data, the MAC address, and the device feature tag matching strategy;
[0085] A DHCP response data determining module 35 is configured to determine whether to allow a device to access according to the service area corresponding to the DHCP request, and an access rule and a 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 is configured to send the DHCP response data to the client;
[0087] A database recording module 37 is configured to record the DHCP request data, the device feature tag contained in the DHCP request, information representing whether to allow the device to access, and the DHCP response data to a database.
[0088] The embodiment of the application provides a device for realizing LAN device management and statistics based on a DHCP service, which labels the type of a client by matching the characteristics of a DHCP request of the client, and provides access control, different configurations for different client types, and client type quantity statistics on the basis; the device adopts a standard DHCP protocol, is simple to deploy, supports most of existing network devices, and supports LANs of various scales; the device supports a distributed deployment implementation scheme, can realize system load balancing, disaster recovery and smooth capacity expansion, is standard and normative, and has perfect implementation foundation conditions.
[0089] The DHCP service area includes an IP address segment, a corresponding network interface, and an access rule and a configuration list determined according to a device characteristic label in the DHCP service area.
[0090] The DHCP request receiving module is configured to receive a DHCP request sent by a client, and determine a DHCP service area corresponding to the DHCP request based on a source network interface.
[0091] The device further includes a DHCP request version determining module configured to determine whether the DHCP request is a DHCPv4 request or a DHCPv6 request based on a DHCP request protocol version.
[0092] The device characteristic label determining module is configured to parse DHCP Option data in the DHCP request message according to the DHCP request protocol version, and match a device characteristic label contained in the DHCP request in a device characteristic label matching strategy according to the DHCP Option data and a MAC address.
[0093] The DHCP response data determining module is configured to read an access rule and a configuration list of the DHCP service area, determine whether the access rule is met in the access rule of the DHCP service area according to the device characteristic label contained in the DHCP request, match a configuration item meeting a condition in the configuration list of the DHCP service area according to the device characteristic label contained in the DHCP request if the access rule is met, and determine that the device is allowed to access.
[0094] The DHCP response data determining module is further configured to set DHCP Option and values contained in the DHCP response data according to the configuration item meeting the condition.
[0095] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device for realizing LAN device management and statistics based on the DHCP service described above can refer to the corresponding process in the foregoing embodiment of the method for realizing LAN device management and statistics based on the DHCP service, and will not be described herein again.
[0096] Embodiment Four
[0097] The embodiment of the present application further provides an electronic device for running the method for realizing local area network device management and statistics based on a DHCP service. Figure 4 As shown in FIG. 1, an electronic device includes a memory 100 and a processor 101, wherein the memory 100 is used for storing one or more computer instructions, and the one or more computer instructions are executed by the processor 101 to realize the method for realizing local area network device management and statistics based on a DHCP service.
[0098] Further, Figure 4 As shown in FIG. 1, the electronic device 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] The memory 100 can include a high-speed random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used. The bus 102 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 4 In FIG. 1, only one bidirectional arrow is used to represent the bus, but it does not mean that there is only one bus or only one type of bus.
[0100] The processor 101 can be an integrated circuit chip having a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 101 or the instruction in the form of software. The processor 101 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Each method, step and logic block diagram disclosed in the embodiment of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiment of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the storage 100, and the processor 101 reads the information in the storage 100, and combines the hardware to complete the steps of the method of the above embodiment.
[0101] The embodiment of the present application further provides 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 realizing local area network device management and statistics based on the DHCP service, and specific implementation can be referred to the method embodiment, and will not be repeated here.
[0102] The computer program product of the method for realizing local area network device management and statistics based on the DHCP service provided by the embodiment of the present application comprises a computer readable storage medium storing program codes, the instructions included in the program codes can be used to execute the method in the foregoing method embodiment, and specific implementation can be referred to the method embodiment, and will not be repeated here.
[0103] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and / or device described above can refer to the corresponding process in the foregoing method embodiment, and will not be repeated here.
[0104] In addition, in the description of the embodiments of the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connection", "connecting" should be understood in a broad sense, for example, can be fixedly connected, can be detachably connected, or integrally connected; can be mechanically connected, can be electrically connected; can be directly connected, can be indirectly connected through an intermediate medium, or can be the communication inside two elements. For those skilled in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.
[0105] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the part of the present application that essentially contributes to the prior art or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing 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 embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0106] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", "third" are only 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 application, which are used to illustrate the technical solutions of the present application, and are not limiting, the protection scope of the present application is not limited thereto, although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art within the technical range disclosed by the present application can modify or easily think of changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for implementing LAN device management and statistics based on DHCP service, characterized in that, The method comprises: setting a device feature label matching strategy and a dynamic host configuration protocol (DHCP) service area; the DHCP service area contains an Internet Protocol (IP) address segment, a corresponding network interface, and an access rule and a configuration list determined according to a device feature label under the DHCP service area; receiving a DHCP request sent by a client, and determining a DHCP service area corresponding to the DHCP request; if the DHCP request is an Internet Protocol version 6 (IPv6) dynamic host configuration protocol (DHCPv6) request, searching for a media access control (MAC) address corresponding to a source IPv6 address in an IPv6 neighbor table of an operating system according to the source IPv6 address in the DHCP request message; matching a device feature label contained in the DHCP request according to the DHCP request data, the MAC address, and the device feature label matching strategy; determining whether to allow device access according to the service area corresponding to the DHCP request and the access rule and the configuration list of the service area, and continuing to determine DHCP response data if device access is allowed; sending the DHCP response data to the client; recording the DHCP request data, the device feature label contained in the DHCP request, information indicating whether to allow device access, and the DHCP response data to a database.
2. The method of claim 1, wherein, The step of receiving a DHCP request sent by a client and determining a DHCP service area corresponding to the DHCP request comprises: receiving a DHCP request sent by a client, and determining a DHCP service area corresponding to the DHCP request based on a source network interface.
3. The method of claim 1, wherein, The method further comprises: determining whether the DHCP request is an Internet Protocol version 4 (IPv4) dynamic host configuration protocol (DHCPv4) request or a DHCPv6 request based on a DHCP request protocol version.
4. The method of claim 3, wherein, The step of matching a device feature label contained in the DHCP request according to the DHCP request data, the MAC address, and the device feature label matching strategy comprises: parsing DHCP Option data in the DHCP request message according to the DHCP request protocol version; matching the device feature label contained in the DHCP request in the device feature label matching strategy according to the DHCP Option data and the MAC address.
5. The method of claim 4, wherein, The step of determining whether to allow device access according to the service area corresponding to the DHCP request and the access rule and the configuration list of the service area comprises: reading the access rule and the configuration list of the DHCP service area; determining whether to meet the access rule in the access rule of the DHCP service area according to the device feature label contained in the DHCP request; if the access rule is met, matching a configuration item meeting a condition in the configuration list of the DHCP service area according to the device feature label contained in the DHCP request, and determining to allow device access.
6. The method of claim 5, wherein, If the device is allowed to access, continue to determine the step of the DHCP response data, including: According to the eligible configuration item, set the DHCP Option and value contained in the DHCP response data.
7. An apparatus for implementing LAN device management and statistics based on a DHCP service, characterized in that, The device comprises: A feature tag matching strategy setting module, configured to set a device feature tag matching strategy and a DHCP service area; the DHCP service area contains an IP address segment, a corresponding network interface, and an access rule and a configuration list issued under the device feature tag determined according to the device feature tag matching strategy; A DHCP request receiving module, configured to receive a DHCP request sent by a client and determine a DHCP service area corresponding to the DHCP request; A DHCP request processing module, configured to, when the DHCP request is a DHCPv6 request, find a MAC address corresponding to a source IPv6 address in an IPv6 neighbor table of an operating system according to the source IPv6 address in the DHCP request message; A device feature tag determining module, configured to match a device feature tag contained in the DHCP request according to the DHCP request data, the MAC address, and the device feature tag matching strategy; A DHCP response data determining module, configured to determine whether to allow the device to access according to the service area corresponding to the DHCP request and the access rule and the 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 tag contained in the DHCP request, information representing whether to allow the device to access, and the DHCP response data to a database.
8. An electronic device, comprising: The computer readable storage medium stores computer executable instructions, and the computer executable instructions, when called and executed by the processor, cause the processor to implement the method for realizing local area network device management and statistics based on the DHCP service according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions, and the computer executable instructions, when called and executed by the processor, cause the processor to implement the method for realizing local area network device management and statistics based on the DHCP service according to any one of claims 1 to 6.
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