Method, device, computer program product and server for allocating address lease term

By obtaining and utilizing the historical average lease term information of short-term rental terminal equipment, dynamically determine the lease term of the target terminal equipment, solving the problem of low IP address utilization rate in the existing technology, and achieving more flexible and efficient IP address lease term management.

CN119788647APending Publication Date: 2025-04-08TP-LINK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510012984.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In the prior art, the lease term allocation method of IP addresses leads to low utilization rate of IP addresses, especially because the default lease term setting relies on manual experience and lacks consideration for the actual network environment, resulting in the inadequate recovery of IP addresses and wasted address resources. In addition, the average lease term cannot truly reflect the reasonable lease term time in the network, resulting in low IP address utilization.

Method used

By obtaining the short-term average lease term information of the target terminal equipment, the information is determined based on the historical average lease period of each short-term lease terminal equipment, and the historical average lease period of the short-term lease terminal equipment is less than the preset lease period threshold. Then, based on the target lease information, the target lease period of the target terminal device is determined and the lease period is allocated for its address.

Benefits of technology

This method can timely recycle IP addresses and renew them, improve the utilization rate of IP addresses and enhance the flexibility and agility of lease period allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119788647A_ABST
    Figure CN119788647A_ABST
Patent Text Reader

Abstract

The present application belongs to the field of network communication technology, and in particular, relates to a method, device, computer program product and server for allocating address leases. The method includes obtaining target lease information when receiving an address request from a target terminal device; wherein the target lease information includes an average short-lease lease, and the average short-lease lease is determined based on the historical average lease of each short-lease terminal device, and the historical average lease of each short-lease terminal device is less than a lease threshold; based on the target lease information, the target lease of the target terminal device is determined; based on the target lease, a lease is allocated for the address of the target terminal device. When allocating leases, the above method only needs to consider the historical average lease of each short-lease terminal device, so that the IP address can be recovered and renewed in a timely manner, which helps to improve the utilization rate of the IP address and can enhance the flexibility and agility of lease allocation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of network communication technology, and in particular, relates to a method, device, computer program product and server for allocating address lease periods. Background Art

[0002] When a terminal device is communicating over the network, it needs to use the unique Internet Protocol (IP) address corresponding to the terminal device in the network to send and receive messages. With the continuous development of network communication technology, the number of terminal devices connected to the network has also exploded. In order to improve the utilization rate of IP addresses, existing solutions usually allocate IP addresses based on the Dynamic Host Configuration Protocol (DHCP). When allocating an IP address, it is also necessary to set a corresponding lease period for the IP address so that the IP address can be recovered or renewed in a timely manner. In one existing lease allocation scheme, the server records the online time of each terminal device and allocates a lease to each terminal device based on the time; however, for a terminal device that accesses the network for the first time, the server allocates a fixed default lease to it. The setting of the default lease relies on manual experience and lacks consideration of the actual network environment. If the fixed default lease is set too long, it will lead to untimely recovery of IP addresses and waste of address resources. In another existing lease allocation scheme, the server can consider the average lease of each terminal device in the entire network when allocating a lease to the IP address of a terminal device. However, if the number of terminal devices with longer leases and shorter leases in the network is equal, the average value cannot truly reflect the reasonable lease time in the network, resulting in low utilization of IP addresses in the network. Summary of the invention

[0003] In view of this, embodiments of the present application provide a method, device, computer program product, and server for allocating address leases to solve the problem of low utilization of IP addresses in the prior art methods for allocating address leases.

[0004] A first aspect of an embodiment of the present application provides a method for allocating a lease period for an address, which may include:

[0005] Upon receiving an address request from a target terminal device, obtaining target lease information; wherein the target lease information includes an average short-lease lease, which is determined based on a historical average lease of each short-lease terminal device, and the historical average lease of each short-lease terminal device is less than a lease threshold;

[0006] Determining a target lease of the target terminal device based on the target lease information;

[0007] Based on the target lease, a lease is allocated for the address of the target terminal device.

[0008] A second aspect of an embodiment of the present application provides a device for allocating address leases, which may include:

[0009] An acquisition module, configured to acquire target lease information upon receiving an address request from a target terminal device; wherein the target lease information includes an average short-lease lease, which is determined based on a historical average lease of each short-lease terminal device, and the historical average lease of each short-lease terminal device is less than a lease threshold;

[0010] A determination module, configured to determine a target lease of the target terminal device based on the target lease information;

[0011] An allocation module is used to allocate a lease to the address of the target terminal device based on the target lease.

[0012] A third aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned address lease allocation methods are implemented.

[0013] The fourth aspect of an embodiment of the present application provides a server, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the server implements the steps of any one of the above-mentioned address lease allocation methods.

[0014] A fifth aspect of an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed, any of the above-mentioned address lease allocation methods is executed.

