Address allocation method and device

By dividing and synchronizing the subnet segments of the address pool between master and slave devices in the DRNI environment, the problem that master and slave devices cannot achieve centralized address management and allocation is solved, and the DHCP client is launched on any network device, reducing performance pressure and improving the online rate.

CN115499414BActive Publication Date: 2025-03-04NEW H3C TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210972334.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-15
Publication Date
2025-03-04
Estimated Expiration
2042-08-15

AI Technical Summary

Technical Problem

In the DRNI environment, the master and slave devices cannot implement centralized management and allocation of addresses, resulting in the DHCP client being unable to be online at any network device.

Method used

By realizing sub-network segment division and synchronization of the address pool between the master and the slave device, after receiving the DHCP Discover message, the master device judges and divides the network segment, allocates the address, and synchronizes the sub-network information to the slave device to ensure centralized management and allocation of addresses.

Benefits of technology

It realizes that any network device of the DHCP client is launched in the DRNI environment, which reduces the performance pressure of the network device, increases the online rate of the DHCP client, and avoids address conflicts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115499414B_ABST
    Figure CN115499414B_ABST
Patent Text Reader

Abstract

The present application provides an address allocation method and device, the method comprising: when receiving a first DHCP Discover message sent by a first DHCP client, determining whether a first subnet segment exists locally; if not, determining whether the first subnet segment can be divided from the first network segment; if so, creating the first subnet segment and obtaining a first address; when it is determined that the first DHCP client uses the first address to go online, sending a first synchronization message to a slave device, the first synchronization message including the network segment information of the first subnet segment and a first table item of the first DHCP client, so that the slave device determines whether a corresponding first subnet segment exists locally; if so, removing the first address from the first subnet segment and generating a first table item; if not, creating the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removing the first address from the first subnet segment, and generating a first table item.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to an address allocation method and device. Background Art

[0002] Distributed Resilient Network Interconnect (DRNI) is a cross-device link aggregation technology that virtualizes multiple physical devices into one network device at the aggregation level to achieve cross-device link aggregation, thereby providing device-level redundancy protection and traffic load sharing.

[0003] like Figure 1 As shown, Figure 1 This is a schematic diagram of the DRNI network model. Figure 1 In the example, network device A and network device B are neighbors, network device A is the master device, and network device B is the slave device. The master and slave devices share the load and forward the service traffic sent by the host. When one of the network devices fails, the service traffic can be quickly forwarded by another network device to ensure the normal operation of the service traffic.

[0004] Dynamic Host Configuration Protocol (DHCP) uses a client / server model, where the server dynamically allocates network configuration parameters such as IP addresses and default gateways to network devices.

[0005] like Figure 2 As shown, Figure 2 This is a basic DHCP networking diagram. Figure 2 In the DHCP protocol, when a DHCP client and multiple DHCP servers are in the same physical network segment, the DHCP client broadcasts a DHCP Discover message. After each DHCP server receives the DHCP Discover message, it searches for an address pool in the same network segment based on the address of the interface that receives the DHCP Discover message, and selects an address from the address pool to allocate to the DHCP client. Each DHCP server sends a DHCP Offer message to the client, which includes information such as the address assigned by the DHCP server to the DHCP client, the default gateway address, and the DNS server address.

[0006] After receiving multiple DHCP Offer messages, the DHCP client processes the first DHCP Offer message received first, which includes the address of a DHCP server. The DHCP client broadcasts a DHCP Request message, which includes the address of the DHCP server selected by the DHCP client. The selected DHCP server sends a DHCP Acknowledgement (Ack) message to the DHCP client, and the DHCP Ack message includes the lease of the address assigned by the DHCP server. At this point, the interaction process between the DHCP client and the DHCP server is completed.

[0007] After receiving the DHCP ACK message, the DHCP client checks whether the address assigned by the DHCP server can be used. If it can be used, the DHCP client successfully obtains the address and automatically starts the renewal process according to the address lease; if it cannot be used, the DHCP client sends a DHCP Decline message to the DHCP server to notify the DHCP server to disable the address. The DHCP client starts a new address application process again.

[0008] Since DHCP is a widely used address allocation and management technology, and the use of DRNI is becoming more and more widespread, how to support DHCP in a DRNI environment is a problem that needs to be solved at present.

[0009] Currently, DHCP support in a DRNI environment can be achieved through the following methods:

[0010] The DHCP server is configured in both the master and slave devices, but the allocatable address segments of the address pools in the two network devices do not overlap. For example, both network device A and network device B configure the address pool test_pool, and the network segment of the address pool is 20.0.0.0 / 24. However, the address segment that network device A can allocate is 20.0.0.1-20.0.0.125, and the address segment that network device B can allocate is 20.0.0.126-20.0.0.254.

[0011] After receiving the DHCP Discover message sent by the DHCP client, each network device can use its own configured address segment to independently allocate addresses to the DHCP client. After allocating addresses, it synchronizes the locally generated client table entries to the peer end, ensuring that the DHCP client can complete operations such as renewal and offline on any network device.

[0012] However, in the above implementation, the master and slave devices do not implement centralized management and allocation of addresses. For example, after the address segment in network device A is used up, even if there are still available addresses in the address segment in network device B, the DHCP client cannot successfully go online from network device A. Summary of the invention

[0013] In view of this, the present application provides an address allocation method and device to solve the problem that in the existing DRNI environment supporting DHCP, the master and slave devices cannot achieve centralized management and allocation of addresses, resulting in the DHCP client being unable to go online at any network device in the DRNI environment.

[0014] In a first aspect, the present application provides an address allocation method, the method being applied to a master device, the master device being in a DRNI network, the DRNI network further comprising a slave device, a first address pool being configured in the master device, the first address pool having a corresponding first network segment, a second address pool being configured in the slave device, the second address pool having a corresponding second network segment, the method comprising:

[0015] When receiving a first DHCP Discover message sent by a first DHCP client, determining whether there is a first subnet segment available for allocating addresses locally;

[0016] If not, determining whether the first subnet segment can be divided from the first net segment;

[0017] If yes, create the first subnet segment and obtain the first address from the first subnet segment;

[0018] Sending a first DHCP Offer message to the first DHCP client, where the first DHCP Offer message includes the first address;

[0019] After determining that the first DHCP client goes online using the first address, sending a first synchronization message to the slave device, the first synchronization message including the network segment information of the first subnet segment and the first table item of the first DHCP client, the first table item including the first address, so that the slave device determines whether the corresponding first subnet segment exists locally, if so, removes the first address from the first subnet segment, and generates the first table item; if not, creates the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table item;

[0020] The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0021] In a second aspect, the present application provides an address allocation method, the method being applied to a slave device, the slave device being in a DRNI network, the DRNI network further comprising a master device, a first address pool being configured in the master device, the first address pool having a corresponding first network segment, a second address pool being configured in the slave device, the second address pool having a corresponding second network segment, the method comprising:

[0022] receiving a first synchronization message sent by the master device, wherein the first synchronization message includes network segment information of a first subnet segment created by the master device in the first network segment and a first table entry of a first DHCP client, wherein the first table entry includes a first address of the first DHCP client;

[0023] According to the network segment information of the first sub-network segment, determining whether a corresponding first sub-network segment exists locally;

[0024] If it exists, remove the first address from the first subnet segment and generate the first table entry;

[0025] If it does not exist, creating the first subnet segment from the second network segment, removing the first address from the first subnet segment, and generating the first table entry;

[0026] The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0027] In a third aspect, the present application provides an address allocation device, the device is applied to a master device, the master device is in a DRNI network, the DRNI network also includes a slave device, a first address pool is configured in the master device, the first address pool has a corresponding first network segment, a second address pool is configured in the slave device, the second address pool has a corresponding second network segment, and the device includes:

[0028] A first determining unit, configured to determine whether there is a first subnet segment available for allocating addresses locally when receiving a first DHCP Discover message sent by a first DHCP client;

[0029] a second judgment unit, configured to judge whether the first sub-network segment can be divided from the first network segment if the sub-network segment does not exist;

