Address allocation method and device, computer equipment and storage medium

By assigning the address at the data link layer, the target network address is allocated to the target requesting end in the layer 2 network according to the identification field and the current address allocation information of the requesting end, which solves the problem of address conflict in the layer 2 network and improves network performance and stability.

CN119697159APending Publication Date: 2025-03-25CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411742148.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In a Layer 2 network, as the scale of the virtual server increases, insufficient capacity of the aggregation switch leads to a degradation of performance, and the prior art is difficult to uniformly allocate address in a Layer 2 network, which is prone to address conflict problems.

Method used

By implementing an address allocation method at the data link layer, the address request message and current address allocation information of the target request end are obtained, and the target network address is allocated to the target request end according to the identification field and address allocation information of the request end, and the address allocation information is updated to avoid address conflicts.

Benefits of technology

This method can effectively solve the problem of address conflict in the Layer 2 network, ensure the uniqueness of the network address assigned to each device, and improve network performance and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697159A_ABST
    Figure CN119697159A_ABST
Patent Text Reader

Abstract

The invention relates to an address allocation method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: acquiring an address request message from a target request end; wherein the address request message carries a request end identification field; obtaining current address allocation information; wherein the address allocation information is used for recording allocated request ends in a current data link layer and network address information corresponding to the allocated request ends; allocating a target network address to the target request end according to the address request message, the request end identification field and the current address allocation information; and updating the address allocation information according to the target network address and the request end identification field. By adopting the method, the problem of address conflict in the two-layer network can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, and in particular to an address allocation method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] At present, in order to improve performance, data center aggregation switches are used as gateways and adopt a dual-machine redundant construction mode.

[0003] As data centers enter the era of virtualization, the scale of access servers has increased rapidly, and the scale of virtual servers has increased exponentially. At the same time, more usage scenarios require non-blocking fast switching between any two virtual servers in the same Layer 2 network, which leads to insufficient capacity of the aggregation switch as the gateway and reduces the performance of the entire network. The relevant technology proposes a unified address allocation scheme in the multi-address networking at the edge of the network, which uses a three-layer networking environment for address allocation. In the Layer 2 networking, devices communicate directly through switches. The relevant technology will cause address conflicts and cannot uniformly allocate addresses in the Layer 2 networking. Summary of the invention

[0004] Based on this, it is necessary to provide an address allocation method, apparatus, computer device, computer-readable storage medium and computer program product that can solve the address conflict problem in a layer 2 network in response to the above technical problems.

[0005] In a first aspect, the present application provides an address allocation method, which is applied to a data link layer and includes:

[0006] Obtaining an address request message from a target request end; wherein the address request message carries a request end identification field;

[0007] Acquire current address allocation information; wherein the address allocation information is used to record the allocated request end in the current data link layer and the network address information corresponding to the allocated request end;

[0008] Allocate a target network address for the target request end according to the address request message, the request end identification field and the current address allocation information;

[0009] The address allocation information is updated according to the target network address and the requester identification field.

[0010] In one embodiment, allocating a target network address to the target requester according to the requester identification field and the current address allocation information includes:

[0011] Determine, according to the request end identification field and the current address allocation information, whether the target request end and the allocated request end of the current data link layer are in the same address range;

[0012] When the target request end and the allocated request end are not in the same address range, directly allocating a network address to the address request message according to the address request message;

[0013] In the case that the target request end and the allocated request end are in the same address range, a target network address is allocated to the target request end according to the address request message and the current address allocation information.

[0014] In one of the embodiments, when the target request end and the allocated request end are in the same address range, allocating a target network address for the target request end according to the address request message and the current address allocation information includes:

[0015] In the case where the target request end and the allocated request end are in the same address range, determining an allocated network address corresponding to the allocated request end in the same address range as the target request end;

[0016] A target network address different from the allocated network address is allocated to the target requester.

[0017] In one of the embodiments, determining whether the target requester and the allocated requester of the current data link layer are in the same address range according to the requester identification field and the current address allocation information includes:

[0018] Calculate the identification field value according to the request end identification field and the subnet mask corresponding to the request end;

[0019] Traverse multiple allocated field values ​​in the current address allocation information to find out whether there is an allocated field value that is the same as the identification field value, so as to determine whether the target request end and the allocated request end of the current data link layer are in the same address range.

[0020] In one embodiment, the calculating the identification field value according to the request end identification field and the subnet mask corresponding to the request end includes:

[0021] Determine the hardware address of the target request end according to the request end identification field;

[0022] An AND calculation is performed on the hardware address and the subnet mask corresponding to the requesting end to obtain an identification field value.

[0023] In one embodiment, updating the address allocation information according to the target network address and the requester identification field includes:

[0024] Calculate the target network address and the subnet mask to obtain a target field value;

[0025] The target field value and the request end identification field are recorded in the address allocation information in correspondence, so as to obtain the updated address allocation information.

[0026] In a second aspect, the present application further provides an address allocation device, which is applied to a data link layer, and includes:

[0027] A data receiving module, used for acquiring an address request message from a target request end; wherein the address request message carries a request end identification field;

[0028] An information acquisition module, used to acquire current address allocation information; wherein the address allocation information is used to record the allocated request end in the current data link layer and the network address information corresponding to the allocated request end;

[0029] An address allocation module, configured to allocate a target network address to the target request end according to the address request message, the request end identification field and the current address allocation information;

[0030] An information updating module is used to update the address allocation information according to the target network address and the request end identification field.

[0031] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0032] Obtaining an address request message from a target request end; wherein the address request message carries a request end identification field;

[0033] Acquire current address allocation information; wherein the address allocation information is used to record the allocated request end in the current data link layer and the network address information corresponding to the allocated request end;

[0034] Allocate a target network address for the target request end according to the address request message, the request end identification field and the current address allocation information;

[0035] The address allocation information is updated according to the target network address and the requester identification field.

[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0037] Obtaining an address request message from a target request end; wherein the address request message carries a request end identification field;

[0038] Acquire current address allocation information; wherein the address allocation information is used to record the allocated request end in the current data link layer and the network address information corresponding to the allocated request end;

[0039] Allocate a target network address for the target request end according to the address request message, the request end identification field and the current address allocation information;

[0040] The address allocation information is updated according to the target network address and the requester identification field.

[0041] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0042] Obtaining an address request message from a target request end; wherein the address request message carries a request end identification field;

[0043] Acquire current address allocation information; wherein the address allocation information is used to record the allocated request end in the current data link layer and the network address information corresponding to the allocated request end;

[0044] Allocate a target network address for the target request end according to the address request message, the request end identification field and the current address allocation information;

[0045] The address allocation information is updated according to the target network address and the requester identification field.

[0046] The above-mentioned address allocation method, device, computer equipment, storage medium and computer program product are applied to a layer 2 network. The layer 2 network mainly works at the data link layer of the OSI (Open Systems Interconnection) model and is used to process direct communication and data transmission between devices. By obtaining an address request message from a target request end, a request end identification field is obtained, and then by obtaining the current address allocation information, the allocated request end in the current data link layer recorded by the address allocation information and the network address information corresponding to the allocated request end are obtained, so that according to the address request message, the request end identification field and the current address allocation information, a target network address is allocated to the target request end, and according to the network address information corresponding to the allocated request end recorded in the current data link layer, a target network address that does not conflict with the currently allocated address can be allocated to the target request end, and then the address allocation information is updated according to the target network address and the request end identification field, so that it can be ensured that the request end corresponding to the next address request message can also be allocated a network address that does not cause conflict, thereby solving the problem of address conflict in the layer 2 network. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are 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 creative work.

[0048] Figure 1 A diagram of an application environment of an address allocation method in an embodiment;

[0049] Figure 2 A schematic diagram of a flow chart of an address allocation method in an embodiment;

[0050] Figure 3 A schematic diagram of a flow chart of step S206 of an address allocation method in an embodiment;

[0051] Figure 4 is a structural block diagram of an address allocation device in one embodiment;