[0015] Compared with the prior art, the embodiments of the present application have the following beneficial effects: when receiving an address request from a target terminal device, the embodiments of the present application obtain target lease information; wherein the target lease information includes an average short-term lease, which is determined based on the historical average lease of each short-term terminal device, and the historical average lease of each short-term terminal device is less than the lease threshold; based on the target lease information, the target lease of the target terminal device is determined; based on the target lease, a lease is allocated for the address of the target terminal device. When the embodiments of the present application allocate leases, only the historical average lease of each short-term terminal device needs to be considered, so that the IP address can be recovered and renewed in a timely manner, which helps to improve the utilization rate of the IP address and can enhance the flexibility and agility of lease allocation. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0017] Figure 1 A schematic diagram of an application scenario in an embodiment of the present application;

[0018] Figure 2 A flowchart of an embodiment of a method for allocating a lease term for an address in an embodiment of the present application;

[0019] Figure 3 A schematic diagram of a lease allocation process for an address;

[0020] Figure 4 A structural diagram of an embodiment of a device for allocating lease periods for an address in an embodiment of the present application;

[0021] Figure 5 This is a schematic block diagram of a server in an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described below are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0023] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0024] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0025] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0026] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0027] In addition, in the description of the present application, the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0028] When a terminal device is communicating over a network, it needs to use the unique Internet Protocol (IP) address corresponding to the terminal device in the network to send and receive messages. With the continuous development of network communication technology, the number of terminal devices connected to the network has also exploded. In order to improve the utilization rate of IP addresses, existing solutions usually allocate IP addresses based on the Dynamic Host Configuration Protocol (DHCP). For each IP address, the usage period (i.e., lease period) of the IP address needs to be determined accordingly during allocation. After the lease period of the IP address expires, the IP address can be recycled, or the lease period of the IP address can be extended so that the terminal device can continue to use the IP address. Through the DHCP protocol, each IP address in the network can be utilized and managed to a large extent.

[0029] In one existing lease allocation scheme, the server records the online time of each terminal device and allocates a lease to each terminal device based on this; however, for a terminal device that accesses the network for the first time, the server allocates a fixed default lease to it. The setting of the default lease relies on manual experience and lacks consideration of the actual network environment. If the fixed default lease is set too long, it will lead to untimely recovery of IP addresses and waste of address resources; in another existing lease allocation scheme, when the server allocates a lease to the IP address of a terminal device, the server will consider the average lease of the IP addresses of each terminal device in the entire network; for example, the lease corresponding to the average value can be set as the lease of the IP address of the terminal device. However, if the number of terminal devices with longer leases and shorter leases in the network is equal, the average value cannot truly reflect the reasonable lease time in the network; specifically, when the number of terminal devices with longer leases and shorter leases in the network is equal, the average value of the lease will be lower than the longer lease in the network and higher than the shorter lease in the network; if the IP address of a terminal device that requires a longer lease is assigned to the lease corresponding to the average value, the terminal device will apply for renewal of its IP address more frequently, thereby increasing the load on the entire network; if the IP address of a terminal device that requires a shorter lease is assigned to the lease corresponding to the average value, the terminal device will have left the network but will still have to wait until the lease expires before its IP address can be recycled, resulting in low utilization of the IP address; in addition, the inability to recycle IP addresses in a timely manner will make the limited IP address resources even more strained, which may cause other terminal devices to be unable to access the Internet normally due to failure to obtain IP addresses.

[0030] In view of this, embodiments of the present application provide a method, apparatus, computer program product, and server for allocating address leases to solve the problem of low utilization of IP addresses in the prior art methods for allocating address leases.

[0031] It should be noted that the execution subject of the method of the present application is a server, which can be specifically a server configured to execute DHCP service.

[0032] Figure 1 An application scenario of an embodiment of the present application is shown. Specifically, when a terminal device needs to access a network, or when the terminal device has accessed a network but needs to extend the validity period of its IP address, a corresponding address request can be sent to a server based on the DHCP protocol. The server can provide the terminal device with corresponding address allocation services or address renewal services based on the address request. When the server performs address allocation or address renewal, it needs to simultaneously determine the lease period of the IP address. Here, the terminal device can be regarded as a client that requests and receives corresponding address services.

[0033] The terminal device in the embodiment of the present application may be a terminal device with a higher mobility frequency (referred to as a mobile terminal device), and the mobile terminal device may specifically include but is not limited to mobile phones, tablet computers, laptop computers, wearable devices and other computing devices; the terminal device in the embodiment of the present application may also be a terminal device with a lower mobility frequency (referred to as a fixed terminal device), and the fixed terminal device may specifically include but is not limited to desktop computers, smart TVs, printers, scanners and other computing devices.

[0034] In an embodiment of the present application, in order to facilitate the analysis, study and management of the use of IP addresses by various terminal devices in the network, a corresponding lease data record can be generated for each terminal device that has accessed the network. The lease data record of each terminal device may include the terminal device's unique identifier, online time, number of online times and historical average lease.

[0035] The unique identifier of the terminal device may be used to distinguish between various terminal devices, and different terminal devices may have different unique identifiers. As an example, the unique identifier of the terminal device may be a Media Access Control (MAC) address of the terminal device.