[0030] an acquiring unit, configured to create the first subnet segment and acquire the first address from the first subnet segment;

[0031] a sending unit, configured to send a first DHCP Offer message to the first DHCP client, wherein the first DHCP Offer message includes the first address;

[0032] The sending unit is further configured to, when determining that the first DHCP client goes online using the first address, send a first synchronization message to the slave device, the first synchronization message including the network segment information of the first subnet segment and the first table item of the first DHCP client, the first table item including the first address, so that the slave device determines whether the corresponding first subnet segment exists locally, and if so, removes the first address from the first subnet segment and generates the first table item; if not, creates the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table item;

[0033] The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0034] In a fourth aspect, the present application provides an address allocation device, the device is applied to a slave device, the slave device is in a DRNI network, the DRNI network also includes a master device, a first address pool is configured in the master device, the first address pool has a corresponding first network segment, a second address pool is configured in the slave device, the second address pool has a corresponding second network segment, and the device includes:

[0035] a receiving unit, configured to receive a first synchronization message sent by the master device, wherein the first synchronization message includes network segment information of a first subnet segment created by the master device in the first network segment and a first table entry of a first DHCP client, wherein the first table entry includes a first address of the first DHCP client;

[0036] A first judgment unit, used for judging whether a corresponding first sub-network segment exists locally according to the network segment information of the first sub-network segment;

[0037] a removing unit, configured to remove the first address from the first subnet segment if it exists, and generate the first table entry;

[0038] a creating unit, configured to create the first subnet segment from the second network segment if it does not exist, remove the first address from the first subnet segment, and generate the first table entry;

[0039] The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0040] In a fifth aspect, the present application provides a network device, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to execute the method provided in the first aspect of the present application.

[0041] In a sixth aspect, the present application provides a network device, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to execute the method provided in the second aspect of the present application.

[0042] Therefore, by applying the address allocation method and apparatus provided by the present application, when the master device receives the first DHCP Discover message sent by the first DHCP client, the master device determines whether there is a first subnet segment available for address allocation locally; if not, the master device determines whether the first subnet segment can be divided from the first network segment; if so, the master device creates the first subnet segment and obtains the first address from the first subnet segment; the master device sends a first DHCP Offer message to the first DHCP client, and the first DHCP The Offer message includes the first address; when the master device determines that the first DHCP client uses the first address to go online, the master device sends a first synchronization message to the slave device, the first synchronization message includes the network segment information of the first subnet segment and the first table item of the first DHCP client, the first table item includes the first address, so that the slave device determines whether the first subnet segment to which the first address belongs exists locally, if so, the slave device removes the first address from the first subnet segment and generates the first table item; if not, the slave device creates the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table item; wherein the first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0043] In this way, the master and slave devices share the same total network segment, and the subnet segment on the slave device is allocated by the master device, but each device exclusively uses the local subnet segment and allocates addresses to the DHCP clients that are online on itself, which not only realizes the centralized management of addresses, but also avoids conflicts when multiple devices allocate addresses at the same time. This solves the problem that in the existing DRNI environment, the master and slave devices cannot realize the centralized management and allocation of addresses, resulting in the DHCP client being unable to go online at any network device in the DRNI environment. It reduces the performance pressure of network devices and increases the online rate of DHCP clients. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 This is a schematic diagram of the DRNI network model;

[0045] Figure 2 This is a basic DHCP networking diagram;

[0046] Figure 3 A flowchart of an address allocation method provided in an embodiment of the present application;

[0047] Figure 4A flowchart of another address allocation method provided in an embodiment of the present application;

[0048] Figure 5 A structural diagram of an address allocation device provided in an embodiment of the present application;

[0049] Figure 6 A structural diagram of another address allocation device provided in an embodiment of the present application;

[0050] Figure 7 The network device hardware structure provided in the embodiment of the present application. DETAILED DESCRIPTION

[0051] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0052] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.

[0053] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0054] The following is a detailed description of an address allocation method provided in an embodiment of the present application. Figure 3 , Figure 3 A flowchart of an address allocation method provided in an embodiment of the present application. The method is applied to a master device. The address allocation method provided in an embodiment of the present application may include the following steps.

[0055] Step 310: When receiving a first DHCP Discover message sent by a first DHCP client, determine whether there is a first subnet segment available for allocating addresses locally.

[0056] Specifically, Figure 1 As shown in the figure, the DRNI network includes a master device and a slave device. The master and slave devices are connected to the same switching device and receive messages sent by the host through the switching device, or the master and slave devices send messages to the host through the switching device. An IPL link has been established between the master and slave devices. The master and slave devices form load sharing and jointly forward the service traffic sent by the host. When one of the network devices fails, the service traffic can be quickly forwarded by another network device to ensure the normal operation of the service traffic.

[0057] In the embodiment of the present application, the same address pool is configured in both the master and slave devices, and the address segments that can be allocated in each address pool are exactly the same. The DHCP server function is configured in both the master and slave devices, and both can independently receive DHCP messages sent by DHCP clients and allocate addresses to DHCP clients.

[0058] Further, a first address pool is configured in the master device, and the first address pool has a corresponding first network segment, and a second address pool is configured in the slave device, and the second address pool has a corresponding second network segment. The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment. For example, the first network segment and the second network segment are both 20.0.0.0 / 16.

[0059] When the master device receives the first DHCP Discover message sent by the first DHCP client, the master device determines whether there is a first subnet segment available for allocating addresses locally. If there is no first subnet segment available locally, the master device executes step 320.

[0060] In the embodiment of the present application, the first network segment can be divided into multiple sub-network segments, for example, 20.0.1.0 / 24, 20.0.2.0 / 24, 20.0.3.0 / 24, etc. As an implementation method, the first sub-network segment currently available for address allocation in the master device does not exist, that is, there are no remaining addresses in the currently existing sub-network segment, that is, the number of unallocated addresses is 0, and the remaining network segment has not been divided; or, the first network segment has not been divided.

[0061] Step 320: If it does not exist, determine whether the first sub-segment can be divided from the first network segment.

[0062] Specifically, according to the judgment in step 310, if the first subnet segment does not exist, the master device continues to judge whether the first subnet segment can be divided from the first network segment. If the first subnet segment can be divided from the first network segment, the master device executes step 330; if the first subnet segment cannot be divided from the first network segment, the master device generates and sends a first notification message to the first DHCP client to prompt the first DHCP client that the address allocation fails.

[0063] The first network segment cannot be divided into a first sub-network segment, that is, there are no remaining network segments for division in the first network segment.

[0064] Step 330: If yes, create the first subnet segment and obtain the first address from the first subnet segment.

[0065] Specifically, according to the judgment in step 330, if the first network segment can be divided into a first sub-network segment, the master device creates a sub-network segment, namely, the first sub-network segment, and obtains a first address from the first sub-network segment.

[0066] It should be noted that although the master device allocates addresses to DHCP clients from available subnet segments, the mask allocated to the client is still the mask of the first network segment (ie, 16 in the previous example), not the mask of the subnet segment (ie, 24 in the previous example).

[0067] The master device may refer to the existing process of allocating addresses to DHCP clients to obtain the first address from the first subnet segment, which will not be repeated here.

[0068] Step 340: Send a first DHCP Offer message to the first DHCP client, where the first DHCP Offer message includes the first address.

[0069] Specifically, according to the description of step 330, after the master device allocates an address to the first DHCP client, it generates a first DHCP Offer message according to existing DHCP regulations, and the first DHCP Offer message includes a yiaddr field and a siaddr field. The yiaddr field carries the first address, and the siaddr field carries the master device address.

[0070] The master device sends a first DHCP Offer message to the first DHCP client. After receiving the first DHCP Offer message, the first DHCP client obtains the first address and the master device address therefrom, and determines that the master device allocates the first address to itself.

[0071] It is understandable that, according to existing DHCP regulations, after the master device allocates the first address to the first DHCP client, it also records the allocated first address and the first DHCP client in correspondence.

