WO2020001045A1 - 管理地址的方法和装置 - Google Patents

管理地址的方法和装置 Download PDF

Info

Publication number
WO2020001045A1
WO2020001045A1 PCT/CN2019/076221 CN2019076221W WO2020001045A1 WO 2020001045 A1 WO2020001045 A1 WO 2020001045A1 CN 2019076221 W CN2019076221 W CN 2019076221W WO 2020001045 A1 WO2020001045 A1 WO 2020001045A1
Authority
WO
WIPO (PCT)
Prior art keywords
client
dhcp server
address
lease
lease period
Prior art date
Application number
PCT/CN2019/076221
Other languages
English (en)
French (fr)
Inventor
孟金华
曹锋
季叶一
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP19827386.4A priority Critical patent/EP3800853A4/en
Publication of WO2020001045A1 publication Critical patent/WO2020001045A1/zh
Priority to US17/134,073 priority patent/US20210119965A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5053Lease time; Renewal aspects

Definitions

  • Embodiments of the present application relate to the field of communications, and in particular, to a method and device for managing addresses.
  • a method for allocating an Internet Protocol (IP) address by a Dynamic Host Configuration Protocol (DHCP) server includes: a client broadcasts a DHCP-DISCOVER message to determine a DHCP server that assigns an IP address.
  • the DHCP server that received the DHCP-DISCOVER message assigns an IP address to the client, and returns a DHCP-OFFER message carrying the IP address to the client.
  • the client selects an IP address from the received multiple IP addresses, and sends a DHCP-REQUEST message carrying the selected IP address in a broadcast manner.
  • the DHCP server After receiving the DHCP-REQUEST message, the DHCP server determines that it has kept the lease record corresponding to the IP address in the DHCP-REQUEST message, and then sends a DHCP-ACK message to the client to notify the client that the IP address it has selected is available. used. When the lease corresponding to the IP address used by the client expires, or after the DHCP server receives the DHCP-RELEASE message sent by the client, the DHCP server recovers the IP address used by the client.
  • the DHCP server When the DHCP service fails to effectively obtain the client's use of the IP address, the DHCP server still allocates addresses and continues to lease the IP address allocated to the client, so that the IP address resources cannot be effectively used.
  • the embodiments of the present application provide a method and a device for managing addresses, which help to make effective use of IP address resources.
  • a method for managing addresses includes: a DHCP server assigns an IP address and a lease period to a client; and the DHCP server detects the online status of the client during the lease period; and the DHCP server detects After the client goes offline, the IP address assigned to the client is recovered.
  • the DHCP server after the DHCP server assigns an IP address and a lease period to the client, when it is determined that the lease period has not expired and the client does not use the assigned IP address, the DHCP server can recover the IP address allocated to the client. In this way, the DHCP server can monitor the IP address used by the client in real time, and actively recover the IP address used by the client without using the allocated IP address, thereby improving the availability of the IP address resources in the DHCP server address pool.
  • the DHCP server detecting the online status of the client during the lease period includes: the DHCP server determines that the detection condition is triggered during the lease period, sends a ping packet to the client, and the ping report
  • the destination address of the message is the IP address assigned by the DHCP server to the client; if the DHCP server does not receive a ping response packet from the client within a preset time, the client is determined to be offline; or, the DHCP server detects during the lease period
  • the online status of the client includes: the DHCP server determines that the detection condition is triggered during the lease period, and sends an Address Resolution Protocol (ARP) message to the client; the DHCP server does not receive the ARP returned by the client within a preset time
  • the response packet determines that the client is offline.
  • the DHCP server's active detection process of the client's online status is implemented, so that the client's use of the IP address can be obtained in a timely manner.
  • the DHCP server determining that the detection condition is triggered during the lease period includes: when the DHCP server does not receive the lease renewal message sent by the client during the lease renewal time. To determine that the detection condition is triggered during the lease period; or when the DHCP server is at a preset detection time point within the lease period, determine that the detection condition is triggered during the lease period and that the preset detection time point is the start of the lease period Time or any time during the lease. In the foregoing manner, the detection process of the online status of the client is started at a specified time or a preset detection time point, such as when the lease renewal time has arrived and no lease renewal message is received.
  • the method further includes: the DHCP server saves itself as the client The status of the assigned IP address is updated to be unavailable; or, the DHCP server sets the IP address allocated for the client that it has saved to a high priority.
  • the real-time update of the usage status and priority status of the IP addresses in the address pool of the DHCP server is achieved to improve the flexibility of IP address allocation.
  • the DHCP server after detecting that the client is offline, recovers the IP address assigned to the client, and the method further includes: the DHCP server assigns the IP address assigned to the client After being reclaimed, update the status of the IP address assigned to the client saved by itself to be available; or, after the IP address assigned to the client is recovered, the DHCP server sets the IP address assigned to the client to be set to Low priority.
  • the DHCP server allocates high-priority IP addresses in the address pool, it then allocates low-priority IP addresses, thereby improving the utilization of IP addresses in the DHCP server address pool. At the same time, possible abnormal allocation errors are avoided.
  • a device for managing addresses may include a distribution module, a detection module, and a recycling module.
  • the allocation module is used to assign an IP address and lease period to the client;
  • the detection module is used to detect the online status of the client during the lease period;
  • the determination module is used to recover the IP allocated to the client after detecting that the client is offline. address.
  • the detection module is specifically configured to determine that a detection condition is triggered during the lease period, and sends a ping packet to the client.
  • the destination address of the ping packet is the assignment module as the client.
  • the assigned IP address if the ping response packet returned by the client is not received within the preset time, the client is determined to be offline; or the detection module is specifically used to determine that the detection condition is triggered during the lease period and sends the address to the client Analyze protocol ARP packets; if no ARP response packet returned by the client is received within a preset time, it is determined that the client is offline.
  • the device may further include a determining module; the determining module is configured to determine that the lease renewal message sent by the client is not received during the lease renewal time of the lease period; The detection condition is triggered during the lease period; or the determination module may also be used to determine that the detection condition is triggered during the lease period when the current time is a preset detection time point within the lease period, and the preset detection time point is from the start of the lease period Start time or any time during the lease term.
  • the device further includes an update module; the update module is used to update the status of the IP address allocated for the client saved by the update module to unavailable, or the update module is used to update The IP address assigned to the client saved by itself is set to a high priority.
  • the device further includes an update module; the update module is configured to save the IP address allocated to the client after the IP address allocated to the client is recovered. The status is updated to be available; or the update module is used to set the IP address allocated to the client to the low priority after the IP address allocated to the client is recovered.
  • a computer-readable storage medium stores a computer program, and the computer program includes code that can be executed by a processor to implement the first aspect or any implementation manner of the first aspect.
  • a computer program is provided, and when the computer program is executed by a processor, the first aspect or the method in any implementation manner of the first aspect is implemented.
  • the program may be stored in whole or in part on a storage medium packaged with the processor, or may be partially or entirely stored in a memory not packaged with the processor.
  • an apparatus for managing addresses including: a memory and a processor, where the memory is used to store code, and the processor executes the first aspect or any of the first aspect according to the code read from the memory.
  • a processor includes a circuit for assigning an IP address to a target client, a circuit for detecting an online state of the client during a lease period, and after detecting that the client is offline. Circuit reclaiming the IP address assigned to the client.
  • the processor may be a chip.
  • FIG. 1 is a flowchart of a method for managing addresses
  • FIG. 2 is a schematic diagram of an application scenario provided by an embodiment of the present application.
  • FIG. 3 is one of the flowcharts of a method for managing an address according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of an application scenario provided by an embodiment of the present application.
  • FIG. 5 is a flowchart of a method for managing an address according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of an address management device according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an address management device according to an embodiment of the present application.
  • any embodiment or design described as “exemplary” or “for example” in the embodiments of the present application should not be construed as more preferred or more advantageous than other embodiments or designs. Rather, the use of the words “exemplary” or “for example” is intended to present the relevant concept in a concrete manner.
  • the meaning of “plurality” means two or more. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
  • Figure 1 shows a method for managing addresses, specifically:
  • Step 101 The client broadcasts a DHCP-DISCOVER message to a DHCP server in the network.
  • the DHCP-DISCOVER message carries the identification information of the client.
  • the identification information is used to uniquely identify the client.
  • the identification information may be a MAC address.
  • DHCP server A hereinafter referred to as DHCP Server A
  • DHCP server B hereinafter referred to as DHCP Server B
  • DHCP Server B received the message (multiple DHCP servers can exist in the network.
  • DHCP Server A and DHCP Server B are used as examples. Be explained).
  • Step 102 DHCP Server A and DHCP Server B return a DHCP-OFFER message to the client.
  • the DHCP server detects that there is an IP address resource available for allocation in the local address pool, and returns a DHCP-OFFER message to the client.
  • the message carries the IP address allocated to the client, the client's identification information, lease information (including lease duration and lease renewal duration), and other information.
  • the steps of DHCP server B are the same as those of DHCP server A, and are not described here.
  • Step 103 The client broadcasts a DHCP-REQUEST message. Specifically, the client can only process one of the received DHCP-OFFER messages. Therefore, the general principle is that the client processes the first received DHCP-OFFER message. Take the first DHCP-OFFER message received by the client as the DHCP server B as an example. The client selects the IP address assigned by DHCP Server B as the IP address of the client. Subsequently, the client sends a DHCP-REQUEST message in a broadcast manner to inform the DHCP server in the network of the IP address selected by the client and the DHCP server it belongs to. Specifically, the DHCP-REQUEST message carries the selected IP address, the IP address of the DHCP server, and the client's identification information.
  • Step 104 The DHCP server returns a DHCP-ACK packet. Specifically, the DHCP server that received the DHCP-REQUEST message in the network determines whether the IP address carried in the message exists in the local address pool. If it does not exist, DHCP Sever does nothing and only clears the corresponding IP address allocation record. In this example, DHCP Server B detects that the IP address exists in the local address pool, then DHCP Server B returns a response message to the client, that is, a DHCP-ACK packet, which carries the lease information of the IP address, the client Identification information of the client and the IP address assigned to the client.
  • a DHCP-ACK packet which carries the lease information of the IP address, the client Identification information of the client and the IP address assigned to the client.
  • step 105 after receiving the DHCP-ACK message, the client checks whether the IP address allocated by the DHCP server can be used. If available, the client obtains the IP address and goes online. If the client finds that the IP address has already been used, the client sends a DHCP-Decline message to the DHCP server to notify the DHCP server to disable the IP address, and then the client starts a new IP address application process.
  • the method may further include step 106.
  • the client When the client goes offline, it may release its own IP address by sending a DHCP-RELEASE message. After receiving the DHCP-RELEASE message, the DHCP server determines that the client is offline and recovers the IP address assigned to the client.
  • the DHCP After the DHCP server sends a DHCP-ACK message, the DHCP will start to lease the IP address according to the lease information in the ACK message. However, if the client fails to receive the DHCP-ACK packet due to other reasons such as the network, the client cannot go online normally, that is, the client cannot use the address assigned by DHCPSever. At this time, DHCP Sever will still perform lease timing based on the lease information in the DHCP-ACK packet, so that the IP address assigned to the client is still unavailable and cannot be assigned to other newly accessed clients.
  • the DHCP-RELEASE message may not be sent in time, or due to other reasons such as the network, the DHCP-RELEASE message may not be successfully sent to the DHCP server.
  • DHCP Sever does not detect that the client is offline, and still leases the IP address, so that the IP address assigned to the client is still unavailable and cannot be assigned to other newly accessed clients.
  • embodiments of the present application provide a method for managing addresses, which can effectively use IP addresses and improve the utilization rate of IP address resources.
  • FIG. 2 is a schematic diagram of an application scenario provided by an embodiment of the present application.
  • the scenario shown in FIG. 2 includes a DHCP server 11 and a client 12.
  • the client 12 may be a computer, a smart phone, a telephone, a cable TV set-top box, and other devices.
  • the number of DHCP servers and clients in the network may be one or more.
  • the application scenario shown in FIG. 2 uses one client 12 and one DHCP server 11 as examples. With reference to the application scenario shown in FIG. 2, a specific implementation of the present application is described below.
  • FIG. 3 the method for managing addresses in the embodiment of the present application is shown in FIG. 3:
  • Step 201 Set detection conditions.
  • an operator may perform a setting in advance on a DHCP server in the network, that is, a configuration file is set, so that the DHCP server performs judgment on a detection condition by reading the configuration content in the configuration file.
  • the detection condition may be set based on the lease renewal time.
  • the operator configures in the DHCP server in advance, and this configuration can be used to instruct the DHCP server to determine that the detection condition is triggered if the lease renewal message does not receive the lease renewal message sent by the client, that is, start Check whether the client is online.
  • the lease renewal message carries the destination address, source address, and lease renewal content.
  • the destination address can be the address of a DHCP server.
  • the source address is the media access control (MAC) address of the client.
  • the lease renewal content is used to indicate the length of the lease renewal period.
  • the lease renewal period is a multiple of the lease period, that is, the lease renewal content clearly indicates the number of lease periods that need to be renewed.
  • the lease renewal time arrival time may be the lease renewal deadline time.
  • the DHCP server detects whether a lease renewal message is received 1.5 days after the DHCP-ACK message is sent, until the first 2 days (the second day after lease start) ends. If the lease renewal message is not received on the second day, it is determined that the client does not renew the IP address.
  • the second day in the example is the above-mentioned lease renewal deadline, which can be used as the arrival time of the lease renewal time in the embodiment of the present application.
  • the setting of the detection conditions may be set based on a specified time point.
  • a time point can be set in advance, and the DHCP server will start detecting the online status of the client at the set time point.
  • the specified time point may be the start time of the lease term, or any time during the lease term.
  • Step 202 The client broadcasts a DHCP-DISCOVERY message.
  • Step 203 The DHCP server assigns an IP address to the client according to the DHCP-DISCOVERY.
  • steps 202 and 203 reference may be made to the related description in the method corresponding to FIG. 1, and details are not described herein.
  • the DHCP server further stores an IP address list.
  • the IP address list records the status information of each IP address in the DHCP server address pool. Among them, the status information includes priority and usage.
  • the IP address assigned to the client in the IP address list is marked as unavailable.
  • the IP address allocated to the client is called the target IP address. Among them, the IP addresses marked as unavailable in the IP address list will not be assigned to other clients. Because the IP address marked as unavailable cannot be reassigned to other clients by the DHCP server, the priority of the IP address marked as unavailable can be ignored or set to null.
  • Step 204 The DHCP server detects the online status of the client during the lease period.
  • the DHCP server After detecting that the detection condition set in step 301 is triggered, the DHCP server starts a detection process of the online status of the client.
  • the step of the DHCP server determining whether the detection condition is triggered may specifically include: the lease duration is 3 days, the lease renewal time is 1.5 days, and the lease renewal expires. As an example, the time is 2 days (the second day after the lease starts).
  • the DHCP server monitors in real time whether a lease renewal message is received from the client. If the lease renewal message is received before the end of the second day, it can be determined that the client is online. Conversely, if the client does not receive a lease renewal message before the end of the second day, the client may have two states.
  • the client is online, but the client does not renew the lease.
  • the other is that the client has been abnormally offline or has not been online (that is, a case where a DHCP-ACK message has not been received). Therefore, in order to further determine whether the status of the client is the latter, the DHCP server needs to detect whether the client is online.
  • the step of the DHCP server determining whether the detection condition is triggered may specifically include: a time module exists in the DHCP server, and the DHCP server may obtain the time module from the time module in real time. current time. The DHCP server can then determine whether the detection condition is triggered based on the acquired current time.
  • the specified time point is set as the start time of the lease period, it is mainly aimed at the problem that the client may not successfully receive the DHCP-ACK message. That is, after the DHCP server sends a DHCP-ACK message, it can start the process of detecting the online status of the client. If the specified time point is set to any time in the lease period, DHCP-RELEASE packets for possible clients may not be successfully sent to the DHCP server, or the client goes offline abnormally, resulting in failure to send DHCP-RELEASE in a timely manner. Message problems.
  • the DHCP server may detect the online status of the client by using a Packet Internet Packet (ping) packet. Specifically, the DHCP server can send a ping message to the client, and after receiving the ping message, the client returns a ping response message. After the DHCP server receives the ping packet, it can confirm that the client is online, and the DHCP server does nothing. Conversely, if the DHCP server does not receive a ping response packet, it is determined that the client is not online.
  • ping Packet Internet Packet
  • the manner in which the DHCP server sends a ping response message may be sent multiple times, that is, the DHCP server sends the client multiple times (for example, 10) at a specified interval (for example, 1 ms). Times) ping message. If the DHCP server receives at least one ping response packet, it can determine that the client is online, thereby avoiding misjudgment of the client's online status due to network delay and other reasons.
  • the DHCP server can detect the online status of the client through an Address Resolution Protocol (ARP) message.
  • ARP Address Resolution Protocol
  • the ARP message carries an active address, such as the address of the DHCP server (Can be an IP address), and a destination address, such as the IP address assigned to the client, so that after receiving the ARP packet, the client can send the device corresponding to the source address (that is, the DHCP server) according to the source address it carries. Returns an ARP response packet.
  • the process of detecting the client's online status through ARP packets is similar to that of ping packets, and is not described here.
  • Step 205 After detecting that the client is offline, the DHCP server recovers the IP address allocated to the client.
  • the DHCP server may determine the online status of the client by using the foregoing method. In one embodiment, if the detection result indicates that the client is online, the DHCP server does nothing. In another embodiment, if the detection result is that the client is offline, the DHCP server determines to reclaim the IP address allocated to the client.
  • the “offline” of the client may refer to a scenario in which the client fails to receive the DHCP-ACK message and the client fails to go online, or it may refer to a scenario where the client is offline but has not successfully sent DHCP. -RELEASE message scene.
  • the DHCP server will recover the IP address allocated to the client (to distinguish other IP addresses in the DHCP server, in this embodiment, the IP address allocated to the client is called the target IP address). After that, the unavailable state of the target IP address is released, and the DHCP server updates the use of the target IP address in the IP address list to the available state. Then, the target IP address can be used to assign to other clients.
  • the DHCP server detects the current priority of the target IP address, and reduces the priority of the target IP address recorded in the IP address list according to the priority rules of the IP address list. level.
  • the DHCP server when assigning the IP address in the address pool, the DHCP server adopts the principle of first assigning high priority and assigning after low priority. In this way, the client that is abnormally offline can be used again. IP address previously assigned. Example: After the DHCP server recovers the IP address of client A (10.1.1.11), it lowers the priority of 10.1.1.11 in the IP address list.
  • the DHCP server will select one of the IP addresses with high priority (higher than 10.1.1.11) and assign it to other clients.
  • the DHCP server will assign 10.1.1.11 to other clients only when high-priority IP addresses are assigned.
  • the client A if the client A is online again, it can send a DHCP-REQUEST message to the DHCP server, and carry the address 10.1.1.11 in the message to request the DHCP server to assign 10.1.1.11 to the DHCP server again.
  • the DHCP server detects 10.1.1.11 in the address pool, and assigns 10.1.1.11 to client A again.
  • the DHCP server If the DHCP server detects that 10.1.1.11 does not exist in the address pool, it returns a DHCP-NAK packet to client A, instructing client A to restart the IP address application process to apply for another IP address.
  • the client by introducing the priority, the client can be given the opportunity to reuse the previously assigned IP address when the client is abnormally offline and online again, thereby simplifying the IP address application process and effectively improving The efficiency of IP address allocation further improves the user experience.
  • the priority in the IP address list can be decremented according to the sorting order, that is, the IP address ranked first in the IP address list has the highest priority, and then it is decremented gradually, that is, in the The IP address at the bottom of the IP address list has the lowest priority.
  • the manner in which the DHCP server reduces the priority of the target IP address may be: placing the target IP address at the bottom of the IP address list, so that the priority of the target IP address is all IP addresses in the IP address list Lowest priority.
  • the DHCP server will assign IP addresses in the order of priority in the process of assigning IP addresses, that is, after receiving the DHCP-DISCOVERY message, the DHCP server will use the status as Among the available IP addresses, the first IP address is assigned to the client. Then, it is located at the bottom, that is, the IP address that is recovered using the solution of the embodiment of this application. DHCP will be used at the higher priority IP addresses. After the assignment, the lower priority IP address is assigned.
  • the priorities in the IP address list may be arranged at specific levels.
  • Each IP address in the IP address list of the DHCP server can have a corresponding priority level. The smaller the number, the higher the priority level. For example, the priority level of 10.1.1.5 is 1. and the priority level of 10.1.1.6. If the level is 2, the priority level of 10.1.1.6 is lower than the priority level of 10.1.1.5.
  • the priority level of 10.1.1.11 is adjusted to the lowest level. If the lowest priority level in the IP address list corresponds to 20, Then the priority level of 10.1.1.11 is updated to 21.
  • the above examples are merely to make those skilled in the art better understand the technical solution of the present application, and the method for setting the priority is not limited in this application.
  • the method for managing addresses in the embodiments of the present application implements active detection of the online status of the client by sending a ping message or an ARP message to the client, and confirms that the client is offline Next, the IP address allocated to the client is recycled, so that the IP address can be effectively used and the utilization rate of the IP address resource can be improved.
  • FIG. 4 is a schematic diagram of another application scenario according to an embodiment of the present application.
  • This application scenario includes a DHCP server 21, a DHCP relay device 22, and a client 23.
  • the client 23 may be a computer, a smart phone, a telephone, a cable TV set-top box, and other devices. It should be noted that in actual applications, the number of DHCP servers and clients can be one or more.
  • the application scenario shown in FIG. 4 uses a DHCP server 21, a DHCP relay device 22, and a client 23 as examples. Be explained. With reference to the application scenario shown in FIG. 4, a specific implementation of the present application will be described below with reference to FIG. 5.
  • Step 301 Set detection conditions.
  • Step 302 The client broadcasts a DHCP-DISCOVERY message.
  • the client broadcasts a DHCP-DISCOVERY message to a DHCP relay device with which it communicates.
  • the DHCP intermediate device sends a DHCP-DISCOVERY message to the DHCP server in unicast.
  • a specific sending method reference may be made to the corresponding content in the method corresponding to FIG. 1, which is not repeated in this application.
  • Step 303 The DHCP server allocates an IP address to the client according to the DHCP-DISCOVERY message.
  • Step 304 Detect the online status of the client during the lease period.
  • the interactive data between the DHCP server and the client are all forwarded in the form of unicast through the DHCP relay device.
  • the process of detecting the online status of the client by the DHCP server cannot be detected using ARP packets.
  • the DHCP server can detect the online status of the client through a ping packet.
  • Step 304 After detecting that the client is offline, the DHCP server recovers the IP address allocated to the client.
  • the method for managing addresses provided by the embodiments of the present application can enable the DHCP server to actively detect the online status of the client, thereby reclaiming IP addresses in a timely manner, and effectively improving the resource utilization of the DHCP server address pool.
  • a DHCP server and the like include a hardware structure and / or a software module corresponding to each function.
  • a DHCP server and the like include a hardware structure and / or a software module corresponding to each function.
  • the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is performed by hardware or computer software-driven hardware depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
  • the function modules of the DHCP server may be divided according to the foregoing method examples.
  • each function module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above integrated modules can be implemented in the form of hardware or software functional modules. It should be noted that the division of the modules in the embodiments of the present application is schematic, and is only a logical function division. In actual implementation, there may be another division manner.
  • the device for managing addresses may be the DHCP server in the foregoing embodiment.
  • the device for managing addresses may include: an allocation module 31, a detection module 32, and a recycling module 33.
  • the allocation module 31 may be used to allocate an IP address and a lease period to the client, and used to support the DHCP server to perform S203 and S303 in the above method embodiment;
  • the detection module 32 may be used to detect the online status of the client during the lease period.
  • the recovery module 33 may be used to support the DHCP server to execute S205 and S305 in the above method embodiment.
  • the DHCP server may further include a determination module 34 and an update module 35.
  • the determining module 34 may be configured to support the DHCP server to execute the “determining whether a detection condition is triggered” in the foregoing embodiment.
  • the update module 35 is configured to support the DHCP server to execute the "update the IP address status" in the above-mentioned embodiment, and support the DHCP server to execute the "set the priority of the IP address" in the above-mentioned embodiment.
  • An embodiment of the present application further provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program, and the computer program includes code, which can be executed by a processor included in a device for managing an address to execute the foregoing. The steps performed by the DHCP server in the method corresponding to FIG. 2 or FIG. 4.
  • An embodiment of the present application further provides a computer program, when the computer program is executed by a processor, to execute an example of steps performed by a DHCP server in the method corresponding to FIG. 2 or FIG. 4.
  • the program may be stored in whole or in part on a storage medium packaged with the processor, or may be partially or entirely stored in a memory not packaged with the processor.
  • the apparatus for managing addresses includes a processor 702, a communication interface 703, a memory 701, and a bus 704.
  • the processor 702, the communication interface 703, and the memory 701 are connected to each other through a bus 704.
  • the memory 701 is configured to store program code
  • the processor 702 is configured to read the program code from the memory 701 to execute the steps performed by the DHCP server in the method corresponding to FIG. 2 or FIG. 4.
  • the steps of the method or algorithm described in connection with the disclosure of the embodiments of the present application may be implemented in a hardware manner, or may be implemented in a manner that a processor executes software instructions.
  • Software instructions can be composed of corresponding software modules.
  • Software modules can be stored in Random Access Memory (RAM), flash memory, Read Only Memory (ROM), and erasable programmable read-only memory (ROM). Erasable (Programmable ROM, EPROM), electrically erasable programmable read-only memory (EPROM), registers, hard disks, mobile hard disks, read-only optical disks (CD-ROMs), or any other form of storage medium known in the art.
  • An exemplary storage medium is coupled to the processor such that the processor can read information from, and write information to, the storage medium.
  • the storage medium may also be an integral part of the processor.
  • the processor and the storage medium may reside in an ASIC.
  • the ASIC can reside in a DHCP server or client.
  • the processor and the storage medium can also exist as separate components in the DHCP server or client.
  • Computer-readable media includes computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another.
  • a storage media may be any available media that can be accessed by a general purpose or special purpose computer.