[0036] The online time of a terminal device is the time when the terminal device was last online. Here, when an address is allocated or an address is renewed for the terminal device, it can be regarded as the terminal device being online. The online time of a terminal device can be updated every time the terminal device goes online. For example, when a terminal device requests a server to access the network (referred to as requesting address allocation), the server can allocate an IP address to the terminal device (referred to as address allocation). At this time, it can be regarded as the terminal device being online, and the online time of the terminal device is updated. For another example, when the lease of the IP address being used by the terminal device expires, but the terminal device needs to continue to use the IP address, the terminal device can request the server to extend the lease of the IP address (referred to as requesting address renewal), and the server can extend the lease of the IP address (referred to as address renewal). At this time, it can be regarded as the terminal device being online, and the online time of the terminal device is updated.

[0037] For example, at time 1, terminal device 1 needs to access the network and requests address allocation from the server. The server can allocate an address and a corresponding lease period to terminal device 1 based on the request. At this time, the online time of terminal device 1 can be updated to time 1. At time 2, terminal device 2 requests address allocation from the server and is allocated a corresponding address and a lease period. At this time, the online time of terminal device 2 can be updated to time 2. At time 3, the lease period of the address of terminal device 2 expires, so the terminal device requests address renewal from the server. The server can renew the address of terminal device 2 based on the request. At this time, the online time of terminal device 2 can be updated to time 3.

[0038] The number of times a terminal device goes online is the sum of the number of times the terminal device goes online, and the initial value of the number of times the terminal device goes online can be 0.

[0039] For example, when terminal device 1 requests network access from the server for the first time, the server can increase the number of online times of terminal device 1 by one count unit (i.e., update from 0 to 1); thereafter, when the lease of the address of terminal device 1 expires and it requests renewal of the address from the server, the server can increase the number of online times of terminal device 1 by one count unit (i.e., update from 1 to 2).

[0040] The historical average lease of a terminal device is the average of each online duration of the terminal device, and the time difference between a certain online time of the terminal device and the corresponding offline time is the corresponding online duration; specifically, when the terminal device leaves the network, it can be regarded as the terminal device going offline, and here, the time when the terminal device goes offline can be called the offline time; for example, at time 1, the terminal device goes online, and at time 2, the terminal device goes offline, then the corresponding online duration of the terminal device is the time difference between time 2 and time 1. In an embodiment of the present application, the online duration of the terminal device can be the expected online duration (specifically, the lease period allocated by the server to the terminal device) or the actual online duration; when the terminal device goes online, the corresponding online duration at this time can be the expected online duration of the terminal device, and the expected online duration can be the duration of the corresponding lease period of the terminal device at this time; when the terminal device goes offline, the corresponding online duration of the terminal device at this time can be the actual online duration of the terminal device. The historical average lease period of the terminal device can be updated each time the terminal device goes online; in the embodiment of the present application, after the server allocates an address or renews the address for the terminal device, the historical average lease period of the terminal device can be updated; in this case, the calculation formula for the updated historical average lease period t2 of the terminal device is:

[0041]

[0042] Among them, t2 ′ is the historical average lease period of the terminal device before the update, n is the number of online times of the terminal device; t expect It is the expected online duration of the terminal device. The specific value is the duration of the lease corresponding to address allocation or address renewal.

[0043] In addition, if the terminal device leaves the network (i.e., no longer uses the corresponding IP address) and sends a preset address release request to the server to instruct the server to reclaim the IP address of the terminal device, the server can update the historical average lease of the terminal device when reclaiming the IP address of the terminal device; in this case, the calculation formula of the updated historical average lease t2 of the terminal device is:

[0044]

[0045] Among them, t actual The actual online duration of the terminal device is specifically the difference between the offline time and the online time of the terminal device.

[0046] It should be understood that if the terminal device leaves the network but does not send a preset address release request to the server, there is no need to update the historical average lease period of the terminal device.

[0047] In an embodiment of the present application, when a terminal device accesses the network for the first time, the server may create a lease data record corresponding to the terminal device, and may perform corresponding updates each time the terminal device goes online or offline.

[0048] As an example, at time 1 (specifically 0:00), terminal device A accesses the network for the first time. At this time, the server can generate a lease data record corresponding to terminal device A. In this case, the number of online times of terminal device A (i.e., n) and the historical average lease of terminal device A in the lease data record are both initial values, and the initial value can be specifically set to 0; the server can assign an address and a corresponding lease to terminal device A. Here, the server assigns a lease of 1 (specifically 1 hour, and the time period corresponding to the lease is 0:00-01:00) to the address of terminal device A. Afterwards, the server can update the historical average lease of terminal device A; here, the historical average lease t2 of terminal device A can be updated according to the following formula:

[0049]

[0050] Where t20 is the historical average lease period of terminal device A before the update at time 1, that is, 0; t expect-1 is the expected online duration of terminal device A at time 1, specifically the duration of lease 1 assigned by the server, i.e., 1 hour; t21 is the historical average lease of terminal device A after update at time 1; according to the above formula, it can be calculated that the historical average lease of terminal device A after update at time 1 is 1 hour; thereafter, the number of online times of terminal device A can be increased by one counting unit (i.e., n is updated to 1), and the online time of terminal device A can be updated to time 1; after the lease expires, terminal device A requests the server to renew the address at time 2 (specifically, 01:00), and the server renews the IP address of terminal device A, and the renewed lease is lease 2 (specifically, 2 hours, and the time period corresponding to the lease is 01:00-03:00). At this time, the historical average lease of terminal device A can be updated:

[0051]

[0052] Among them, t21 is the historical average lease period of terminal device A before the update at time 2, t22 is the historical average lease period of terminal device A after the update at time 2, and t expect-2 is the expected online duration of terminal device A at time 2, specifically the duration of lease 2 assigned by the server, i.e., 2 hours; according to the above formula, it can be calculated that the updated historical average lease of terminal device A at time 2 is 1.5 hours; afterwards, the number of online times of terminal device A can be increased by one counting unit (i.e., n is updated to 2), and the online time of terminal device A can be updated to time 2. At time 3 (specifically, 02:30), terminal device A leaves the network. If terminal device A does not send a preset address release request to the server when leaving the network, there is no need to update the historical average lease of terminal device A; if terminal device A sends a preset address release request to the server when leaving the network, the server can reclaim the IP address of terminal device A and update the historical average lease of terminal device A. The specific update formula is:

[0053]

[0054] Among them, t22 is the historical average lease period of terminal device A before the update at time 3, t23 is the historical average lease period of terminal device A after the update at time 3, and t actual is the actual online duration of terminal device A at time 3, that is, the difference between time 3 (offline time) and online time (time 2), specifically 1.5 hours; according to the above formula, it can be calculated that the updated historical average lease period of terminal device A at time 3 is 1.25 hours.

[0055] Optionally, the server may store the lease data record of each terminal device in the network into a preset database, and the lease data record of each terminal device may serve as a data entry in the database.

[0056] By establishing data records for each lease period, a solid data foundation can be laid for the decision-making process of lease period allocation for terminal equipment.

[0057] The following is a detailed description of the address lease allocation process in the embodiment of the present application; specifically, please refer to Figure 2 In an embodiment of the present application, an embodiment of a method for allocating a lease period for an address may include steps S201 to S203:

[0058] Step S201: upon receiving an address request from a target terminal device, obtaining target lease information.

[0059] When a terminal device needs to access the network or extend the lease of its IP address, it can initiate a corresponding address request to the server. Here, the address request can be an address allocation request or an address renewal request. The address allocation request can be used to instruct the server to allocate an address and a corresponding lease to the terminal device, and the address renewal request can be used to instruct the server to renew the address of the target terminal device.

[0060] Specifically, if a terminal device needs to access the network, it can send an address allocation request to the server to request the server to allocate a corresponding IP address to the terminal device so that the terminal device can access the Internet normally. If the terminal device has been connected to the network and has been assigned an IP address, and still needs to continue to use the IP address after the IP address expires, it can send an address renewal request to the server to request the server to renew the IP address and extend its usage period.

[0061] For ease of description, the address lease allocation method of the embodiment of the present application will be described below by taking any terminal device that sends an address request to the server (referred to as the target terminal device) as an example.

[0062] Based on the unique identifier of the target terminal device, the target terminal device can generate a corresponding address request and send the address request to the server.

[0063] After receiving the address request from the target terminal device, the server may parse the address request to extract the unique identifier of the target terminal device; based on the unique identifier of the target terminal device, it may be determined whether the target terminal device is a terminal device accessing the network for the first time.

[0064] Specifically, the server may query each lease data record based on the unique identifier of the target terminal device to determine whether there is a lease data record corresponding to the unique identifier in each lease data record.

[0065] If the lease data record corresponding to the unique identifier cannot be found in each lease data record, it can be considered that there is no lease data record corresponding to the target terminal device, indicating that the target terminal device is a terminal device that requests to access the network for the first time.

[0066] If the lease data record corresponding to the unique identifier is found in each lease data record, it can be considered that there is a lease data record corresponding to the target terminal device, indicating that the target terminal device has accessed the network before, that is, the target terminal device is not a terminal device requesting to access the network for the first time.

[0067] In an embodiment of the present application, when allocating an address lease to a target terminal device, the lease periods of some other terminal devices in the network can be referenced; or, the lease periods of some other terminal devices in the network and the historical lease periods of the target terminal device itself can be referenced at the same time. Based on this, a more reasonable lease period can be determined, which helps to improve address utilization.

[0068] Specifically, after receiving the address request of the target terminal device, the server can obtain the target lease information; here, the target lease information can at least include the average short-term lease, which can be determined based on the historical average lease of each short-term lease terminal device, and the short-term lease terminal device is a terminal device whose historical average lease is less than a preset lease threshold. The above lease threshold can be set according to actual needs, and the embodiment of the present application does not limit this. For example, the lease threshold can be set to 1 hour, 2 hours, 3 hours, etc.

[0069] In an embodiment of the present application, each terminal device in the network can be divided into terminal devices with a shorter historical average lease period (referred to as short-lease terminal devices) and terminal devices with a longer historical average lease period (referred to as long-lease terminal devices). When allocating a lease period for the address of the target terminal device, only the historical average lease period of each short-lease terminal device can be considered without considering the historical average lease period of the long-lease terminal device. This ensures to a certain extent that the allocated lease period will not be too long, so that the allocated address can be recovered in a timely manner.