[0072] Step 350: When it is determined that the first DHCP client goes online using the first address, a first synchronization message is sent to the slave device, where the first synchronization message includes the network segment information of the first subnet segment and the first table entry of the first DHCP client, where the first table entry includes the first address, so that the slave device determines whether the corresponding first subnet segment exists locally. If so, the first address is removed from the first subnet segment and the first table entry is generated; if not, the first subnet segment is created from the second network segment according to the network segment information of the first subnet segment, the first address is removed from the first subnet segment, and the first table entry is generated.

[0073] Specifically, according to the description of step 340, after receiving the first DHCP Offer message, the first DHCP client selects the address sent by the DHCP server, broadcasts the DHCP Request message, verifies whether the address is available, etc. At the same time, as the master device of the DHCP server, it also continues to perform DHCP interaction with the first DHCP client.

[0074] When the first DHCP client successfully uses the first address as its own address, the master device generates a first table entry of the first DHCP client, which includes the first DHCP client identifier, the first address, lease information of the first address, and other contents.

[0075] The master device generates and sends a first synchronization message to the slave device through an IPL link. The first synchronization message includes network segment information of the first sub-network segment and a first table entry.

[0076] After receiving the first synchronization message, the slave device obtains the network segment information of the first sub-network segment and the first table entry from the first synchronization message, and determines whether the slave device has the corresponding first sub-network segment locally.

[0077] It is understandable that if the first DHCP client is the first client to go online in the first subnet segment, when the master device synchronizes the network segment information and the DHCP client table item to the slave device, the corresponding first subnet segment does not exist in the slave device. At this time, the slave device creates the first subnet segment from the second network segment based on the network segment information of the first subnet segment, and removes the first address from the first subnet segment. The slave device also generates the first table item locally. In this way, the master and slave devices achieve synchronization of DHCP client table items.

[0078] If the first DHCP client is not the first client to go online in the first subnet segment, when the master device synchronizes the network segment information and the DHCP client table item to the slave device, the corresponding first subnet segment should exist in the slave device. At this time, the slave device removes the first address from the first subnet segment. The slave device also generates the first table item locally. In this way, the master and slave devices achieve synchronization of DHCP client table items.

[0079] The slave device removes the first address from the first subnet segment, that is, the slave device records the first address as an allocated address, and records the first address and the first DHCP client in correspondence.

[0080] Therefore, by applying the address allocation method provided by the present application, when the master device receives the first DHCP Discover message sent by the first DHCP client, the master device determines whether there is a first subnet segment available for address allocation locally; if not, the master device determines whether the first subnet segment can be divided from the first network segment; if so, the master device creates the first subnet segment and obtains the first address from the first subnet segment; the master device sends a first DHCPOffer message to the first DHCP client, and the first DHCP The Offer message includes the first address; when the master device determines that the first DHCP client uses the first address to go online, the master device sends a first synchronization message to the slave device, the first synchronization message includes the network segment information of the first subnet segment and the first table item of the first DHCP client, the first table item includes the first address, so that the slave device determines whether the first subnet segment to which the first address belongs exists locally, if so, the slave device removes the first address from the first subnet segment and generates the first table item; if not, the slave device creates the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table item; wherein the first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0081] In this way, the master and slave devices share the same total network segment, and the subnet segment on the slave device is allocated by the master device, but each device exclusively uses the local subnet segment and allocates addresses to the DHCP clients that are online on itself, which not only realizes the centralized management of addresses, but also avoids conflicts when multiple devices allocate addresses at the same time. This solves the problem that in the existing DRNI environment, the master and slave devices cannot realize the centralized management and allocation of addresses, resulting in the DHCP client being unable to go online at any network device in the DRNI environment. It reduces the performance pressure of network devices and increases the online rate of DHCP clients.

[0082] Optionally, the embodiment of the present application also includes: after the first subnet segment exists locally in the master device, the master device allocates an address to the first DHCP client.

[0083] Specifically, if the first subnet segment exists locally, the master device obtains the first address from the first subnet segment. The first address is the address allocated by the master device to the first DHCP client.

[0084] It is understandable that after the master device allocates an address to the first DHCP client, steps 340 to 350 may be repeatedly performed, which will not be repeated here.

[0085] In an embodiment of the present application, since the first network segment can be divided into multiple sub-segments, as an implementation method, the first sub-segment currently available for assigning addresses in the main device is usually one, that is, the sub-segment that can currently provide unassigned addresses is one.

[0086] Of course, in another implementation, there may be multiple subnet segments for allocating addresses in the master device, that is, there are multiple subnet segments that can currently provide unallocated addresses. If there are multiple subnet segments locally, the master device can determine the subnet segment to which the interface address belongs by the interface address of the interface receiving the DHCP Discover message, and obtain an address in the subnet segment.

[0087] The embodiment of the present application is described below with the number of subnet segments that can currently provide unallocated addresses as one, and the same is true when the number of subnet segments is multiple.

[0088] Optionally, the embodiment of the present application also includes a process in which the slave device is unable to allocate an address to the second DHCP client and applies for a subnet segment from the master device.

[0089] Specifically, when the slave device receives the second DHCP Discover message sent by the second DHCP client, the slave device determines whether there is a local subnet segment available for address allocation, for example, the second subnet segment (referred to as the second subnet segment here to distinguish it from the subnet segment in the aforementioned embodiment).

[0090] If there is a second subnet segment, the slave device obtains the first address from the second subnet segment. The second address is the address allocated by the slave device to the second DHCP client.

[0091] It is understandable that after the slave device allocates an address to the second DHCP client, the same process as the master device performing steps 340 to 350 may be repeated, which will not be repeated here.

[0092] If the second subnet segment does not exist, the slave device sends a second DHCP Discover message to the master device through the IPL link.

[0093] It can be understood that the second subnet segment that can be used to allocate addresses does not currently exist in the device, that is, there are no remaining addresses in the currently existing subnet segment, that is, the number of unallocated addresses is 0, and the remaining segment has not been divided; or, the second segment has not been divided.

[0094] After receiving the second DHCP Discover message, the master device determines whether a second subnet segment can be divided from the first network segment. If a second subnet can be divided from the first network segment, the master device creates a second subnet segment and obtains a second address from the second subnet segment, which is the address assigned by the master device to the second DHCP client. The second subnet segment does not overlap with other subnet segments created in the master device to avoid address conflicts.

[0095] If the second subnet segment cannot be divided in the first network segment, the master device generates and sends a DHCP NAK message to the slave device to prompt the slave device that the address allocation for the second DHCP client fails. The slave device generates and sends a second notification message to the second DHCP client to prompt the second DHCP client that the address allocation fails.

[0096] The second sub-segment cannot be divided out in the first network segment, that is, there are no remaining network segments for division in the first network segment.

[0097] After the master device allocates an address to the second DHCP client, it generates a second DHCP Offer message, which includes a yiaddr field and a siaddr field. The yiaddr field carries the second address, and the siaddr field carries the master device address.

[0098] The master device sends a second DHCP Offer message to the slave device. After receiving the second DHCP Offer message, the slave device obtains the second address from it. According to the second address, the slave device creates a second subnet segment in the second network segment. The slave device updates the master device address carried by the siaddr field included in the second DHCP Offer message to the slave device address, and sends the second DHCP Offer message to the second DHCP client. After receiving the second DHCP Offer message, the second DHCP client obtains the second address and the slave device address from it, and determines that the slave device allocates the second address to itself.

[0099] It is understandable that, according to the existing DHCP regulations, the slave device also records the second address that has been allocated in correspondence with the second DHCP client. At the same time, when the second DHCP client successfully uses the second address as its own address, the slave device also generates a second entry for the second client, the second entry including the second DHCP client identifier, the second address, the lease information of the second address, and other contents.

[0100] The slave device generates and sends a second synchronization message to the master device through the IPL link. The second synchronization message includes the network segment information of the second sub-network segment and the second table entry.

[0101] After receiving the second synchronization message, the master device obtains the network segment information of the second subnet segment and the second table item. According to the network segment information of the second subnet segment and the second address, the master device removes the second address from the second subnet segment. The master device also generates the second table item locally. In this way, the master and slave devices realize the synchronization of the DHCP client table items.