Abstract

本申请实施例提供了一种管理地址的方法和装置,涉及通信领域,该方法包括:DHCP服务器为目标客户端分配IP地址;在租约期内检测客户端的在线状态;以及,在检测到客户端下线后,回收为客户端分配的IP地址。本申请能够使IP地址资源获得有效使用,从而提升了IP地址资源的利用率。

Description

管理地址的方法和装置
本申请要求于2018年6月29日提交中国专利局、申请号为CN 201810712572.0、发明名称为“管理地址的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及通信领域,尤其涉及一种管理地址的方法和装置。
背景技术
目前通过动态主机配置协议(Dynamic Host Configuration Protocol,DHCP)服务器分配互联网协议(Internet Protocol,IP)地址的方法包括:客户端广播DHCP-DISCOVER报文来确定分配IP地址的DHCP服务器。接收到DHCP-DISCOVER报文的DHCP服务器为该客户端分配IP地址,并向客户端返回携带IP地址的DHCP-OFFER报文。客户端从接收到的多个IP地址中选择一个IP地址,并以广播方式发送携带有选择的IP地址的DHCP-REQUEST报文。收到DHCP-REQUEST报文的DHCP服务器判断自身保存了与DHCP-REQUEST报文中的IP地址对应的租约记录后,向客户端发送DHCP-ACK报文,以通知客户端其选择的IP地址可被使用。DHCP服务器在客户端所采用的IP地址对应的租约到期时,或者DHCP服务器在收到客户端发送的DHCP-RELEASE报文后,回收客户端所采用的IP地址。
当DHCP服务未能有效地获取客户端对于IP地址的使用状态时,DHCP服务器仍分配地址的会持续对分配给客户端的IP地址进行租用计时,这样,IP地址资源未能获得有效的使用。
发明内容
本申请实施例提供了一种管理地址的方法和装置,有助于使得IP地址资源获得有效使用。
为达到上述目的,本申请采用如下技术方案:
第一方面,提供一种管理地址的方法,该方法包括:DHCP服务器为客户端分配IP地址和租约期;并且,DHCP服务器在该租约期内检测客户端的在线状态;以及,DHCP服务器在检测到客户端下线后,回收为客户端分配的IP地址。
上述方法中,DHCP服务器为客户端分配IP地址和租约期后,当确定租约期未到期,而客户端未使用分配的IP地址时,DHCP服务器能够对分配给客户端的IP地址进行回收。这样,DHCP服务器能够对客户端所使用的IP地址进行实时监控,并在客户端未使用分配的IP地址的情况下进行主动回收,提高DHCP服务器地址池中IP地址的资源的可用率。
在第一方面的第一种可选的实现方式中,DHCP服务器在租约期内检测客户端的在线状态包括:DHCP服务器确定在租约期内检测条件被触发,向客户端发送ping报文,ping报文的目的地址是DHCP服务器为客户端分配的IP地址;DHCP服务器在预设时间内未接收到客户端返回的ping响应报文,则确定客户端下线;或者,DHCP服务器在租约期内检测客户端的在线状态包括:DHCP服务器确定在租约期内检测条件被触发,向客户端发送地址解 析协议(Address Resolution Protocol,ARP)报文;DHCP服务器在预设时间内未接收到客户端返回的ARP响应报文,则确定客户端下线。通过上述方式,实现了DHCP服务器对客户端在线状态的主动检测过程,从而能够及时获取到客户端对IP地址的使用状态。
在第一方面的第二种可选的实现方式中,DHCP服务器确定在租约期内检测条件被触发包括:DHCP服务器在租约期内的续租时刻未接收到客户端发送的续租报文时,确定在租约期内检测条件被触发;或者DHCP服务器在当前时刻为租约期内的预设检测时间点时,确定在租约期内检测条件被触发,预设检测时间点为租约期的起始时刻或者租约期内的任意时刻。通过上述方式,实现了在指定时刻或预设的检测时间点,比如续租时间已到达而未接收到续租报文时,启动对客户端在线状态的检测流程。
在第一方面的第三种可选的实现方式中,DHCP服务器根据客户端发送的地址请求信息,为客户端分配IP地址和租约期之后,方法还包括:DHCP服务器将自身保存的为客户端分配的IP地址的状态更新为不可用;或者,DHCP服务器将自身保存的为客户端分配的IP地址设置为高优先级。通过上述方式,实现了对DHCP服务器的地址池中的IP地址的使用情况和优先级状态的实时更新,以提升IP地址分配的灵活性。
在第一方面的第四种可选的实现方式中,DHCP服务器在检测到客户端下线后,回收为客户端分配的IP地址之后,方法还包括:DHCP服务器在为客户端分配的IP地址被回收后,将自身保存的为客户端分配的IP地址的状态更新为可用;或者,DHCP服务器在为客户端分配的IP地址被回收后,将自身保存的为客户端分配的IP地址设置为低优先级。通过上述设计,实现了DHCP服务器将地址池中具有高优先级的IP地址进行分配后,再对具有低优先级的IP地址进行分配,从而在提升了DHCP服务器地址池中IP地址的利用率的同时避免了可能发生的异常分配错误。
第二方面,提供一种管理地址的装置,该装置可以包括:分配模块、检测模块以及回收模块。其中,分配模块用于为客户端分配IP地址和租约期;检测模块用于在租约期内检测客户端的在线状态;判定模块用于在检测到客户端下线后,回收为客户端分配的IP地址。
在第二方面的第一种可选的实现方式中,检测模块具体用于确定在租约期内检测条件被触发,向客户端发送ping报文,ping报文的目的地址是分配模块为客户端分配的IP地址;在预设时间内未接收到客户端返回的ping响应报文,则确定客户端下线;或者检测模块具体用于确定在租约期内检测条件被触发,向客户端发送地址解析协议ARP报文;在预设时间内未接收到客户端返回的ARP响应报文,则确定客户端下线。
在第二方面的第二种可选的实现方式中,该装置还可以包括确定模块;确定模块用于在租约期内的续租时刻未接收到客户端发送的续租报文时,确定在租约期内检测条件被触发;或者确定模块还可以用于在当前时刻为租约期内的预设检测时间点时,确定在租约期内检测条件被触发,预设检测时间点为租约期的起始时刻或者租约期内的任意时刻。
在第二方面的第三种可选的实现方式中,该装置还包括更新模块;更新模块用于将自身保存的为客户端分配的IP地址的状态更新为不可用,或者更新模块用于将自身保存的为客户端分配的IP地址设置为高优先级。
在第二方面的第四种可选的实现方式中,该装置还包括更新模块;更新模块用于在为客户端分配的IP地址被回收后,将自身保存的为客户端分配的IP地址的状态更新为可用;或者更新模块用于在为客户端分配的IP地址被回收后,将自身保存的为客户端分配的IP地址设置为低优先级。
第三方面,提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序包含代码,代码可由处理器执行,以实现第一方面或第一方面任一种实现方式中的方法。
第四方面,提供一种计算机程序,当该计算机程序被处理器执行时,实现第一方面或第一方面任一种实现方式中的方法。所述程序可以全部或者部分存储在与处理器封装在一起的存储介质上,也可以部分或者全部存储在不与处理器封装在一起的存储器上。
第五方面,提供一种用于管理地址的装置,包括:存储器和处理器,其中,存储器用于存储代码,处理器根据从存储器中读取的代码,执行第一方面或第一方面任一种实现方式中的方法。
第六方面,提供一种处理器,该处理器包括:用于为目标客户端分配IP地址的电路、用于在租约期内检测客户端的在线状态的电路、以及在检测到客户端下线后回收为客户端分配的IP地址的电路。上述处理器可以为芯片。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是一种管理地址的方法的流程图;
图2是本申请一个实施例提供的应用场景示意图;
图3是本申请一个实施例提供的管理地址的方法的流程图之一;
图4是本申请一个实施例提供的应用场景示意图;
图5是本申请一个实施例提供的管理地址的方法的流程图;
图6是本申请实施例提供的一种管理地址的装置的结构示意图。
图7是本申请实施例提供的一种管理地址的装置的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。本申请实施例的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一目标对象和第二目标对象等是用于区别不同的目标对象,而不是用于描述目标对象的特定顺序。在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个处理单元是指两个或两个以上的处理单元;多个系统是指两个或两个以上的系统。
如图1所示为一种管理地址的方法,具体为:
步骤101,客户端向网络中的DHCP服务器广播DHCP-DISCOVER报文。DHCP-DISCOVER报文中携带有客户端的标识信息。该标识信息用于唯一标识该客户端,比如该标识信息可以为MAC地址。DHCP服务器A(以下简称DHCP Sever A)与DHCP服务器B(以下简称DHCP Sever B)均接收到该报文(网络中可存在多个DHCP服务器,此处仅以DHCP Sever A与DHCP Sever B为例进行说明)。
步骤102,DHCP Sever A和DHCP Sever B向客户端返回DHCP-OFFER报文。具体的,DHCP Sever A检测到本地地址池中存在可供分配的IP地址资源,则向客户端返回DHCP-OFFER报文。该报文中携带有为客户端分配的IP地址、客户端的标识信息、租约信息(包括租约时长和续租时长)及其它信息。DHCP Sever B的步骤与DHCP Sever A的步骤相同,此处不赘述。
步骤103,客户端广播DHCP-REQUEST报文。具体的,客户端仅能处理接收到的DHCP-OFFER报文中的其中一个报文。因此,一般的原则是客户端处理第一个接收到的DHCP-OFFER报文,以客户端接收到的第一个DHCP-OFFER报文为DHCP Sever B发出的为例。客户端选择DHCP Sever B分配的IP地址作为本客户端的IP地址。随后,客户端以广播的方式发出DHCP-REQUEST报文,以告知网络中的DHCP Sever该客户端选中的IP地址以及所属DHCP Sever。具体的,该DHCP-REQUEST报文中携带有选中的IP地址、DHCP Sever B的IP地址、客户端的标识信息等。
步骤104,DHCP Sever B返回DHCP-ACK报文。具体的,网络中接收到DHCP-REQUEST报文的DHCP Sever判断该报文中携带的IP地址是否存在于本地地址池。如果不存在,则DHCP Sever不作任何处理,仅清除相应的IP地址分配记录。在该实例中,DHCP Sever B检测到IP地址存在于本地地址池中,则DHCP Sever B向客户端返回响应信息,即DHCP-ACK报文,该报文中携带有IP地址的租约信息、客户端的标识信息以及为客户端分配的IP地址。
步骤105,客户端接收到DHCP-ACK报文后,检查DHCP Sever B分配的IP地址是否能够使用。如果可以使用,则客户端获取IP地址,并上线。如果客户端发现IP地址已经被使用,则客户端向DHCP Sever发出DHCP-Decline报文,通知DHCP Sever B禁用该IP地址,然后客户端开始新的IP地址申请过程。
在步骤105之后,方法还可以包括步骤106,客户端下线时,可通过发送DHCP-RELEASE报文释放自己的IP地址。DHCP Sever B接收到DHCP-RELEASE报文后,确定客户端离线,回收为客户端分配的IP地址。
上述解决方案中,1)在DHCP服务器发送DHCP-ACK报文后,DHCP将依据ACK报文中的租约信息开始对该IP地址进行租用计时。但是,若由于网络等其它原因,导致客户端未成功接收到该DHCP-ACK报文,则客户端无法正常上线,即,客户端无法使用DHCP Sever分配的地址。此时,DHCP Sever仍然会根据DHCP-ACK报文中的租约信息进行租用计时,使分配给客户端的IP地址仍处于被不可用状态,无法分配给其它新接入的客户端。2)客户端异常离线后,可能出现未能及时发送DHCP-RELEASE报文的情况,或者,由于网络等其他原因,致使DHCP-RELEASE报文未能成功发送给DHCP Sever。对于上述两种情况,DHCP Sever未感知到客户端下线,仍然会对IP地址进行租用计时,使分配给客户端的IP地址仍处于被不可用状态,无法分配给其它新接入的客户端。
为了解决上述技术方案中存在的问题,本申请实施例提供了一种管理地址的方法,能 够使IP地址获得有效地使用,提高IP地址资源的利用率。
图2为本申请实施例提供的一种应用场景示意图。图2所示的场景包括DHCP服务器11和客户端12。在本申请实施例具体实施的过程中,客户端12可以为电脑、智能手机、电话机、有线电视机顶盒等设备。需要说明的是,在实际应用中,网络中DHCP服务器和客户端的数量均可以为一个或多个,图2所示应用场景以一个客户端12和一台DHCP服务器11为例进行说明。结合图2所示的应用场景,下面对本申请的具体实施方案进行说明。
实施例一
结合图2,如图3所示为本申请实施例中的管理地址的方法,在图3中:
步骤201,设置检测条件。
在本申请的实施例中,操作人员可在网络中的DHCP服务器中预先进行设置,即,设置配置文件,从而使DHCP服务器通过读取配置文件中的配置内容,执行对检测条件的判定。
在一个实施例中,检测条件可以为基于续租时间进行设置。具体的,操作人员预先在DHCP服务器中进行配置,该配置可用于指示DHCP服务器若在续租时间到达时刻,未收到客户端发送的续租报文,则确定检测条件被触发,即,启动对客户端是否在线进行检测。其中,续租报文中携带有目的地址、源地址和续租内容。其中,目的地址可以是DHCP服务器的地址。源地址为客户端的媒体接入控制(Media Access Control,MAC)地址。该续租内容用于指示客户端所要续租的时长,其中,续租时长为租约期的倍数,即,续租内容中明确指示需要续租的租约期个数。在一个实施例中,续租时间到达时刻可以为续租截止时刻。举例说明:在现有实施例中,若租约时长为3天,续租时长为1.5天,则DHCP服务器从发送DHCP-ACK报文后的1.5天开始检测是否接收到续租报文,直至第2天(租约开始后的第2天)截止。若在第2天仍未接收到续租报文,则确定客户端不对IP地址进行续租。在举例中的第2天即为上述提及续租截止时刻,即可作为本申请实施例中的续租时间到达时刻。
在另一个实施例中,对于检测条件的设置,可以基于指定的时间点进行设置。具体可预先设定时间点,则DHCP服务器将在设定时间点到达时刻,启动对客户端在线状态的检测。其中,该指定时间点可以为租约期的起始时刻,还可以为租约期内的任意时刻。
步骤202,客户端广播DHCP-DISCOVERY报文。
步骤203,DHCP服务器依据DHCP-DISCOVERY,为客户端分配IP地址。
步骤202和203可以具体参见图1对应的方法中的相关描述,此处不赘述。
在本申请的实施例中,DHCP服务器中还存储有IP地址列表。该IP地址列表中记录有DHCP服务器地址池中的每个IP地址的状态信息。其中,状态信息包括优先级和使用情况。在一个实施例中,DHCP服务器将IP地址分配给客户端后,将IP地址列表中分配给客户端的IP地址被标记为不可用状态。为与DHCP服务器中的其它IP地址进行,本申请实施例中,分配给客户端的IP地址称为目标IP地址。其中,IP地址列表中被标记为不可用状态的IP地址不会被分配给其他客户端。因为被标记为不可用状态的IP地址无法被DHCP服务器再分配给其他客户端,所以被标记为不可用状态的IP地址的优先级可被忽略或被设置为空。
步骤204,DHCP服务器在租约期内检测客户端的在线状态。
具体的,在本申请的实施例中,DHCP服务器在检测到步骤301中设置的检测条件被触发后,启动对客户端的在线状态的检测流程。
在一个实施例中,若检测条件为基于续约报文设置的,则DHCP服务器判断检测条件是否被触发的步骤可以具体包括:以租约时长为3天、续租时间为1.5天、续租截止时间为2天(租约开始后的第2天)为例。DHCP服务器在IP地址对应的续租时间到达时刻,即,第1.5天,实时监测是否接收到来自客户端的续租报文。若在第2天结束之前接收到续租报文,则可确定客户端在线。相反,如果客户端在第2天结束之前未接收到续租报文,则客户端可能存在两种状态,一种为客户端在线,但是客户端不续租。另一种为客户端已经异常离线或一直未上线(即,未接收到DHCP-ACK报文的情况)。因此,为进一步确定客户端的状态是否为后者,DHCP服务器需要检测客户端是否在线。
在另一个实施例中,若检测条件为基于指定时间设置的,则DHCP服务器判断检测条件是否被触发的步骤可以具体包括:DHCP服务器中存在时间模块,DHCP服务器可从时间模块中,实时获取到当前时间。随后DHCP服务器可依据获取到的当前时间判断检测条件是否被触发。
在该实施例中,若指定时间点被设置为租约期的起始时刻,主要是针对可能出现的客户端未成功接收DHCP-ACK报文的问题。即,DHCP服务器可在发送DHCP-ACK报文后,即可启动对客户端的在线状态的检测流程。若指定时间点被设置为租约期内的任意时刻,即可针对可能出现的客户端的DHCP-RELEASE报文未成功发送到DHCP服务器,或者,客户端异常下线,导致未能及时发送DHCP-RELEASE报文的问题。
仍参照图3,在本申请的一个实施例中,DHCP服务器可以通过网际包探测器(Packet Internet Groper,ping)报文对客户端的在线状态进行检测。具体的,DHCP服务器可向客户端发送ping报文,客户端接收到ping报文后,则会返回ping响应报文。DHCP服务器接收到ping报文后,可确定客户端在线,DHCP服务器不作任何处理。反之,若DHCP服务器未接收到ping响应报文,则确定客户端未在线。其中,在一个可能的实施例中,DHCP服务器发送ping响应报文的方式,可以为多次发送,即,DHCP服务器以指定的间隔时间(例如:1ms)向客户端发送多次(例如:10次)ping报文。若DHCP服务器接收到至少一条ping响应报文,则可确定客户端在线,从而能够避免因网络延迟等原因对客户端在线状态的误判。
在另一个实施例中,DHCP服务器可以通过地址解析协议(Address Resolution Protocol,ARP)报文对客户端的在线状态进行检测,在该实施例中,ARP报文携带有源地址,比如DHCP服务器的地址(可以是IP地址),以及目的地址,比如已分配给客户端的IP地址,从而使客户端在接收到ARP报文后,可根据其携带的源地址向源地址对应的设备(即DHCP服务器)返回ARP响应报文。通过ARP报文检测客户端在线状态的过程与ping报文的相似,此处不赘述。
步骤205,DHCP服务器在检测到客户端下线后,回收为客户端分配的IP地址。
具体的,在本申请的实施例中,DHCP服务器通过上述方法,可确定客户端的在线情况。在一个实施例中,若检测结果为客户端在线,则DHCP服务器不作任何处理。在另一个实施例中,若检测结果为客户端下线,则DHCP服务器判定回收为客户端分配的IP地址。在本申请的实施例中,客户端“下线”可以指客户端未成功接收到DHCP-ACK消息,导致客户端未成功上线的场景,也可以指客户端已离线但并未能成功发送 DHCP-RELEASE消息的场景。
此外,在本申请的实施例中,DHCP服务器将分配给客户端的IP地址(为区分DHCP服务器中的其它IP地址,在本实施例中,将分配给客户端的IP地址称为目标IP地址)回收后,目标IP地址的不可用状态解除,DHCP服务器将目标IP地址在IP地址列表中的使用情况更新为可用状态。则,目标IP地址可用于分配给其它客户端。
在本申请的实施例中,DHCP服务器在将目标IP地址回收之后,检测目标IP地址当前的优先级情况,并依据IP地址列表的优先级规则,降低目标IP地址在IP地址列表中记录的优先级。在本申请的实施例中,DHCP服务器在对地址池中的IP地址进行分配时,采用高优先级先分配,低优先级后分配的原则,通过该方式,能够使异常离线的客户端再次使用之前分配的IP地址。举例说明:DHCP服务器将客户端A的IP地址(10.1.1.11)回收后,将IP地址列表中10.1.1.11的优先级降低,此时,如果有其他客户端向DHCP服务器申请分配IP地址,则DHCP服务器将会从高优先级(比10.1.1.11优先级高)的IP地址中选择其一,并分配给其它客户端。在高优先级的IP地址均被分配的情况下,DHCP服务器才会将10.1.1.11分配给其它客户端。在本申请的实施例中,若客户端A再次上线后,可向DHCP服务器发送DHCP-REQUEST报文,并且在该报文中携带10.1.1.11地址,以请求DHCP服务器再次将10.1.1.11分配给客户端A。DHCP服务器检测地址池中存在10.1.1.11,则将10.1.1.11再次分配给客户端A。若DHCP服务器检测地址池中不存在10.1.1.11,则向客户端A返回DHCP-NAK报文,以指示客户端A重新启动IP地址申请流程,以申请其它IP地址。本申请实施例中,通过引入优先级,从而能够使客户端在异常离线,并重新上线的情况下,能够有机会再次使用之前被分配的IP地址,从而简化IP地址申请流程,有效地提升了IP地址分配的效率,进而提高了用户使用体验。
在一个实施例中,IP地址列表中的优先级可以通过按照排列顺序逐级递减的方式,即,排在IP地址列表首位的IP地址优先级为最高级,随后逐级递减,即,排在IP地址列表末位的IP地址优先级为最低级。在该实施例中,DHCP服务器降低目标IP地址的优先级的方式可以为:将目标IP地址放置于IP地址列表的末位,从而使目标IP地址的优先级为IP地址列表中的所有IP地址的最低优先级。对应的,在该实施例中,DHCP服务器在分配IP地址的过程中,将按照优先级顺序进行IP地址的分配,也就是说,DHCP服务器在接收到DHCP-DISCOVERY报文后,将使用情况为可用状态的IP地址中排在首位的IP地址分配给客户端,则,位于末位,即,采用本申请实施例方案被回收的IP地址,DHCP将会在较高优先级的IP地址均被分配后,再对低优先级的IP地址进行分配。
在另一个实施例中,IP地址列表中的优先级可以以具体级别进行排列。举例说明:DHCP服务器的IP地址列表中的各IP地址可具有对应的优先级级别,数字越小的优先级级别越高,如:10.1.1.5的优先级级别为1、10.1.1.6的优先级级别为2,则10.1.1.6的优先级级别低于10.1.1.5的优先级级别。在该实施例中,DHCP服务器对客户端A的10.1.1.11进行回收后,将10.1.1.11的优先级级别调至最低,若此时IP地址列表中的最低优先级级别对应的数字为20,则10.1.1.11的优先级级别更新为21。上述举例仅为使本领域人员更好的理解本申请的技术方案,本申请对优先级的设定方法不做限定。
综上所述,本申请实施例中的管理地址的方法,通过对客户端发送ping报文或者ARP报文,从而实现对客户端在线情况的主动检测,并且,在确认客户端已离线的情况下,对分配给客户端的IP地址进行回收,进而能够使IP地址获得有效地使用,提高IP地址资源 的利用率。
实施例二
参见图4,为本申请实施例提供的另一种应用场景示意图。该应用场景中包括DHCP服务器21、DHCP中继设备22、客户端23。在本申请实施例具体实施的过程中,客户端23可以为电脑、智能手机、电话机、有线电视机顶盒等设备。需要说明的是,在实际应用中,DHCP服务器、客户端的数量均可以为一个或多个,图4所示应用场景以一台DHCP服务器21、一个DHCP中继设备22和一个客户端23为例进行说明。结合图4所示的应用场景,下面对本申请的具体实施方案进行说明,参照图5。
步骤301,设置检测条件。
步骤302,客户端广播DHCP-DISCOVERY报文。
具体的,在本实施例中,客户端将DHCP-DISCOVERY报文广播给与其进行通信连接的DHCP中继设备。随后,DHCP中级设备以单播的形式将DHCP-DISCOVERY报文发送给DHCP服务器。具体发送方法可以参照图1对应的方法中的相应内容,本申请在此不再赘述。
步骤303,DHCP服务器依据DHCP-DISCOVERY报文,为客户端分配IP地址。
步骤304,在租约期内检测客户端的在线状态。
具体的,在本实施例中,DHCP服务器与客户端之间的交互数据均是通过DHCP中继设备以单播的形式进行转发。需要说明的是,在DHCP服务器与客户端之间存在DHCP中继设备的情况下,DHCP服务器对客户端的在线状态进行检测的过程,无法使用ARP报文进行检测。在一个实施例中,DHCP服务器可以通过ping报文对客户端的在线状态进行检测。
步骤304,DHCP服务器在检测到客户端下线后,回收为客户端分配的IP地址。
综上所述,本申请实施例提供的管理地址的方法,能够实现DHCP服务器对客户端在线状态的主动检测,从而及时对IP地址进行回收,有效提升了DHCP服务器地址池的资源利用率。
上述主要从各个网元之间交互的角度对本申请实施例提供的方案进行了介绍。可以理解的是,DHCP服务器等为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对DHCP服务器进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用对应各个功能划分各个功能模块的情况下,用于管理地址的装置可以是上述实施例中的DHCP服务器。如图6所示,用于管理地址的装置可以包括:分配模块31、检测模块32和回收模块33。其中,分配模块31可以用于为客户端分配IP地址和租约期,以 及用于支持DHCP服务器执行上述方法实施例中的S203、S303;检测模块32可以用于在租约期内检测客户端的在线状态,以及用于支持DHCP服务器执行上述方法实施例中的S204、S304;回收模块33可以用于支持DHCP服务器执行上述方法实施例中的S205、S305。可选的,如图6所示,该DHCP服务器还可以包括确定模块34和更新模块35。确定模块34可以用于支持DHCP服务器执行上述实施例中的“确定检测条件是否被触发”。更新模块35用于支持DHCP服务器执行上述实施例中的“更新IP地址的状态”,以及支持DHCP服务器执行上述实施例中的“设置IP地址的优先级”。其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序包含代码,该代码可由用于管理地址的装置所包括的处理器执行,以执行上述图2或图4对应的方法中DHCP服务器执行的步骤。
本申请实施例还提供一种计算机程序,当该计算机程序被处理器执行时,以执行上述图2或图4对应的方法中DHCP服务器执行的步骤例。所述程序可以全部或者部分存储在与处理器封装在一起的存储介质上,也可以部分或者全部存储在不与处理器封装在一起的存储器上。
如图7所示,用于管理地址的装置包括:处理器702、通信接口703、存储器701和总线704。处理器702、通信接口703以及存储器701通过总线704相互连接。存储器701用于存储程序代码,处理器702用于从存储器701中读取程序代码,以执行上述图2或图4对应的方法中DHCP服务器执行的步骤。
结合本申请实施例公开内容所描述的方法或者算法的步骤可以硬件的方式来实现,也可以是由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于随机存取存储器(Random Access Memory,RAM)、闪存、只读存储器(Read Only Memory,ROM)、可擦除可编程只读存储器(Erasable Programmable ROM,EPROM)、电可擦可编程只读存储器(Electrically EPROM,EEPROM)、寄存器、硬盘、移动硬盘、只读光盘(CD-ROM)或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。另外,该ASIC可以位于DHCP服务器或客户端中。当然,处理器和存储介质也可以作为分立组件存在于DHCP服务器或客户端中。
本领域技术人员应该可以意识到,在上述一个或多个示例中,本申请实施例所描述的功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是通用或专用计算机能够存取的任何可用介质。
以上所述的具体实施方式,对本申请实施例的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本申请实施例的具体实施方式而已,并不用于限定本申请实施例的保护范围,凡在本申请实施例的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本申请实施例的保护范围之内。