[0052] Figure 5 is an internal structure diagram of a computer device in one embodiment;

[0053] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] The address allocation method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network, and the terminal 102 can act as a requesting end to send an address request message to the server 104. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The data storage system can be used to store address allocation information, and can also be used to store information such as the requesting end identification field and calculation result data of the requesting end. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0056] In an exemplary embodiment, Figure 2 As shown, a method for allocating addresses is provided, which is applied to Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps S202 to S208. Among them:

[0057] Step S202, obtaining an address request message from the target request end.

[0058] The address request message carries a request end identification field. This method is applied to the Layer 2 network, also known as the data link layer. "Layer 2" refers to the data link layer, which belongs to the second layer of the OSI model. "Layer 2" is used to describe the scenario in which devices communicate through physical addresses (MAC addresses) in a local area network technology such as Ethernet. Devices are usually directly connected and do not require complex routers to forward data.

[0059] Exemplarily, the target requester may be a DHCP (Dynamic Host Configuration Protocol) client. DHCP is a network protocol used to automatically assign IP addresses and other network configurations (such as subnet masks, default gateways, and DNS servers, etc.) to devices in a network, greatly simplifying network management. In a traditional network, each device needs to manually set these network parameters, while the DHCP protocol enables devices to automatically obtain this information.

[0060] Correspondingly, the server 104 may be a DHCP server, the address request message may be a DHCP Discovery message, and the requester identification field may be an option82 field, wherein the requester identification field may include information such as the client hardware address, hardware address type, and hardware length.

[0061] Exemplarily, the DHCP client first sends a DHCP Discovery message to the DHCP server, and uses the available field (option) of the DHCP message for identification. The message carries a series of information constituting option 82.

[0062] Step S204, obtaining current address allocation information.

[0063] The address allocation information is used to record the allocated request end in the current data link layer and the network address information corresponding to the allocated request end.

[0064] Exemplarily, the server 104 may generate two tables in the BRAS (Broadband Remote Access Server) pool as address allocation information during the initialization phase, wherein one table is a DHCP server parameter table, which is used to record the number of DHCP servers in the BRAS pool and their corresponding IP address information; and the other table is used to record the option value corresponding to each client (each client is marked with the option 82 value).

[0065] BRAS is a server used in broadband networks to manage and control user access, authentication, authorization, billing and other functions. BRAS is located at the edge of the network, usually connected between the access network and the core network, and is used to process network connection requests from users.

[0066] Step S206: Allocate a target network address for the target requester according to the address request message, the requester identification field and the current address allocation information.

[0067] Exemplarily, when a DHCP client initiates an IP address request, the server 104 may first extract the target requested IP address and the identification information of the requesting end from the DHCP message of the request. Then, the server 104 traverses the Option field in the BRAS gateway table according to the identification field of the requesting end to find out whether there is the same identification information as the client. If the server 104 does not find an entry that matches the Option field of the client during the traversal process, it means that the DHCP client is located in an independent network segment. At this time, the server can directly allocate the requested IP address to avoid IP address conflicts.

[0068] During this process, if the server finds a record in the table that has the same Option field as the DHCP client, it means that the client and other devices are in the same network segment, and there is a risk of IP address conflict. To avoid this, the server 104 can re-evaluate the target IP address and reallocate a new, non-conflicting IP address based on the current network environment. In this way, the server 104 can ensure that the IP address allocated to the client each time is unique and will not conflict with other devices in the same network segment, thereby ensuring the stability and normal operation of the network.

[0069] Step S208: update the address allocation information according to the target network address and the request end identification field.

[0070] Exemplarily, after completing this address allocation, server 104 can update the address allocation information based on the newly allocated target network address and the requester identification field, and record the new requester identification field and the allocated target network address in the BRAS gateway table, thereby ensuring that the requester corresponding to the next address request message can also be allocated a network address that does not cause conflict.