[0102] The master device removes the second address from the second subnet segment, that is, the master device records the second address as an allocated address, and records the second address and the second DHCP client in correspondence.

[0103] Optionally, the embodiment of the present application also includes: a process in which the master and slave devices reclaim allocated addresses and synchronize with the peer end.

[0104] Specifically, according to existing DHCP regulations, after successfully obtaining an address, a DHCP client can release its own address at any time by sending a DHCPRelease message. After receiving the DHCP Release message, the DHCP server will reclaim the corresponding address and reallocate it.

[0105] After receiving the DHCP Release message sent by the third DHCP client, the master device reclaims the third address allocated to the third DHCP client and deletes the locally recorded correspondence between the third address and the third DHCP client and the related entries of the third DHCP client.

[0106] The master device generates and sends a third synchronization message to the slave device through the IPL link, where the third synchronization message includes a third address and network segment information of a third subnet segment.

[0107] After receiving the third synchronization message, the slave device obtains the third address and the network segment information of the third subnet segment. The slave device recovers the third address from the third subnet segment. At the same time, the slave device deletes the locally recorded correspondence between the third address and the third DHCP client, as well as the related table items of the third DHCP client. The slave device also determines whether all addresses included in the third subnet segment have been recovered, and if so, deletes the third subnet segment from the slave device.

[0108] Similarly, the master device also determines whether all addresses included in the third subnet segment have been recovered. If so, the master device deletes the third subnet segment, and the third subnet segment can be divided again later.

[0109] Further, if the fourth DHCP client goes online at the slave device, when the fourth DHCP client releases its own fourth address, it may send a DHCP Release message to the slave device through the IPL link.

[0110] After receiving the DHCP Release message, the slave device also executes the entire process of the master device reclaiming the address, deleting the local record, sending the synchronization message, and deleting the subnet segment. Similarly, the master device also executes the entire process of the slave device reclaiming the address, deleting the local record, and deleting the subnet segment. This is only briefly described here.

[0111] The master device receives a fourth synchronization message sent by the slave device, the fourth synchronization message including a fourth address and the network segment information of a fourth subnet segment to which the fourth address belongs. According to the network segment information of the fourth subnet segment and the fourth address, the master device reclaims the fourth address from the fourth subnet segment. The master device determines whether all addresses included in the fourth subnet segment have been reclaimed; if so, the master device deletes the fourth subnet segment, and the fourth subnet segment can be repeatedly divided later.

[0112] Optionally, the embodiment of the present application also includes: after the master-slave device is switched, the new master device synchronizes information with the new slave device.

[0113] Specifically, if the master device fails, the master device is restarted, and after the restart, the master and slave devices switch roles, the master device is downgraded to a new slave device, and the slave device is upgraded to a new master device.

[0114] The new master device updates the network segment status of the local subnet segment in the peer state to the local state, while the network segment status of the subnet segment in the local state remains unchanged. The new master device generates and sends a fifth synchronization message to the new slave device through the IPL link, the fifth synchronization message includes the network segment information of all subnet segments existing in the new master device and the third table items of all DHCP clients that have been online, and the third table item includes the fifth address of each DHCP client.

[0115] After receiving the fifth synchronization message, the new slave device obtains the network segment information of all subnet segments existing in the new master device and the third table entry of all online DHCP clients. According to the network segment information of all subnet segments, the new slave device creates a corresponding subnet segment in the first network segment.

[0116] According to the fifth address, the new slave device removes the fifth address from the corresponding subnet segment; at the same time, the new slave device also generates a third table entry.

[0117] It can be understood that in the above-mentioned embodiment, the process of the device removing addresses from the subnet segment and generating DHCP client entries has been described in detail, which will not be repeated here.

[0118] Optionally, the embodiment of the present application also includes: after the master device creates a sub-segment in the local network segment, a process of recording the network segment status of the created sub-segment.

[0119] Specifically, after the master device creates the first subnet segment, the master device records the network segment status of the first subnet segment as the local end status, that is, the first subnet segment created by the master device in the local first network segment, and the addresses in the first subnet segment can only be allocated by the master device. At the same time, the slave device also creates the first subnet segment, and records the network segment status of the first subnet segment as the peer end status, and the addresses in the first subnet segment cannot be allocated by the slave device.

[0120] After the master device creates the second subnet segment, the master device records the segment status of the second subnet segment as the peer status, that is, the master device creates the second subnet segment for the slave device in the first network segment. The addresses in the second subnet segment can only be allocated by the slave device, and the master device cannot allocate them.

[0121] The new slave device, that is, the original master device, creates the fifth subnet segment. After the master-slave device is switched, the new slave device records the segment status of the fifth subnet segment as the peer status, that is, the addresses in the fifth subnet segment can only be allocated by the new master device, that is, the original slave device, and the new slave device cannot allocate them.

[0122] For example, before the master device fails, the existing subnet segments in the master device include the first subnet segment 20.0.2.0 / 24 (local end status) and the second subnet segment 20.0.4.0 / 24 (opposite end status), and the existing subnet segments in the backup device include the first subnet segment 20.0.2.0 / 24 (opposite end status) and the second subnet segment 20.0.4.0 / 24 (local end status).

[0123] After the master device restarts, the slave device is upgraded to the new master device, and the master device is downgraded to the new slave device. The new master device updates the network segment status of the local subnet segment in the peer state to the local state, while the network segment status of the subnet segment in the local state remains unchanged.

[0124] The new master device generates and sends the fifth synchronization message to the new slave device through the IPL link. In this way, after the master-slave device is switched, the new master device includes the first subnet segment 20.0.2.0 / 24 (local state) and the second subnet segment 20.0.4.0 / 24 (local state); the new slave device includes the first subnet segment 20.0.2.0 / 24 (opposite state) and the second subnet segment 20.0.4.0 / 24 (opposite state).

[0125] It should be noted that, in the aforementioned embodiment, the above synchronization message can be implemented by using the following messages: one is to use a DHCP protocol message, and the other is to use a private network message defined by each manufacturer.

[0126] Another address allocation method provided in the embodiment of the present application is described in detail below. Figure 4 , Figure 4A flowchart of another address allocation method provided in an embodiment of the present application. The method is applied to a slave device. The address allocation method provided in an embodiment of the present application may include the following steps.

[0127] Step 410: Receive a first synchronization message sent by the master device, where the first synchronization message includes segment information of a first sub-segment created by the master device in the first network segment and a first table entry of a first DHCP client, where the first table entry includes a first address of the first DHCP client.

[0128] Specifically, the same address pool is configured in both the master and slave devices, and the address segments that can be allocated in each address pool are exactly the same. The DHFP server function is configured in both the master and slave devices, and both can independently receive DHCP messages sent by DHCP clients and allocate addresses to DHCP clients.

[0129] Further, a first address pool is configured in the master device, and the first address pool has a corresponding first network segment, and a second address pool is configured in the slave device, and the second address pool has a corresponding second network segment. The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment. For example, the first network segment and the second network segment are both 20.0.0.0 / 16.

[0130] According to the above embodiment, the master device allocates an address to the first DHCP client, and when the first DHCP client successfully uses the first address as its own address, the master device generates a first table entry for the first DHCP client. The master device generates and sends a first synchronization message to the slave device through the IPL link. The first synchronization message includes the network segment information of the first subnet segment and the first table entry.

[0131] After receiving the first synchronization message, the slave device obtains the network segment information of the first sub-network segment and the first table entry therefrom.

[0132] Step 420: Determine whether a corresponding first subnet segment exists locally based on the network segment information of the first subnet segment.

[0133] Specifically, according to the description of step 410, after the network segment information of the first sub-network segment is acquired from the device, it is determined whether the corresponding first sub-network segment exists locally.

[0134] If the first subnet segment exists locally, the slave device executes step 430 ; if the first subnet segment does not exist locally, the slave device executes step 440 .