[0070] In order to more truly reflect the recent rental period of short-rental terminal devices, the historical average rental period of each short-rental terminal device that has been online recently (i.e., the online time is close to the current time) can be considered to a greater extent, and the historical average rental period of each short-rental terminal device that has not been online recently (i.e., the online time is far from the current time) can be considered to a lesser extent.

[0071] Here, the short-term rental terminal devices can be sorted according to the online time to obtain one or more short-term rental terminal devices (called first short-term rental terminal devices) whose online time is within the first time period, and one or more short-term rental terminal devices (called second short-term rental terminal devices) whose online time is within the second time period; then, the average short-rental lease period can be determined based on the historical average lease period of each first short-rental terminal device and the historical average lease period of each second short-rental terminal device.

[0072] The first time period is earlier than the second time period. The specific interval between the first time period and the second time period can be set according to actual needs, and the embodiment of the present application does not limit this.

[0073] As an example, the first time period can be a time range starting from the current moment and looking back more than one month, and the second time period can be a time range starting from the current moment and looking back no more than one month; for example, if the current moment is November 30, then the time range starting from November 30 and looking back more than one month is: the earliest recorded moment to October 31, and the time period from the earliest recorded moment to October 31 can be determined as the first time period; in addition, the time range starting from November 30 and looking back no more than one month is: November 1 to November 30, and the time period from November 1 to November 30 can be determined as the second time period.

[0074] Afterwards, each short-term rental terminal device whose online time is in the first time period can be determined as each first short-term rental terminal device, and each short-term rental terminal device whose online time is in the second time period can be determined as each second short-term rental terminal device.

[0075] Based on each first short-rental terminal device and each second short-rental terminal device, the average short-rental lease period can be calculated; specifically, the average of the historical average lease periods of each first short-rental terminal device can be calculated to obtain the first historical average lease period, and the average of the historical average lease periods of each second short-rental terminal device can be calculated to obtain the second historical average lease period.

[0076] Since the online time of each first short-term rental terminal device is far away from the current time, the first historical average rental period can be considered to a lesser extent when calculating the historical average rental period of short-term rentals; and since the online time of each second short-term rental terminal device is close to the current time, the second historical average rental period can be considered to a greater extent when calculating the historical average rental period of short-term rentals.

[0077] Specifically, the weight corresponding to the first historical average lease period can be set to the first weight, and the weight corresponding to the second historical average lease period can be set to the second weight, and the second weight can be set to a value greater than the first weight; thereafter, the first historical average lease period and the second historical average lease period can be merged based on the first weight and the second weight, so as to obtain a more reasonable short-term average lease period.

[0078] The specific values ​​of the first weight and the second weight can be set according to actual needs, and the embodiment of the present application does not limit this. For example, the first weight can be set to 0.3, and the second weight can be set to 0.7.

[0079] As an example, the first historical average lease term and the second historical average lease term may be weighted and calculated, and the calculation formula of the short-term average lease term t1 may be expressed as:

[0080] t1=a*t22+(1-a)*t21,

[0081] Among them, a is the second weight, and the value of 1-a can represent the first weight, t21 is the first historical average lease period, and t22 is the second historical average lease period.

[0082] In an embodiment of the present application, in order to improve the accuracy of the short-term rental average value and make it more realistically reflect the rental period of the short-term rental terminal device, the short-term rental average rental period can also be updated regularly. Here, the short-term rental average rental period can be updated based on a preset update time interval. Among them, the update time interval can be set according to actual needs, and the embodiment of the present application does not limit this. For example, the update time interval can be set to 1 hour, that is, the short-term rental average rental period is updated every 1 hour.

[0083] Based on the average short-term rental period, the target rental period information can be determined.

[0084] Step S202: Determine the target lease of the target terminal device based on the target lease information.

[0085] If the address request is an address allocation request, the server may allocate an address to the target terminal device; during this process, the lease period corresponding to the allocated address also needs to be determined.

[0086] In the embodiment of the present application, if the server cannot find the lease data record corresponding to the target terminal device, that is, there is no lease data record corresponding to the target terminal device, then the target terminal device can be considered as a terminal device that is requesting to access the network for the first time; when assigning an IP address to the target terminal device, a default lease can be assigned to the IP address of the target terminal device. Specifically, the average short-term lease can be directly determined as the lease of the target terminal device (referred to as the target lease).

[0087] If the server queries the lease data record corresponding to the target terminal device, that is, there is a lease data record corresponding to the target terminal device, then the target terminal device can be considered to be a terminal device with an access history. At this time, the historical lease situation of the target terminal device and the lease situation of short-rent terminal devices in the network can be comprehensively considered to determine the target lease for the target terminal device.

[0088] In an embodiment of the present application, the target lease information may also include the historical average lease of the target terminal device (referred to as the target historical average lease). When determining the target lease for the target terminal device that has previously accessed the network, the short-lease average lease and the target historical average lease may be merged to obtain a first lease. Specifically, when performing lease fusion, the weight corresponding to the short-lease average lease (referred to as the third weight) and the weight corresponding to the target historical average lease (referred to as the fourth weight) may be determined. Thereafter, based on the third weight and the fourth weight, the short-lease average lease and the target historical average lease may be merged to obtain a first lease. Thereafter, the first lease may be determined as the target lease.