[0071] The above-mentioned address allocation method is applied to a layer 2 network. The layer 2 network mainly works at the data link layer of the OSI model and is used to process direct communication and data transmission between devices. By obtaining an address request message from a target request end, a request end identification field is obtained, and then by obtaining the current address allocation information, the allocated request end in the current data link layer recorded by the address allocation information and the network address information corresponding to the allocated request end are obtained. Thus, according to the address request message, the request end identification field and the current address allocation information, a target network address is allocated to the target request end. According to the network address information corresponding to the allocated request end recorded in the current data link layer, a target network address that does not conflict with the currently allocated address can be allocated to the target request end. Then, the address allocation information is updated according to the target network address and the request end identification field, so as to ensure that the request end corresponding to the next address request message can also be allocated a network address that does not cause conflict, thereby solving the problem of address conflict in the layer 2 network.

[0072] In the traditional DHCP protocol, when querying whether there is an address conflict, it is usually necessary to traverse all the allocated IP addresses. If each query requires access to the IP address table, the query efficiency and response time of the system will be affected, especially when the number of clients is large, the time complexity of the query will become higher. In the above embodiment, the Option82 field is used to identify whether the device is in the same subnet. Only a simple match is performed through this small table (Option82 table) to determine whether there is an address conflict. Therefore, the system only needs to access the Option82 table, and the time complexity is O(n), without having to traverse the huge IP address table every time. This reduces unnecessary calculations and query steps and improves query efficiency. If each query involves accessing and comparing the complete IP address table, the system design will become more complicated, especially when the number of devices is large. The solution provided by the above embodiment avoids frequent queries to the huge table, making the system design more concise and reducing the difficulty of maintenance and expansion.

[0073] At the same time, the data table that needs to be maintained in this embodiment only occupies 32 bits (4 bytes), so even if the number of devices is large, the memory occupied by these tables is very limited, and the overall memory consumption does not exceed 1MB, which means that the system can efficiently handle a large number of device requests without causing memory overload. When querying whether there is an address conflict, you only need to traverse the Option82 table without additionally querying the complex IP address table. This makes the time complexity of the system query O(n), where n is the number of entries in the table (i.e., the number of clients). This method is not only efficient, but also can quickly determine whether there is a conflict.

[0074] In an exemplary embodiment, Figure 3As shown, step S206 includes steps S302 to S306. Among them:

[0075] Step S302: Determine whether the target requester and the allocated requester of the current data link layer are in the same address range according to the requester identification field and the current address allocation information.

[0076] Exemplarily, service 104 can calculate the identification field value based on the request end identification field and the subnet mask corresponding to the request end, traverse multiple allocated field values ​​in the current address allocation information, and search whether there is an allocated field value that is the same as the identification field value to determine whether the target request end and the allocated request end of the current data link layer are in the same address range.

[0077] Furthermore, the server 104 may determine the hardware address of the target requester according to the requester identification field, and perform an AND calculation on the hardware address and the subnet mask corresponding to the requester, thereby obtaining the identification field value.

[0078] Exemplarily, when the DHCP server receives the address request message from the client, the server 104 may first extract the identification field of the requesting end from the message. Assume that the identification field contains the hardware address of the device (usually the MAC address of the device) and the requested IP address range information. The server 104 can determine the hardware address of the target requesting end through this identification field. For example, assuming that the hardware address of the target requesting end is 00:1A:2B:3C:4D:5E, then extract from the message that the IP address range requested by the device is 192.168.1.0 / 24.

[0079] Next, the server 104 may perform an AND operation based on the hardware address and subnet mask of the target requester. For example, assuming that the subnet mask of the requester is 255.255.255.0 (which means that the network range is 192.168.1.0 to 192.168.1.255), the server 104 may perform an AND operation on the hardware address and the subnet mask to obtain an identification field value. The identification field value is a network identifier determined by the hardware address and the subnet mask, which is used to uniquely indicate the network segment where the requester is located.