[0135] Step 430: If it exists, remove the first address from the first subnet segment and generate the first table entry.

[0136] Specifically, according to the judgment in step 420, the slave device has a first subnet segment locally, and the slave device removes the first address from the first subnet segment. The slave device also generates a first table entry locally. In this way, the master and slave devices achieve synchronization of DHCP client table entries.

[0137] Step 440: If it does not exist, create the first subnet segment from the second network segment, remove the first address from the first subnet segment, and generate the first table entry.

[0138] Specifically, according to the judgment of step 420, the slave device does not have the first subnet segment locally, and the slave device creates the first subnet segment from the second subnet segment according to the network segment information of the first subnet segment, and removes the first address from the first subnet segment. The slave device also generates the first table entry locally. In this way, the master and slave devices achieve synchronization of DHCP client table entries.

[0139] Therefore, by applying the address allocation method provided by the present application, a slave device receives a first synchronization message sent by a master device, the first synchronization message including the network segment information of a first subnet segment created by the master device in a first network segment and a first table entry of a first DHCP client, the first table entry including a first address of the first DHCP client; based on the network segment information of the first subnet segment, the slave device determines whether a corresponding first subnet segment exists locally; if so, the slave device removes the first address from the first subnet segment and generates a first table entry; if not, the slave device creates a first subnet segment from a second network segment, removes the first address from the first subnet segment, and generates a first table entry.

[0140] In this way, the master and slave devices share the same total network segment, and the subnet segment on the slave device is allocated by the master device, but each device exclusively uses the local subnet segment and allocates addresses to the DHCP clients that are online on itself, which not only realizes the centralized management of addresses, but also avoids conflicts when multiple devices allocate addresses at the same time. This solves the problem that in the existing DRNI environment, the master and slave devices cannot realize the centralized management and allocation of addresses, resulting in the DHCP client being unable to go online at any network device in the DRNI environment. It reduces the performance pressure of network devices and increases the online rate of DHCP clients.

[0141] Optionally, the embodiment of the present application also includes a process in which the slave device is unable to allocate an address to the second DHCP client and applies for a subnet segment from the master device.

[0142] Specifically, when the slave device receives the second DHCP Discover message sent by the second DHCP client, the slave device determines whether there is a local subnet segment available for address allocation, for example, the second subnet segment (referred to as the second subnet segment here to distinguish it from the subnet segment in the aforementioned embodiment).

[0143] If there is a second subnet segment, the slave device obtains the first address from the second subnet segment. The second address is the address allocated by the slave device to the second DHCP client.

[0144] It is understandable that after the slave device allocates an address to the second DHCP client, the same process as the master device performing steps 340 to 350 may be repeated, which will not be repeated here.

[0145] If the second subnet segment does not exist, the slave device sends a second DHCP Discover message to the master device through the IPL link.

[0146] After receiving the second DHCP Discover message, the master device determines whether a second subnet segment can be divided from the first network segment. If a second subnet can be divided from the first network segment, the master device creates a second subnet segment and obtains a second address from the second subnet segment, which is the address assigned by the master device to the second DHCP client. The second subnet segment does not overlap with other subnet segments created in the master device to avoid address conflicts.

[0147] If the second subnet segment cannot be divided in the first network segment, the master device generates and sends a DHCP NAK message to the slave device to prompt the slave device that the address allocation for the second DHCP client fails. The slave device generates and sends a second notification message to the second DHCP client to prompt the second DHCP client that the address allocation fails.

[0148] After the master device allocates an address to the second DHCP client, it generates a first DHCP Offer message, which includes a yiaddr field and a siaddr field. The yiaddr field carries the second address, and the siaddr field carries the master device address.

[0149] The master device sends a first DHCP Offer message to the slave device. After receiving the first DHCP Offer message, the slave device obtains the second address from it. According to the second address, the slave device creates a second subnet segment in the second network segment. The slave device updates the master device address carried by the siaddr field included in the first DHCP Offer message to the slave device address, and obtains a second DHCPOffer message.

[0150] The slave device sends a second DHCP Offer message to the second DHCP client. After receiving the second DHCP Offer message, the second DHCP client obtains the second address and the slave device address from the message, and determines that the slave device allocates the second address to itself.

[0151] It is understandable that, according to the existing DHCP regulations, the slave device also records the second address that has been allocated in correspondence with the second DHCP client. At the same time, when the second DHCP client successfully uses the second address as its own address, the slave device also generates a second entry for the second client, the second entry including the second DHCP client identifier, the second address, the lease information of the second address, and other contents.

[0152] The slave device generates and sends a second synchronization message to the master device through the IPL link. The second synchronization message includes the network segment information of the second sub-network segment and the second table entry.

[0153] After receiving the second synchronization message, the master device obtains the network segment information of the second subnet segment and the second table item. According to the network segment information of the second subnet segment and the second address, the master device removes the second address from the second subnet segment. The master device also generates the second table item locally. In this way, the master and slave devices realize the synchronization of the DHCP client table items.

[0154] Optionally, the embodiment of the present application also includes: a process in which the master and slave devices reclaim allocated addresses and synchronize with the peer end.

[0155] Specifically, according to existing DHCP regulations, after successfully obtaining an address, a DHCP client can release its own address at any time by sending a DHCPRelease message. After receiving the DHCP Release message, the DHCP server will reclaim the corresponding address and reallocate it.

[0156] After receiving the DHCP Release message sent by the third DHCP client, the master device reclaims the third address allocated to the third DHCP client and deletes the locally recorded correspondence between the third address and the third DHCP client and the related entries of the third DHCP client.

[0157] The master device generates and sends a third synchronization message to the slave device through the IPL link, where the third synchronization message includes a third address and network segment information of a third subnet segment.

[0158] After receiving the third synchronization message, the slave device obtains the third address and the network segment information of the third subnet segment. The slave device recycles the third address from the third subnet segment. At the same time, the slave device deletes the locally recorded correspondence between the third address and the third DHCP client, as well as the relevant table entries of the third DHCP client. The slave device also determines whether all addresses included in the third subnet segment have been recycled. If so, the slave device deletes the third subnet segment, and the third subnet segment can be allocated again later.

[0159] Similarly, the master device also determines whether all addresses included in the third subnet segment have been recycled. If so, the master device deletes the third subnet segment.

[0160] Further, if the fourth DHCP client goes online at the slave device, when the fourth DHCP client releases its own fourth address, it may send a DHCP Release message to the slave device through the IPL link.

[0161] After receiving the DHCP Release message, the slave device also executes the entire process of the master device reclaiming the address, deleting the local record, sending the synchronization message, and deleting the subnet segment. Similarly, the master device also executes the entire process of the slave device reclaiming the address, deleting the local record, and deleting the subnet segment. This is only briefly described here.

[0162] The slave device generates and sends a fourth synchronization message to the master device through the IPL link. The fourth synchronization message includes a fourth address and segment information of a fourth subnet segment to which the fourth address belongs.

[0163] After receiving the fourth synchronization message, the master device reclaims the fourth address from the fourth subnet segment according to the network segment information of the fourth subnet segment and the fourth address. The master device determines whether all addresses included in the fourth subnet segment have been reclaimed; if so, the master device deletes the fourth subnet segment.

[0164] Similarly, the slave device also determines whether all addresses included in the fourth subnet segment have been recycled. If so, the slave device deletes the fourth subnet segment.

[0165] Optionally, the embodiment of the present application also includes: after the master-slave device is switched, the new master device synchronizes information with the new slave device.

[0166] Specifically, if the master device fails, the master device is restarted, and after the restart, the master and slave devices switch roles, the master device is downgraded to a new slave device, and the slave device is upgraded to a new master device.

[0167] The new master device updates the network segment status of the local subnet segment in the peer state to the local state, while the network segment status of the subnet segment in the local state remains unchanged. The new master device generates and sends a fifth synchronization message to the new slave device through the IPL link, the fifth synchronization message includes the network segment information of all subnet segments existing in the new master device and the third table items of all DHCP clients that have been online, and the third table item includes the fifth address of each DHCP client.

