Route processing method and apparatus, electronic device, computer-readable storage medium, and computer program product
By generating a second routing table to store the same routes in the cloud network and processing changes, the problem of duplicate distribution of different routing tables in the cloud network is solved, improving the efficiency of routing table changes and the reliability of network operation and maintenance.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2025-11-12
- Publication Date
- 2026-07-02
AI Technical Summary
Existing technologies are insufficient to effectively address the issue of duplicate route distribution between different routing tables in cloud networks, leading to inefficient routing table changes and impacting data transmission efficiency.
By generating a second routing table to store the same routes in multiple first routing tables, and performing lookup and modification processing based on the address of the route to be changed, the changed route is ensured to take effect in multiple first routing tables, avoiding duplicate distribution.
It effectively reduces the total number of routing tables stored, improves the efficiency of routing table changes, reduces control plane stability risks, and enhances the efficiency and reliability of network operation and maintenance.
Smart Images

Figure CN2025134481_02072026_PF_FP_ABST
Abstract
Description
Routing processing methods, apparatus, electronic devices, computer-readable storage media, and computer program products
[0001] Cross-references to related applications
[0002] This application is based on and claims priority to Chinese Patent Application No. 2024119193832, filed on December 23, 2024, the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application relates to the field of network communication, and in particular to a routing processing method, apparatus, electronic device, computer-readable storage medium, and computer program product. Background Technology
[0004] With the rapid development and popularization of cloud computing technology, the scale of cloud networks of various cloud vendors has also increased significantly. As a result, the pressure of using and maintaining routing tables has also increased. Reasonable routing table design helps to enhance network flexibility and security. Cloud computing tenants can control the flow of data packets and optimize transmission paths by configuring routing rules and reasonably selecting the next hop type, thereby improving network throughput performance and reducing service latency.
[0005] In related technologies, routing table improvements are mainly achieved through routing table structure optimization and compact routing techniques. However, the aforementioned methods for improving and optimizing routing tables are still insufficient to cope with application scenarios where routes change frequently, which in turn seriously affects data transmission efficiency. Summary of the Invention
[0006] This application provides a routing processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can effectively avoid the same route being repeatedly issued in different routing tables, thereby effectively improving the efficiency of routing table changes.
[0007] The technical solution of this application embodiment is implemented as follows:
[0008] This application provides a routing processing method, including:
[0009] A second routing table is generated based on multiple first routing tables, wherein the second routing table stores the same routes in the multiple first routing tables;
[0010] The search process is performed based on the address to be changed to obtain the route to be changed that matches the address to be changed;
[0011] When the route to be changed is located in the second routing table, the route to be changed in the second routing table is modified to obtain the modified route, wherein the modified route is effective in all of the multiple first routing tables.
[0012] A combined routing table, the combined routing table comprising: a second routing table shared by a plurality of first routing tables and a third routing table corresponding to each of the first routing tables;
[0013] The second routing table stores multiple identical routes from the first routing table;
[0014] The third routing table stores the remaining routes in the corresponding first routing table, excluding the identical routes.
[0015] This application provides a routing processing apparatus, including:
[0016] A decoupling module is used to generate a second routing table based on multiple first routing tables, wherein the second routing table stores the same routes in the multiple first routing tables;
[0017] The lookup module is used to perform lookup processing based on the address to be changed, and to obtain the route to be changed that matches the address to be changed;
[0018] The modification module is used to modify the route to be modified in the second routing table when the route to be modified is located in the second routing table, so as to obtain the modified route, wherein the modified route is effective in all of the multiple first routing tables.
[0019] This application provides an electronic device, including:
[0020] Memory is used to store executable instructions or computer programs.
[0021] When a processor executes computer-executable instructions or computer programs stored in the memory, it implements the routing processing method provided in the embodiments of this application.
[0022] This application provides a computer-readable storage medium storing a computer program or computer-executable instructions, which, when executed by a processor, implements the routing processing method provided in this application.
[0023] This application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, they implement the routing processing method provided in this application.
[0024] The embodiments of this application have the following beneficial effects:
[0025] By generating a second routing table based on multiple first routing tables, and storing identical routes from multiple first routing tables, duplicate routes are abstracted into a single routing table, effectively reducing the memory consumption caused by storing routes repeatedly in multiple routing tables. A lookup process is performed based on the address of the route to be changed to obtain a route matching that address. When the route to be changed is located in the second routing table, it is modified to obtain the changed route. This modified route takes effect in multiple first routing tables. This narrows the scope of changing a large number of duplicate routes to the second routing table rather than all first routing tables, effectively preventing the same route from being repeatedly distributed across different routing tables, thereby improving the efficiency of routing table changes and reducing the control plane stability risks caused by massive changes. In summary, the embodiments of this application effectively reduce the total number of routes stored, effectively prevent the repeated distribution of the same route across different routing tables, and thus effectively improve the efficiency of routing table changes. Attached Figure Description
[0026] Figure 1 is a schematic diagram of the architecture of the routing processing system 100 provided in an embodiment of this application;
[0027] Figure 2 is a schematic diagram of the structure of the electronic device 500 provided in an embodiment of this application;
[0028] Figure 3 is a flowchart illustrating the routing processing method provided in an embodiment of this application;
[0029] Figure 4 is a flowchart illustrating the routing processing method provided in an embodiment of this application;
[0030] Figure 5 is a flowchart illustrating the routing processing method provided in an embodiment of this application;
[0031] Figure 6 is a flowchart illustrating the routing processing method provided in an embodiment of this application;
[0032] Figure 7 is a flowchart illustrating the routing method provided in an embodiment of this application;
[0033] Figure 8 is a flowchart illustrating the routing processing method provided in an embodiment of this application;
[0034] Figure 9 is a flowchart illustrating the routing method provided in an embodiment of this application;
[0035] Figure 10 is a flowchart illustrating the routing method provided in an embodiment of this application;
[0036] Figure 11 is a design framework diagram of the original routing table provided in an embodiment of this application;
[0037] Figure 12 is a design framework diagram of the improved routing table provided in an embodiment of this application;
[0038] Figure 13 is a schematic diagram of the routing provided in an embodiment of this application;
[0039] Figure 14 is a schematic diagram of generating a corresponding lookup tree based on a routing table according to an embodiment of this application;
[0040] Figure 15 is a schematic diagram of a two-level routing representation example provided in an embodiment of this application;
[0041] Figure 16 is a schematic diagram of a route disabling example of a two-level routing table provided in an embodiment of this application;
[0042] Figure 17 is a detailed schematic diagram of the two-level routing table lookup provided in the embodiment of this application. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0044] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0045] It is understood that in the embodiments of this application, data such as user information are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with relevant laws, regulations and standards.
[0046] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0047] In the following description, the terms “first, second, ...” are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that “first, second, ...” may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0049] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0050] 1) Virtual Private Cloud (VPC): A virtual private cloud is a logically isolated virtual network environment built for cloud computing resources such as cloud servers, cloud containers, and cloud databases. It is configured and managed independently by cloud computing tenants and aims to improve the security of tenant resources and simplify tenant network deployment. A tenant can create one or more VPCs according to network and security needs.
[0051] 2) Virtual Private Cloud Identifier (VPCID): A Virtual Private Cloud Identifier is an identifier used in cloud computing services to uniquely identify a Virtual Private Cloud. When a VPC is created, the system assigns a unique VPCID to the VPC by default.
[0052] 3) Load balancing (LB): Load balancing is a computer load processing method that distributes the workload of computer applications across multiple server nodes according to a certain allocation strategy, aiming to improve system reliability and efficiency.
[0053] 4) Subnet: A subnet is a set of routing prefixes within a VPC. It divides the VPC network segment into several blocks, each block corresponding to a subnet. Tenants can rationally plan routing prefix resources by dividing the network into subnets. All cloud resources in a VPC must be deployed within a subnet.
[0054] 5) Cloud Networks: Cloud networks are network architectures and service models based on cloud computing technology. Cloud networks virtualize traditional physical network devices and resources, enabling elastic allocation and management of network resources through the virtual network functions provided by the cloud computing platform. Cloud networks can provide flexible and scalable network services, offering users efficient, secure, and reliable network connections and communication.
[0055] 6) Cloud Gateway: A cloud gateway is a load balancing gateway that runs in a cloud network. It has network forwarding, load balancing and other capabilities. Common cloud gateways include Layer 4 load balancing gateways and Layer 7 load balancing gateways.
[0056] 7) Virtual Switch (vSwtich): A virtual switch operates in a Layer 2 data network and implements the Layer 2 (and some Layer 3) network functions of a physical switch through software.
[0057] 8) Routing: Routing, also known as routing entries or routing rules, is an item in the routing table that includes information such as destination address, subnet mask, next-hop type, and next-hop address. It determines the direction of network data packets. Routing in cloud networks is generally divided into system routing and custom routing. Routing from major cloud vendors supports both IPv4 and IPv6.
[0058] 9) Routing Table: A routing table is a collection of routing rules stored in a router, gateway, or computer. When data packets are forwarded in the network, the routing table is consulted according to the longest prefix matching algorithm to obtain information such as the next node.
[0059] 10) Longest Prefix Match (LPM) Algorithm: The Longest Prefix Match algorithm is a routing lookup technique where the "longest prefix" refers to the network address in the routing table that matches the destination route prefix of the data packet from the leftmost position. Choosing the longest prefix ensures that the data packet is forwarded through the most specific (i.e., the most precise match) path.
[0060] 11) Border Gateway Protocol (BGP): BGP is a dynamic routing protocol used for exchanging routing information between autonomous systems.
[0061] 12) Equal-Cost Multi-Path (ECMP): Equal-Cost Multi-Path is a network routing technique that allows packets to be load-balanced across multiple paths with the same cost (e.g., hop count, bandwidth, latency, etc.). The main purpose of ECMP is to improve network availability, fault tolerance, and bandwidth utilization.
[0062] 13) Open Shortest Path First (OSPF): OSPF is a link-state-based interior gateway protocol developed by the IETF for transmitting routing information within an autonomous system.
[0063] 14) Software Defined Networking (SDN): Software defined networking is a network design technology that separates the control plane and data plane of a network, thereby achieving programmability, flexibility and controllability of the network.
[0064] 15) Control plane: A concept in SDN networks, responsible for decision-making, including routing decisions, network policy formulation, traffic management, etc., and distributing the rules and flow tables corresponding to the above policies to the data plane.
[0065] 16) Data plane: A concept in SDN networks, responsible for data packet processing. It mainly receives and processes data packets according to the rules and flow tables issued by the control plane, and forwards the data packets to their destination.
[0066] 17) Key-value pairs: Key-value pairs are a method for storing, retrieving, and managing data. The key is a unique identifier used to index or identify the value associated with it; the value is the data associated with the key.
[0067] 18) Responding to: used to indicate the conditions or states on which the operation performed depends. When the conditions or states on which it depends are met, one or more operations performed may be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.
[0068] With the rapid development and popularization of cloud computing technology, the scale of cloud networks of various cloud vendors has also increased significantly, leading to a continuous increase in the pressure of routing table usage and maintenance. The routing table is the foundation for various network facilities (such as vSwitch, switches, cloud gateways, etc.) to forward data packets. When forwarding data packets, network facilities need to look up matching routing table entries based on the destination route prefix to determine the correct next-hop exit. In the IP routing table, each entry includes a route address, also known as a prefix, generally represented as P / L, where P represents the prefix address (host or network address) and L represents the prefix length (mask length of the host or network address). The process of looking up a routing table entry is also called the longest match lookup process. This involves first performing a logical AND operation between the destination route prefix to be searched and the prefix length bits in the routing table entry, then matching the result with the prefix address in the routing table entry, and selecting the route with the longest prefix length among all matches as the matching route.
[0069] Furthermore, routing tables are crucial for managing and controlling network traffic; a well-designed routing table helps enhance network flexibility and security. Cloud computing tenants can control packet flow and optimize transmission paths by configuring routing rules and appropriately selecting next-hop types, thereby improving network throughput and reducing service latency. At the product level, once a tenant associates a routing table with a subnet, that routing table can be applied to network forwarding. In the network products of mainstream cloud vendors, routing can be divided into two types: system routes and custom routes. The product policy is that only one routing table can be associated with each subnet. Therefore, a single routing table generated by the control plane contains both system routes and tenant-defined routes.
[0070] In related technologies, improvements to routing tables mainly focus on two aspects: routing table structure optimization and compact routing technology.
[0071] Routing table structure optimization primarily improves lookup performance by optimizing the data structure and lookup algorithm of the routing table. A common optimization technique is to maintain the routing table using a specific tree structure, leveraging the low complexity of tree-based lookup algorithms to accelerate routing table searches. Common tree structures used for maintaining routing tables include B-trees, trie trees, and radix trees. These tree structures are all optimized trie trees (data structure optimization, tree depth compression). Although there are some differences in design, the underlying technical principles for routing tables are similar: constructing the tree structure and performing table lookups through three logical parts: "bit comparison," "mask comparison," and "backtracking." This type of routing table optimization can improve lookup efficiency, and the compressed tree structure can also save some memory space. However, it cannot solve the problem of a large amount of duplicate routing information in different routing tables in cloud networks.
[0072] Compact routing is a special routing technique designed to optimize routing table size and shorten route length. It strikes a balance between routing table size and path length, achieving a smaller routing table while maintaining low path latency and high network performance. In some routing protocols, such as BGP or OSPF, each router stores a large amount of routing information to ensure the optimal path to any destination can be found. Compact routing reduces the amount of routing information that needs to be stored through various algorithms and techniques. Common compact routing techniques include:
[0073] (1) Hierarchical routing: By dividing the network into multiple layers or regions, simplified routing information is used within each region, while cross-region routing uses more detailed routing information.
[0074] (2) Name-dependent routing: Routing decisions are based on the name or identifier of the destination, rather than the traditional routing prefix. This can reduce the amount of routing information required by using more efficient naming and address allocation strategies.
[0075] (3) Route aggregation: Combines routing information of multiple network destinations into one entry and is used when the destinations have a certain hierarchical structure or common characteristics.
[0076] Compact routing can be effectively applied to scenarios such as data center networks that require efficient routing information management. However, it is difficult to design a compact routing algorithm that can effectively reduce the size of the routing table while maintaining path efficiency. Furthermore, due to the network isolation, bandwidth billing, and high availability requirements of cloud network scenarios, it is difficult to further apply compact routing technology.
[0077] Therefore, the related routing table designs support only a limited range of application scenarios, and most of them are optimizations for a single routing table or routing algorithm, which cannot effectively solve the problem of duplicate routes between different routing tables. In addition, the optimization of routing tables for cloud network scenarios is very limited, for example, it cannot optimize for the frequent changes of a large number of routes in cloud networks.
[0078] Based on this, embodiments of this application provide a routing processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can effectively avoid the repeated distribution of the same route in different routing tables, thereby effectively improving the efficiency of routing table changes. The electronic device provided in embodiments of this application can be implemented as a server, or implemented collaboratively by a server and a terminal. The following description uses the implementation of the routing processing method provided in embodiments of this application by a server and a terminal as an example.
[0079] For example, referring to Figure 1, Figure 1 is a schematic diagram of the architecture of the routing processing system 100 provided in an embodiment of this application. To support a routing processing application, as shown in Figure 1, the routing processing system 100 includes: a server 200, a network 300, and a router 400. The router 400 is connected to the server 200 through the network 300. The network 300 can be a local area network or a wide area network, or a combination of the two. The router 400 can be a home router, an enterprise-level router, or a backbone router, etc.
[0080] In some embodiments, multiple routers 400 transmit their stored first routing tables to server 200 via network 300. After receiving the multiple first routing tables, server 200 generates a second routing table based on the multiple first routing tables, wherein the second routing table stores the same routes in the multiple first routing tables. Then, server 200 performs a lookup process based on the address of the route to be changed to obtain the route to be changed that matches the address of the route to be changed. Subsequently, when the route to be changed is located in the second routing table, server 200 modifies the route to be changed in the second routing table to obtain the modified route. Finally, server 200 transmits the modified route to the corresponding router 400 via network 300 so that the modified route takes effect in multiple first routing tables.
[0081] It should be noted that the technical solutions provided in this application can be applied to various application scenarios, such as cloud computing scenarios, mobile communication networks, Internet of Things, branch office connections, and many other scenarios.
[0082] In some embodiments, taking a cloud computing scenario as an example, firstly, the server decouples the first routing table stored in the virtual router corresponding to each virtual machine to obtain a second routing table, where the second routing table stores multiple identical routes from the first routing table. Next, when the virtual machine's network environment changes, the server determines the address of the route to be changed corresponding to the change and performs a lookup process based on the address to be changed to obtain the route to be changed that matches the address. Subsequently, when the route to be changed is located in the second routing table, the route to be changed in the second routing table is modified to obtain the modified route, ensuring that the modified route takes effect in the first routing table of each virtual machine's corresponding virtual router. This effectively avoids the duplicate distribution of the same route in different routing tables, thereby significantly improving the efficiency of routing table changes.
[0083] In some embodiments, taking an IoT scenario as an example, firstly, the server decouples the first routing table stored in the router corresponding to each IoT device to obtain a second routing table, where the second routing table stores multiple identical routes from the first routing table. Next, when a device network changes in the IoT, the server determines the address of the route to be changed corresponding to the network change and performs a lookup process based on this address to obtain a route matching the address. Subsequently, when the route to be changed is located in the second routing table, the route in the second routing table is modified to obtain the modified route, ensuring that the modified route takes effect in the first routing table of each IoT device's corresponding router. This effectively avoids the duplicate distribution of the same route in different routing tables, thereby significantly improving the efficiency of routing table changes.
[0084] In large cloud data center networks, hundreds or thousands of tenant Virtual Private Clouds (VPCs) need to access the Internet. Traditionally, each tenant's VPC routing table (i.e., the first routing table) is configured with a default route (e.g., 0.0.0.0 / 0), whose next hop points to the IP address of the same centralized Internet gateway cluster (e.g., 192.0.2.1). When the IP address of the Internet gateway needs to be changed due to network expansion or maintenance (e.g., to 203.0.113.1), network operators must scan and modify this default route in the routing table of each tenant's VPC one by one. This process is time-consuming, cumbersome, and highly susceptible to network outages for some tenants due to omissions or misconfigurations, resulting in significant operational risks and workload. With the implementation of this application, the default route of the Internet gateway is treated as a common route, extracted from the VPC routing tables (first routing tables) of all tenants, and centrally stored in a shared second routing table (i.e., the extended routing table). When the internet gateway IP address needs to be changed, operations and maintenance personnel only need to look up the gateway IP address 192.0.2.1 as the route to be changed. The system, through lookup processing, locates the route to be changed in the second routing table. Since this route is in the second routing table, the system performs the change processing, updating its next-hop IP address to 203.0.113.1 in one go, and obtaining the changed route. This change immediately takes effect on all tenant VPCs referencing this shared route. This means that all tenant VPCs (their first routing tables) automatically and synchronously update the next hop of their default routes to the new IP address without any individual modifications. This scenario demonstrates how to simplify what was originally a high-risk, manual operation requiring thousands of steps into a one-click, second-level automated operation. This greatly improves the efficiency and reliability of network operations and maintenance, ensures global consistency of configuration changes, and significantly reduces the risk of large-scale network failures due to human error.
[0085] Large enterprises typically have a headquarters data center and dozens of branch offices across the country. Each branch office's local network router maintains its own routing table (i.e., a first routing table), which contains a route pointing to the headquarters data center's server network segment (e.g., 10.100.0.0 / 16), with the next hop pointing to the headquarters' core router. When the enterprise restructures its network, requiring the data center to be migrated to a new location and the next-hop address of the server network segment to be updated accordingly, network engineers must remotely log into each branch office's router and modify this specific route in its routing table one by one. This process is not only inefficient, but also can cause service interruptions or routing oscillations for each branch office accessing the data center during the entire update process. After applying the embodiments of this application, the same route pointing to the headquarters data center in all branch office routing tables is abstracted and centrally maintained in a second routing table within the enterprise backbone network. After the data center migration, network engineers designate the server network segment 10.100.0.0 / 16, which needs to be updated, as the route address to be changed. The system locates this route in the central second routing table through a lookup process. Subsequently, the system modifies the next-hop information of this route, pointing it to the new core router address, thus obtaining the modified route. This change takes effect in multiple first routing tables through routing protocols or configuration synchronization mechanisms. Routers in all branch offices do not require individual configuration and can immediately learn the optimal path to the new data center through the updated shared route. This scenario demonstrates the value of this invention in enterprise wide area network (WAN) scenarios. It achieves centralized, precise, and instantaneous management of critical shared routes, enabling network changes to be completed quickly and smoothly, minimizing business downtime, and improving the agility and maintainability of the entire enterprise network.
[0086] For example, server 200 in Figure 1 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. Router 400 can be a virtual router, wireless router, wired router, multi-functional router, etc., but is not limited to these. Router 400 and server 200 can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.
[0087] The structure of the electronic device provided in the embodiments of this application will be further described below. Taking a server as an example, referring to Figure 2, Figure 2 is a schematic diagram of the structure of the electronic device 500 provided in the embodiments of this application. The electronic device 500 shown in Figure 2 includes: at least one processor 510, a memory 540, and at least one network interface 520. The various components in the electronic device 500 are coupled together through a bus system 530. It can be understood that the bus system 530 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 530 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all buses are labeled as bus system 530 in Figure 2.
[0088] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0089] User interface 530 includes one or more output devices 531 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0090] The memory 540 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 540 may optionally include one or more storage devices physically located away from the processor 510.
[0091] The memory 540 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 540 described in this application embodiment is intended to include any suitable type of memory.
[0092] In some embodiments, memory 540 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0093] Operating system 541 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, for implementing various basic business functions and handling hardware-based tasks;
[0094] The network communication module 542 is used to reach other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.
[0095] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2 shows a routing processing apparatus 543 stored in a memory 540, which can be software in the form of programs and plug-ins, including the following software modules: decoupling module 5431, lookup module 5432, change module 5433, deletion module 5434, acquisition module 5435, creation module 5436, and storage module 5437. These modules are logically related, and therefore can be arbitrarily combined or further split according to the functions they implement. It should be noted that, for ease of expression, all the above modules are shown at once in Figure 2, but this should not be considered as excluding the implementation of the routing processing apparatus 543 which may only include the decoupling module 5431, the lookup module 5432, and the change module 5433. The functions of each module will be described below.
[0096] The routing processing method provided in this application will be specifically described below with reference to exemplary applications and implementations of the terminal devices provided in the embodiments of this application.
[0097] Referring to Figure 3, which is a flowchart of the routing processing method provided in an embodiment of this application, the steps shown in Figure 3 will be described in conjunction with the steps shown in Figure 3.
[0098] In step 101, a second routing table is generated based on multiple first routing tables.
[0099] Here, the second routing table stores multiple identical routes from the first routing table.
[0100] In some embodiments, each route in the routing table consists of at least an IP address, a subnet mask, and a next hop, wherein the route address includes an IP address and a subnet mask.
[0101] For example, a route's IP address could be 192.168.1.0, its subnet mask could be 255.255.255.0, and its next hop could be 192.168.0.1. This means that a packet destined for IP address 192.168.1.0 / 24 should be sent to the next hop with IP address 192.168.0.1.
[0102] It's important to note that, taking a cloud computing scenario as an example, the first routing table belongs to a specific Virtual Private Cloud (VPN) and can be associated with one or more subnets within that VPN. The first routing table contains VPN-specific routes (e.g., tenant-defined routes and routes generated by tenant-created cloud services) as well as routes automatically generated from the public network environment. The second routing table decouples these automatically generated routes from the first routing table and stores them separately. The second routing table can be associated with different subnets under different VPNs. Similarly, in an IoT scenario, the first routing table belongs to a specific device and can be associated with one or more subnets within that device. The first routing table contains device-specific routes as well as routes automatically generated from the device's public environment. The second routing table decouples these automatically generated routes from the first routing table and stores them separately. The second routing table can be associated with different subnets under different devices. Furthermore, the current routing tables can be applied to various scenarios, including cloud computing, mobile communication networks, and IoT. The network environment corresponding to the routing tables may differ in different application scenarios; therefore, no specific application scenario is limited here.
[0103] For example, taking a cloud computing scenario, assume that Virtual Private Cloud 1 includes subnet 1 and subnet 2. The first routing table corresponding to subnet 1 includes routes A, B, and C, and the first routing table corresponding to subnet 2 includes routes B, C, and D. Virtual Private Cloud 2 includes subnets 4, 5, and 6. The first routing table corresponding to subnet 4 includes routes B, C, and E, the first routing table corresponding to subnet 5 includes routes B, C, and F, and the first routing table corresponding to subnet 6 includes routes B, C, and G. By decoupling subnets 1, 2, 3, 4, and 5, the common routes in the multiple first routing tables corresponding to the five subnets are identified as routes B and C. That is, routes B and C are stored in the second routing table as common routes for subnets 1, 2, 3, 4, and 5.
[0104] In some embodiments, when performing step 101, a third routing table corresponding to each of the plurality of first routing tables may be generated based on the plurality of first routing tables. The third routing table stores the remaining routes in the corresponding first routing tables other than the same routes.
[0105] In some embodiments, the decoupling result of multiple first routing tables also includes a third routing table corresponding to each first routing table. The third routing table stores the remaining routes in the corresponding first routing table, excluding identical routes. Thus, by dividing the first routing table into a two-level storage method of second and third routing tables, the memory consumption caused by duplicate storage of routes in multiple routing tables can be effectively reduced.
[0106] It should be noted that, taking the cloud computing scenario as an example, the third routing table belongs to the same virtual private cloud as the first routing table and is associated with one or more subnets that are the same as the first routing table. The first routing table contains specific routes for the virtual private cloud. Taking the IoT scenario as an example, the third routing table belongs to the same device as the first routing table and is associated with one or more subnets that are the same as the first routing table. The first routing table contains specific routes for the device. In other words, the third routing table stores the remaining routes corresponding to the same routes stored in the first routing table, excluding those stored in the second routing table.
[0107] Continuing with the example above, the route stored in the third routing table of subnet 1 is route A, the route stored in the third routing table of subnet 2 is route D, the route stored in the third routing table of subnet 3 is route E, the route stored in the third routing table of subnet 4 is route F, and the route stored in the third routing table of subnet 5 is route G.
[0108] In step 102, a lookup process is performed based on the address to be changed to obtain the route to be changed that matches the address to be changed.
[0109] In some embodiments, firstly, the route address to be changed (including IP address and subnet mask) is determined. Here, the route address to be changed can be determined by searching for routes directly related to the faulty link, or the route address to be changed can be directly obtained according to changes in business requirements. The specific method for obtaining the route address to be changed can be determined according to actual needs and is not specifically limited here. Next, a search is performed on all routes in the current routing table based on the IP address and subnet mask of the route to be changed. Here, the search can be performed by directly traversing the routing table, or by constructing a compressed binary tree and performing hierarchical matching on the compressed binary tree. The specific search method can be determined according to actual conditions and is not specifically limited here. Finally, the found route is used as the route to be changed for matching the route address to be changed.
[0110] For example, assume the current routing table includes Route 1, Route 2, and Route 3; Route 1's IP address is 192.168.1.0, subnet mask is 255.255.255.0, and next hop is 192.168.0.1; Route 2's IP address is 192.168.2.0, subnet mask is 255.255.255.0, and next hop is 192.168.0.2; Route 3's IP address is 10.0.0.0, subnet mask is 255.255.255.0, and next hop is 192.168.0.3; First, determine that the route address to be changed is 192.168.2.0 / 24 (where the first part is the IP address, i.e., 192.168.2.0, and the second part is the subnet mask, i.e., 255.255.255.0); then, traverse each route in the routing table. The route address of route 1, 192.168.1.0 / 24, does not match the route address to be changed, while the route address of route 2, 192.168.2.0 / 24, matches the route address to be changed; finally, select route 2 as the route to be changed that matches the route address to be changed.
[0111] In some embodiments, referring to FIG4, FIG4 is a schematic flowchart of the routing processing method provided in the embodiments of this application. As shown in FIG4, step 102 shown in FIG3 can be implemented by step 1021A or step 1022A shown in FIG4. The steps shown in FIG4 will be described in conjunction with the steps shown in FIG4.
[0112] In step 1021A, when the total number of routes in the routing table to be searched is greater than the total number of routes threshold, a compressed binary tree corresponding to the routing table to be searched is generated, and the search process is performed in the compressed binary tree based on the route address to be changed.
[0113] It should be noted that the total number of routes threshold can be a preset value or dynamically determined based on the current application scenario; no specific limitation is made here.
[0114] In some embodiments, referring to FIG5, FIG5 is a schematic flowchart of the routing processing method provided in the embodiments of this application. As shown in FIG5, step 1021A shown in FIG4 can be implemented by steps 10211A to 10215A shown in FIG5, and will be described in conjunction with the steps shown in FIG5.
[0115] In step 10211A, the routing prefixes of all routes included in the routing table to be searched are sorted based on the mask length to obtain the routing prefix sequence.
[0116] In some embodiments, firstly, the routing addresses (including IP addresses and subnet masks) of all routes are extracted from the second routing table; then, for each IP address, the length of the subnet mask is calculated, where the subnet mask length represents the boundary between the network portion and the host portion of the network address, and the longer the length, the more specific the network portion; finally, the prefix sequence of the route is determined based on the subnet mask length of each route.
[0117] For example, suppose the second routing table contains routes 1, 2, and 3. Route 1 has a route prefix of 192.168.1.0 and a subnet mask of 255.255.255.0; route 2 has a route prefix of 192.168.1.0 and a subnet mask of 255.255.255.128; and route 3 has a route prefix of 192.168.2.0 and a subnet mask of 255.255.0.0. Then, for each route prefix, the subnet mask length is calculated: route 1 has a mask length of 24, route 2 has a mask length of 25, and route 3 has a mask length of 16. Finally, the resulting route prefix sequence is {25, 24, 16}.
[0118] In step 10212A, a compressed binary tree is created, and steps 10213A to 10215A are executed sequentially for each route prefix in the route prefix sequence.
[0119] It should be noted that before creating a compressed binary tree, the node structure of the compressed binary tree needs to be defined, and the root node of the compressed binary tree needs to be created. All attributes of the root node are set to the initial state, and the compressed binary tree is created using the initialized root node.
[0120] In step 10213A, the routing prefix is matched starting from the root node of the compressed binary tree.
[0121] In some embodiments, the route with the shortest route prefix in the route prefix sequence is selected as the root node, and subsequent nodes are matched sequentially.
[0122] Following the example above, route 3 can be used as the root node of the compressed binary tree.
[0123] In some embodiments, when there are multiple routes with the shortest prefix in the route prefix sequence (for example, the prefix sequences of two routes with the shortest prefix are both 16), the routes are matched, a new node is generated based on the matching prefix length of the two routes, and the new node is used as the root node of the compressed tree.
[0124] For example, suppose there are two routes in the route prefix sequence with corresponding route addresses of 10.0.10.0.24 / 24 and 10.0.11.0 / 24 respectively. Then, the two routes are matched to obtain a matching prefix length of 23, and 10.0.10.0 / 23 is generated as the root node of the compressed tree.
[0125] It should be noted that after performing step 10213A, the child nodes of the first node can be matched with the routing prefix, and step 10214A or step 10215A can be performed according to the comparison result.
[0126] In step 10214A, when a child node of the first node matches a routing prefix, the route corresponding to the routing prefix is moved to a child node of the first node.
[0127] In some embodiments, it is checked whether the child nodes of the first node match the routing prefix. Here, the IP address of the child node can be summed with the IP address of the routing prefix and compared with the subnet mask of the routing prefix. If the child node matches the routing prefix, the corresponding route is moved from the routing table of the first node to the routing table of the child node. After moving the route, it may be necessary to update the routing information of other related nodes to ensure that other nodes are aware of the new route address.
[0128] For example, suppose the child node of the first node is 192.168.1.0 / 24 and the route prefix is 192.168.1.0 / 24. By comparison, it is confirmed that the child node 192.168.1.0 / 24 matches the route prefix 192.168.1.0 / 24. Therefore, the route 192.168.1.0 / 24 is moved from the routing table of the first node to the routing table of the child node.
[0129] In step 10215A, when the first node does not have a child node that matches the route prefix, the route corresponding to the route prefix is moved to the newly created node, and the newly created node is linked to the first node.
[0130] In some embodiments, when the first node does not have a child node that matches the routing prefix, a new node is created based on the routing prefix, the routing prefix is moved to the newly created node, and the newly created node is linked to the first node.
[0131] For example, assuming the IP address of the first node is 192.168.0.1 and the routing prefix is 192.168.10.0 / 24, if the matching process finds that the first node has no child node matching 192.168.10.0 / 24, then a new node 192.168.10.1 is created, the routing prefix is moved to the new node 192.168.10.1, and the newly created node 192.168.10.1 is linked with the first node 192.168.0.1.
[0132] In step 10216A, when all routes in the routing table to be searched have been moved to the compressed binary tree, the compressed binary tree is used as the compressed binary tree of the corresponding routing table to be searched.
[0133] Here, once all routes in the routing table to be searched have their corresponding nodes determined in the compressed binary tree, it means that the compressed binary tree has been created. The compressed binary tree that has been moved is then used as the compressed binary tree for the corresponding routing table to be searched.
[0134] This application not only reduces the storage space of the routing table by creating a compressed binary tree, but also provides a faster point lookup rate, which can effectively improve the efficiency of routing table lookup.
[0135] In step 1022A, when the total number of routes in the routing table to be searched is not greater than the total number of routes threshold, the longest prefix matching process is performed in the routing table to be searched based on the address of the route to be changed.
[0136] In some embodiments, when the total number of routes in the routing table to be looked up is not greater than the total number of routes threshold, the longest prefix matching algorithm is used to find the route that best matches the route address to be changed. The route address to be changed is matched with each route address in the second routing table to obtain the matching prefix length between each route address and the route address to be changed. The route corresponding to the longest matching prefix is taken as the route to be changed.
[0137] For example, suppose the routing table to be looked up contains route 1 with a route address of 192.168.1.0 / 24, route 2 with a route address of 192.168.2.0 / 24, and route 3 with a route address of 192.168.1.8 / 29. The route address to be changed is 192.168.1.10 / 24. Using the longest prefix matching algorithm, the matching prefix length between route 1 and the route address to be changed is determined to be 24, the matching prefix length between route 2 and the route address to be changed is 22, and the matching prefix length between route 3 and the route address to be changed is 30. Therefore, the matching prefix length between route 3 and the route address to be changed is the longest, and route 3 is selected as the route to be changed.
[0138] The routing table to be looked up here can be the second routing table or the third routing table. The third routing table is the routing table corresponding to each first routing table, and the third routing table contains the remaining routes in the corresponding first routing table except for the same routes. The same routes here are the shared routes of multiple first routing tables stored in the second routing table.
[0139] This application dynamically determines the lookup strategy based on the total number of routes in the routing table. When the number of routes in the routing table is small, the routing table can be traversed directly to find the target route, which can reduce the time required to build the compressed tree. When the number of routes in the routing table is large, building the compressed tree can significantly reduce the number of table lookups, thereby effectively improving the efficiency of table lookup.
[0140] In some embodiments, referring to FIG6, FIG6 is a schematic flowchart of the routing processing method provided in the embodiments of this application. As shown in FIG6, step 102 shown in FIG3 can be implemented by steps 1021B to 1023B shown in FIG6, and will be described in conjunction with the steps shown in FIG6.
[0141] In step 1021B, a lookup is performed in the second routing table based on the route address to be changed, and a first lookup result is obtained.
[0142] In some embodiments, firstly, a suitable search algorithm is selected, such as prefix tree matching or a search method using other data structures; then, the selected search algorithm is used to match each route in the second routing table to obtain the corresponding search result.
[0143] For example, assuming the second routing table includes routes 1, 2, and 3, the route to be changed is matched one by one with routes 1, 2, and 3, and the final search result is determined based on the final matching result. For example, if the final matching result of the route to be changed indicates that it matches route 1, then the search result is that the search in the second routing table was successful. If the final matching result of the route to be changed does not match routes 1, 2, and 3, then the search result is that the search in the second routing table failed.
[0144] It should be noted that after performing step 1021B, you can perform step 1022B or step 1023B as described below based on the search results.
[0145] In step 1022B, when the first lookup result indicates that the lookup in the second routing table failed, a lookup process is performed in the third routing table based on the address to be changed, to obtain the route to be changed that matches the address to be changed.
[0146] It should be noted that when the first lookup result indicates that the lookup in the second routing table has failed, a lookup process is performed in the third routing table based on the route address to be changed. The lookup process in the third routing table can be the same as or different from the lookup process in the second routing table in step 1021B, and no specific limitation is made here.
[0147] For example, assuming the lookup method for the third routing table in step 1022B is the same as that in step 1021B, and the third routing table includes routes 4 and 5, if the final matching result of the route to be changed successfully matches route 4, then the route to be changed matching the address of the route to be changed is route 4. If the final matching result of the route to be changed fails to match both routes 4 and 5, then the lookup fails. Alternatively, assuming the lookup method for the third routing table in step 1022B is different from that in step 1021B, and the third routing table includes routes 4 and 5, if the matching prefix between the route to be changed and route 4 is 24, and the matching prefix between the route to be changed and route 5 is 20, then the route to be changed matching the address of the route to be changed is route 4.
[0148] In step 1023B, when the first lookup result indicates a successful lookup in the second routing table, the found route is used as the route to be changed that matches the address of the route to be changed.
[0149] Following the example in step 1021B, assuming that the final matching result of the route to be changed indicates a match with route 1, then route 1 will be taken as the route to be changed that matches the address of the route to be changed.
[0150] This application can quickly determine whether a matching route exists by first searching the address to be changed in the second routing table. If the search fails, it then searches the third routing table, which reduces unnecessary search steps and improves overall search efficiency. In addition, by effectively managing the routing table, the storage space requirement is reduced and the transmission of a large amount of unnecessary routing information between network devices is avoided.
[0151] In some embodiments, referring to FIG7, FIG7 is a schematic flowchart of the routing processing method provided in the embodiments of this application. As shown in FIG7, after executing step 101 shown in FIG3, steps 104A to 105A shown in FIG7 can also be executed. The steps shown in FIG7 will be described in conjunction with the steps shown in FIG7.
[0152] In step 104A, in response to the deletion operation of the first route in the target first routing table, and the first route belongs to the same route, the second routing table remains unchanged, and the first route is added to the third routing table of the corresponding target first routing table.
[0153] Here, the target first routing table is derived from multiple first routing tables.
[0154] In some embodiments, first, the first route to be deleted from the first routing table is determined; then, the route type is checked (here, it belongs to the same route, that is, the first route belongs to the second routing table); then, the first route is added to the third routing table.
[0155] For example, suppose the first routing table includes routes 1, 2, 3, and 4, the corresponding second routing table includes routes 2 and 3, and the third routing table includes routes 1 and 4. If the first route to be deleted is route 2, and route 2 belongs to the same route, then add route 2 from the second routing table to the third routing table, so that the third routing table includes routes 1, 2, and 4.
[0156] During the deletion operation, keeping the second routing table unchanged ensures the stability and consistency of common routes, preventing changes to a single route from affecting the communication of the entire network. Adding the first route to be deleted to the third routing table allows for flexible handling of specific routes, and marking the first route as disabled in the third routing table makes routing table management easier.
[0157] In step 105A, the disabled state of the first route is marked in the third route table of the corresponding target first route table.
[0158] Following the example above, after adding route 2 to the third routing table, route 2 in the third routing table is marked as disabled to indicate that the first route in the first routing table has been deleted.
[0159] In some embodiments, referring to FIG8, FIG8 is a schematic flowchart of the routing processing method provided in the embodiments of this application. As shown in FIG8, after executing step 101 shown in FIG3, step 104B shown in FIG8 can also be executed. The description will be based on the steps shown in FIG8.
[0160] In step 104B, in response to the deletion operation of the first route in the target first routing table, and the first route does not belong to the same route, the first route is marked as disabled in the third routing table of the corresponding target first routing table.
[0161] Here, the target first routing table is derived from multiple first routing tables.
[0162] For example, suppose the first routing table includes routes 1, 2, 3, and 4, the corresponding second routing table includes routes 2 and 3, and the third routing table includes routes 1 and 4. If the first route to be deleted is determined to be route 4, and route 4 is located in the third routing table (i.e., it does not belong to the same route), then route 4 in the third routing table is marked as disabled to indicate that the first route in the first routing table has been deleted.
[0163] This application improves the management efficiency of routing tables and enhances network stability and reliability by performing detailed routing management between the second and third routing tables, providing a more refined and efficient network management tool.
[0164] In some embodiments, referring to FIG9, FIG9 is a schematic flowchart of the routing processing method provided in the embodiments of this application. As shown in FIG9, after executing step 101 shown in FIG3, steps 106 to 108 shown in FIG9 can also be executed. The steps shown in FIG9 will be described in conjunction with the steps shown in FIG9.
[0165] In step 106, in response to a query operation for the target route address in the target first routing table, a query process is performed in the third routing table corresponding to the target first routing table to obtain at least one first matching route.
[0166] Here, the target first routing table is derived from multiple first routing tables.
[0167] In some embodiments, when a query operation is received for the target route address in the first routing table, the third routing table is accessed and the query is performed on the third routing table. Here, the search can be performed by directly traversing the third routing table, or by constructing a compressed binary tree and performing hierarchical matching on the compressed binary tree; at least one route matching the target route address is found from the third routing table.
[0168] For example, taking direct traversal of the third routing table as an example, assuming the third routing table includes route 1, route 2, route 3, and route 4, by matching the destination route address with the route address of each route, we find that the matching prefix length between route 1 and the destination route address is 20, the matching prefix length between route 2 and the destination route address is 24, the matching prefix length between route 3 and the destination route address is 19, and the matching prefix length between route 4 and the destination route address is 23. Here, we can directly regard routes 1, 2, 3, and 4 as at least one route that matches the destination route address. Assuming that a route with a matching prefix length greater than 22 is considered a route that matches the destination address, that is, routes 2 and 4 are considered at least one route that matches the destination route address.
[0169] In another example, let's consider constructing a compressed binary tree and performing a layered matching search within it. Assume the root node of the compressed binary tree is route 1, the second layer includes routes 2 and 3 (i.e., routes 2 and 3 are children of route 1), and the third layer includes routes 4 and 5 (i.e., routes 4 and 5 are children of route 3, and route 2 has no children). Then, based on the target route address, the compressed binary tree is matched layer by layer. First, the nodes in the first layer of the compressed binary tree (i.e., route 1) are matched, resulting in a prefix length of 19 between route 1 and the target route address. Next, the child nodes of route 1 in the second layer of the compressed binary tree are matched... Matching (i.e., routes 2 and 3), we find that the prefix length of the match between route 2 and the target route is 23, and the prefix length of the match between route 3 and the target route is 24. Therefore, in the second layer, route 3 is a route that matches the target route address. Subsequently, we match the child nodes of route 3 in the third layer of the compressed binary tree (i.e., routes 4 and 5). We find that the prefix length of the match between route 4 and the target route is 25, and the prefix length of the match between route 5 and the target route is 26. Therefore, in the third layer, route 5 is a route that matches the target route address. Finally, we can conclude that routes 1, 3, and 5 are at least one route found in the third routing table that matches the target route address.
[0170] In step 107, a query is performed in the second routing table to obtain at least one second matching route.
[0171] It should be noted that the implementation method of step 107 is similar to that of step 106, and the specific implementation method of step 106 can be referred to, which will not be repeated here. In addition, the query method of step 107 can be the same as that of step 106 (i.e., both use the method of directly traversing the routing table to search, or both use the method of constructing a compressed binary tree and performing hierarchical matching on the compressed binary tree to search), or it can be different from the query method of step 106 (i.e., one uses the method of directly traversing the routing table to search, and the other uses the method of constructing a compressed binary tree and performing hierarchical matching on the compressed binary tree to search), and no specific limitation is made here.
[0172] In step 108, at least one first matching route and at least one second matching route are matched to obtain the target route corresponding to the target route address.
[0173] This application determines the target route for the target route address by querying and matching routing information in the target's first routing table, third routing table, and second routing table. This allows for more accurate matching of routing information, optimizes route lookup performance, and ensures network consistency and reliability.
[0174] In some embodiments, referring to FIG10, FIG10 is a schematic flowchart of the routing processing method provided in the embodiments of this application. As shown in FIG10, step 108 shown in FIG3 can be described in conjunction with steps 1081 to 1085 shown in FIG10.
[0175] In step 1081, a first set consisting of at least one first matching route is generated, and a second set consisting of at least one second matching route is generated.
[0176] For example, suppose the first matching route includes route 1 and route 2, where the routing address of route 1 is 10.0.12.0 / 23 and the routing address of route 2 is 10.0.13.0 / 24; the second matching route includes route 3 and route 4, where the routing address of route 3 is 10.0.12.0 / 23 and the routing address of route 4 is 10.0.13.128 / 25; then the generated first set can be represented as {10.0.12.0 / 23, 10.0.13.0 / 24}, and the generated second set can be represented as {10.0.12.0 / 23, 10.0.13.128 / 25}.
[0177] In step 1082, the first best matching route is obtained from the first set, and the second best matching route is obtained from the second set.
[0178] It should be noted that here, the matching route with the longest matching prefix can be selected from the set as the best matching route.
[0179] Continuing with the example above, we can obtain the routing address of the first best matching route in the first set as 10.0.13.0 / 24, and the routing address of the second best matching route in the second set as 10.0.13.128 / 25.
[0180] In step 1083, the route with the longest prefix among the first and second best-matching routes is taken as the target route to be determined, and the first and second best-matching routes are removed from their respective sets.
[0181] Following the above embodiment, by comparing the first most matching route and the second most matching route, it can be seen that the route address of the route with the longest prefix is 10.0.13.128 / 25. That is, the route corresponding to the route address 10.0.13.128 / 25 is taken as the target route to be determined, and the first most matching route and the second most matching route are deleted from the first set and the second set respectively. The first set after deletion is {10.0.12.0 / 23}, and the second set after deletion is {10.0.12.0 / 23}.
[0182] It should be noted that after executing step 1083, step 1084 or step 1085 can be executed depending on whether the target route is disabled.
[0183] In step 1084, when the pending target route is disabled, a new pending target route is determined based on the current first set and the current second set to replace the pending target route.
[0184] Continuing with the example above, suppose the pending destination route (i.e., the route corresponding to route address 10.0.13.128 / 25) is disabled, indicating that the pending destination route has been deleted from the first routing table. Therefore, it is necessary to select the second best matching route from the second set, i.e., the route corresponding to 10.0.12.0 / 23, and compare the first best matching route and the second best matching route again. It can be seen that the route with the longest prefix has the route address 10.0.13.0 / 24. That is, the route corresponding to route address 10.0.13.0 / 24 is selected as the pending destination route to replace the route corresponding to route address 10.0.13.128 / 25.
[0185] In step 1085, when the pending target route is not disabled, the pending target route is used as the target route for the corresponding target route address.
[0186] Continuing with the example above, assuming the target route (i.e. the route corresponding to route address 10.0.13.128 / 25) is not disabled, the route corresponding to route address 10.0.13.128 / 25 will be directly used as the target route for the corresponding target route address.
[0187] This technical solution achieves efficient and reliable optimal route selection through an intelligent parallel query and dynamic optimization mechanism. Its technical effects are mainly reflected in the following three aspects: Ensuring optimal route selection: By querying multiple routing tables (first and second sets) in parallel and using the "longest prefix matching" principle to select the most accurate route from candidate routes, the network-level optimality of the data forwarding path is effectively guaranteed, improving network efficiency. Enhancing the reliability and fault tolerance of route management: An innovative mechanism for checking and handling "disabled states" is introduced. When the optimal route is unavailable, the system can automatically and seamlessly degrade to the suboptimal route, avoiding service interruptions caused by a single route failure and significantly enhancing network resilience and service continuity. Improving the efficiency of the route lookup process: By grouping matching routes into sets and iteratively processing them according to rules, the lookup logic is optimized. This clear process structure avoids repeated judgments on invalid or suboptimal routes, thereby reducing computational overhead and accelerating the final route decision-making speed.
[0188] In some embodiments, before performing step 102, the following processes may also be performed: performing any of the following processes: in response to a routing change operation of an object, obtaining the routing address to be changed corresponding to the routing change operation; in response to a migration event or change event of a network component, obtaining the destination address involved in the migration event or change event as the routing address to be changed. This ensures the continuity and efficiency of network communication.
[0189] In some embodiments, the network management system or router configuration interface is detected to detect whether there is a request or command for route change. If a route change operation is detected, the details of the change request are analyzed and the route address to be changed is extracted from the change request. The route address to be changed includes the IP network address and the subnet mask. After obtaining the route address to be changed, further processing operations such as updating the routing table and notifying relevant network components or devices can be performed.
[0190] For example, suppose a network administrator decides to change the route for IP address 192.168.10.0 / 24 through the network management system, changing its next hop from 192.168.5.1 to 192.168.6.1. When the detection system detects this change operation, it extracts the address to be changed as 192.168.10.0 / 24 from the change command and further performs an update of the routing table.
[0191] In other embodiments, migration or change events of network components are identified through tools, log systems, or event management systems, and the information of migration or change events is analyzed to determine the network components involved in the event. If the migration or change affects routing, the corresponding routing address is extracted from the network component as the routing address to be changed. After obtaining the routing address to be changed, further processing operations such as updating the routing table and notifying relevant network components or devices can be performed.
[0192] For example, suppose a server migrates from subnet 192.168.2.0 / 24 to subnet 192.168.3.0 / 24. After the network detection system detects the server migration, it determines that the server's new address 192.168.3.0 / 24 needs to update its routing information. The system then treats 192.168.3.0 / 24 as the routing address to be changed and performs the corresponding routing update operation.
[0193] This application's embodiment intelligently acquires the address to be changed through a dual-trigger mechanism, achieving precision and automation in network change operations. It improves operational accuracy and efficiency by directly locking onto the target route in response to specific route change operations, avoiding the tedious and potentially inaccurate manual lookups in the full routing table, making change operations more precise and efficient. It also enhances the system's proactive adaptability and reliability: when underlying network components (such as gateways and servers) migrate or change, the system automatically captures the event and extracts the relevant destination address as the change target, achieving dynamic coordination between network routing and infrastructure status. This significantly reduces the risk of route failure due to underlying changes, improving the overall reliability and self-healing capability of the system. This design combines manual and event-driven approaches to form an intelligent, efficient, and reliable route change triggering system, providing crucial support for the automated operation and stable operation of large-scale networks.
[0194] In step 103, when the route to be changed is located in the second routing table, the route to be changed in the second routing table is modified to obtain the changed route.
[0195] Here, the changed route takes effect in multiple first routing tables.
[0196] It should be noted that when the route to be changed is located in the second routing table, the change can be made directly on the second routing table, or the change can be made to the route to be changed and then added to the third routing table.
[0197] In some embodiments, firstly, the routing entries that need to be modified in the second routing table are determined, such as IP addresses and next-hop addresses. Then, the routing entries to be modified in the second routing table are modified, ensuring that the modification operation complies with network policies and routing protocols. Once the second routing table confirms the successful modification, the modified routing information is synchronized to all relevant first routing tables, so that the modified route takes effect in multiple first routing tables. In this way, by synchronizing the modified routing information to all relevant first routing tables, the consistency of routing information throughout the network is ensured, avoiding data inconsistencies between different routing tables. Furthermore, centralizing routing changes in the second routing table reduces the need for repeated modification operations on duplicate routes in multiple first routing tables, preventing the same route from being repeatedly distributed across different routing tables, thereby improving the efficiency of routing table changes.
[0198] For example, suppose the IP address corresponding to the route that needs to be changed in the second routing table is determined to be 192.168.1.0, the subnet mask is 255.255.255.0, and the next-hop address is 192.168.2.1. If it is determined that the next-hop address in the route to be changed will be changed from 192.168.2.1 to 192.168.2.2, then the next hop of the route to be changed 192.168.1.0 / 24 will be changed from 192.168.2.1 to 192.168.2.2. The changed routing information will be synchronized to all relevant first routing tables, while the route to be changed in the second routing table remains unchanged.
[0199] In another example, suppose the IP address corresponding to the route that needs to be changed in the second routing table is determined to be 192.168.1.0, the subnet mask is 255.255.255.0, and the next-hop address is 192.168.2.1. If it is determined that the next-hop address in the route to be changed will be changed from 192.168.2.1 to 192.168.2.2, then the next hop of the route to be changed 192.168.1.0 / 24 in the second routing table will be changed from 192.168.2.1 to 192.168.2.2. The changed routing information will be synchronized to all relevant first routing tables so that the changed route takes effect in multiple first routing tables.
[0200] In some embodiments, when the route to be changed is located in a third routing table, the route to be changed in the third routing table is modified to obtain the modified route.
[0201] Here, the changed route takes effect in the first routing table corresponding to the third routing table.
[0202] In some embodiments, firstly, the routing entries that need to be changed in the third routing table are determined, such as IP addresses, next-hop addresses, etc.; then, the routing entries to be changed in the third routing table are modified, and it is determined that the modification operation complies with the requirements of network policies and routing protocols; when the third routing table confirms that the change is successful, the changed routing information is synchronized to the first routing table related to the third routing table, so that the changed route only takes effect in the first routing table corresponding to the third routing table.
[0203] For example, suppose the IP address corresponding to the route that needs to be changed in the third routing table is determined to be 192.168.11.0, the subnet mask is 255.255.0.0, and the next-hop address is 192.168.10.1. If it is determined that the next-hop address in the route to be changed will be changed from 192.168.10.1 to 192.168.10.2, then the next hop of the route to be changed 192.168.11.0 / 16 in the third routing table will be changed from 192.168.10.1 to 192.168.10.2. The changed routing information will be synchronized to the first routing table associated with the third routing table, so that the changed route only takes effect in the first routing table corresponding to the third routing table.
[0204] This solution significantly improves network operation and maintenance efficiency and reliability through routing table decoupling and centralized management of shared routes. Its technical effects are mainly reflected in: Enabling efficient and accurate operation and maintenance changes: Aggregating identical routes from multiple first routing tables into a unified second routing table simplifies changes to shared routes from multiple repetitive operations to a one-time operation. When such routes need modification, only one change needs to be performed in the second routing table for global effect, greatly improving operation and maintenance efficiency and accuracy. Ensuring configuration consistency and reliability: Managing shared routes through a centralized second routing table fundamentally eliminates omissions or configuration inconsistencies that may result from manual modifications, ensuring strict synchronization of network policies across all relevant first routing tables, enhancing overall network stability and reliability. Optimizing system resources and architectural clarity: This decoupled architecture eliminates redundant storage of identical routes in multiple locations, saving memory and computing resources. Simultaneously, it clearly defines the management boundaries between shared routes and tenant-specific routes, making the network architecture clearer and facilitating maintenance and fault location.
[0205] In some embodiments, before executing step 101, the following processes may also be performed: In response to a first creation operation for a first virtual network environment, obtain a shared route automatically generated based on a public network environment during the creation process, a first custom route of the first object initiating the first creation operation, and a route corresponding to the first virtual network environment; and create a first routing table corresponding to the first virtual network environment based on the shared route, the first custom route, and the route corresponding to the first virtual network environment; In response to a second creation operation for a second virtual network environment, obtain a shared route automatically generated based on a public network environment during the creation process, a second custom route of the second object initiating the second creation operation, and a route corresponding to the second virtual network environment; and create a first routing table corresponding to the second virtual network environment based on the shared route, the second custom route, and the route corresponding to the second virtual network environment. This ensures communication within the virtual network environment and connectivity with external networks, while also meeting the personalized routing needs of specific objects.
[0206] In some embodiments, firstly, when creating the first virtual network environment, the public network environment automatically allocates some shared routes, which can be used to access external network resources. The shared routes are extracted from the public network environment. Next, the first creation operation may involve specific routing requirements of the first object (e.g., a virtual machine or a server), wherein the specific routing requirements are proposed in the form of custom routes, and the custom routes are identified and obtained. Subsequently, based on the network topology and requirements of the first virtual network environment, the corresponding routes in the first virtual network environment are determined. Afterward, based on the shared routes, the first custom routes, and the routes of the first virtual network environment, a comprehensive routing table (i.e., the first routing table) is constructed.
[0207] For example, assuming the shared route in the first virtual network includes 0.0.0.0 / 0, the first custom route includes 10.10.1.0 / 24, and the route in the first virtual network environment includes 192.168.10.0 / 24, then the corresponding first routing table includes 0.0.0.0 / 0, 10.10.1.0 / 24, and 192.168.10.0 / 24.
[0208] In other embodiments, the implementation of constructing the first routing table of the second virtual network environment is similar to that of constructing the first routing table of the first virtual network environment. For details, please refer to the implementation of constructing the first routing table of the first virtual network environment, which will not be repeated here.
[0209] For example, assuming the shared route in the second virtual network includes 0.0.0.0 / 0, the second custom route includes 10.10.2.0 / 24, and the route in the first virtual network environment includes 192.168.20.0 / 24, then the corresponding first routing table includes 0.0.0.0 / 0, 10.10.2.0 / 24, and 192.168.20.0 / 24.
[0210] In some embodiments, this application further includes a combined routing table, which includes: a second routing table shared by multiple first routing tables and a third routing table corresponding to each first routing table; the second routing table stores the same routes in the multiple first routing tables; and the third routing table stores the remaining routes in the corresponding first routing tables other than the same routes.
[0211] It's important to note that the second routing table contains common or shared routes from multiple first routing tables. These routes are used by multiple first routing tables, such as default routes to the Internet or routes to major network services. Furthermore, the second routing table is shared by multiple first routing tables, and any update to the second routing table affects all first routing tables that use it. The third routing table contains specific routes from the corresponding first routing table, excluding shared routes. These routes are specific to a single first routing table, and each first routing table has an independent third routing table. That is, the content of each third routing table is unique and specifically serves a corresponding first routing table.
[0212] The combined routing table architecture proposed in this application further splits the original single routing table or the decoupled ordinary routing table (first routing table) into a shared second routing table and a dedicated third routing table, achieving a fine-grained separation of routing data both logically and physically. This architectural change brings about a series of synergistic technical effects:
[0213] 1. Significantly optimizes storage resources and reduces hardware costs. By extracting and merging duplicate routing entries (identical routes) from multiple first routing tables into a single second routing table, redundant storage is completely eliminated. The specific content of each first routing table is only retained in its respective third routing table, resulting in a substantial reduction in its size.
[0214] 2. Significantly improves routing lookup and forwarding performance. The routing lookup engine can adopt more efficient strategies during lookups. For example, it can query the second and third routing tables in parallel, or intelligently select the table to query first based on destination address characteristics. Smaller third routing tables are more easily cached in the high-speed cache, further accelerating the lookup speed. This reduces the average routing lookup latency, improves packet forwarding efficiency, and provides the network with higher throughput and lower latency, which is crucial for high-performance computing and real-time applications.
[0215] 3. Achieving precise decoupling and efficient management of operational responsibilities, this architecture clearly delineates the operational boundaries of different roles. The second routing table (shared): maintained by the cloud platform operator or global network administrator. Its content includes routes related to the underlying network infrastructure (such as gateways, peering connections, and shared services). The third routing table (dedicated): maintained by the tenant or business operations personnel. Its content includes routes entirely belonging to the tenant's custom network topology (such as inter-subnet routes and policy-specific routes).
[0216] 4. Enhanced network resilience and scalability: When a new tenant or network node needs to be added, the system only needs to create a small, initially empty third routing table for it and allow it to share the existing second routing table. New tenant onboarding becomes very fast and lightweight, and the overall network system's expansion is almost unrestricted by the amount of routing table data, demonstrating excellent scalability.
[0217] 5. Provides a clearer logical view of routing, facilitating fault location. When routing issues occur, operations personnel can check the second and third routing tables separately. First, check the third routing table to confirm the correctness of tenant-defined routes. If the third routing table is correct, check the second routing table to confirm the shared infrastructure is functioning properly. This separation provides a clear troubleshooting path, avoiding the tedious task of searching through a single, large routing table, and significantly shortening the Mean Time To Repair (MTTR).
[0218] The "combined routing table" described in this application is not a simple aggregation of functions, but a profound architectural innovation. Through the separation of "shared" and "dedicated" resources, it generates synergistic enhancements across multiple core dimensions, including resource utilization, performance, operation and maintenance management, scalability, and maintainability. This provides an efficient, elegant, and cost-effective systematic solution to the routing management challenges in large-scale, multi-tenant network environments. This architectural advancement is a key manifestation of the inventiveness of this application.
[0219] In some embodiments, generating a second routing table based on multiple first routing tables can be achieved by the following technical solution: obtaining the same route in the multiple first routing tables; and generating the second routing table based on the same route.
[0220] As an example, all routing entries in the multiple first routing tables are retrieved. Specifically, this can be done by periodically or on-demand batch reading of all contents of the first routing tables through network management protocols (such as SNMP) or direct access to the router's configuration database. Comparative analysis identifies identical routes, where "identical routes" refer to routing entries with identical destination network address prefixes and next-hop addresses. In one implementation, a hash algorithm can be used: calculate the hash value of each routing entry (in the string form of "destination network / mask: next hop"), and group routing entries with the same hash value into the same group. The group with the largest number of hash values is considered the "identical route" to be extracted. In another implementation, a sorting and comparison algorithm can be used: sort all routing entries by destination network and next hop, then traverse the sorted list to identify consecutively repeating routing entries. Based on these identical routes, a second routing table is generated. One or more identified "identical route" entries are written into a new, independent second routing table. Subsequently, network devices can be configured to prioritize or last query this second routing table during route queries.
[0221] This embodiment uses static aggregation to quickly build a shared routing table from an existing network environment, making it particularly suitable for network initialization deployments or periodic optimization scenarios. It effectively reduces the storage of redundant routing entries, laying the foundation for efficient operation and maintenance with "one-time changes, global impact."
[0222] In some embodiments, generating a second routing table based on multiple first routing tables can be achieved through the following technical solution: detecting routing change events corresponding to each of the first routing tables and identifying the routes that have changed in the routing change events; when the changed routes conform to predefined shared routing rules, adding the changed routes to the second routing table.
[0223] As an example, route change events in the first routing table are detected. Specifically, an event detector can be registered on the router or SDN (Software-Defined Networking) controller. When any route entry is added, modified, or deleted in the first routing table, the system immediately captures this route change event and its details. The route that has been changed in the route change event is identified. The specific change content is extracted from the event information, for example, a new route 10.0.0.0 / 8->Gateway A has been added. It is then determined whether the changed route conforms to predefined shared routing rules. This is a decision-making step. The shared routing rules can be based on at least one of the following: Next-hop type rule: Determines whether the next hop of the route is of a specific type, such as "Internet Gateway (IGW)," "Peering," or "Cloud Service Endpoint (VPCE)." If so, it is determined to be a shared route. Route label rule: Determines whether the route is tagged with a specific label (e.g., shared: true). Administrators can explicitly specify whether a route is a shared route when creating it using this label. If the rules are met, the changed route is added to the second routing table. For example, the next hop of the newly added route 10.0.0.0 / 8->Gateway A is identified as a "peer-to-peer gateway", which meets the rules, so the system automatically adds it to the second routing table.
[0224] This embodiment provides a real-time, accurate mechanism for building and maintaining a second routing table. It responds quickly, requires no full scan, and has low system overhead. Through rule-driven mechanisms, it can intelligently identify true shared routes, avoiding misjudgments that may arise from static aggregation. It is particularly suitable for dynamically changing cloud network environments, ensuring that the second routing table always remains synchronized with the actual needs of the network.
[0225] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario. For ease of understanding, the application of the routing processing method to a cloud technology scenario will be used as an example.
[0226] The routing processing method provided in this application can be applied to network components in cloud computing scenarios such as virtual private clouds and cloud gateways. It can reduce the total number of routes stored in these network components and improve the efficiency of massive tenant routing table changes, thereby mitigating the control plane stability risks caused by a large number of routing change operations.
[0227] Taking a cloud gateway as an example, the routing table design provided in this application can replace the current routing table design (different tenant networks and cloud vendors' self-developed services generate a large number of independent routing tables, see Figure 11, which is a design framework diagram of the original routing table provided in the embodiment of this application). Taking cloud services as an example, some regional intranet gateways may need to maintain tens of thousands of routing tables, containing millions of routes. Analysis has revealed that some routing tables may contain a large number of routes carrying the same routing information, that is, some routes will appear repeatedly in multiple routing tables. Moreover, the repeated routes are automatically generated by the system based on the network topology and the cloud services created by the tenant. These routes will change with the migration and changes of network components, which may frequently trigger routing table change operations. For example, if there are 100 duplicate routes in 100 routing tables, then changing 100 routes (e.g., modifying the next hop) will trigger a total of 10,000 (i.e., 100 × 100) change operations, which will seriously affect the efficiency of route changes.
[0228] The routing table design provided in this application is transparent to the user, meaning that the user interface displays a single routing table. However, in actual network components, a single routing table is divided into two routing tables (including a regular routing table and an extended routing table). The regular routing table has a similar framework to the original routing table and belongs to a specific tenant's network. The extended routing table, on the other hand, is a collection of routes carrying the same routing information and can be associated with different regular routing tables for sharing among different subnets of different tenants.
[0229] Therefore, by abstracting duplicate routes into a separate routing table, this application can effectively reduce the memory consumption caused by repeatedly storing routes in a large number of routing tables. In addition, this application can also narrow the scope of a large number of route change operations to an extended routing table, thereby improving the timeliness of route change operations and reducing the control plane stability risk caused by massive changes.
[0230] In some embodiments, referring to Figure 12, which is a design framework diagram of the improved routing table provided in this application embodiment, as shown in Figure 12, this application constructs a two-level routing table, namely a normal routing table and an extended routing table. The normal routing table has a similar structure to the original routing table, belongs to a certain virtual private cloud, and can be associated with one or more subnets under the corresponding virtual private cloud. The normal routing table contains specific routes of the virtual private cloud, including tenant-defined routes and specific routes generated by cloud services created by the tenant. The extended routing table can be associated with different subnets under different virtual private clouds, that is, the extended routing table is cross-virtual private clouds. These virtual private clouds can belong to different tenants, that is, the routes in the extended routing table can be applied to different virtual private clouds of different tenants. Furthermore, the routes in the extended routing table are routes automatically generated by the system based on the public network environment when the tenant creates virtual private clouds and cloud services. The routes in the extended routing table do not affect the isolation and security between tenants and between virtual private clouds.
[0231] When looking up a routing table, you can first look up the ordinary routing table. When the ordinary routing table is associated with the extended routing table, you can then look up the extended routing table. By comparing the results of the two lookups, you can get the final result. Compared with the design of a single routing table that only looks up the table once, the two-level routing tables in this application look up the routing table twice. Therefore, it is necessary to consider the potential lookup overhead. First, this application accelerates table lookups by optimizing the routing table structure. Specifically, it employs a level-compressed lookup tree to speed up the lookup of a single table. Furthermore, the level-compressed technique is strongly correlated with the subnet mask of the route. Therefore, in cloud networks, the subnet masks of routes are mainly concentrated in a few fixed segments (e.g., 255.255.0.0, 255.255.255.0, 255.255.128.0, etc.), resulting in a lookup tree depth generally within 8, thus minimizing the lookup overhead. Additionally, in the routing table structure design of this application, routes in the ordinary routing table and extended routing table are obtained by splitting the original single routing table. Therefore, compared to the corresponding single routing table, the overall route size of the ordinary routing table and extended routing table does not significantly increase, thus limiting the overhead of two lookups.
[0232] In some embodiments, this application maintains the routing table using a Level Compressed Tree (LC-Tree) to achieve longest prefix matching. See Figure 13, which is a routing representation diagram provided in an embodiment of this application. Figure 13 shows a routing table with 8 routes. See Figure 14, which is a schematic diagram of generating the corresponding lookup tree based on the routing table provided in an embodiment of this application. The lookup tree constructed according to the routing table is shown in Figure 14. The LC-Tree has the following characteristics:
[0233] (1) Each tree node has at most two child nodes (i.e., the degree of the node is 2);
[0234] (2) The data structure of each node is the same, that is, the key of the node is the destination network segment (the destination network segment can be obtained by performing a "logical AND" operation on the destination IP address and the subnet mask), so each node can carry routing information;
[0235] (3) Nodes can be divided into two categories: routing nodes and intermediate nodes. Routing nodes carry real routing information (nodes drawn with solid lines in Figure 14), while intermediate nodes are auxiliary nodes used to build binary trees (nodes drawn with dashed lines in Figure 14). The key of an intermediate node is the longest common prefix of its leaf nodes. For example, the longest common prefix of 10.0.10.0 / 24 and 10.0.11.0 / 24 is 10.0.10.0 / 23.
[0236] The design of building a search tree using the longest common prefix can effectively compress the depth of the search tree. For example, for IPv4 addresses, the maximum depth (layers) of the LC-Tree is 33 (0~32). In actual cloud network application scenarios, the depth of the LC-Tree is generally within 8. Each layer only needs to be looked up (compared) once, and the number of comparisons required each time the table is looked up is at most the depth of the tree. Therefore, the efficiency of the table lookup is relatively high.
[0237] In some embodiments, the "route disabling" in this application does not mean disabling a route in a routing table in the usual sense. Rather, it is a concept introduced in the two-level routing table design. Since the extended routing table is invisible to the user, and the user interface still displays a single routing table, when a user deletes a route (i.e., the route added by the user is a custom route and does not belong to the extended routing table, so the addition operation does not need to be considered), the deleted route may belong to the extended routing table. If the deletion operation is directly applied to the extended routing table (i.e., deleting a route from the extended routing table), then the current route will also become invisible in other routing tables associated with the extended routing table, which is equivalent to deleting routes from multiple routing tables, affecting the integrity of other routing tables, which is not as expected. Therefore, it is necessary to define an operation where "the result of deleting a route from the extended routing table is only applied to a portion of the ordinary routing tables." This application calls this operation "route disabling," meaning that when a user deletes a route belonging to the extended routing table, it is equivalent to disabling a route belonging to the extended routing table in a certain ordinary routing table. Referring to Figure 15, which is a schematic diagram of a two-level routing table provided in this application embodiment, a user's routing table is abstracted into a two-level routing table. The user wants to delete a route with a destination network segment of 10.0.1.128 / 26 (where / 26 corresponds to the subnet mask 255.255.255.192) and a next hop of 9.10.10.11. This route belongs to the extended routing table, which will trigger route disabling.
[0238] In some embodiments, referring to Figure 16, which is a schematic diagram of a route disabling example using a two-level routing table provided in this application embodiment, the route disabling design of this application includes two parts: First, a "disabling flag" is added to the route to indicate whether the route is disabled. By default, the "disabling flag" of all routes is not set and is recorded as 0, indicating that the flag is not disabled. Routes in the extended routing table are visible to all associated tables, so this flag is ignored in the extended routing table, that is, the disabling flag of routes in the extended routing table is always 0. Second, the route that needs to be disabled is added to the ordinary routing table (inserted into the lookup tree corresponding to the ordinary routing table), and the disabling flag of this route is set to 1, indicating that the route is disabled. Therefore, a disabled route will exist in both the ordinary routing table and the extended routing table, and the "disabling flag" is maintained in the ordinary routing table.
[0239] In some embodiments, taking the routing table in Figure 16 as an example, assuming the destination IP address of the data packet for route lookup is 10.0.13.180, then two levels of routing tables need to be looked up. See Figure 17, which is a specific schematic diagram of the two-level routing table lookup provided in the embodiments of this application.
[0240] First, the ordinary routing table is searched, starting from the root node of the search tree, using the longest prefix matching method until no node matches the destination IP. Next, all matching routes are recorded. Unlike ordinary table lookup algorithms that only record the most recent match, this application records all matching nodes, excluding intermediate nodes of the search tree, as these are only used to construct the tree structure and do not carry routing information. For example, the node corresponding to 10.0.8.0 / 21 in Figure 17 is not recorded. Since the overhead of recording is negligible, the overhead of adding recording information is not considered. Then, the extended routing table is searched, starting from the root node of the search tree, until no node matches the destination IP. Afterward, all matching routes are recorded, similar to the ordinary routing table. Finally, the search results of the ordinary and extended routing tables are compared to obtain the final lookup result. In most scenarios, only one comparison is needed: comparing the routes in the last records of the two lookups, corresponding to the "best-matching route" in the regular routing table and the extended routing table, respectively. As shown in Figure 17, comparing the routes 10.0.13.0 / 24 and 10.0.13.128 / 25, by comparing the lengths of the two route prefixes, we can see that the prefix of the route corresponding to 10.0.13.128 / 25 is longer, thus making it the final target route. If the disabled flag of the compared route is set (equal to 1), it may trigger "backtracking" logic, requiring an increase in the number of comparisons. A set disabled flag indicates that this route was deleted by the user, and according to the principle of longest prefix matching, this route will also appear in the lookup results of the extended routing table. If this route is also the best-matching route in the extended routing table, it means that the current best-matching route is a disabled route and cannot be used as a lookup result, so this route needs to be skipped, and the comparison of the next best-matching route continues. This process continues until the final lookup result is obtained. Recording all matching routes is for backtracking operations. Since the probability that the most matching route happens to correspond to a disabled route is very low, the probability of needing to make multiple comparisons is low, and the impact on the overall route lookup efficiency is minimal.
[0241] In summary, this application proposes a novel routing table design that reduces the memory overhead caused by a large number of duplicate routes in the routing tables of massive tenants. In addition, it significantly reduces the number of changes caused by duplicate routes, alleviates the communication pressure between the control plane and the data plane, and improves the timeliness of routing table changes.
[0242] The following description continues to illustrate the exemplary structure of the routing processing device 543 provided in the embodiments of this application as a software module. In some embodiments, as shown in FIG2, the software module stored in the routing processing device 543 in the memory 540 may include: a decoupling module 5431, a lookup module 5432, and a change module 5433.
[0243] The decoupling module 5431 is configured to generate a second routing table based on multiple first routing tables, wherein the second routing table stores the same routes in multiple first routing tables; the lookup module 5432 is configured to perform lookup processing based on the address of the route to be changed to obtain the route to be changed that matches the address of the route to be changed; the modification module 5433 is configured to modify the route to be changed in the second routing table when the route to be changed is located in the second routing table to obtain the modified route, wherein the modified route takes effect in multiple first routing tables.
[0244] In some embodiments, the lookup module 5432 is further configured to generate a compressed binary tree corresponding to the route table to be looked up when the total number of routes in the route table to be looked up is greater than the total number of routes threshold, and perform a lookup process in the compressed binary tree based on the route address to be changed to obtain the route to be changed that matches the route address to be changed; when the total number of routes in the route table to be looked up is not greater than the total number of routes threshold, perform the longest prefix matching process in the route table to be looked up based on the route address to be changed to obtain the route to be changed that matches the route address to be changed.
[0245] In some embodiments, the lookup module 5432 is further configured to sort the route prefixes of all routes included in the routing table to be looked up based on the mask length to obtain a route prefix sequence; create a compressed binary tree, and perform the following processing on each route prefix in the route prefix sequence in sequence: start the matching process of the route prefix from the root node of the compressed binary tree; when the child node of the first node matches the route prefix, move the route corresponding to the route prefix to the child node of the first node; when the first node does not have a child node that matches the route prefix, move the route corresponding to the route prefix to a newly created node, and link the newly created node to the first node; when all routes in the routing table to be looked up have been moved to the compressed binary tree, use the compressed binary tree as the compressed binary tree of the corresponding routing table to be looked up.
[0246] In some embodiments, the decoupling module 5431 is further configured to generate a third routing table corresponding to each of the plurality of first routing tables, wherein the third routing table stores the remaining routes in the corresponding first routing tables other than the identical routes.
[0247] In some embodiments, the lookup module 5432 is further configured to perform a lookup process in a second routing table based on the route address to be changed, and obtain a first lookup result; when the first lookup result indicates that the lookup in the second routing table fails, perform a lookup process in a third routing table based on the route address to be changed, and obtain a route to be changed that matches the route address to be changed; when the first lookup result indicates that the lookup in the second routing table succeeds, use the route obtained from the lookup as the route to be changed that matches the route address to be changed.
[0248] In some embodiments, the routing data processing device 543 further includes a deletion module 5434.
[0249] The deletion module 5434 is configured to perform the following processing in response to a deletion operation on a first route in a target first routing table, where the first route belongs to the same route: keep the second routing table unchanged, and add the first route to the third routing table of the corresponding target first routing table, wherein the target first routing table comes from multiple first routing tables; mark the first route as disabled in the third routing table of the corresponding target first routing table.
[0250] In some embodiments, the deletion module 5434 is further configured to, in response to a deletion operation on a first route in a target first routing table, and the first route does not belong to the same route, perform the following process: mark the first route as disabled in a third routing table corresponding to the target first routing table, wherein the target first routing table originates from multiple first routing tables.
[0251] In some embodiments, the query module 5432 is further configured to perform the following processing in response to a query operation on a target route address in a target first routing table: perform a query process in a third routing table corresponding to the target first routing table to obtain at least one first matching route, wherein the target first routing table is derived from multiple first routing tables; perform a query process in a second routing table to obtain at least one second matching route; and perform a matching process on the at least one first matching route and the at least one second matching route to obtain a target route corresponding to the target route address.
[0252] In some embodiments, the query module 5432 is further configured to generate a first set consisting of at least one first matching route and a second set consisting of at least one second matching route; obtain a first most matching route from the first set and a second most matching route from the second set; use the route with the longest prefix among the first and second most matching routes as a pending target route and delete the first and second most matching routes from their respective sets; when the pending target route is in a disabled state, determine a new pending target route based on the current first set and the current second set to replace the pending target route; when the pending target route is not in a disabled state, use the pending target route as the target route for the corresponding target route address.
[0253] In some embodiments, the routing data processing device 543 further includes an acquisition module 5435.
[0254] The acquisition module 5435 is configured to perform any of the following processes: in response to a route change operation of an object, acquire the route address to be changed corresponding to the route change operation; in response to a migration event or change event of a network component, acquire the destination address involved in the migration event or change event as the route address to be changed.
[0255] In some embodiments, the routing data processing device 543 further includes a creation module 5436.
[0256] Module 5436 is configured to, in response to a first creation operation for a first virtual network environment, acquire a shared route automatically generated based on the public network environment during the creation process, a first custom route of the first object initiating the first creation operation, and a route corresponding to the first virtual network environment, and create a first routing table corresponding to the first virtual network environment based on the shared route, the first custom route, and the route corresponding to the first virtual network environment; and in response to a second creation operation for a second virtual network environment, acquire a shared route automatically generated based on the public network environment during the creation process, a second custom route of the second object initiating the second creation operation, and a route corresponding to the second virtual network environment, and create a first routing table corresponding to the second virtual network environment based on the shared route, the second custom route, and the route corresponding to the second virtual network environment.
[0257] In some embodiments, the routing data processing device 543 further includes a storage module 5437.
[0258] Storage module 5437 is configured to store a combined routing table, which includes: a second routing table shared by multiple first routing tables and a third routing table corresponding to each first routing table; the second routing table stores the same routes in the multiple first routing tables; the third routing table stores the remaining routes in the corresponding first routing table excluding the same routes.
[0259] In some embodiments, the determining module 5431 is further configured to: obtain the same route in the plurality of first routing tables; and generate the second routing table based on the same route.
[0260] In some embodiments, the determining module 5431 is further configured to: detect route change events corresponding to each of the first routing tables, and identify the routes that have changed in the route change events; when the changed routes conform to predefined shared routing rules, add the changed routes to the second routing table.
[0261] It should be noted that the description of the apparatus in this application embodiment is similar to that of the method embodiment described above, and has similar beneficial effects as the method embodiment, therefore, it will not be repeated. Any technical details not covered in the routing processing apparatus provided in this application embodiment can be understood based on the descriptions of any one of the figures 3, 4, 5, 6, 7, 8, 9, or 10.
[0262] This application provides a computer program product including a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the routing processing method described above in this application.
[0263] This application provides a computer-readable storage medium storing computer-executable instructions or computer programs. When the computer-executable instructions or computer programs are executed by a processor, the processor will execute the routing processing method provided in this application, such as the routing processing method shown in Figures 3, 4, 5, 6, 7, 8, 9, or 10.
[0264] In some embodiments, the computer-readable storage medium may be a memory such as ferroelectric random access memory (FRAM), ROM, programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); or it may be a device that includes one or any combination of the above-mentioned memories.
[0265] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0266] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).
[0267] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0268] In summary, this application's embodiments generate a second routing table based on multiple first routing tables. This second routing table stores identical routes from multiple first routing tables. By abstracting duplicate routes into a single routing table, the memory consumption caused by storing routes repeatedly in multiple routing tables can be effectively reduced. A lookup process is performed based on the address of the route to be changed to obtain a route matching that address. When the route to be changed is located in the second routing table, it is modified to obtain the modified route. This modified route takes effect in multiple first routing tables. Thus, the scope of modification operations for a large number of duplicate routes is narrowed down to the second routing table, effectively avoiding the repeated distribution of the same route in different routing tables, thereby improving the efficiency of routing table modifications and reducing the control plane stability risks caused by massive changes. In conclusion, this application's embodiments can effectively reduce the total number of routes stored, effectively avoid the repeated distribution of the same route in different routing tables, and thus effectively improve the efficiency of routing table modifications.
[0269] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A routing processing method, the method being executed by an electronic device, the method comprising: A second routing table is generated based on multiple first routing tables, wherein the second routing table stores the same routes in the multiple first routing tables; The search process is performed based on the address to be changed to obtain the route to be changed that matches the address to be changed; When the route to be changed is located in the second routing table, the route to be changed in the second routing table is modified to obtain the modified route, wherein the modified route is effective in all of the multiple first routing tables.
2. The method according to claim 1, wherein, The method further includes: Based on the plurality of first routing tables, a third routing table is generated corresponding to each of the first routing tables. The third routing table stores the remaining routes in the corresponding first routing tables, excluding the identical routes.
3. The method according to claim 2, wherein, The process of searching based on the address to be changed to obtain the route to be changed that matches the address to be changed includes: Based on the route address to be changed, a lookup process is performed in the second routing table to obtain a first lookup result; When the first lookup result indicates that the lookup in the second routing table fails, a lookup process is performed in the third routing table based on the address to be changed to obtain the route to be changed that matches the address to be changed. When the first lookup result indicates a successful lookup in the second routing table, the found route is used as the route to be changed that matches the address of the route to be changed.
4. The method according to claim 2, wherein, The method further includes: In response to a deletion operation on a first route in the target first routing table, and the first route belongs to the same route, the following processing is performed: Keep the second routing table unchanged, and add the first route to the third routing table corresponding to the target first routing table, wherein the target first routing table is derived from the plurality of first routing tables; Mark the disabled state of the first route in the third route table corresponding to the first route table of the target.
5. The method according to claim 2, wherein, The method further includes: In response to a deletion operation on a first route in the target first routing table, and the first route does not belong to the same route, the following processing is performed: The disabled state of the first route is marked in the third route table corresponding to the target first route table, wherein the target first route table is derived from the plurality of first route tables.
6. The method according to claim 2, wherein, The method further includes: In response to a query operation targeting the destination route address in the first routing table, the following processing is performed: A query is performed in the third routing table corresponding to the target first routing table to obtain at least one first matching route, wherein the target first routing table is derived from the plurality of first routing tables; Perform a query on the second routing table to obtain at least one second matching route; The at least one first matching route and the at least one second matching route are matched to obtain the target route corresponding to the target route address.
7. The method according to claim 6, wherein, The step of matching the at least one first matching route and the at least one second matching route to obtain the target route corresponding to the target route address includes: Generate a first set consisting of the at least one first matching route, and generate a second set consisting of the at least one second matching route; Obtain the first best-matching route from the first set, and obtain the second best-matching route from the second set; The route with the longest prefix among the first and second best-matching routes is designated as the target route, and the first and second best-matching routes are removed from their respective sets. When the pending target route is disabled, a new pending target route is determined based on the current first set and the current second set to replace the pending target route; When the pending target route is not disabled, the pending target route is used as the target route corresponding to the target route address.
8. The method according to any one of claims 1 to 7, wherein, Before performing a lookup process based on the address to be changed to obtain a route that matches the address to be changed, the method further includes: Perform any of the following processes: In response to a route change operation on the object, obtain the route address to be changed corresponding to the route change operation; In response to a migration or change event of a network component, the destination address involved in the migration or change event is obtained as the routing address to be changed.
9. The method according to any one of claims 1 to 8, wherein, The lookup process based on the route address to be changed includes: When the total number of routes in the routing table to be searched exceeds the total number of routes threshold, a compressed binary tree corresponding to the routing table to be searched is generated, and the search process is performed in the compressed binary tree based on the route address to be changed. When the total number of routes in the routing table to be searched is not greater than the total number of routes threshold, the longest prefix matching process is performed in the routing table to be searched based on the route address to be changed.
10. The method according to claim 9, wherein, The step of generating a compressed binary tree corresponding to the routing table to be looked up includes: The routing prefixes of all routes included in the routing table to be searched are sorted based on the mask length to obtain a routing prefix sequence; Create a compressed binary tree, and perform the following processing sequentially for each of the route prefixes in the route prefix sequence: start matching the route prefixes from the root node of the compressed binary tree; when a child node of the first node matches the route prefix, move the route corresponding to the route prefix to the child node of the first node; when the first node does not have a child node that matches the route prefix, move the route corresponding to the route prefix to a newly created node, and link the newly created node to the first node; When all routes in the routing table to be searched are moved to the compressed binary tree, the compressed binary tree is used as the compressed binary tree corresponding to the routing table to be searched.
11. The method according to any one of claims 1 to 10, wherein, The method further includes: In response to a first creation operation for a first virtual network environment, the system obtains a shared route automatically generated based on a public network environment during the creation process, a first custom route of the first object that initiated the first creation operation, and a route corresponding to the first virtual network environment. Based on the shared route, the first custom route, and the route corresponding to the first virtual network environment, the system creates a first routing table corresponding to the first virtual network environment. In response to a second creation operation for a second virtual network environment, the system obtains a shared route automatically generated based on the public network environment during the creation process, a second custom route of the second object that initiated the second creation operation, and a route corresponding to the second virtual network environment. Based on the shared route, the second custom route, and the route corresponding to the second virtual network environment, the system creates a first routing table corresponding to the second virtual network environment.
12. The method according to any one of claims 1 to 11, characterized in that, The process of generating a second routing table based on multiple first routing tables includes: Obtain the same route from the multiple first routing tables; Based on the same route, a second routing table is generated.
13. The method according to any one of claims 1 to 12, characterized in that, The process of generating a second routing table based on multiple first routing tables includes: Detect route change events corresponding to each of the first routing tables, and identify the routes that have changed in the route change events; When the changed route conforms to the predefined shared routing rules, the changed route is added to the second routing table.
14. A combined routing table, the combined routing table comprising: A second routing table shared by multiple first routing tables and a third routing table corresponding to each of the first routing tables; The second routing table stores multiple identical routes from the first routing table; The third routing table stores the remaining routes in the corresponding first routing table, excluding the identical routes.
15. A routing processing apparatus, the apparatus comprising: The decoupling module is configured to generate a second routing table based on multiple first routing tables, wherein the second routing table stores the same routes in the multiple first routing tables; The lookup module is configured to perform lookup processing based on the address to be changed, and obtain the route to be changed that matches the address to be changed; The modification module is configured to modify the route to be modified in the second routing table when the route to be modified is located in the second routing table, thereby obtaining the modified route, wherein the modified route is effective in all of the multiple first routing tables.
16. An electronic device comprising: Memory is used to store executable instructions or computer programs. A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the routing processing method according to any one of claims 1 to 13.
17. A computer-readable storage medium storing computer-executable instructions or a computer program, wherein when executed by a processor, the computer-executable instructions or the computer program implement the routing processing method according to any one of claims 1 to 13.
18. A computer program product comprising computer-executable instructions or a computer program, wherein when executed by a processor, the computer-executable instructions or the computer program implement the routing processing method according to any one of claims 1 to 13.