[0080] Then, the server 104 can traverse the current address allocation information and check the allocated IP addresses and subnet masks. For example, the current server has allocated the following IP address information: 192.168.1.10 (corresponding to the hardware address 00:1A:2B:3C:4D:5F) 192.168.1.20 (corresponding to the hardware address 00:1A:2B:3C:4D:6A) 192.168.1.30 (corresponding to the hardware address 00:1A:2B:3C:4D:7B) The server 104 can check these allocated address records, compare their identification field values ​​one by one, and determine whether there is a record with the same identification field value as the target request end. Assuming the calculated identification field value is 192.168.1.0 / 24, the server will check each assigned record: For 192.168.1.10, the server will check its identification field value and find that it is the same as the identification field value 192.168.1.0 / 24 of the target requester, indicating that the requester and the currently assigned device are in the same subnet. For 192.168.1.20 and 192.168.1.30, it will also be found that their identification field values ​​match the target requester.

[0081] Step S304: when the target request end and the allocated request end are not in the same address range, directly allocate a network address to the address request message according to the address request message.

[0082] For example, when the server detects that the target request end and the allocated request end are not in the same address range, it means that the target request end is located in a network segment or subnet that is completely different from other devices. In this case, the server 104 does not need to perform complex conflict detection or reallocate IP addresses, and directly allocates a new network address to it based on the address request message of the target request end. Since the target request end and the allocated device are not in the same subnet, the server does not need to consider IP address conflicts, and directly allocates a new IP address available in the target subnet based on the request message. This allocation process is very simple and efficient, because it does not involve complex conflict checks, and the server only needs to ensure that the allocated IP address is unique and valid in the target subnet.

[0083] For example, assume that the identification field value of the target request end is 192.168.2.0 / 24, and the IP addresses currently allocated in the server all belong to the subnet 192.168.1.0 / 24. At this time, since the target request end does not overlap with any device in the existing network, the allocation process does not require any additional conflict handling steps, and the server 104 can directly allocate an IP address belonging to the 192.168.2.0 / 24 network segment to the target request end according to the subnet information in the target request message.

[0084] Step S306: when the target request end and the allocated request end are in the same address range, a target network address is allocated to the target request end according to the address request message and the current address allocation information.

[0085] For example, if the server finds a record with the same identification field value as the target requester, it means that the IP address of the target requester may have been allocated in the current network segment. The server needs to avoid conflicts and re-allocate a different IP address to the target requester. In this way, the server ensures that each allocated IP address is within the correct network range and will not conflict with other devices in the same network segment.

[0086] Exemplarily, when the target requester and the allocated requester are in the same address range, the server 104 may determine the allocated network address corresponding to the allocated requester in the same address range as the target requester, and allocate a target network address different from the allocated network address to the target requester.

[0087] Further, when the server 104 finds that the target requester and the allocated requester are in the same address range, it means that the target requester and the existing devices in the network share the same subnet or network segment. In this case, the server 104 can take measures to ensure that a unique IP address is assigned to the target requester to avoid conflicts with other devices in the same network segment: First, the server 104 can identify the allocated requester in the same address range as the target requester by comparing the identification field of the target requester with the identification field of the already allocated IP address. The identification field can be calculated from the hardware address and the subnet mask, and can accurately represent the network segment where the device is located. If the identification field value of the target request end is the same as the identification field value of the assigned device, it means that these devices are located in the same subnet. Assume that the identification field value of the target request end is 192.168.1.0 / 24, and among the currently assigned devices, the following devices are also in the same address range: assigned device 1: 192.168.1.10 (corresponding to hardware address 00:1A:2B:3C:4D:5F); assigned device 2: 192.168.1.20 (corresponding to hardware address 00:1A:2B:3C:4D:6A).

[0088] The server 104 can confirm that the target requester (e.g., hardware address 00:1A:2B:3C:4D:5E) is located in the same subnet 192.168.1.0 / 24 as these allocated devices, so a new, unique IP address needs to be assigned to the target requester. In this case, the server 104 can select an IP address from the available address pool of the subnet to ensure that there will be no conflict with the allocated devices. For example, assuming that 192.168.1.10 and 192.168.1.20 have been allocated, the server 104 may allocate 192.168.1.30 to the target requester because this address has not been used in the subnet 192.168.1.0 / 24. At this time, the server 104 can exclude all allocated IP addresses and select a new IP address, so that the target requester can ensure that the IP address does not conflict with other devices in the network, ensuring that each device in the network has a unique address. This process will avoid IP address conflicts and ensure the normal operation of the network. That is, when the target requester and the allocated requester are in the same address range, the server 104 can first determine the allocated address in the subnet and ensure that a unique address that does not conflict with other devices is selected for the target requester, thereby ensuring the uniqueness and correctness of the network address allocation.