[0168] After receiving the fifth synchronization message, the new slave device obtains the network segment information of all subnet segments existing in the new master device and the third table entry of all online DHCP clients. According to the network segment information of all subnet segments, the new slave device creates a corresponding subnet segment in the first network segment.

[0169] According to the fifth address, the new slave device removes the fifth address from the corresponding subnet segment; at the same time, the new slave device also generates a third table entry.

[0170] Optionally, the embodiment of the present application also includes: after the slave device creates a sub-segment in the local network segment, a process of recording the network segment status of the created sub-segment.

[0171] Specifically, after the slave device creates the first subnet segment, the slave device records the segment state of the first subnet segment as the peer state, that is, the addresses in the first subnet segment cannot be allocated by the slave device but can only be allocated by the master device.

[0172] After the slave device creates the second subnet segment, the slave device records the segment status of the second subnet segment as the local status. The addresses in the second subnet segment can only be allocated by the slave device, and cannot be allocated by the master device.

[0173] It should be noted that, in the aforementioned embodiment, the above synchronization message can be implemented by using the following messages: one is to use a DHCP protocol message, and the other is to use a private network message defined by each manufacturer.

[0174] Based on the same inventive concept, the embodiment of the present application also provides an address allocation device corresponding to the address allocation method. Figure 5 , Figure 5 An address allocation device is provided in an embodiment of the present application, the device is applied to a master device, the master device is in a DRNI network, the DRNI network also includes a slave device, a first address pool is configured in the master device, the first address pool has a corresponding first network segment, a second address pool is configured in the slave device, the second address pool has a corresponding second network segment, and the device includes:

[0175] The first determining unit 510 is configured to determine whether there is a first subnet segment available for allocating addresses locally when receiving a first DHCP Discover message sent by a first DHCP client;

[0176] A second determination unit 520 is configured to determine whether the first sub-network segment can be divided from the first network segment if the sub-network segment does not exist;

[0177] An acquiring unit 530 is configured to create the first subnet segment and acquire a first address from the first subnet segment;

[0178] The sending unit 540 is configured to send a first DHCP Offer message to the first DHCP client, where the first DHCP Offer message includes the first address;

[0179] The sending unit 540 is further configured to, when it is determined that the first DHCP client goes online using the first address, send a first synchronization message to the slave device, the first synchronization message including the network segment information of the first subnet segment and the first table item of the first DHCP client, the first table item including the first address, so that the slave device determines whether the corresponding first subnet segment exists locally, if so, removes the first address from the first subnet segment, and generates the first table item; if not, creates the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table item;

[0180] The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0181] Optionally, the acquisition unit 530 is further configured to, if present, acquire the first address from the first subnet segment;

[0182] The sending unit 540 is further configured to send a first DHCP Offer message to the first DHCP client, where the first DHCP Offer message includes the acquired first address;

[0183] The sending unit 540 is further used to, when it is determined that the first DHCP client goes online using the first address, send a first synchronization message to the slave device, the first synchronization message including the network segment information of the first subnet segment and the first table entry of the first DHCP client, the first table entry including the first address, so that the slave device determines whether the corresponding first subnet segment exists locally, if so, removes the first address from the first subnet segment, and generates the first table entry; if not, creates the first subnet segment in the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table entry.

[0184] Optionally, the second determining unit 520 is further configured to determine whether a second subnet segment can be divided from the first network segment when receiving a second DHCPDiscover message sent by the slave device;

[0185] The acquisition unit 530 is further configured to, if yes, create the second subnet segment, and acquire a second address from the second subnet segment, where the second address is an address allocated by the master device to the second DHCP client that sends the second DHCP Discover message;

[0186] The sending unit 540 is further configured to send a second DHCP Offer message to the slave device, where the second DHCP Offer message includes the second address, so that the slave device creates the second subnet segment in the second network segment according to the second address;

[0187] The apparatus further includes: a receiving unit (not shown in the figure), configured to receive a second synchronization message sent by the slave device, wherein the second synchronization message includes network segment information of the second subnet segment and a second table entry of the second DHCP client, wherein the second table entry includes the second address;

[0188] a removing unit (not shown in the figure), configured to remove the second address from the second subnet segment according to the network segment information of the second subnet segment and the second address;

[0189] A generating unit (not shown in the figure), configured to generate the second table entry;

[0190] The second subnet segment does not overlap with other subnet segments created in the master device.

[0191] Optionally, the sending unit 540 is further configured to, if the third address included in the third subnet segment has been recovered, send a third synchronization message to the slave device, the third synchronization message including the third address and the network segment information of the third subnet segment, so that the slave device recovers the third address from the third subnet segment, and after determining that all addresses included in the third subnet segment have been recovered, delete the third subnet segment;

[0192] The device further comprises: a deleting unit (not shown in the figure), configured to delete the third subnet segment if all addresses included in the third subnet segment have been recycled;

[0193] The third address is the address of the third DHCP client.

[0194] Optionally, the receiving unit (not shown in the figure) is further used to receive a fourth synchronization message sent by the slave device, wherein the fourth synchronization message includes a fourth address and network segment information of a fourth subnet segment to which the fourth address belongs;

[0195] The device further includes: a recovery unit (not shown in the figure), configured to recover the fourth address from the fourth subnet segment according to the network segment information of the fourth subnet segment and the fourth address;

[0196] A third judgment unit (not shown in the figure), used to judge whether all addresses included in the fourth subnet segment have been recycled;

[0197] The deleting unit (not shown in the figure) is further used for, if yes, deleting the fourth subnet segment;

[0198] The fourth address is the address of the fourth DHCP client.

[0199] Optionally, when the master device is downgraded to a new slave device and the slave device is upgraded to a new master device, the receiving unit (not shown in the figure) is further used to receive a fifth synchronization message sent by the new master device, the fifth synchronization message including the network segment information of all subnet segments existing in the new master device and the third table entry of all DHCP clients that have gone online, the third table entry including the fifth address of each DHCP client;

[0200] The removing unit (not shown in the figure) is further used to create a corresponding sub-segment in the first network segment according to the network segment information of all sub-segments and the fifth address, and remove the fifth address from the corresponding sub-segment;

[0201] The generating unit (not shown in the figure) is further configured to generate the third table entry.

[0202] Optionally, the device further comprises: a recording unit (not shown in the figure), configured to record that the network segment state of the first sub-network segment is a local state;

[0203] The recording unit (not shown in the figure) is also used to record the network segment state of the second sub-network segment as the peer state;

[0204] The recording unit (not shown in the figure) is further used to record the network segment state of the fifth sub-network segment as a peer state.

[0205] Based on the same inventive concept, the embodiment of the present application also provides an address allocation device corresponding to the address allocation method. Figure 6 , Figure 6 Another address allocation device provided in an embodiment of the present application is applied to a slave device, the slave device is in a DRNI network, the DRNI network also includes a master device, a first address pool is configured in the master device, the first address pool has a corresponding first network segment, a second address pool is configured in the slave device, the second address pool has a corresponding second network segment, and the device includes:

[0206] The receiving unit 610 is configured to receive a first synchronization message sent by the master device, wherein the first synchronization message includes network segment information of a first subnet segment created by the master device in the first network segment and a first table entry of a first DHCP client, wherein the first table entry includes a first address of the first DHCP client;

[0207] A first determination unit 620 is used to determine whether there is a corresponding first subnet segment locally according to the network segment information of the first subnet segment;

[0208] A removing unit 630, configured to remove the first address from the first subnet segment if it exists, and generate the first table entry;

[0209] A creating unit 640, configured to create the first subnet segment from the second subnet segment if it does not exist, remove the first address from the first subnet segment, and generate the first table entry;

[0210] The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0211] Optionally, a second determination unit (not shown in the figure) is configured to determine whether there is a second subnet segment available for allocating addresses locally when receiving a second DHCP Discover message sent by a second DHCP client;

[0212] The apparatus further comprises: a sending unit (not shown in the figure), configured to send the second DHCP Discover message to the master device if the second DHCP Discover message does not exist;

