Address allocation method, device, DHCP server, system and storage medium
By binding MAC address prefixes to an address pool in the DHCP server, the problem of client address isolation from different device manufacturers is solved, enabling accurate address allocation and simplified IP address renewal, and improving the management flexibility of the DHCP server.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NINGBO SANXING MEDICAL & ELECTRIC CO LTD
- Filing Date
- 2023-07-28
- Publication Date
- 2026-06-16
Smart Images

Figure CN116886668B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communications, and more specifically, to an address allocation method, apparatus, DHCP server, system, and storage medium. Background Technology
[0002] In a local area network (LAN), a DHCP (Dynamic Host Configuration Protocol) server is typically configured. This server is responsible for the centralized management and allocation of IP addresses, enabling hosts in the network environment to dynamically obtain information such as IP addresses, gateway addresses, and DNS server addresses, thereby improving IP address utilization.
[0003] IP address allocation handled by a DHCP server is a dynamic allocation process. The process is as follows: a computer, acting as a DHCP client, requests an IP address from the DHCP server. The DHCP server only temporarily assigns an IP address to the client, with a lease period. Once the lease expires, the IP address is returned to the DHCP server for use by other clients. If the DHCP client still needs an IP address to perform its tasks, it can choose to renew the lease or request a different IP address. Therefore, the IP address obtained by a client may change each time, which is a dynamic allocation process.
[0004] A common dynamic address allocation method in existing technologies is that the DHCP server binds its own interface (physical interface or virtual interface) to various configured address pools. When it receives a Solicit message from a client, the DHCP server selects an available address from the address pool corresponding to the interface that received the Solicit message and allocates it to the client.
[0005] However, this method of using interface-bound address pools cannot achieve isolation between clients from different device manufacturers under the same interface. Summary of the Invention
[0006] The purpose of this invention is to provide an address allocation method, apparatus, DHCP server, system, and storage medium to improve the problems existing in the prior art.
[0007] The embodiments of the present invention can be implemented as follows:
[0008] In a first aspect, the present invention provides an address allocation method applied to a DHCP server, wherein the DHCP server is pre-configured with multiple address pools, and each address pool is bound to a MAC address prefix; the method includes:
[0009] Receive the first address request message sent by the client device;
[0010] The client MAC address of the client device is determined based on the first address request message; the MAC address prefix of the client MAC address represents the device manufacturer to which the client device belongs;
[0011] Search for a target address pool from all the address pools that matches the MAC address prefix of the client's MAC address;
[0012] An idle target address is determined from the target address pool and allocated to the client device for use. The target address is an IP address or an IP prefix.
[0013] Optionally, the step of determining the client MAC address of the client device based on the first address request message includes:
[0014] The first address request message is parsed to obtain the unique identifier DUID of the client device carried in the first address request message;
[0015] The client MAC address is parsed from the DUID of the client device.
[0016] Optionally, the step of determining a free target address from the target address pool and allocating the target address to the client device includes:
[0017] Determine free target addresses from the target address pool;
[0018] The system replies to the client device with a first response message, which carries the target address and lease information.
[0019] When a second address request message is received from the client device, a second response message is sent back to the client device to enable the client device to use the target address; the second address request message is sent by the client device after receiving the first response message and is used to request the use of the target address.
[0020] Optionally, the DHCP server manages each address pool through a database, and the method further includes:
[0021] The target allocation information of the target address is saved to the database; the target allocation information includes the target address, the lease information, the DUID of the client device, and the Identity Association Identifier (IAID).
[0022] When a renewal request is received from the client device before the lease expires, the target allocation information is searched from several allocation information in the database based on the DUID and IAID carried in the renewal request.
[0023] The client device is replied with a renewal response message containing the target address and new lease term information to reassign the target address to the client device.
[0024] Optionally, the DHCP server maintains a configuration message queue; the DHCP server manages each address pool through a database; the method further includes:
[0025] Continuously monitor the configured message queue;
[0026] When the configuration message queue is detected to contain an address pool change instruction sent by the control device, the address pool change instruction is retrieved.
[0027] If the address pool change instruction is a new instruction, a new address pool belonging to the specified link range is added to the database, and the new address pool is bound to the new MAC address prefix; the new instruction includes the specified link range and the new MAC address prefix;
[0028] If the address pool change instruction is a deletion instruction, the specified address pool corresponding to the specified MAC address prefix is searched from the database, and the specified address pool is deleted; the deletion instruction includes the specified MAC address prefix.
[0029] Secondly, the present invention also provides an address allocation device applied to a DHCP server, wherein the DHCP server is pre-configured with multiple address pools, and each address pool is bound to a MAC address prefix; the device includes:
[0030] The receiving module is used for:
[0031] Receive the first address request message sent by the client device;
[0032] The client MAC address of the client device is determined based on the first address request message; the MAC address prefix of the client MAC address represents the device manufacturer to which the client device belongs;
[0033] The lookup module is used to search for a target address pool that matches the MAC address prefix of the client's MAC address from all the address pools.
[0034] The allocation module is used to determine free target addresses from the target address pool and allocate the target addresses to the client device for use.
[0035] Optionally, the DHCP server maintains a configuration message queue; the DHCP server manages each address pool through a database; the device further includes a listening module, used for:
[0036] Continuously monitor the configured message queue;
[0037] When the configuration message queue is detected to contain an address pool change instruction sent by the control device, the address pool change instruction is retrieved.
[0038] If the address pool change instruction is a new instruction, a new address pool belonging to the specified link range is added to the database, and the new address pool is bound to the new MAC address prefix; the new instruction includes the specified link range and the new MAC address prefix;
[0039] If the address pool change instruction is a deletion instruction, the specified address pool corresponding to the specified MAC address prefix is searched from the database, and the specified address pool is deleted; the deletion instruction includes the specified MAC address prefix.
[0040] Thirdly, the present invention also provides a DHCP server, comprising: a memory and a processor, wherein the memory stores a software program, and when the DHCP server is running, the processor executes the software program to implement the address allocation method provided in the first aspect above.
[0041] Fourthly, the present invention also provides an address allocation system, the allocation system comprising at least one DHCP server and several client devices;
[0042] The DHCP server is used to assign addresses to each of the client devices according to the address allocation method provided in the first aspect above.
[0043] Fifthly, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the address allocation method provided in the first aspect.
[0044] Compared with existing technologies, embodiments of the present invention provide an address allocation method, apparatus, DHCP server, system, and storage medium. In this invention, the DHCP server is pre-configured with multiple address pools bound to MAC address prefixes. Therefore, when the DHCP server receives a first address request message from a client device, it determines the client device's MAC address based on the first address request message. Then, it searches the entire address pool for a target address pool that matches the MAC address prefix of the client device's MAC address. Finally, it determines an available target address from the target address pool and allocates the target address to the client device. Its advantage lies in the fact that, since the MAC address prefix of the client device's MAC address represents the device manufacturer to which the client device belongs, binding the address pool to the MAC address prefix ensures that the addresses allocated to client devices from the same device manufacturer belong to the link range defined by the same address pool, thereby achieving address isolation between different device manufacturers. Attached Figure Description
[0045] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is one of the flowcharts illustrating an address allocation method provided in an embodiment of the present invention.
[0047] Figure 2 This is a second flowchart illustrating an address allocation method provided in an embodiment of the present invention.
[0048] Figure 3 This is a schematic diagram of signaling interaction between a client device and a DHCP server, provided as an embodiment of the present invention.
[0049] Figure 4 This is a schematic diagram of an application scenario provided by an embodiment of the present invention.
[0050] Figure 5 This is the third flowchart illustrating an address allocation method provided in an embodiment of the present invention.
[0051] Figure 6 This is a schematic diagram of an address allocation device provided in an embodiment of the present invention.
[0052] Figure 7 This is a schematic diagram of the structure of a DHCP server provided in an embodiment of the present invention. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0054] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0055] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0056] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.
[0057] Here, we will first introduce the keywords or key terms involved in this invention:
[0058] 1. Identity Association (IA): An Identity Association is a structure that enables servers and clients to identify, group, and manage a set of related IPv6 addresses. Each IA includes an IAID and associated configuration information. A client must associate at least one IA with each of its interfaces that needs to obtain an IPv6 address from the server. The client uses the IA associated with the interface to obtain configuration information from the server.
[0059] 2. IAID: Used to identify the IA. Duplicate IAIDs must be unique to the same client. The IAID should not be lost or changed due to factors such as device restarts.
[0060] 3. DUID, DHCP Unique Identifier, is a unique identifier for DHCPv6 devices. Each server or client has one and only one unique identifier. Servers use DUID to identify different clients, and clients use DUID to identify servers. DUIDs are generated in three ways:
[0061] (1) DUID-LLT (DUID Based on Link-layer Address Plus Time): Generates DHCPv6 device DUID values based on time and link-layer address.
[0062] (2) DUID-EN (DUID Assigned by Vendor Based on Enterprise Number): Generates DHCPv6 device DUID value based on the enterprise number registered with IANA.
[0063] (3) DUID-LL (DUID Based on Link-layer Address): Generates DHCPv6 device DUID value based on link-layer address.
[0064] As mentioned in the background section, a common dynamic allocation method in the prior art is that the DHCP server binds its own interface (physical interface or virtual interface) to various configured address pools. When it receives a Solicit message from a client, the DHCP server selects an available address from the address pool corresponding to the interface that received the Solicit message and allocates it to the client.
[0065] However, this method of using interface-bound address pools cannot achieve isolation for clients from different device manufacturers under the same interface.
[0066] In scenarios where relay devices are present, all interactions between network devices and the DHCP server need to be forwarded through the relay devices. In existing technologies, after receiving a Solicit message from a client, the relay device adds a link-address field to the Solicit message before forwarding it to the DHCP server. The link-address field is an IPv6 global unicast address or a link-local address. The DHCP server can identify the link the client is connected to based on the link-address field and then select a free address from the address pool belonging to the same link range as the link-address for allocation.
[0067] However, in the method of obtaining the address pool based on link-address, once the link-address changes, clients that were previously allocated IP addresses through the old link-address cannot renew their contracts normally and can only request new IP addresses, which is quite cumbersome.
[0068] Furthermore, existing DHCP services are difficult to modify and add address pools during application.
[0069] Based on the discovery of the aforementioned technical problems, the inventors, through creative labor, proposed the following technical solutions to solve or improve these problems. It should be noted that the deficiencies in the solutions of the prior art are all results derived by the inventors after practical experience and careful research. Therefore, the discovery process of the aforementioned problems and the solutions proposed in the embodiments of this application below should be considered contributions made by the inventors to this application during the inventive process, and should not be construed as technical content known to those skilled in the art.
[0070] In view of this, embodiments of the present invention provide an address allocation method that binds an address pool to a MAC address prefix. Since the MAC address prefix of a client's MAC address can identify the device manufacturer to which the client device belongs, address allocation based on this prefix ensures that the addresses allocated to various client devices from the same device manufacturer belong to the same link range defined by the address pool, thereby achieving address isolation between different device manufacturers. The following detailed description, through embodiments and in conjunction with the accompanying drawings, will illustrate this method.
[0071] The address allocation provided in this embodiment of the invention can be applied to a DHCP server. This DHCP server needs to be pre-configured with multiple address pools, each bound to a MAC address prefix. The DHCP server in this invention represents a DHCPv6 server, which can be a virtual server or a physical server.
[0072] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating an address allocation method provided in an embodiment of the present invention. The method includes the following steps S101 to S104:
[0073] S101. Receive the first address request message sent by the client device.
[0074] In this embodiment, the first address request message is a Solicit message sent by the client device.
[0075] S102. Determine the client MAC address of the client device based on the first address request message.
[0076] As you can understand, a MAC address is 48 bits (6 bytes) long, typically represented as 12 hexadecimal numbers. The first 3 bytes of the MAC address are the MAC address prefix, representing the network hardware manufacturer's identifier, which is assigned by the IEEE (Institute of Electrical and Electronics Engineers); while the last 3 bytes of the MAC address represent the serial number of a specific network product (such as a network interface card) manufactured by that manufacturer. Therefore, the MAC address is a unique identifier for a device.
[0077] Therefore, in this embodiment, the MAC address prefix of the client MAC address represents the device manufacturer to which the client device belongs.
[0078] S103. Search for the target address pool that matches the MAC address prefix of the client's MAC address from the entire address pool.
[0079] S104. Determine a free target address from the target address pool and allocate the target address to the client device for use.
[0080] In this embodiment, a free target address can be determined from the target address pool. This target address is an IPv6 address or an IPv6 prefix. Reserved addresses (such as anycast addresses defined in RFC 2526), conflicting addresses, and already assigned addresses in the target address pool cannot be reassigned.
[0081] The address allocation method provided in this invention binds an address pool to a MAC address prefix. Since the MAC address prefix of a client's MAC address can identify the device manufacturer to which the client device belongs, address allocation based on this can search for a target address pool in the entire address pool that matches the MAC address prefix of the client's MAC address, and then find an idle target address from the target address pool to allocate to the client device. This ensures that the addresses allocated to different client devices from the same device manufacturer belong to the link range defined by the same address pool, thereby achieving address isolation between different device manufacturers.
[0082] In an optional implementation, the first address request message, i.e., the Solicit message, carries the DUID of the client device. The sub-steps of step S101 above may include:
[0083] S1011. Parse the first address request message to obtain the unique identifier DUID of the client device carried in the first address request message.
[0084] S1012. Extract the client MAC address from the DUID of the client device.
[0085] In this embodiment, according to standard RFC3315, the DUID is generated based on the link layer address, that is, based on the MAC address. Its components include: a 16-bit DUID type (3), a 16-bit network hardware type code, and the device's link layer address, i.e., the MAC address.
[0086] For optional implementation methods, please refer to [link / reference]. Figure 2 The sub-steps of step S104 above may include: S1041 to S1043.
[0087] S1041. Determine an available target address from the target address pool.
[0088] S1042. Reply to the client device with the first response message.
[0089] In this embodiment, the first response message is the Advertise message, which includes: the DUID of the client device, the DUID of the DHCP server, the target address, and the lease period information.
[0090] S1043. When a second address request message is received from a client device, a second response message is sent back to the client device so that the client device can use the target address.
[0091] In this embodiment, after receiving the first response message, the client device sends a second address request message to the DHCP server to request the use of the target address.
[0092] It can be understood that the second address request message is the same as the Request message; the second response message is the same as the Reply message, which is used to confirm that the target address will be assigned to the DHCP server.
[0093] Please see Figure 3 During the entire address allocation process, the interaction flow between the client device and the DHCP server is as follows:
[0094] 1. The client device sends a Solicit message to the DHCP server, requesting the DHCP server to assign an address;
[0095] 2. After the DHCP server determines an available target address, it replies with an Advertise message to the client device to indicate the available target address and lease period information.
[0096] 3. The client sends a Request message to the DHCP server, which is used by the DHCP server to request the use of the target address;
[0097] 4. The DHCP server replies with a Reply message to the client device to confirm that the target address has been assigned to the DHCP server.
[0098] For the optional implementation methods, please refer to Figure 4 The DHCP server can manage various address pools through a database built on a MySQL server.
[0099] Optional, please see Figure 5 Following step S104, the following steps S105 to S107 may also be included:
[0100] S105. Save the target address's target allocation information to the database.
[0101] In this embodiment, the target allocation information may include the target address, lease term information, the DUID of the client device, and the Identity Association Identifier (IAID).
[0102] Understandably, the database can also store allocation information after each address allocation.
[0103] S106. When a renewal request is received from a client device before the lease expires, the target allocation information is searched from several allocation information in the database based on the DUID and IAID carried in the renewal request.
[0104] S107. Reply to the client device with a renewal response message containing the target address and new lease term information, so as to reassign the target address to the client device for use.
[0105] Optionally, the DHCP server may maintain a configuration message queue, which is used to temporarily store instructions sent by the control device to configure the address pool. Correspondingly, the address allocation process may further include the following steps S201–S204:
[0106] S201, continuously monitor the configured message queue.
[0107] S202. When an address pool change instruction sent by the control device is detected in the configuration message queue, the address pool change instruction is retrieved.
[0108] In this embodiment, the address pool change instruction sent by the control device is used to instruct the DHCP server to add a new address pool with a specified link range and associated with a new device manufacturer, or to instruct the DHCP server to delete the address pool corresponding to a specified device manufacturer.
[0109] S2013. If the address pool change instruction is a new instruction, a new address pool belonging to the specified link range is added to the database, and the new address pool is bound to the new MAC address prefix.
[0110] In this embodiment, the new instructions may include specifying the link range and a new MAC address prefix representing the new equipment manufacturer.
[0111] S204. If the address pool change instruction is a deletion instruction, search the database for the specified address pool corresponding to the specified MAC address prefix, and delete the specified address pool.
[0112] In this embodiment, the deletion instruction may include a specified MAC address prefix representing a specified device manufacturer.
[0113] It should be noted that the execution order of each step in the above method embodiments is not limited to that shown in the accompanying drawings, and the execution order of each step shall be subject to the actual application. The execution order of steps S201 to S204 can be arbitrary and is not limited to steps S101 to S107 above.
[0114] In order to perform the corresponding steps in the above method embodiments and various possible implementations, an implementation of an address allocation device is given below.
[0115] Please see Figure 6 , Figure 6 A schematic diagram of the address allocation device provided in an embodiment of the present invention is shown. The address allocation device 200 is applied to a DHCP server, which is pre-configured with multiple address pools, each address pool being bound to a MAC address prefix. The address allocation device 200 includes: a receiving module 210, a lookup module 220, and an allocation module 230.
[0116] The receiving module 210 is configured to: receive a first address request message sent by a client device; determine the client MAC address of the client device based on the first address request message; and specify the MAC address prefix of the client MAC address to indicate the device manufacturer to which the client device belongs.
[0117] The lookup module 220 is used to search for a target address pool that matches the MAC address prefix of the client's MAC address from the entire address pool;
[0118] The allocation module 230 is used to determine free target addresses from the target address pool so as to allocate the target addresses to the client devices.
[0119] Optionally, when the receiving module 210 determines the client MAC address of the client device based on the first address request message, it can specifically be used to: parse the first address request message to obtain the unique identifier DUID of the client device carried in the first address request message; and parse the client MAC address from the DUID of the client device.
[0120] Optionally, when the allocation module 230 determines a free target address from the target address pool and allocates the target address to the client device, it can specifically be used to: determine a free target address from the target address pool; reply to the client device with a first response message, the first response message carrying the target address and lease information; when a second address request message is received from the client device, reply to the client device with a second response message so that the client device can use the target address; the second address request message is sent by the client device after receiving the first response message and is used to request the use of the target address.
[0121] Optionally, the allocation module 230 can also be used to: save the target allocation information of the target address to a database; the target allocation information includes the target address, lease term information, DUID of the client device, and Identity Association Identifier (IAID); when a renewal request is received from the client device before the lease term expires, the target allocation information is searched from several allocation information in the database based on the DUID and IAID carried in the renewal request; and a renewal response message with the target address and new lease term information is sent back to the client device to reassign the target address to the client device.
[0122] Optionally, the DHCP server maintains a configuration message queue; the DHCP server manages each address pool through a database; the device also includes a listening module 240, used for: continuously listening to the configuration message queue; when it detects an address pool change command sent by the control device in the configuration message queue, retrieving the address pool change command; if the address pool change command is a new command, adding a new address pool belonging to the specified link range in the database, and binding the new address pool to the new MAC address prefix; the new command includes the specified link range and the new MAC address prefix; if the address pool change command is a delete command, searching the database for the specified address pool corresponding to the specified MAC address prefix, and deleting the specified address pool; the delete command includes the specified MAC address prefix.
[0123] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the address allocation device 200 described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0124] Please see Figure 7 , Figure 7 This is a schematic diagram of a DHCP server provided in an embodiment of the present invention. The DHCP server 300 includes a processor 310, a memory 320, and a bus 330, with the processor 310 connected to the memory 320 via the bus 330.
[0125] The memory 320 can be used to store software programs, such as the software program corresponding to the address allocation device 200 provided in the embodiments of the present invention. The processor 310 executes various functional applications and data processing by running the software program stored in the memory 320 to implement the address allocation method provided in the embodiments of the present invention.
[0126] The memory 320 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), flash memory, programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0127] The processor 310 can be an integrated circuit chip with signal processing capabilities. The processor 310 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it 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, or discrete hardware components.
[0128] Understandable. Figure 7 The structure shown is for illustrative purposes only; the DHCP server 300 may also include more... Figure 7 The more or fewer components shown, or having the same Figure 7 The different configurations shown. Figure 7 The components shown can be implemented using hardware, software, or a combination thereof.
[0129] The present invention also provides an address allocation system, which may include at least one DHCP server and several client devices, wherein each DHCP server is used to allocate addresses to each client device according to the address allocation method in the above embodiments.
[0130] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the address allocation method disclosed in the above embodiments. The computer-readable storage medium can be, but is not limited to, various media capable of storing program code, such as a USB flash drive, portable hard drive, ROM, RAM, PROM, EPROM, EEPROM, FLASH disk, or optical disk.
[0131] In summary, this invention provides an address allocation method, apparatus, DHCP server, system, and storage medium. In this invention, the DHCP server is pre-configured with multiple address pools bound to MAC address prefixes. Therefore, when the DHCP server receives a first address request message from a client device, it determines the client device's MAC address based on the first address request message. Then, it searches the entire address pool for a target address pool that matches the MAC address prefix of the client device's MAC address. Finally, it determines an available target address from the target address pool and allocates the target address to the client device. Its advantage lies in the fact that, since the MAC address prefix of the client device's MAC address represents the device manufacturer to which the client device belongs, binding the address pool to the MAC address prefix ensures that the addresses allocated to client devices from the same device manufacturer belong to the link range defined by the same address pool, thereby achieving address isolation between different device manufacturers.
[0132] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An address allocation method, characterized in that, Applied to a DHCP server, the DHCP server is pre-configured with multiple address pools managed by a database, each address pool being bound to a MAC address prefix; the method includes: Receive the first address request message sent by the client device; The client MAC address of the client device is determined based on the first address request message; the MAC address prefix of the client MAC address represents the device manufacturer to which the client device belongs; Search for a target address pool from all the address pools that matches the MAC address prefix of the client's MAC address; An available target address is determined from the target address pool, and a first response message is sent back to the client device. The first response message carries the target address and lease information; the target address is an IP address or an IP prefix. When a second address request message is received from the client device, a second response message is sent back to the client device to enable the client device to use the target address; the second address request message is sent by the client device after receiving the first response message and is used to request the use of the target address; The target allocation information of the target address is saved to the database; the target allocation information includes the target address, the lease information, the DUID of the client device, and the Identity Association Identifier (IAID). When a renewal request is received from the client device before the lease expires, the target allocation information is searched from several allocation information in the database based on the DUID and IAID carried in the renewal request. The client device is replied with a renewal response message containing the target address and new lease term information to reassign the target address to the client device.
2. The method according to claim 1, characterized in that, The step of determining the client MAC address of the client device based on the first address request message includes: The first address request message is parsed to obtain the unique identifier DUID of the client device carried in the first address request message; The client MAC address is parsed from the DUID of the client device.
3. The method according to claim 1, characterized in that, The DHCP server maintains a configuration message queue; the method further includes: Continuously monitor the configured message queue; When the configuration message queue is detected to contain an address pool change instruction sent by the control device, the address pool change instruction is retrieved. If the address pool change instruction is a new instruction, a new address pool belonging to the specified link range is added to the database, and the new address pool is bound to the new MAC address prefix; the new instruction includes the specified link range and the new MAC address prefix; If the address pool change instruction is a deletion instruction, the specified address pool corresponding to the specified MAC address prefix is searched in the database, and the specified address pool is deleted; the deletion instruction includes the specified MAC address prefix.
4. An address allocation device, characterized in that, An apparatus for use with a DHCP server, wherein the DHCP server is pre-configured with multiple address pools managed by a database, and each address pool is bound to a MAC address prefix; the apparatus includes: The receiving module is used for: Receive the first address request message sent by the client device; The client MAC address of the client device is determined based on the first address request message; the MAC address prefix of the client MAC address represents the device manufacturer to which the client device belongs; The lookup module is used to search for a target address pool that matches the MAC address prefix of the client's MAC address from all the address pools. The allocation module is used to determine an idle target address from the target address pool and reply to the client device with a first response message, the first response message carrying the target address and lease information; the target address is an IP address or an IP prefix. The allocation module is further configured to reply with a second response message to the client device when it receives a second address request message sent by the client device, so that the client device can use the target address; the second address request message is sent by the client device after receiving the first response message, and is used to request the use of the target address; The allocation module is further configured to save the target allocation information of the target address to the database; the target allocation information includes the target address, the lease information, the DUID of the client device, and the Identity Association Identifier (IAID); The allocation module is further configured to, when receiving a renewal request sent by the client device before the lease term expires, search for the target allocation information from several allocation information in the database based on the DUID and IAID carried in the renewal request; The allocation module is also configured to reply to the client device with a renewal response message containing the target address and new lease term information, so as to reassign the target address to the client device for use.
5. The apparatus according to claim 4, characterized in that, The DHCP server maintains a configuration message queue; the device further includes a listening module, used for: Continuously monitor the configured message queue; When the configuration message queue is detected to contain an address pool change instruction sent by the control device, the address pool change instruction is retrieved. If the address pool change instruction is a new instruction, a new address pool belonging to the specified link range is added to the database, and the new address pool is bound to the new MAC address prefix; the new instruction includes the specified link range and the new MAC address prefix; If the address pool change instruction is a deletion instruction, the specified address pool corresponding to the specified MAC address prefix is searched in the database, and the specified address pool is deleted; the deletion instruction includes the specified MAC address prefix.
6. A DHCP server, characterized in that, include: The DHCP server includes a memory and a processor, wherein the memory stores a software program, and the processor executes the software program to implement the address allocation method as described in any one of claims 1-3 when the DHCP server is running.
7. An address allocation system, characterized in that, The allocation system includes at least one DHCP server and several client devices; The DHCP server is used to assign addresses to each of the client devices according to the address allocation method of any one of claims 1-3.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the address allocation method according to any one of claims 1-3.