[0089] Furthermore, after allocating the target network address to the target requester, the server 104 may also calculate the target network address and the subnet mask to obtain the target field value; and record the target field value and the requester identification field in the address allocation information in correspondence to obtain updated address allocation information.

[0090] In another exemplary embodiment, the server 104 obtains an address request message from the target request end, obtains the request end identification field, and then obtains the current address allocation information to obtain the allocated request end and the network address information corresponding to the allocated request end in the recorded current data link layer.

[0091] Next, the server 104 determines the hardware address of the target request end according to the request end identification field, performs AND calculation on the hardware address and the subnet mask corresponding to the request end to obtain the identification field value, and starts to traverse multiple allocated field values ​​in the current address allocation information to find out whether there is an allocated field value that is the same as the identification field value, so as to determine whether the target request end and the allocated request end of the current data link layer are in the same address range: when the target request end and the allocated request end are not in the same address range, directly allocate a network address for the address request message according to the address request message; when the target request end and the allocated request end are in the same address range, determine the allocated network address corresponding to the allocated request end in the same address range as the target request end, and allocate a target network address different from the allocated network address to the target request end.

[0092] Finally, the server 104 calculates the target network address and the subnet mask to obtain the target field value, and records the target field value and the request end identification field in the address allocation information in correspondence to obtain the updated address allocation information.

[0093] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0094] Based on the same inventive concept, the embodiment of the present application also provides an address allocation device for implementing the address allocation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the address allocation device provided below can refer to the limitations of the address allocation method above, and will not be repeated here.

[0095] In an exemplary embodiment, Figure 4 As shown, an address allocation device is provided, which is applied to the data link layer and includes: a data receiving module 402, an information acquisition module 404, an address allocation module 406 and an information update module 408, wherein:

[0096] The data receiving module 402 is used to obtain an address request message from a target request end; wherein the address request message carries a request end identification field;

[0097] The information acquisition module 404 is used to acquire the current address allocation information; wherein the address allocation information is used to record the allocated request end and the network address information corresponding to the allocated request end in the current data link layer;

[0098] The address allocation module 406 is used to allocate a target network address to the target request end according to the address request message, the request end identification field and the current address allocation information;

[0099] The information updating module 408 is used to update the address allocation information according to the target network address and the request end identification field.

[0100] In one embodiment, the address allocation module 406 includes:

[0101] A range determination unit, used to determine whether the target request end and the allocated request end of the current data link layer are in the same address range according to the request end identification field and the current address allocation information;

[0102] A first allocation unit is used to allocate a network address to the address request message directly according to the address request message when the target request end and the allocated request end are not in the same address range;

[0103] The second allocation unit is used to allocate a target network address to the target request end according to the address request message and the current address allocation information when the target request end and the allocated request end are in the same address range.

[0104] In one of the embodiments, the second allocation unit is specifically used to: when the target request end and the allocated request end are in the same address range, determine the allocated network address corresponding to the allocated request end in the same address range as the target request end; and allocate a target network address different from the allocated network address to the target request end.

[0105] In one of the embodiments, the range determination unit is specifically used to: calculate the identification field value based on the request end identification field and the subnet mask corresponding to the request end; traverse multiple allocated field values ​​in the current address allocation information to find out whether there is an allocated field value that is the same as the identification field value, so as to determine whether the target request end and the allocated request end of the current data link layer are in the same address range.

[0106] In one of the embodiments, the range determination unit is further used to: determine the hardware address of the target request end according to the request end identification field; and perform an AND calculation on the hardware address and the subnet mask corresponding to the request end to obtain the identification field value.