[0213] The receiving unit 610 is further configured to receive a first DHCP Offer message sent by the master device, where the first DHCP Offer message includes a second address, where the second address is an address allocated to the second DHCP client in a second subnet segment created locally by the master device;

[0214] The creating unit 640 is further configured to create the second subnet segment in the second network segment according to the second address;

[0215] The sending unit (not shown in the figure) is further configured to send a second DHCP Offer message to the second DHCP client, where the second DHCP Offer message includes the second address;

[0216] The sending unit (not shown in the figure) is further used to, when it is determined that the second DHCP client goes online using the second address, send a second synchronization message to the master device, the second synchronization message including the network segment information of the second subnet segment and the second table entry of the second DHCP client, the second table entry including the second address, so that the master device removes the second address from the second subnet segment created locally and generates the second table entry.

[0217] Optionally, the receiving unit 610 is further configured to receive a third synchronization message sent by the master device, where the third synchronization message includes a third address and network segment information of a third subnet segment to which the third address belongs;

[0218] The device further includes: a recovery unit (not shown in the figure), configured to recover the third address from the third subnet segment according to the network segment information of the third subnet segment and the third address;

[0219] A third judgment unit (not shown in the figure), used to judge whether all addresses included in the third subnet segment have been recycled;

[0220] a deleting unit (not shown in the figure), configured to delete the third subnet segment if yes;

[0221] The third address is the address of the third DHCP client.

[0222] Optionally, the sending unit (not shown in the figure) is further used to, if the fourth address included in the fourth subnet segment has been recovered, send a fourth synchronization message to the master device, the fourth synchronization message including the fourth address and the network segment information of the fourth subnet segment, so that the master device recovers the fourth address from the fourth subnet segment, and deletes the fourth subnet segment after determining that all addresses included in the fourth subnet segment have been recovered;

[0223] The deleting unit (not shown in the figure) is further used to delete the fourth subnet segment if all addresses included in the fourth subnet segment have been recycled;

[0224] The fourth address is the address of the fourth DHCP client.

[0225] Optionally, when the master device is downgraded to a new slave device and the slave device is upgraded to a new master device, the method further includes:

[0226] The device further comprises: an updating unit (not shown in the figure), configured to update the network segment state of the local sub-network segment in the peer state to the local state;

[0227] The sending unit (not shown in the figure) is further used to send a fifth synchronization message to the new slave device, wherein the fifth synchronization message includes the network segment status of all subnet segments existing in the new master device and the third table entry of all DHCP clients that have been online, and the third table entry includes the fifth address of each DHCP client, so that the new slave device creates a corresponding subnet segment according to the network segment information of all subnet segments, removes the fifth address from the corresponding subnet segment, and generates the third table entry.

[0228] Optionally, the device further comprises: a recording unit (not shown in the figure), configured to record that the network segment state of the first sub-network segment is a peer state;

[0229] The recording unit (not shown in the figure) is further used to record the network segment state of the second sub-network segment as the local end state.

[0230] Therefore, by applying the address allocation device provided by the present application, when the master device receives the first DHCP Discover message sent by the first DHCP client, the master device determines whether there is a first subnet segment that can be used to allocate addresses locally; if not, the master device determines whether the first subnet segment can be divided from the first network segment; if so, the master device creates the first subnet segment and obtains the first address from the first subnet segment; the master device sends a first DHCPOffer message to the first DHCP client, and the first DHCP The Offer message includes the first address; when the master device determines that the first DHCP client uses the first address to go online, the master device sends a first synchronization message to the slave device, the first synchronization message includes the network segment information of the first subnet segment and the first table item of the first DHCP client, the first table item includes the first address, so that the slave device determines whether the first subnet segment to which the first address belongs exists locally, if so, the slave device removes the first address from the first subnet segment and generates the first table item; if not, the slave device creates the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table item; wherein the first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

[0231] In this way, the master and slave devices share the same total network segment, and the subnet segment on the slave device is allocated by the master device, but each device exclusively uses the local subnet segment and allocates addresses to the DHCP clients that are online on itself, which not only realizes the centralized management of addresses, but also avoids conflicts when multiple devices allocate addresses at the same time. This solves the problem that in the existing DRNI environment, the master and slave devices cannot realize the centralized management and allocation of addresses, resulting in the DHCP client being unable to go online at any network device in the DRNI environment. It reduces the performance pressure of network devices and increases the online rate of DHCP clients.

[0232] Based on the same inventive concept, the embodiment of the present application also provides a network device, such as Figure 7 As shown, it includes a processor 710, a transceiver 720 and a machine-readable storage medium 730, the machine-readable storage medium 730 stores machine-executable instructions that can be executed by the processor 710, and the processor 710 is prompted by the machine-executable instructions to execute the address allocation method provided in the embodiment of the present application. Figure 5 , Figure 6 The address allocation device shown in FIG. Figure 7 The network device hardware structure shown is implemented.

[0233] The computer-readable storage medium 730 may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. Optionally, the computer-readable storage medium 730 may also be at least one storage device located away from the processor 710.

[0234] The processor 710 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may 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.

[0235] In the embodiment of the present application, the processor 710 reads the machine executable instructions stored in the machine readable storage medium 730, and the machine executable instructions enable the processor 710 itself and the transceiver 720 to execute the address allocation method described in the aforementioned embodiment of the present application.

[0236] In addition, an embodiment of the present application provides a machine-readable storage medium 730, which stores machine-executable instructions. When called and executed by the processor 710, the machine-executable instructions prompt the processor 710 itself and the calling transceiver 720 to execute the address allocation method described in the aforementioned embodiment of the present application.

[0237] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0238] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0239] As for the embodiments of the address allocation device and the machine-readable storage medium, since the contents of the methods involved are basically similar to those of the aforementioned method embodiments, the description is relatively simple, and the relevant parts may refer to the partial description of the method embodiments.

[0240] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. An address allocation method, characterized in that: The method is applied to a master device, the master device is in a DRNI network, the DRNI network also includes a slave device, a first address pool is configured in the master device, the first address pool has a corresponding first network segment, a second address pool is configured in the slave device, the second address pool has a corresponding second network segment, and the method includes: When receiving a first DHCP Discover message sent by a first DHCP client, determining whether there is a first subnet segment available for allocating addresses locally; If not, determining whether the first subnet segment can be divided from the first net segment; If yes, create the first subnet segment and obtain the first address from the first subnet segment; Sending a first DHCP Offer message to the first DHCP client, where the first DHCP Offer message includes the first address; After determining that the first DHCP client goes online using the first address, sending a first synchronization message to the slave device, the first synchronization message including the network segment information of the first subnet segment and the first table item of the first DHCP client, the first table item including the first address, so that the slave device determines whether the corresponding first subnet segment exists locally, if so, removes the first address from the first subnet segment, and generates the first table item; if not, creates the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table item; The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

2. The method according to claim 1, characterized in that The method further comprises: If it exists, obtaining the first address from the first subnet segment; Sending a first DHCP Offer message to the first DHCP client, where the first DHCP Offer message includes the acquired first address; When it is determined that the first DHCP client goes online using the first address, a first synchronization message is sent to the slave device, where the first synchronization message includes the network segment information of the first subnet segment and a first table entry of the first DHCP client, where the first table entry includes the first address, so that the slave device determines whether the corresponding first subnet segment exists locally. If so, the first address is removed from the first subnet segment and the first table entry is generated; if not, the first subnet segment is created in the second network segment according to the network segment information of the first subnet segment, the first address is removed from the first subnet segment, and the first table entry is generated.

3. The method according to claim 1, characterized in that The method further comprises: When receiving the second DHCP Discover message sent by the slave device, determining whether a second subnet segment can be divided from the first network segment; If yes, create the second subnet segment, and obtain a second address from the second subnet segment, where the second address is the address allocated by the master device to the second DHCP client that sends the second DHCP Discover message; Sending a second DHCP Offer message to the slave device, where the second DHCP Offer message includes the second address, so that the slave device creates the second subnet segment in the second network segment according to the second address; receiving a second synchronization message sent by the slave device, wherein the second synchronization message includes network segment information of the second subnet segment and a second table entry of the second DHCP client, wherein the second table entry includes the second address; According to the network segment information of the second subnet segment and the second address, removing the second address from the second subnet segment; generating the second table entry; The second subnet segment does not overlap with other subnet segments created in the master device.