Claims (11)

  1. 一种管理地址的方法,其特征在于,包括:
    DHCP服务器为所述客户端分配IP地址和租约期;
    所述DHCP服务器在所述租约期内检测所述客户端的在线状态;
    所述DHCP服务器在检测到所述客户端下线后,回收为所述客户端分配的IP地址。
  2. 根据权利要求1所述的方法,其特征在于,所述DHCP服务器在所述租约期内检测所述客户端的在线状态包括:
    所述DHCP服务器确定在所述租约期内检测条件被触发,向所述客户端发送ping报文,所述ping报文的目的地址是所述DHCP服务器为所述客户端分配的IP地址;所述DHCP服务器在预设时间内未接收到所述客户端返回的ping响应报文,则确定所述客户端下线;或者
    所述DHCP服务器在所述租约期内检测所述客户端的在线状态包括:所述DHCP服务器确定在所述租约期内检测条件被触发,向所述客户端发送地址解析协议ARP报文;所述DHCP服务器在预设时间内未接收到所述客户端返回的ARP响应报文,则确定所述客户端下线。
  3. 根据权利要求2所述的方法,其特征在于,所述DHCP服务器确定在所述租约期内检测条件被触发包括:
    所述DHCP服务器在所述租约期内的续租时刻未接收到所述客户端发送的续租报文时,确定在所述租约期内检测条件被触发;或者
    所述DHCP服务器在当前时刻为所述租约期内的预设检测时间点时,确定在所述租约期内检测条件被触发,所述预设检测时间点为所述租约期的起始时刻或者所述租约期内的任意时刻。
  4. 根据权利要求1至3任一所述的方法,其特征在于,DHCP服务器为所述客户端分配IP地址和租约期之后,所述方法还包括:
    所述DHCP服务器将自身保存的为所述客户端分配的IP地址的状态更新为不可用;或者
    所述DHCP服务器将自身保存的为所述客户端分配的IP地址设置为高优先级。
  5. 根据权利要求1至3任一所述的方法,其特征在于,所述DHCP服务器在检测到所述客户端下线后,回收为所述客户端分配的IP地址之后,所述方法还包括:
    所述DHCP服务器在所述为所述客户端分配的IP地址被回收后,将自身保存的为所述客户端分配的IP地址的状态更新为可用;或者
    所述DHCP服务器在所述为所述客户端分配的IP地址被回收后,将自身保存的为所述客户端分配的IP地址设置为低优先级。
  6. 一种管理地址的装置,其特征在于,包括:
    分配模块,用于为所述客户端分配IP地址和租约期;
    检测模块,用于在所述租约期内检测所述客户端的在线状态;
    回收模块,用于在检测到所述客户端下线后,回收为所述客户端分配的IP地址。
  7. 根据权利要求6所述的装置,其特征在于,所述检测模块具体用于:确定在所述租约期内检测条件被触发,向所述客户端发送ping报文,所述ping报文的目的地址是所述分配模块为所述客户端分配的IP地址;在预设时间内未接收到所述客户端返回的ping 响应报文,则确定所述客户端下线;或者
    所述检测模块具体用于:确定在所述租约期内检测条件被触发,向所述客户端发送地址解析协议ARP报文;在预设时间内未接收到所述客户端返回的ARP响应报文,则确定所述客户端下线。
  8. 根据权利要求7所述的装置,其特征在于,所述装置还包括确定模块;
    所述确定模块用于在所述租约期内的续租时刻未接收到所述客户端发送的续租报文时,确定在所述租约期内检测条件被触发;或者
    所述确定模块用于在当前时刻为所述租约期内的预设检测时间点时,确定在所述租约期内检测条件被触发,所述预设检测时间点为所述租约期的起始时刻或者所述租约期内的任意时刻。
  9. 根据权利要求6至8任一所述的装置,其特征在于,所述装置还包括更新模块;
    所述更新模块用于将自身保存的为所述客户端分配的IP地址的状态更新为不可用;或者
    所述更新模块用于将自身保存的为所述客户端分配的IP地址设置为高优先级。
  10. 根据权利要求6至8任一所述的装置,其特征在于,所述装置还包括更新模块;
    所述更新模块用于在所述为所述客户端分配的IP地址被回收后,将自身保存的为所述客户端分配的IP地址的状态更新为可用;或者
    所述更新模块用于在所述为所述客户端分配的IP地址被回收后,将自身保存的为所述客户端分配的IP地址设置为低优先级。
  11. 一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序包含代码,所述代码可由处理器执行,以执行权利要求1至5任一所述的方法。