[0107] In one embodiment, the information update module 408 is specifically used to: calculate the target network address and subnet mask to obtain the target field value; record the target field value and the request end identification field in the address allocation information in correspondence to obtain the updated address allocation information.

[0108] Each module in the above-mentioned address allocation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0109] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store address allocation information, and can also be used to store information such as the request end identification field and calculation result data of the request end. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an address allocation method is implemented.

[0110] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, an address allocation method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0111] Those skilled in the art will understand that Figure 6The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0112] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining an address request message from a target request end; wherein the address request message carries a request end identification field; obtaining current address allocation information; wherein the address allocation information is used to record the allocated request end and the network address information corresponding to the allocated request end in the current data link layer; allocating a target network address to the target request end according to the address request message, the request end identification field and the current address allocation information; and updating the address allocation information according to the target network address and the request end identification field.

[0113] In one embodiment, the processor also implements the following steps when executing the computer program: determining whether the target request end and the allocated request end of the current data link layer are in the same address range based on the request end identification field and the current address allocation information; when the target request end and the allocated request end are not in the same address range, directly allocating a network address for the address request message based on the address request message; when the target request end and the allocated request end are in the same address range, allocating a target network address for the target request end based on the address request message and the current address allocation information.

[0114] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the target request end and the allocated request end are in the same address range, determining the allocated network address corresponding to the allocated request end in the same address range as the target request end; and allocating a target network address different from the allocated network address to the target request end.

[0115] In one embodiment, when the processor executes the computer program, the following steps are also implemented: calculating the identification field value based on the request end identification field and the subnet mask corresponding to the request end; traversing multiple allocated field values ​​in the current address allocation information, and searching whether there is an allocated field value that is the same as the identification field value, so as to determine whether the target request end and the allocated request end of the current data link layer are in the same address range.

[0116] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining the hardware address of the target request end according to the request end identification field; performing an AND calculation on the hardware address and the subnet mask corresponding to the request end to obtain the identification field value.

[0117] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the target network address and subnet mask are calculated to obtain the target field value; the target field value and the request end identification field are recorded in the address allocation information in correspondence to obtain the updated address allocation information.

[0118] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: obtaining an address request message from a target request end; wherein the address request message carries a request end identification field; obtaining current address allocation information; wherein the address allocation information is used to record the allocated request end and the network address information corresponding to the allocated request end in the current data link layer; allocating a target network address to the target request end according to the address request message, the request end identification field and the current address allocation information; and updating the address allocation information according to the target network address and the request end identification field.

[0119] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the request end identification field and the current address allocation information, determining whether the target request end and the allocated request end of the current data link layer are in the same address range; when the target request end and the allocated request end are not in the same address range, directly allocating a network address for the address request message based on the address request message; when the target request end and the allocated request end are in the same address range, allocating a target network address for the target request end based on the address request message and the current address allocation information.

[0120] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the target request end and the allocated request end are in the same address range, determining the allocated network address corresponding to the allocated request end in the same address range as the target request end; and allocating a target network address different from the allocated network address to the target request end.

[0121] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: calculating the identification field value based on the request end identification field and the subnet mask corresponding to the request end; traversing multiple allocated field values ​​in the current address allocation information, and searching whether there is an allocated field value that is the same as the identification field value, so as to determine whether the target request end and the allocated request end of the current data link layer are in the same address range.

[0122] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining the hardware address of the target request end according to the request end identification field; performing an AND calculation on the hardware address and the subnet mask corresponding to the request end to obtain the identification field value.

[0123] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the target network address and subnet mask are calculated to obtain the target field value; the target field value and the request end identification field are recorded in the address allocation information in correspondence to obtain the updated address allocation information.

[0124] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: obtaining an address request message from a target request end; wherein the address request message carries a request end identification field; obtaining current address allocation information; wherein the address allocation information is used to record the allocated request end and the network address information corresponding to the allocated request end in the current data link layer; allocating a target network address to the target request end according to the address request message, the request end identification field and the current address allocation information; and updating the address allocation information according to the target network address and the request end identification field.