[0089] The specific values ​​of the third weight and the fourth weight can be set according to actual needs, and the embodiments of the present application do not limit this.

[0090] As an example, the third weight and the fourth weight may both be set to 0.5. Based on the third weight and the fourth weight, the average short-term rental period and the target historical average rental period may be weightedly calculated. In this case, the calculation formula for the target rental period T may be:

[0091]

[0092] Among them, t2 target The target historical average lease period is thus taken into account, and the historical lease period of the target terminal device and the lease period of each short-lease terminal device in the network can be considered at the same time, so as to more accurately match the lease period required by the target terminal device and avoid the lease period being too long or too short.

[0093] If the address request is an address renewal request, the server may renew the address of the target terminal device, and needs to simultaneously determine a renewal lease period corresponding to the address of the target terminal device.

[0094] It should be understood that a terminal device may send an address renewal request to a server only when its IP address expires. Therefore, the terminal device sending the address renewal request is not accessing the network for the first time, and the server or database has a lease data record for the terminal device.

[0095] If the target terminal device sends an address renewal request to the server, it can be considered that the target terminal device is likely to be online for a long time. At this time, the renewal period can be appropriately extended to avoid frequent renewals of the target terminal device.

[0096] In an embodiment of the present application, when an address renewal request is received, the server can comprehensively consider the historical lease status of the target terminal device and the lease status of each short-lease terminal device in the network to determine a target lease for the target terminal device.

[0097] Here, when determining the target lease period for the target terminal device for renewal, a corresponding weight (called the fifth weight) can be set for the short-lease average lease period, and a corresponding weight (called the sixth weight) can also be set for the target historical average lease period; then, based on the fifth weight and the sixth weight, the short-lease average lease period and the target historical average lease period can be merged to obtain a second lease period; then, the second lease period can be directly determined as the target lease period.

[0098] The specific values ​​of the fifth weight and the sixth weight can be set according to actual needs, and the embodiments of the present application do not limit this.

[0099] As an example, the fifth weight and the sixth weight may both be set to 1, and based on the fifth weight and the sixth weight, the average short-term rental period and the target historical average rental period may be weightedly calculated; in this case, the calculation formula for the target rental period T may be:

[0100] T=t2 target +t1.

[0101] Based on this, the lease period of each short-lease terminal device in the network can be combined to reasonably extend the lease period of the target terminal device based on the target historical average lease period, thereby reducing the message interaction between the target terminal device and the server due to lease renewal, which can alleviate the burden on the server to a certain extent, so that the server can use the saved resources to stably run other tasks.

[0102] In a specific implementation method of an embodiment of the present application, after receiving an address renewal request, the server can determine whether the target terminal device is offline. If the target terminal device is offline, there is no need to perform the above-mentioned renewal process; if the target terminal device is not offline, the lease period can be allocated according to the above-mentioned renewal process.

[0103] When determining the lease period, the embodiments of the present application can reasonably consider the different situations of the terminal devices and flexibly determine the appropriate lease period; for the terminal devices that access the network for the first time, the lease period can be determined with reference to the average short-lease period, and a shorter lease period can be allocated to the target terminal device in a scenario where the lease situation is unclear, so that the IP address can be recovered in a timely manner, reducing the waste of IP address resources; for the terminal devices that have previously accessed the network, the average short-lease period and the historical average lease period of the terminal device can be balancedly referenced, so as to avoid the situation where the allocated lease period is inconsistent with the historical usage habits of the terminal device, and can more accurately match the actual needs of the terminal device; for the terminal devices that are renewed, the lease period can be appropriately extended on the basis of their own historical average lease period, reducing the frequency of renewal of the terminal device to reduce the server load; accordingly, the rental period can be flexibly determined based on the actual situation of each terminal device, and to a large extent avoid the situation where some short-lease terminal devices cannot effectively recycle IP addresses, while some long-lease terminal devices need to renew frequently.

[0104] Step S203: Based on the target lease, a lease is allocated to the address of the target terminal device.

[0105] In an embodiment of the present application, if the address request is an address allocation request, then when allocating an address to the target terminal device, the target lease period can be determined as the lease period corresponding to the address of the target terminal device; if the address request is an address renewal request, then when renewing the address of the target terminal device, the target lease period can be determined as the renewal lease period corresponding to the address of the target terminal device.

[0106] By constructing the lease data record in the embodiment of the present application, it is possible to accurately distinguish long-lease terminal devices from short-lease terminal devices, and track the lease status of each terminal device, so that the appropriate lease period can be flexibly determined in each scenario, which helps to improve the versatility of the lease allocation method.

[0107] In a specific implementation of the embodiment of the present application, after the target terminal device goes offline or the target lease expires, the IP address of the target terminal device can be promptly recovered so that the IP address can be allocated to other terminal devices in need.

[0108] In addition, each time a lease is allocated to a target terminal device or an IP address is reclaimed, the average short-term lease and the target historical average lease need to be updated in a timely manner to ensure the accuracy of the lease data record and provide better support for the lease allocation decision-making process.