4. The method according to claim 1, characterized in that: The method further comprises: If the third address included in the third subnet segment has been recovered, a third synchronization message is sent to the slave device, wherein the third synchronization message includes the third address and the network segment information of the third subnet segment, so that the slave device recovers the third address from the third subnet segment, and after determining that all addresses included in the third subnet segment have been recovered, deletes the third subnet segment; If all addresses included in the third subnet segment have been recycled, deleting the third subnet segment; The third address is the address of the third DHCP client.

5. The method according to claim 1, characterized in that: The method further comprises: receiving a fourth synchronization message sent by the slave device, wherein the fourth synchronization message includes a fourth address and network segment information of a fourth subnet segment to which the fourth address belongs; Reclaiming the fourth address from the fourth subnet segment according to the network segment information of the fourth subnet segment and the fourth address; Determining whether all addresses included in the fourth subnet segment have been recovered; If yes, deleting the fourth subnet segment; The fourth address is the address of the fourth DHCP client.

6. The method according to claim 3, characterized in that When the master device is downgraded to a new slave device and the slave device is upgraded to a new master device, the method further includes: receiving a fifth synchronization message sent by the new master device, wherein the fifth synchronization message includes network segment information of all subnet segments existing in the new master device and third table entries of all online DHCP clients, wherein the third table entry includes a fifth address of each DHCP client; According to the network segment information of all sub-network segments and the fifth address, create a corresponding sub-network segment in the first network segment, and remove the fifth address from the corresponding sub-network segment; The third table entry is generated.

7. The method according to claim 6, characterized in that After creating the first subnet segment, the method further includes: Recording the network segment status of the first sub-network segment as a local status; After creating the second subnet segment, the method further includes: Recording the network segment status of the second sub-network segment as a peer status; After creating the corresponding sub-network segment in the first network segment, the method further includes: The network segment status of the corresponding sub-network segment is recorded as the peer status.

8. An address allocation method, characterized in that: The method is applied to a slave device, the slave device is in a DRNI network, the DRNI network also includes a master device, a first address pool is configured in the master device, the first address pool has a corresponding first network segment, and a second address pool is configured in the slave device, the second address pool has a corresponding second network segment, and the method includes: receiving a first synchronization message sent by the master device, wherein the first synchronization message includes network segment information of a first subnet segment created by the master device in the first network segment and a first table entry of a first DHCP client, wherein the first table entry includes a first address of the first DHCP client; According to the network segment information of the first sub-network segment, determining whether a corresponding first sub-network segment exists locally; If it exists, remove the first address from the first subnet segment and generate the first table entry; If it does not exist, creating the first subnet segment from the second network segment, removing the first address from the first subnet segment, and generating the first table entry; The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

9. The method according to claim 8, characterized in that The method further comprises: When receiving the second DHCP Discover message sent by the second DHCP client, determining whether there is a second subnet segment available for address allocation locally; If not, sending the second DHCP Discover message to the master device; receiving a first DHCP Offer message sent by the master device, where the first DHCP Offer message includes a second address, where the second address is an address allocated to the second DHCP client in a second subnet segment created locally by the master device; Creating the second subnet segment in the second network segment according to the second address; Sending a second DHCP Offer message to the second DHCP client, where the second DHCP Offer message includes the second address; When it is determined that the second DHCP client goes online using the second address, a second synchronization message is sent to the master device, where the second synchronization message includes the network segment information of the second subnet segment and a second table entry of the second DHCP client, where the second table entry includes the second address, so that the master device removes the second address from the second subnet segment created locally and generates the second table entry.

10. The method according to claim 8, characterized in that The method further comprises: receiving a third synchronization message sent by the master device, wherein the third synchronization message includes a third address and network segment information of a third subnet segment to which the third address belongs; Recovering the third address from the third subnet segment according to the network segment information of the third subnet segment and the third address; Determining whether all addresses included in the third subnet segment have been recovered; If yes, deleting the third subnet segment; The third address is the address of the third DHCP client.

11. The method according to claim 8, characterized in that The method further comprises: If the fourth address included in the fourth subnet segment has been recovered, a fourth synchronization message is sent to the master device, wherein the fourth synchronization message includes the fourth address and the network segment information of the fourth subnet segment, so that the master device recovers the fourth address from the fourth subnet segment, and after determining that all addresses included in the fourth subnet segment have been recovered, deletes the fourth subnet segment; If all addresses included in the fourth subnet segment have been recycled, deleting the fourth subnet segment; The fourth address is the address of the fourth DHCP client.

12. The method according to claim 8, characterized in that When the master device is downgraded to a new slave device and the slave device is upgraded to a new master device, the method further includes: Update the network segment status of the local subnet segment in the peer state to the local state; A fifth synchronization message is sent to the new slave device, wherein the fifth synchronization message includes the network segment status of all subnet segments existing in the new master device and the third table entry of all online DHCP clients, wherein the third table entry includes the fifth address of each DHCP client, so that the new slave device creates a corresponding subnet segment according to the network segment information of all subnet segments, removes the fifth address from the corresponding subnet segment, and generates the third table entry.

13. The method according to claim 9, characterized in that After creating the first subnet segment, the method further includes: Recording the network segment status of the first sub-network segment as a peer status; After creating the second subnet segment, the method further includes: The network segment status of the second sub-network segment is recorded as the local end status.

14. An address allocation device, characterized in that: The apparatus is applied to a master device, the master device is in a DRNI network, the DRNI network also includes a slave device, a first address pool is configured in the master device, the first address pool has a corresponding first network segment, a second address pool is configured in the slave device, the second address pool has a corresponding second network segment, and the apparatus includes: A first determining unit, configured to determine whether there is a first subnet segment available for allocating addresses locally when receiving a first DHCP Discover message sent by a first DHCP client; a second judgment unit, configured to judge whether the first sub-network segment can be divided from the first network segment if the sub-network segment does not exist; an acquiring unit, configured to create the first subnet segment and acquire the first address from the first subnet segment; a sending unit, configured to send a first DHCP Offer message to the first DHCP client, wherein the first DHCP Offer message includes the first address; The sending unit is further configured to, when determining that the first DHCP client goes online using the first address, send a first synchronization message to the slave device, the first synchronization message including the network segment information of the first subnet segment and the first table item of the first DHCP client, the first table item including the first address, so that the slave device determines whether the corresponding first subnet segment exists locally, and if so, removes the first address from the first subnet segment and generates the first table item; if not, creates the first subnet segment from the second network segment according to the network segment information of the first subnet segment, removes the first address from the first subnet segment, and generates the first table item; The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

15. An address allocation device, characterized in that: The device is applied to a slave device, the slave device is in a DRNI network, the DRNI network also includes a master device, a first address pool is configured in the master device, the first address pool has a corresponding first network segment, a second address pool is configured in the slave device, the second address pool has a corresponding second network segment, and the device includes: a receiving unit, configured to receive a first synchronization message sent by the master device, wherein the first synchronization message includes network segment information of a first subnet segment created by the master device in the first network segment and a first table entry of a first DHCP client, wherein the first table entry includes a first address of the first DHCP client; A first judgment unit, used for judging whether a corresponding first sub-network segment exists locally according to the network segment information of the first sub-network segment; a removing unit, configured to remove the first address from the first subnet segment if it exists, and generate the first table entry; a creating unit, configured to create the first subnet segment from the second network segment if it does not exist, remove the first address from the first subnet segment, and generate the first table entry; The first address pool is the same as the second address pool, and the first network segment is the same as the second network segment.

Citation Information

Patent Citations

  • Method and system for sharing dynamic address pool in multi-virtual local area network (VLAN) environment

    CN102857587A

  • Data transmission method and computer system

    CN111698338A