[0125] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the request end identification field and the current address allocation information, determining whether the target request end and the allocated request end of the current data link layer are in the same address range; when the target request end and the allocated request end are not in the same address range, directly allocating a network address for the address request message based on the address request message; when the target request end and the allocated request end are in the same address range, allocating a target network address for the target request end based on the address request message and the current address allocation information.

[0126] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the target request end and the allocated request end are in the same address range, determining the allocated network address corresponding to the allocated request end in the same address range as the target request end; and allocating a target network address different from the allocated network address to the target request end.

[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: calculating the identification field value based on the request end identification field and the subnet mask corresponding to the request end; traversing multiple allocated field values ​​in the current address allocation information, and searching whether there is an allocated field value that is the same as the identification field value, so as to determine whether the target request end and the allocated request end of the current data link layer are in the same address range.

[0128] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining the hardware address of the target request end according to the request end identification field; performing an AND calculation on the hardware address and the subnet mask corresponding to the request end to obtain the identification field value.

[0129] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the target network address and subnet mask are calculated to obtain the target field value; the target field value and the request end identification field are recorded in the address allocation information in correspondence to obtain the updated address allocation information.

[0130] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0131] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0132] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0133] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. An address allocation method, characterized in that: The method is applied to a data link layer, and comprises: Obtaining an address request message from a target request end; wherein the address request message carries a request end identification field; Acquire current address allocation information; wherein the address allocation information is used to record the allocated request end in the current data link layer and the network address information corresponding to the allocated request end; Allocate a target network address for the target request end according to the address request message, the request end identification field and the current address allocation information; The address allocation information is updated according to the target network address and the requester identification field.

2. The method according to claim 1, characterized in that The allocating a target network address to the target requester according to the requester identification field and the current address allocation information includes: Determine, according to the request end identification field and the current address allocation information, whether the target request end and the allocated request end of the current data link layer are in the same address range; When the target request end and the allocated request end are not in the same address range, directly allocating a network address to the address request message according to the address request message; In the case that the target request end and the allocated request end are in the same address range, a target network address is allocated to the target request end according to the address request message and the current address allocation information.

3. The method according to claim 2, characterized in that When the target request end and the allocated request end are in the same address range, allocating a target network address for the target request end according to the address request message and the current address allocation information includes: In the case where the target request end and the allocated request end are in the same address range, determining an allocated network address corresponding to the allocated request end in the same address range as the target request end; A target network address different from the allocated network address is allocated to the target requester.

4. The method according to claim 2, characterized in that: The determining, according to the request end identification field and the current address allocation information, whether the target request end and the allocated request end of the current data link layer are in the same address range includes: Calculate the identification field value according to the request end identification field and the subnet mask corresponding to the request end; Traverse multiple allocated field values ​​in the current address allocation information to find out whether there is an allocated field value that is the same as the identification field value, so as to determine whether the target request end and the allocated request end of the current data link layer are in the same address range.

5. The method according to claim 4, characterized in that The calculating the identification field value according to the request end identification field and the subnet mask corresponding to the request end includes: Determine the hardware address of the target request end according to the request end identification field; An AND calculation is performed on the hardware address and the subnet mask corresponding to the requesting end to obtain an identification field value.

6. The method according to claim 5, characterized in that The updating of the address allocation information according to the target network address and the request end identification field comprises: Calculate the target network address and the subnet mask to obtain a target field value; The target field value and the request end identification field are recorded in the address allocation information in correspondence, so as to obtain the updated address allocation information.

7. An address allocation device, characterized in that: The device is applied to a data link layer, and comprises: A data receiving module, used for acquiring an address request message from a target request end; wherein the address request message carries a request end identification field; An information acquisition module, used to acquire current address allocation information; wherein the address allocation information is used to record the allocated request end in the current data link layer and the network address information corresponding to the allocated request end; An address allocation module, configured to allocate a target network address to the target request end according to the address request message, the request end identification field and the current address allocation information; An information updating module is used to update the address allocation information according to the target network address and the request end identification field.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.