A method and system for allocating network resources and distributing topology in a distributed network range
Through the joint management center computing and allocation of network resources, the problems of resource allocation and VLAN unified allocation in cross-region distributed network shooting ranges are solved, efficient resource allocation and topological distribution are realized, and the construction of large-scale distributed network shooting ranges is supported.
Patent Information
- Application Number
- CN202411488856.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-24
AI Technical Summary
When building a cross-regional distributed network shooting range, the existing technology has problems such as inconvenient allocation of network resources such as node IP and gateways, inadequate allocation of VLAN resources, and insufficient direct message delivery topology distribution mechanism across multiple shooting ranges.
The joint management center calculates the number of network segments in the local sub-ranges in the total topology, sets up the gateway IP, and allocates network segment resources to the local sub-ranges; allocates VLAN resources for the connections across sub-ranges in the total topology, and occupies VLAN resources. The pool records the correspondence between the connection, port and VLAN information; splits the total topology into the topology of the corresponding sub-range information according to the sub-range information belonging to each node, and distributes the split topology to the corresponding sub-range.
It realizes efficient allocation of node IP, gateway and VLAN resources, ensures the integrity and consistency of message delivery and topological distribution, and supports the construction of large-scale distributed cross-region network shooting ranges.
Smart Images

Figure CN119011362B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and system for allocating network resources and distributing topology in a distributed network range, and belongs to the technical field of computer software and network security. Background Art
[0002] With the increasingly complex and severe cyberspace security threats, the importance of cyberspace security-related infrastructure has been increasing. In addition to dedicated network ranges, more universities, research institutes and technology companies have developed many dedicated network ranges with an eye on core application scenarios in different fields. With the increasing maturity of new technologies such as cloud computing and big data, comprehensive and large-scale distributed network ranges have become a development trend through the effective integration and coordination of various resources. Network ranges have also gradually shifted from costly local cluster deployment to a distributed service provision model.
[0003] When building a cross-regional distributed network range, the IP and gateway settings of the nodes in each region need to consider the IP and gateway settings of the complete network topology, and the allocation of VLAN resources used to connect different ranges, compared to a single network range. The following deficiencies exist in the existing network range foundation: 1. The allocation of network resources such as node IP and gateway requires analysis of the configuration of the complete network topology nodes. For large-scale distributed ranges, the loading and analysis of complete network topology data consumes a lot of single-machine resources and does not fully utilize the advantages of distribution. 2. The local cluster range does not consider the unified allocation of VLAN network resources required for interoperability across network ranges. 3. The local cluster range does not consider the cross-regional multi-range direct messaging topology distribution mechanism. Summary of the invention
[0004] Purpose of the invention: In view of the problems existing in the above-mentioned prior art, the purpose of the present invention is to provide a method and system for allocating network resources and distributing topology in a distributed network range, which supports efficient allocation of node IP, gateway, and VLAN resources used for communication between different ranges. At the same time, through efficient message transmission and topology distribution mechanisms, the integrity and consistency of message transmission and topology distribution are guaranteed.
[0005] Technical solution: To achieve the above-mentioned invention object, the present invention adopts the following technical solution:
[0006] A method for allocating network resources and distributing topology in a distributed network range comprises the following steps:
[0007] The joint management center calculates the number of network segments of each sub-shooting range in the overall topology, sets the gateway IP, and allocates network segment resources to each sub-shooting range based on the network segment resource pool corresponding to the overall topology;
[0008] The joint management center allocates VLAN resources for the connections across the sub-ranges in the overall topology, and records the correspondence between the connections, ports, and VLAN information in the occupied VLAN resource pool. The VLAN record information is set to an invalid state by default;
[0009] The joint management center splits the overall topology into corresponding sub-range topologies according to the sub-range information to which each node belongs;
[0010] The joint management center distributes the split topology to the corresponding sub-shooting ranges;
[0011] When each sub-shooting range executes topology construction, it applies for VLAN resources from the joint management center and updates the corresponding VLAN record information to a valid state.
[0012] Furthermore, the calculation of the number of network segments of each local sub-range in the overall topology, setting the gateway IP, and allocating network segment resources to each local sub-range according to the network segment resource pool corresponding to the overall topology include:
[0013] Traverse all the connections in the total topology;
[0014] If the nodes at both ends of the connection belong to the same sub-target range, determine whether any of the nodes is included in the switch set. If so, the current connection processing ends; otherwise, the number of network segments of the sub-target range to which it belongs is increased by one, and if the node type is a switch, it is added to the switch set;
[0015] If the nodes at both ends of the connection belong to different sub-ranges, take a network segment from the network segment resource pool corresponding to the overall topology and set it to the current connection. If the type of the node is a router or firewall, set the port IP of the connection to the gateway IP corresponding to the taken network segment, and set the gateway IP of the connection to the gateway IP corresponding to the taken network segment;
[0016] After traversing the connections, the resources in the network segment resource pool are allocated to each sub-target range according to the proportion of network segment resources required by each sub-target range.
[0017] Furthermore, the allocating VLAN resources for the connections across the sub-ranges in the overall topology includes:
[0018] The VLAN resource pool stores all currently occupied VLAN information, including connection ID, port ID, VLAN information, and whether the VLAN record information is valid;
[0019] Traverse all the connections in the overall topology. If the nodes at both ends of the connection belong to different sub-ranges, apply for VLAN resources.
[0020] Get the VLAN resource file lock;
[0021] Query whether there is data corresponding to the connection ID in the VLAN resource pool. If not, obtain the maximum VLAN value in the current data, and allocate a new VLAN value based on the value, which does not exist in the VLAN resource pool or exists but the VLAN record information of the corresponding entry is invalid, and add the connection ID, port ID and the allocated new VLAN value to the VLAN resource pool, and set the VLAN record information invalid by default; if the connection ID exists but the corresponding port ID does not exist, obtain the VLAN value of the existing connection ID, and add the data corresponding to the corresponding port ID to the VLAN resource pool, and set the VLAN record information invalid by default; if both the connection ID and the port ID exist, directly return the corresponding VLAN value in the VLAN resource pool;
[0022] Release the VLAN resource file lock.
[0023] Furthermore, when each sub-shooting range executes topology construction and applies for VLAN resources from the joint management center, it uses the connection ID to query all relevant VLAN records in the VLAN resource pool and updates the record status to a valid state; if a record with the same VLAN value but a different connection ID already exists in a valid state, the VLAN resources are allocated again, the new VLAN value is obtained, the VLAN record information is updated and the record status is set to a valid state.
[0024] Furthermore, the overall topology is split into topologies corresponding to the sub-shooting ranges according to the sub-shooting range information to which each node belongs, including:
[0025] Set node information set, port information set and connection information set for each sub-shooting range;
[0026] Traverse the nodes in the entire topology and add them to the node information set of the sub-range to which they belong;
[0027] Traverse the ports in the entire topology and add them to the port information set of the sub-target range to which they belong;
[0028] Traverse the connections in the entire topology and add them to the connection information set of the sub-target range to which any of the two end ports belongs. If the two end ports belong to different sub-target ranges, they are added to the connection information set of the corresponding sub-target ranges respectively.
[0029] Furthermore, the joint management center and local sub-shooting ranges use distributed queues to transmit topology distribution messages. The joint management center first sends a semi-message to the distributed queue to notify it to start a transaction. After the semi-message is sent successfully, the database transaction of the topology distribution status change is executed. Only after the database transaction is successfully executed will a confirmation message be sent to the distributed queue, and the sub-shooting range can consume the semi-message sent by the joint management center.
[0030] After the distributed queue sends a half message to the joint management center and waits for the default timeout period for the database transaction to execute, if it has not received a confirmation or rollback message for the half message sent by the joint management center, the callback interface of the joint management center is called. The callback interface queries the recorded topological distribution status based on the half message sent by the joint management center before. If the currently recorded topological distribution status is consistent with the half message sent to the sub-target range, the distributed queue automatically executes the half-message confirmation transaction, otherwise it automatically executes the half-message rollback transaction.
[0031] Furthermore, according to the configuration of the joint management center database, the effective time of the distributed queue review transaction is set. When the distributed queue is reviewed and confirmed, if the difference between the semi-message sending time of the joint management center and the current time at the time of review is less than the default timeout time of the database, it returns to an uncertain state and waits for the next review.
[0032] A system for allocating network resources and distributing topology in a distributed network range, comprising:
[0033] The joint management center module is used to calculate the number of network segments of each sub-target range in the overall topology, set the gateway IP, and allocate network segment resources to each sub-target range according to the network segment resource pool corresponding to the overall topology; allocate VLAN resources to the connections across sub-target ranges in the overall topology, record the correspondence between the connection, port and VLAN information in the occupied VLAN resource pool, and set the VLAN record information to an invalid state by default; split the overall topology into the topology of the corresponding sub-target range according to the sub-target range information to which each node belongs; and distribute the split topology to the corresponding sub-target range;
[0034] The local shooting range management modules are used to apply for VLAN resources from the joint management center module and update the corresponding VLAN record information to a valid state when executing topology construction.
[0035] Furthermore, distributed queues are used to transmit topology distribution messages between the joint management center module and local shooting ranges.
[0036] A computer program product includes a computer program / instruction, which, when executed by a processor, implements the steps of a method for allocating network resources and distributing topology in a distributed network range.
[0037] Beneficial effects: Compared with the prior art, the present invention has the following advantages: 1. The present invention uses the joint management center to analyze and calculate the total topology in advance, and allocates public network resources (IP and VLAN) in advance. The local sub-ranges only need to obtain the topology of their own nodes. 2. In terms of message distribution and transmission, the joint management center and local sub-ranges adopt a distributed transaction mechanism such as RocketMQ, which can ensure the integrity and consistency of topology distribution and topology status message transmission. 3. The method of the present invention can effectively manage the joint multi-site single-unit ranges and realize large-scale topology distributed cross-regional construction. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 FIG. 4 is a schematic diagram of the architecture of an embodiment of the present invention.
[0039] Figure 2 Schematic diagram of a flow chart of an embodiment of the present invention.
[0040] Figure 3 It is a schematic diagram of the messages between the joint control center and the sub-shooting range in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments.
[0042] The embodiment of the present invention discloses a method for allocating network resources and distributing topology in a distributed network range, which can realize efficient allocation of node IPs and gateways in a large-scale distributed network range, and centralized and efficient allocation of VLAN resources required for cross-range network interconnection.
[0043] like Figure 1 As shown, in the embodiment of the present invention, the top layer of the architecture is a joint management center, which is responsible for parsing and calculating the external input network topology data and distributing it to the registered local sub-ranges. The local ranges will register the status of their heartbeats with the designated joint management center.
[0044] The joint management center receives external topology input, parses it, loads it into its own network topology data structure, and performs network topology resource calculation and allocation, mainly including the calculation of IP resource pool and VLAN resource pool. After completing the topology resource calculation, the topology split is distributed.
[0045] Figure 2 The flowchart of the method for the joint management center to implement the distributed network range network resource allocation and topology distribution mainly includes:
[0046] Step S100, the joint management center calculates the number of network segments of each sub-shooting range in the overall topology, sets the gateway IP, and allocates network segment resources to each sub-shooting range according to the network segment resource pool corresponding to the overall topology.
[0047] Step S200, the joint management center allocates VLAN resources for the connections across the sub-ranges in the overall topology, and records the correspondence between the connections, ports and VLAN information in the occupied VLAN resource pool, and sets the VLAN record information to an invalid state by default.
[0048] Step S300: The joint management center splits the overall topology into topologies corresponding to the sub-ranges according to the sub-range information to which each node belongs.
[0049] Step S400: The joint management center distributes the split topology to the corresponding sub-shooting ranges.
[0050] Step S500, when each sub-shooting range executes topology construction, it applies for VLAN resources from the occupied VLAN resource pool of the joint management center and updates the corresponding VLAN record information to a valid state.
[0051] In an embodiment of the present invention, the joint management center maintains an IP resource pool and a VLAN resource pool. The purpose of the IP resource pool is to ensure that network segments between different regions do not conflict. If the IP resource pool for each region is not pre-occupied and planned, it is very likely that a network in two regions will be assigned to the same segment. As a result, two nodes in the same segment cannot be interconnected due to segment conflicts. The purpose of the VLAN resource pool is to distinguish the VLAN ranges used for different cross-range connections. Avoid conflicts in VLANs used between different sub-ranges. The default range of VLANs is 1-4094. A VLAN resource pool module is set up in the joint management center to be responsible for allocating VLAN resources.
[0052] In this embodiment, for each total topology, the IP resource pool generally defaults to 192.168.0.0 / 16. The default total network segment resource pool is 192.168.0.0 / 24-192.168.255.0 / 24, represented by Set_IP. The joint management center analyzes the total topology, calculates the number of network segments of each sub-range, and uses N_c to represent the number of network segments of a sub-range. The specific steps of IP resource allocation are:
[0053] Step S101, traverse all the connections in the overall topology, and Set_S records all the traversed switches.
[0054] Step S102, if the nodes l and r at both ends of the connection are nodes in the same sub-target range, if Set_S contains l or r, the current connection processing ends; if Set_S does not contain l and does not contain r, N_c = N_c + 1, and if the type of node l is a switch, then l is added to Set_S, and if the type of r is a switch, then r is added to Set_S.
[0055] Step S103, if the nodes l and r at both ends of the connection belong to different sub-ranges, a network segment 192.168.x.0 / 24 is randomly selected from Set_IP and set to the connection. If the type of l is a router or firewall, the port IP of the connection of the l node is set to 192.168.x.254, and the gateway of the connection is set to this IP. Otherwise, if the type of r is a router or firewall, the port IP of the connection of the r node is set to 192.168.x.254, and the gateway of the connection is set to this IP.
[0056] Step S104, after traversing the connections, the network segment resources required for each sub-target range in the current topology can be obtained. The total network segment resources are Set_IP, and Set_IP is distributed to each sub-target range according to the proportion of network segment resources required by each sub-target range. The network segment resource ratio Rr of the current sub-target range is the value of N_c of the sub-target range / the total number of N_c values of all sub-target ranges. The total number of network segment resources of the current sub-target range = the total number of network segment resources multiplied by the network segment resource ratio Rr of the current sub-target range. The network segment resources of the sub-target range = the total number of network segment resources of the current sub-target range is taken out from the total network segment resources Set_IP. The distribution is through the configuration of the information in the topology. The topology information is in JSON format. The outermost layer is the global information of the current topology, which records the topology name, topology global resources and other information. The network segment resources of the current sub-target range topology are placed at this level and distributed to the designated sub-target range as the global information of the topology.
[0057] In this embodiment, the VLAN resource pool stores all currently occupied VLAN information. The information format is (connect_id, port_id, vlan, valid_flag), where connect_id is the connection ID, port_id is the port ID, VLAN is the VLAN used by the current connection, and valid_flag represents whether this VLAN record information is valid. The valid_flag of the VLAN records pre-allocated in the joint management center is false. When each sub-shooting range actually starts the topology construction, it applies to the joint management center again and changes the valid_flag of the corresponding VLAN record to true. The VLAN application record is made effective twice because if the valid_flag of the VLAN entry applied for in the joint management center is set to true at the beginning, it is still a topology at this time, and the VLAN resources are actually needed until the topology of each sub-shooting range is constructed. The reason why VLAN resources are pre-allocated in the topology stage in advance is to make the VLAN resources used as fixed as possible when the same topology is repeatedly constructed and destroyed. If VLAN resources are allocated again when the topology is constructed, they must be released once after each construction and destruction, and the VLAN obtained by the re-construction application will be different.
[0058] In this embodiment, the detailed allocation process of VLAN resources is as follows:
[0059] Step S201, traverse the connection of the entire topology. If the two ends of the connection belong to different sub-ranges, it is necessary to apply for VLAN resources.
[0060] Step S202, obtaining a VLAN resource file lock to prevent concurrent VLAN resource distribution conflicts.
[0061] Step S203, query whether there is data corresponding to connect_id in the VLAN resource pool, if so, compare port_id, if connect_id does not exist, obtain the maximum VLAN value max(vlan) in the current VLAN resource pool, if max(vlan)<=4096, max(vlan)=max(vlan) + 1. If max(vlan)>4094, max(vlan)=max(vlan-4094), and if the currently obtained max(vlan) already has an entry with valid_flag true in the VLAN resource pool corresponding to it, then set max(vlan) = max(vlan)+1, until there is no entry corresponding to max(vlan) in the VLAN resource pool, or the valid_flag of the entry corresponding to max(vlan) is false. After getting max(vlan), add (connect_id, port_id, max(vlan), false) to the VLAN resource pool. If connect_id exists but port_id does not exist, get the VLAN of the existing connect_id and add (connect_id, port_id, vlan, false) to the VLAN resource pool. If both connect_id and port_id exist, directly return the corresponding VLAN in the VLAN resource pool.
[0062] Step S204: releasing the VLAN resource file lock.
[0063] It can be seen that in the joint management center, VLANs are pre-applied for each cross-range connection, but the valid_flag of the VLAN is false. The valid_flag needs to be applied to each sub-range to actually start the topology construction. It is necessary to apply to the VLAN resource pool of the joint management center again to turn the valid_flag to true. If the construction fails, or the sub-range construction is destroyed after the construction is completed, true will be turned to false. It is also possible that at this time, two records with different connect_ids but valid_flag of false occupying the same VLAN appear in the VLAN resource pool.
[0064] When each sub-shooting range applies to the VLAN resource pool of the joint management center, each sub-shooting range uses the (connect_id) information to request the VLAN resource pool of the joint management center, and changes the valid_flag of all VLAN records related to this connect_id to true. If the same VLAN already exists, and valid_flag is true, and the connect_id is different, then the VLAN record obtained above needs to be re-obtained and calculated according to step S203. After the new VLAN is recalculated, all VLAN records related to the connect_id above are modified to the new VLAN, and valid_flag is changed to true. If the same VLAN does not exist, and valid_flag is true, and the connect_id is different, the VLAN corresponding to the current connect_id is directly returned.
[0065] In this embodiment, topology splitting is to split the input full topology data into the topology of the corresponding sub-range according to the sub-range information to which each node belongs. The detailed steps are as follows:
[0066] Step S301, set Set_A_E to record the node information of the A sub-range, Set_A_P to record the port information of the A sub-range, and Set_A_C to record the port connection information of the A sub-range.
[0067] Step S302, traverse the nodes in the entire topology, if the node belongs to sub-shooting range A, Set_A_E adds the node.
[0068] Step S303, traverse the ports in the entire topology, and if the node to which the port belongs belongs to sub-target range A, add the port in Set_A_P.
[0069] Step S304, traverse the lines in the entire topology, and if any of the ports l and r at both ends of the line are in Set_A_P, add the line to Set_A_C. At this point, the topology information belonging only to the sub-range A can be obtained.
[0070] In order to ensure that the joint management center updates the topology distribution status data and the sub-range successfully receives the topology distribution message execution result, the distributed message queue can be used to ensure the effectiveness and accuracy of the topology distribution. For example, in some embodiments, RocketMQ can be used to implement transaction messages.
[0071] Figure 3 The detailed process of the joint management center sending topology-related messages to the sub-ranges through RocketMQ is shown, including:
[0072] Step 1. Send a semi-message: The joint management center first sends a semi-message to RocketMQ to notify it to start a transaction. A semi-message contains complete message content. Unlike a normal message, this message is invisible to the consumer sub-range system before the transaction is committed, and the consumer will not consume this message.
[0073] Step 2. Feedback of semi-message sending results: RocketMQ will feedback the current semi-message sending results to the joint management center.
[0074] Step 3. Commit / rollback transaction: The joint management center will process the transaction according to the result of the semi-message sending. If the semi-message sending is successful, the joint management center commits the database transaction of the topology distribution state change. If the semi-message sending fails, the database transaction is rolled back.
[0075] Step 4. Confirmation / rollback message: If the database transaction is executed successfully, a confirmation message will be sent to RocketMQ, and the consumer range system can see the half message sent before and save the range distribution topology. If the topology distribution status change database transaction fails to execute, a rollback message will be sent to RocketMQ, and RocketMQ will delete the half message sent before.
[0076] Step 5. If the confirmation message of step 4 is not received, check the transaction status: There may be another problem with the above mechanism. After the joint management center executes its own topology distribution state change database transaction, it cannot ensure success to send a rollback or confirmation message of a half message to RocketMQ. That is, if the joint management center is blocked in executing the database transaction of the topology distribution state change, the confirmation or rollback message of the half message sent by the joint management center to RocketMQ will not be executed in time. At this time, since RocketMQ is set to check back, the check fails due to transaction blocking, resulting in the deletion of the half message. However, in fact, the database transaction did not fail to execute. Therefore, it is necessary to set the effective time of the check transaction according to the configuration of the database of the joint management center. In this embodiment, the system database uses MySQL, and the default timeout of the database transaction is 50s. Other times such as the database query execution time and the buffer refresh time are very small compared to the transaction timeout time and can be ignored. Therefore, when setting the RocketMQ check back confirmation, if the difference between the time when the joint management center sends the half message and the current time when checking back is less than the default timeout of the database, the uncertain state is returned and the next check is waited. In short, use RocketMQ's transaction reverse query mechanism. Register a RocketMQ callback interface. RocketMQ sends a half-message in the joint management center and waits for the default timeout period for the database transaction to execute. If it has not received the confirmation or rollback message of the half-message sent by the joint management center, it will call the callback interface implemented by the joint management center.
[0077] Step 6. Query the topology distribution status: The callback interface will query the topology distribution status recorded by the joint management center based on the semi-message previously sent by the joint management center.
[0078] Step 7. Commit / rollback according to the transaction execution status: If the currently recorded topology distribution status is consistent with the semi-message sent to the sub-target range, it means that the topology distribution status change database transaction of the joint management center is executed successfully, then RocketMQ automatically executes the semi-message confirmation transaction, and the sub-target range can start consuming the topology distribution message. If the currently recorded topology distribution status is inconsistent with the semi-message sent to the sub-target range, it means that the topology distribution change database transaction of the joint management center has failed to execute, then RocketMQ automatically executes the semi-message rollback transaction, and the topology distribution of the joint management center to the sub-target range has failed.
[0079] Step 8. Message delivery: After receiving the confirmation message of the half message from the joint management center, RocketMQ pushes the half message to the sub-target range and starts to send the topology information of the sub-target range.
[0080] Step 9. Submit the transaction: After receiving the topology distribution message, the sub-range saves the topology information.
[0081] Based on the same inventive concept, an embodiment of the present invention discloses a system for allocating network resources and distributing topology of a distributed network range, including: a joint management center module, which is used to calculate the number of network segments of each sub-range in the overall topology, set the gateway IP, and allocate network segment resources to each sub-range according to the network segment resource pool corresponding to the overall topology; allocate VLAN resources to the connections across sub-ranges in the overall topology, record the correspondence between the connection, port and VLAN information in the occupied VLAN resource pool, and set the VLAN record information to an invalid state by default; split the overall topology into topologies corresponding to the sub-ranges according to the sub-range information to which each node belongs; and distribute the split topologies to the corresponding sub-ranges; and local sub-range management modules, which are used to apply for VLAN resources from the joint management center module and update the corresponding VLAN record information to a valid state when executing topology construction.
[0082] Based on the same inventive concept, an embodiment of the present invention discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the aforementioned distributed network target range network resource allocation and topology distribution method.
Claims
1. A method for allocating network resources and distributing topology in a distributed network range, characterized in that: The steps include: The joint management center calculates the number of network segments of each sub-shooting range in the overall topology, sets the gateway IP, and allocates network segment resources to each sub-shooting range based on the network segment resource pool corresponding to the overall topology; The joint management center allocates VLAN resources for the connections across the sub-ranges in the overall topology, and records the correspondence between the connections, ports, and VLAN information in the occupied VLAN resource pool. The VLAN record information is set to an invalid state by default; The joint management center splits the overall topology into corresponding sub-range topologies according to the sub-range information to which each node belongs; The joint management center distributes the split topology to the corresponding sub-shooting ranges; When each sub-range executes topology construction, it applies for VLAN resources from the joint management center and updates the corresponding VLAN record information to a valid state; The method of calculating the number of network segments of each sub-shooting range in the overall topology, setting the gateway IP, and allocating network segment resources to each sub-shooting range according to the network segment resource pool corresponding to the overall topology includes: Traverse all the connections in the total topology; If the nodes at both ends of the connection belong to the same sub-target range, determine whether any of the nodes is included in the switch set. If so, the current connection processing ends; otherwise, the number of network segments of the sub-target range to which it belongs is increased by one, and if the node type is a switch, it is added to the switch set; If the nodes at both ends of the connection belong to different sub-ranges, take a network segment from the network segment resource pool corresponding to the overall topology and set it to the current connection. If the type of the node is a router or firewall, set the port IP of the connection to the gateway IP corresponding to the taken network segment, and set the gateway IP of the connection to the gateway IP corresponding to the taken network segment; After traversing the connections, the resources in the network segment resource pool are allocated to each sub-range according to the proportion of network segment resources required by each sub-range; The allocating VLAN resources for the connections across the sub-ranges in the overall topology includes: The VLAN resource pool stores all currently occupied VLAN information, including connection ID, port ID, VLAN information, and whether the VLAN record information is valid; Traverse all the connections in the overall topology. If the nodes at both ends of the connection belong to different sub-ranges, apply for VLAN resources; Get the VLAN resource file lock; Query whether there is data corresponding to the connection ID in the VLAN resource pool. If not, obtain the maximum VLAN value in the current data, and allocate a new VLAN value based on the value, which does not exist in the VLAN resource pool or exists but the VLAN record information of the corresponding entry is invalid, and add the connection ID, port ID and the allocated new VLAN value to the VLAN resource pool, and set the VLAN record information invalid by default; if the connection ID exists but the corresponding port ID does not exist, obtain the VLAN value of the existing connection ID, and add the data corresponding to the corresponding port ID to the VLAN resource pool, and set the VLAN record information invalid by default; if both the connection ID and the port ID exist, directly return the corresponding VLAN value in the VLAN resource pool; Release the VLAN resource file lock.
2. A method for allocating network resources and distributing topology in a distributed network range according to claim 1, characterized in that: When each sub-shooting range executes topology construction and applies for VLAN resources from the joint management center, it uses the connection ID to query all relevant VLAN records in the VLAN resource pool and updates the record status to a valid state; if a record with the same VLAN value but a different connection ID already exists in a valid state, the VLAN resources are allocated again, the new VLAN value is obtained, the VLAN record information is updated and the record status is set to a valid state.
3. A method for allocating network resources and distributing topology in a distributed network range according to claim 1, characterized in that: The method of splitting the total topology into topologies of corresponding sub-shooting ranges according to the sub-shooting range information to which each node belongs includes: Set node information set, port information set and connection information set for each sub-shooting range; Traverse the nodes in the entire topology and add them to the node information set of the sub-range to which they belong; Traverse the ports in the entire topology and add them to the port information set of the sub-target range to which they belong; Traverse the connections in the entire topology and add them to the connection information set of the sub-target range to which any of the two end ports belongs. If the two end ports belong to different sub-target ranges, they are added to the connection information set of the corresponding sub-target ranges respectively.
4. A method for allocating network resources and distributing topology in a distributed network range according to claim 1, characterized in that: The joint management center and local sub-shooting ranges use distributed queues to transmit topology distribution messages. The joint management center first sends a semi-message to the distributed queue to notify it to start a transaction. After the semi-message is sent successfully, the database transaction of the topology distribution status change is executed. Only after the database transaction is successfully executed will a confirmation message be sent to the distributed queue, and the sub-shooting range can consume the semi-message sent by the joint management center; After the distributed queue sends a half message to the joint management center and waits for the default timeout period for the database transaction to execute, if it has not received a confirmation or rollback message for the half message sent by the joint management center, the callback interface of the joint management center is called. The callback interface queries the recorded topological distribution status based on the half message sent by the joint management center before. If the currently recorded topological distribution status is consistent with the half message sent to the sub-target range, the distributed queue automatically executes the half-message confirmation transaction, otherwise it automatically executes the half-message rollback transaction.
5. A method for allocating network resources and distributing topology in a distributed network range according to claim 4, characterized in that: According to the configuration of the joint management center database, set the effective time of the distributed queue review transaction. When the distributed queue is reviewed and confirmed, if the difference between the semi-message sending time of the joint management center and the current time at the time of review is less than the default timeout of the database, it returns to an uncertain state and waits for the next review.
6. A system for allocating network resources and distributing topology in a distributed network range, characterized in that: include: The joint management center module is used to calculate the number of network segments of each sub-range in the overall topology, set the gateway IP, and allocate network segment resources to each sub-range according to the network segment resource pool corresponding to the overall topology; Allocate VLAN resources for the connections across sub-target ranges in the overall topology, record the correspondence between the connection, port and VLAN information in the occupied VLAN resource pool, and set the VLAN record information to an invalid state by default; split the overall topology into the topologies of the corresponding sub-target ranges according to the sub-target range information to which each node belongs; and distribute the split topologies to the corresponding sub-target ranges; The local shooting range management module is used to apply for VLAN resources from the joint management center module and update the corresponding VLAN record information to a valid state when executing topology construction; The method of calculating the number of network segments of each sub-shooting range in the overall topology, setting the gateway IP, and allocating network segment resources to each sub-shooting range according to the network segment resource pool corresponding to the overall topology includes: Traverse all the connections in the total topology; If the nodes at both ends of the connection belong to the same sub-target range, determine whether any of the nodes is included in the switch set. If so, the current connection processing ends; otherwise, the number of network segments of the sub-target range to which it belongs is increased by one, and if the node type is a switch, it is added to the switch set; If the nodes at both ends of the connection belong to different sub-ranges, take a network segment from the network segment resource pool corresponding to the overall topology and set it to the current connection. If the type of the node is a router or firewall, set the port IP of the connection to the gateway IP corresponding to the taken network segment, and set the gateway IP of the connection to the gateway IP corresponding to the taken network segment; After traversing the connections, the resources in the network segment resource pool are allocated to each sub-range according to the proportion of network segment resources required by each sub-range; The allocating VLAN resources for the connections across the sub-ranges in the overall topology includes: The VLAN resource pool stores all currently occupied VLAN information, including connection ID, port ID, VLAN information, and whether the VLAN record information is valid; Traverse all the connections in the overall topology. If the nodes at both ends of the connection belong to different sub-ranges, apply for VLAN resources; Get the VLAN resource file lock; Query whether there is data corresponding to the connection ID in the VLAN resource pool. If not, obtain the maximum VLAN value in the current data, and allocate a new VLAN value based on the value, which does not exist in the VLAN resource pool or exists but the VLAN record information of the corresponding entry is invalid, and add the connection ID, port ID and the allocated new VLAN value to the VLAN resource pool, and set the VLAN record information invalid by default; if the connection ID exists but the corresponding port ID does not exist, obtain the VLAN value of the existing connection ID, and add the data corresponding to the corresponding port ID to the VLAN resource pool, and set the VLAN record information invalid by default; if both the connection ID and the port ID exist, directly return the corresponding VLAN value in the VLAN resource pool; Release the VLAN resource file lock.
7. A distributed network range network resource allocation and topology distribution system according to claim 6, characterized in that: Distributed queues are used to transmit topology distribution messages between the joint management center module and local shooting ranges.
8. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by the processor, the steps of a method for allocating network resources and distributing topology of a distributed network range are implemented according to any one of claims 1-5.
Citation Information
Patent Citations
Remote access method and system for large-scale users in network shooting range
CN114422201A
Communication method and device of network target range, equipment and storage medium
CN116055566A