PCT/CN2019/076221 2018-06-29 2019-02-27 管理地址的方法和装置 WO2020001045A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP19827386.4A EP3800853A4 (en) 2018-06-29 2019-02-27 ADDRESS MANAGEMENT PROCESS AND DEVICE
US17/134,073 US20210119965A1 (en) 2018-06-29 2020-12-24 Address Management Method and Apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810712572.0 2018-06-29
CN201810712572.0A CN110661897A (zh) 2018-06-29 2018-06-29 管理地址的方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/134,073 Continuation US20210119965A1 (en) 2018-06-29 2020-12-24 Address Management Method and Apparatus

Publications (1)

Publication Number Publication Date
WO2020001045A1 true WO2020001045A1 (zh) 2020-01-02

Family

ID=68986035

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/076221 WO2020001045A1 (zh) 2018-06-29 2019-02-27 管理地址的方法和装置

Country Status (4)

Country Link
US (1) US20210119965A1 (zh)
EP (1) EP3800853A4 (zh)
CN (1) CN110661897A (zh)
WO (1) WO2020001045A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11725512B2 (en) 2012-09-14 2023-08-15 Joy Global Underground Mining Llc Method for removing material from a rock wall
US11939868B2 (en) 2016-08-19 2024-03-26 Joy Global Underground Mining Llc Cutting device and support for same

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11750559B2 (en) * 2019-11-15 2023-09-05 Nippon Telegraph And Telephone Corporation Edge switching system, edge switching device, edge switching method, and program
CN114172864B (zh) * 2020-08-21 2024-04-09 中国移动通信集团重庆有限公司 物联网终端地址分配方法及装置
US11637808B2 (en) * 2021-04-22 2023-04-25 Centurylink Intellectual Property Llc Generation and use of micro-pools to assign an IP address to a requesting computing device
US20230208803A1 (en) * 2021-12-29 2023-06-29 Mastercard International Incorporated Ip address control system
CN114374670B (zh) * 2021-12-29 2024-04-30 中国电信股份有限公司 管理ip资源池的方法、装置、dhcp服务器及存储介质
CN114726828B (zh) * 2022-05-10 2023-08-08 普联技术有限公司 Ip地址分配方法、装置、设备及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103763405A (zh) * 2014-01-21 2014-04-30 福建三元达通讯股份有限公司 一种dhcp租约快速回收的方法
CN106470253A (zh) * 2016-11-21 2017-03-01 杭州迪普科技股份有限公司 Ip地址回收方法和装置
CN108076004A (zh) * 2016-11-09 2018-05-25 中国移动通信有限公司研究院 用于客户端检测的ipoe认证方法、装置及服务器

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101997920A (zh) * 2010-11-18 2011-03-30 中兴通讯股份有限公司 Dhcp租约处理方法及装置
CN106331190A (zh) * 2015-06-19 2017-01-11 中兴通讯股份有限公司 Ip地址回收方法、装置及动态主机配置协议服务器
CN107707689B (zh) * 2017-10-31 2020-09-22 迈普通信技术股份有限公司 一种dhcp报文处理方法、dhcp服务器及网关设备

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103763405A (zh) * 2014-01-21 2014-04-30 福建三元达通讯股份有限公司 一种dhcp租约快速回收的方法
CN108076004A (zh) * 2016-11-09 2018-05-25 中国移动通信有限公司研究院 用于客户端检测的ipoe认证方法、装置及服务器
CN106470253A (zh) * 2016-11-21 2017-03-01 杭州迪普科技股份有限公司 Ip地址回收方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3800853A4

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11725512B2 (en) 2012-09-14 2023-08-15 Joy Global Underground Mining Llc Method for removing material from a rock wall
US11939868B2 (en) 2016-08-19 2024-03-26 Joy Global Underground Mining Llc Cutting device and support for same