[0109] For ease of understanding, the address lease allocation method according to the embodiment of the present application will be described below with reference to the accompanying drawings and specific examples.

[0110] See also Figure 3 In this example, the DHCP server (hereinafter referred to as the server) can store the lease data records of each terminal device in a preset database to analyze and track the usage of the IP address of each terminal device.

[0111] When a terminal device needs to access the network, it can send an address allocation request to the server (which can be considered as the terminal device going online) to instruct the server to allocate an address and a corresponding lease period for it.

[0112] After receiving the address allocation request, the server may parse the unique identifier of the terminal device from the address allocation request, and may send a corresponding query instruction to the database to instruct the database to query whether there is a lease data record corresponding to the unique identifier.

[0113] Based on the query instruction sent by the server, the database can search each stored lease data record based on the unique identifier, and can return the search result to the server.

[0114] The server can then calculate the lease period corresponding to the terminal device based on the search results of the database. Specifically, if the lease period data record corresponding to the unique identifier is retrieved, the current lease period of the terminal device can be determined based on the historical average lease period of the terminal device and the average short-term lease period; if the lease period data record corresponding to the unique identifier is not retrieved, the current lease period of the terminal device can be determined based on the average short-term lease period.

[0115] The server can allocate a lease to the terminal device based on the determined lease. In addition, it is necessary to update or create a lease data record for the terminal device; specifically, if there is a lease data record for the terminal device, the lease data record for the terminal device can be updated to obtain an updated lease data record; if there is no lease record for the terminal device, a lease data record corresponding to the terminal device can be created.

[0116] When the terminal device needs to renew the lease of its IP address, it can send an address renewal request to the server to instruct the server to renew the lease of its IP address.

[0117] After receiving the address renewal request, the server may determine the renewal lease period of the terminal device based on the historical average lease period and the average short-term lease period of the terminal device.

[0118] Afterwards, the lease data record corresponding to the terminal device in the database needs to be updated in a timely manner; if the terminal device is offline, the lease data record corresponding to the terminal device in the database also needs to be updated in a timely manner.

[0119] In summary, the embodiment of the present application obtains target lease information when receiving an address request from a target terminal device; wherein the target lease information includes an average short-term lease, and the average short-term lease is determined based on the historical average lease of each short-term terminal device, and the historical average lease of each short-term terminal device is less than the lease threshold; based on the target lease information, the target lease of the target terminal device is determined; based on the target lease, a lease is allocated for the address of the target terminal device. When the embodiment of the present application allocates a lease, only the historical average lease of each short-term terminal device needs to be considered, so that the IP address can be recovered and renewed in a timely manner, which helps to improve the utilization rate of the IP address and can enhance the flexibility and agility of lease allocation.

[0120] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0121] Corresponding to the address lease allocation method described in the above embodiment, Figure 4 A structural diagram of an embodiment of a device for allocating address leases provided in an embodiment of the present application is shown.

[0122] In an embodiment of the present application, a device for allocating address leases may include:

[0123] The acquisition module 401 is used to acquire target lease information when receiving an address request of a target terminal device; wherein the target lease information includes an average short-lease lease, and the average short-lease lease is determined based on the historical average lease of each short-lease terminal device, and the historical average lease of each short-lease terminal device is less than the lease threshold;

[0124] A determination module 402, configured to determine a target lease of the target terminal device based on the target lease information;

[0125] The allocation module 403 is configured to allocate a lease to the address of the target terminal device based on the target lease.

[0126] In a specific implementation of the embodiment of the present application, the target lease information further includes a target historical average lease of the target terminal device;

[0127] The determination module also includes:

[0128] A fusion first submodule is used to fuse the short-term rental average lease term with the target historical average lease term based on the third weight and the fourth weight to obtain a first lease term if there is a lease term data record of the target terminal device;

[0129] The first determining submodule is configured to determine the first lease period as the target lease period.

[0130] In a specific implementation of the embodiment of the present application, the address request is an address allocation request, and the address allocation request instructs the server to allocate an address to the target terminal device;

[0131] The determination module comprises:

[0132] The second determining submodule is configured to determine the average short-lease lease period as the target lease period if there is no lease period data record for the target terminal device.

[0133] In a specific implementation of the embodiment of the present application, the address request is an address renewal request, and the address renewal request instructs the server to renew the address lease of the target terminal device;

[0134] The determination module also includes:

[0135] A second fusion submodule is used to fuse the average short-term rental period and the target historical average rental period based on the fifth weight and the sixth weight to obtain a second rental period;

[0136] The third determining submodule is configured to determine the second lease period as the target lease period.

[0137] In a specific implementation of the embodiment of the present application, the device further includes:

[0138] The first update module is used to update the target historical average lease based on the target online number of the target terminal device, the target historical average lease and the target online duration; wherein the target online number is the number of times the server allocates a lease for the address of the target terminal device, and the target online duration includes the target lease, or the target online duration includes the target lease and the actual online duration of the target terminal device.

[0139] In a specific implementation of the embodiment of the present application, the device further includes:

[0140] A short-term rental terminal device determination module, used to respectively determine one or more first short-term rental terminal devices and one or more second short-term rental terminal devices; wherein the online time of each of the first short-term rental terminal devices is within a first time period, and the online time of each of the second short-term rental terminal devices is within a second time period, and the first time period is earlier than the second time period;

[0141] The lease term fusion module is used to fuse the first historical average lease term with the second historical average lease term based on the first weight and the second weight to obtain the short-term average lease term.

[0142] In a specific implementation of the embodiment of the present application, the device further includes:

[0143] The second updating module is used to update the average short-term rental period based on an updating time interval.

[0144] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0145] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0146] Figure 5 A schematic block diagram of a server provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0147] like Figure 5 As shown, the server 5 of this embodiment includes: a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50. When the processor 50 executes the computer program 52, the steps in the above-mentioned embodiments of the method for assigning leases to each address are implemented, for example Figure 2 Alternatively, when the processor 50 executes the computer program 52, the functions of each module / unit in the above-mentioned device embodiments are realized, for example Figure 4 The functions of modules 401 to 403 are shown.

[0148] Exemplarily, the computer program 52 may be divided into one or more modules / units, which are stored in the memory 51 and executed by the processor 50 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 52 in the server 5.

[0149] Those skilled in the art will understand that Figure 5 It is only an example of the server 5 and does not constitute a limitation on the server 5. The server 5 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the server 5 may also include input and output devices, network access devices, buses, etc.

[0150] The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0151] The memory 51 may be an internal storage unit of the server 5, such as a hard disk or memory of the server 5. The memory 51 may also be an external storage device of the server 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the server 5. Further, the memory 51 may also include both an internal storage unit of the server 5 and an external storage device. The memory 51 is used to store the computer program and other programs and data required by the server 5. The memory 51 may also be used to temporarily store data that has been output or is to be output.

[0152] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0153] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0154] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel 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.

[0155] In the embodiments provided in the present application, it should be understood that the disclosed devices / servers and methods can be implemented in other ways. For example, the device / server embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0156] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0157] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0158] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0159] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for allocating address leases, characterized in that: include: Upon receiving an address request from a target terminal device, obtaining target lease information; wherein the target lease information includes an average short-lease lease, which is determined based on a historical average lease of each short-lease terminal device, and the historical average lease of each short-lease terminal device is less than a lease threshold; Determining a target lease of the target terminal device based on the target lease information; Based on the target lease, a lease is allocated for the address of the target terminal device.

2. The method for allocating address leases according to claim 1, characterized in that: The target lease information also includes the target historical average lease of the target terminal device; The determining, based on the target lease information, a target lease of the target terminal device, further includes: If there is a lease data record of the target terminal device, based on the third weight and the fourth weight, the average short-term lease term and the target historical average lease term are merged to obtain a first lease term; The first lease is determined as the target lease.

3. The method for allocating address leases according to claim 1, characterized in that: The address request is an address allocation request, and the address allocation request instructs the server to allocate an address to the target terminal device; The determining, based on the target lease information, a target lease of the target terminal device includes: If there is no lease data record for the target terminal device, the short-lease average lease period is determined as the target lease period.

4. The method for allocating address leases according to claim 2, characterized in that: The address request is an address renewal request, and the address renewal request instructs the server to renew the address lease of the target terminal device; The determining, based on the target lease information, a target lease of the target terminal device includes: Based on the fifth weight and the sixth weight, the average short-term rental period and the target historical average rental period are merged to obtain a second rental period; The second lease is determined as the target lease.

5. The method for allocating address leases according to claim 1, characterized in that: After allocating a lease to the address of the target terminal device based on the target lease, the method further includes: Based on the target number of online times of the target terminal device, the target historical average lease time and the target online time, updating the target historical average lease time; Among them, the target online number is the number of times the server allocates a lease for the address of the target terminal device, the target online duration includes the target lease, or the target online duration includes the target terminal including the target lease and the actual online duration of the target terminal device.

6. The method for allocating address leases according to any one of claims 1 to 5, characterized in that: The process of determining the average short-term lease term includes: Determine one or more first short-term rental terminal devices and one or more second short-term rental terminal devices respectively; wherein the online time of each of the first short-term rental terminal devices is within a first time period, and the online time of each of the second short-term rental terminal devices is within a second time period, and the first time period is earlier than the second time period; Based on the first weight and the second weight, the first historical average lease term and the second historical average lease term are merged to obtain the short-term average lease term.

7. The method for allocating address leases according to claim 6, characterized in that: Also includes: The average short-term rental period is updated based on an update time interval.

8. A device for allocating address leases, characterized in that: include: An acquisition module, configured to acquire target lease information upon receiving an address request from a target terminal device; wherein the target lease information includes an average short-lease lease, which is determined based on a historical average lease of each short-lease terminal device, and the historical average lease of each short-lease terminal device is less than a lease threshold; A determination module, configured to determine a target lease of the target terminal device based on the target lease information; An allocation module is used to allocate a lease to the address of the target terminal device based on the target lease.

9. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables the method for allocating address leases according to any one of claims 1 to 7 to be executed.

10. A server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the server is caused to implement the steps of the address lease allocation method according to any one of claims 1 to 7.