Also Published As

Publication number Publication date
EP3800853A1 (en) 2021-04-07
CN110661897A (zh) 2020-01-07
EP3800853A4 (en) 2021-06-23
US20210119965A1 (en) 2021-04-22

Similar Documents

Publication Publication Date Title
WO2020001045A1 (zh) 管理地址的方法和装置
US9847967B2 (en) DHCP proxy in a subscriber environment
US7577146B2 (en) Network element modifying the DHCP lease timer
EP2683138A1 (en) Public network address allocation method and device
CN108429824B (zh) 一种地址分配方法及装置
CN107733808B (zh) 一种流量传输方法及装置
EP3664420A1 (en) Managing address spaces across network elements
CN110661894A (zh) 用户ip地址的分配方法、网络设备和存储介质
CN108989476B (zh) 一种地址分配方法以及装置
CN106506724B (zh) 一种分配端口块的方法及装置
EP2658206B1 (en) Ip address configuration method, device and system
CN108600407B (zh) 一种ip地址分配方法、装置、设备及机器可读存储介质
CN106790734B (zh) 一种网络地址分配方法及装置
CN107615723B (zh) 一种互联网协议地址分配方法和中继设备
CN107786680B (zh) 用于对ip地址资源进行管理的方法和装置
WO2020048177A1 (zh) 机顶盒管理方法、装置、设备及存储介质
CN112995349A (zh) 地址管理方法、服务器和计算机可读存储介质
CN115499414A (zh) 地址分配方法及装置
CN102523316A (zh) 一种地址分配方法和设备
CN115174528A (zh) 一种设备地址管控方法、装置及系统
CN108600302B (zh) 物联设备的控制方法、装置和可读存储介质及计算机设备
CN111885215A (zh) 一种存储设备ip地址的配置方法、装置、系统和介质
CN114124737A (zh) 一种控制用户设备接入网络的方法及装置
CN112911026A (zh) 一种地址申请方法、装置及设备
CN114448942B (zh) 一种dhcp报文处理方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19827386

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2019827386

Country of ref document: EP

Effective date: 20201229