IPv6-based IP search method and device
By combining lightweight cache and adaptive search tree in IPv6 routing devices, the problem of low IP search efficiency in IPv6 routing devices is solved, and efficient and fast IP address search is achieved to adapt to changes in network traffic characteristics and rule sets.
Patent Information
- Application Number
- CN202410521870.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-04-28
AI Technical Summary
In IPv6 routing devices, it is difficult for the prior art to efficiently search IP, especially because the increase in IPv6 address length leads to a larger scale of routing tables, requiring more efficient data structures and algorithms.
The combination of lightweight cache and adaptive search tree is adopted. The lightweight cache stores frequently accessed IP addresses and achieves fast matching through a hash table; when the cache misses, an adaptive search tree is built, considering the network traffic characteristics and rule sets, and using popularity and step size to optimize the search process of binary tree or dictionary tree.
It improves the IP search efficiency of IPv6 routing devices, adapts to changes in network traffic, reduces memory consumption, and improves search speed.
Smart Images

Figure CN118282945B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to an IPv6-based IP lookup method and device. Background Art
[0002] On the internet, one of the primary functions of routing devices (such as routers, switches, and load balancers) is to determine the transmission path for data packets based on Internet Protocol (IP) addresses. Therefore, IP lookup (i.e., IP address lookup) is a core operation of routing devices. This IP lookup process primarily involves examining the destination IP address of an incoming packet to identify the longest prefix match in the routing device's forwarding information base (FIB). Longest prefix match refers to an algorithm used by routing devices in the IP protocol to select from routing tables. A routing table contains multiple entries, each of which can include the destination network address, subnet mask, next-hop address, protocol type, and more. Therefore, entries are also called rules. Since each entry in a routing table specifies a network, a destination address may match multiple entries. The most specific entry, the one with the longest subnet mask, is considered the longest prefix match. Suppose a FIB table contains two rules (entries): "192.168.20.16 / 28" and "192.168.0.0 / 16." When the IP address to be searched is "192.168.20.19," both rules match (also called correspondence). In this case, both entries contain the IP address to be searched. In this case, the route with the longest prefix is "192.168.20.16 / 28." This is because its subnet mask ( / 28) is longer than the subnet mask ( / 16) of the other entry, making it more specific. The router uses this rule to forward the packet destined for "192.168.20.19."
[0003] Although the concept of longest prefix matching is the same in both Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6), because IPv6 addresses are four times longer than IPv4, IPv6 routing tables can be larger, requiring more efficient data structures and algorithms for fast lookups. Therefore, how to perform IP lookups in IPv6 devices has become a pressing technical issue. Summary of the Invention
[0004] In order to solve the problems existing in the prior art, the embodiments of the present application provide a method, apparatus, computing device, computer storage medium and product including a computer program for IPv6-based IP lookup, which can improve the efficiency of IP lookup.
[0005] In a first aspect, an embodiment of the present application provides an IPv6-based IP lookup method, characterized in that it is applied to a routing device, a lightweight cache is provided in the routing device, and multiple IP addresses are stored in the lightweight cache, and the multiple IP addresses are all IPv6-based addresses. The method includes: receiving network traffic, the network traffic includes a communication request, and querying the lightweight cache based on the communication request to obtain a second IP address; wherein the communication request includes a first IP address, and the first IP address corresponds to the second IP address; the network traffic is used to characterize data packets transmitted by the network; when the first IP address successfully matches any one of the multiple IP addresses, the second IP address is obtained in the lightweight cache; when the first IP address fails to match any one of the multiple IP addresses, a table entry matching the first IP address is obtained through a search tree; the search tree is constructed according to the network traffic.
[0006] In some possible implementations, the method also includes: obtaining the temporal locality of network traffic, where temporal locality includes high temporal locality and low temporal locality; wherein high temporal locality is represented by the number of hits of the most frequently accessed IP addresses within a period of time reaching a certain proportion to the total number of hash table entries; low temporal locality is represented by the number of hits of the most frequently accessed IP addresses within a period of time not reaching a certain proportion to the total number of hash table entries; in the case of high temporal locality, querying the lightweight cache, and in the case of low temporal locality, querying the search tree.
[0007] In some possible implementations, the ratio is between 10% and 20%.
[0008] In some possible implementations, the search tree is a binary tree, and obtaining a table entry that matches the first IP address through the search tree is specifically as follows: determining the popularity of each node in the binary tree based on the network traffic, the popularity representing the possibility of the node being successfully matched; each of the nodes includes at least one table entry; constructing a binary tree based on the popularity; and obtaining a table entry that matches the first IP address through the binary tree.
[0009] In some possible implementations, popularity is calculated according to the following formula
[0010]
[0011] Where α represents the weight of the number of rules, β represents the weight of the hit count, R(N) represents the number of rules associated with storage node N, and F(N) represents the percentage of packets in historical network traffic that ultimately find a match at node N.
[0012] In some possible implementations, the search tree is a dictionary tree, and obtaining the second IP address through the search tree is specifically as follows: determining the step size through a heuristic algorithm, where the step size represents the number of bits of nodes in the dictionary tree that are searched simultaneously; constructing a dictionary tree based on the step size; and obtaining a table entry that matches the first IP address through the dictionary tree.
[0013] In some possible implementations, the calculation formula for determining the step size through annealing simulation is as follows:
[0014]
[0015]
[0016] Where E[T(S(N))] represents the expected average number of memory accesses for a node at a given step size, N represents the storage node, Nodes represents the total storage nodes, F(N) represents the access frequency of node N, and T lookup (S(N), R(N)) represents the number of memory accesses to perform the search operation on node N, and the function M node (S(N), R(N)) represents the memory overhead of node N, S(N) represents the step size, R(N) represents the number of rules associated with storage node N, Mmax represents the maximum allowed memory capacity, st represents the constraint condition, and M(S(N)) represents the total memory overhead.
[0017] In some possible implementations, multiple IP addresses stored in the lightweight cache are updated.
[0018] In some possible implementations, the search tree is updated when network traffic changes.
[0019] In the second aspect, an embodiment of the present application provides an IPv6-based IP lookup device, which is characterized in that it is deployed in a routing device, a lightweight cache is provided in the routing device, and multiple IP addresses are stored in the lightweight cache, and the multiple IP addresses are all IPv6-based addresses. The device includes: a receiving module for receiving network traffic, the network traffic includes a communication request, and the lightweight cache is queried based on the communication request to obtain a second IP address; wherein the communication request includes a first IP address, and the first IP address corresponds to the second IP address; the network traffic is used to characterize data packets transmitted by the network; the lookup module is used to obtain the second IP address in the lightweight cache when the second IP address successfully matches any one of the multiple IP addresses; the lookup module is also used to obtain a table entry matching the first IP address through a search tree when the second IP address fails to match any one of the multiple IP addresses; the search tree is constructed according to the network traffic.
[0020] In a third aspect, an embodiment of the present application provides a computer-readable storage medium comprising computer-readable instructions. When a computer reads and executes the computer-readable instructions, the computer executes the method as described in any one of the first aspects.
[0021] In a fourth aspect, an embodiment of the present application provides a computing device comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method as described in any one of the first aspects is executed.
[0022] In a fifth aspect, an embodiment of the present application provides a product comprising a computer program, which, when the computer program product runs on a processor, enables the processor to execute the method as described in any one of the first aspects.
[0023] This method constructs a special search tree to adapt to the ever-changing traffic patterns. Using traffic characteristics to guide the construction of the search tree will significantly improve the search efficiency of network routing devices and thus improve the performance of the routing system. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 This is a schematic diagram of an IPv6 search method provided by an embodiment of the present application;
[0026] Figure 2This is a flow chart of an IPv6-based IP lookup method provided in an embodiment of the present application;
[0027] Figure 3 This is a flowchart of an IP lookup provided by an embodiment of the present application;
[0028] Figure 4 This is a schematic diagram of the structure of an IPv6-based IP lookup device provided in an embodiment of the present application;
[0029] Figure 5 It is a structural diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0031] The term "and / or" as used herein describes an association between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. The symbol " / " as used herein indicates that the related objects are in an "or" relationship, for example, A / B means either A or B.
[0032] The terms "first" and "second" in this specification and claims are used to distinguish different objects rather than to describe a specific order of objects. For example, "first response message" and "second response message" are used to distinguish different response messages rather than to describe a specific order of response messages.
[0033] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0034] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more, for example, multiple processing units means two or more processing units, etc.; multiple elements means two or more elements, etc.
[0035] To facilitate understanding of the embodiments of the present application, further explanation will be given below with reference to specific embodiments in conjunction with the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present invention.
[0036] First, the technical terms involved in the embodiments of this application are introduced:
[0037] 1. Long-tail distribution is a type of probability distribution in which a small number of categories occupy most of the samples, while most categories occupy only a small number of samples.
[0038] Next, the technical solutions provided in the embodiments of the present application are introduced.
[0039] In routing devices, IP lookup helps network devices determine how to transmit data packets from one network to another until they reach their final destination. Specifically, when a routing device receives a data packet, it first checks the packet's destination IP address. It then searches its routing table for a routing rule that matches the destination IP address and selects the most specific matching routing rule. Routing rules typically include the next-hop IP address. After determining the next-hop address, the routing device forwards the packet to that address. If the routing rule points to the final destination, the packet is sent directly to the destination host. If it points to another router, that router will query routing rules again and forward the packet until it reaches its final destination. The IP lookup process essentially involves finding a matching routing rule for an IP address. IP lookup involves two key components: flows and rulesets. Flows refer to the actual data packets transmitted across the network, while the ruleset is the Forwarding Information Base (FIB), which defines the rules for processing and forwarding data packets based on their destination IP addresses. IPv6 lookups can be performed using either a trie-based or a binary search tree-based approach. After the rules are found, the data packets can be processed according to the rules found. Figure 1 A schematic diagram of a method for finding IPv6 rules provided by an embodiment of the present application is shown. Figure 1 As shown in (A) in the figure, the IP search method based on the dictionary tree uses the tree data structure of the dictionary tree to split the IPv6 address into bits and store them layer by layer. Each node represents a part of the IP address. Starting from the root node, by traversing downwards, the target entry can be efficiently located. Figure 1 As shown in (B) in FIG, the IP lookup method based on the binary search tree (ie, binary tree) can store IP prefixes of different lengths into different hash tables and organize these hash tables into an asymmetric binary search tree.
[0040] The IP lookup method based on the dictionary tree can accurately match each bit. The IP lookup method based on the binary search tree uses the prefix length of the IP address to determine its depth in the tree, so that IP addresses with the same prefix length are located at the same depth in the tree.
[0041] However, both approaches focus on designing and optimizing the search structure to create an efficient search structure, while also leveraging system caching to improve search performance. Both approaches are based on the idealized scenario of uniform network traffic, without considering the characteristics of network traffic. Network traffic refers to the actual data packets transmitted over the network, and is often used to describe the intensity of data transmission or network usage. Both approaches implicitly assume uniform network traffic distribution, implying that all rules have an equal probability of being hit. This is inconsistent with reality.
[0042] In view of this, an embodiment of the present application provides an IP lookup method based on IPv6. The embodiment of the present application uses real traffic data obtained from the MAWI working group of the wide area Internet development project to statistically analyze the access frequency of each IP address. After ranking these IP addresses by frequency, a cumulative distribution function and a fitting graph are generated, and it is found that the distribution of network traffic shows the characteristics of a long-tail distribution, that is, a small number of IP addresses generate most of the network traffic. Therefore, the present application designs a search tree based on network traffic and queries IP addresses by means of a search tree, which can make full use of the characteristics of traffic distribution. It is worth noting that, unless otherwise specified, IP below also represents an IP address, and all IP addresses are IP addresses based on IPv6.
[0043] For example, Figure 2 The present invention provides a flow chart of an IPv6-based IP lookup method, which can be applied to a routing device. In the routing device, a lightweight cache is provided, and a plurality of IP addresses are stored in the lightweight cache. Figure 1 As shown, the IP search method may include the following steps:
[0044] S21: Receive network traffic, the network traffic includes a communication request, query the lightweight cache based on the communication request to obtain a second IP address. The communication request includes the first IP address, and the first IP address corresponds to the second IP address.
[0045] In this embodiment, IP address entries of some data items that contribute significantly to traffic are stored in a lightweight cache, and are implemented based on a hash table. A lightweight cache is a caching mechanism in a computing device that aims to reduce latency when the system accesses data, improve system performance, and speed up data retrieval by storing frequently accessed data in memory. Stored in the lightweight cache are mainly IP addresses that appear frequently in network traffic. These IP addresses are obtained through traffic sampling and statistics and can represent the direction of most network traffic in the network. The lightweight cache is implemented based on a hash table, and each IP address entry has a corresponding position in the hash table. When a data packet arrives, the system maps the IP address to a position in the hash table using a hash function. After receiving the network traffic, the routing device obtains the actual data packet. The communication request of the data packet contains the first IP address that the data packet needs to communicate with. The routing device needs to route the data packet to the first IP address based on the first IP address. During this process, the routing device needs to know how to forward the data packet to the next hop, or directly forward it to the final destination (if the computing device of the first IP address and the routing device are in the same network). Therefore, the routing device needs to find the IP address that best matches the first IP address, that is, the second IP address.
[0046] S22: In case of a cache hit, obtain the second IP address from the lightweight cache.
[0047] In this embodiment, a cache hit refers to a successful match between the first IP address and any one of the multiple IP addresses stored in the lightweight cache. In the case of a hit, the second IP address can be directly obtained from the lightweight cache.
[0048] S23: If there is no cache hit, obtain a table entry matching the first IP address through a search tree; the search tree is constructed according to network traffic.
[0049] In this embodiment, the second IP address corresponding to the network traffic is not stored in the cache. Therefore, when matching the first IP address with the multiple IP addresses stored in the lightweight cache, no match will be successful. At this time, the routing device needs to search for a table entry that matches the first IP address in the search tree. At this time, by constructing a search tree with reference to the network traffic, the search tree can be made more consistent with the characteristics of the network traffic, and the search for IP addresses can be faster and more efficient. The constructed search tree can be a dictionary tree or a binary tree. When constructing the search tree, in addition to referring to the characteristics of the network force, the rule set can also be referred to at the same time.
[0050] In some possible embodiments, the search tree is a dictionary tree, and the routing device searches for the IP address based on the dictionary tree.
[0051] In this embodiment, if no IP address is assigned to the lightweight cache, the routing device must perform a trie-based search for the IP address, specifically searching for an entry matching the first IP address. In trie-based IP address lookup methods, each trie node represents a decision point, which may contain multiple bits of information. During an IP address prefix lookup, traversal begins at the root node, and each node examines several bits of the address to determine the next child node or retrieve associated next-hop information. In this application, the step size represents the number of bits simultaneously examined in a node, denoted as S(N), to achieve a balance between search efficiency and memory utilization. Generally, nodes with larger step sizes examine more bits simultaneously, facilitating faster searches. However, due to the increased number of child nodes, a larger step size comes at the expense of increased memory consumption. In some approaches, research has focused on data structures, prefix expansion techniques, and compression mechanisms for efficiently storing child pointers and next-hop information, but has overlooked the traffic characteristics of the trie construction process. Therefore, this embodiment adopts a traffic-adaptive step size approach. In an embodiment of the present application, for nodes with higher traffic density, increasing the step size can improve search efficiency, while for nodes with lower traffic density, reducing the step size can save memory. When designing the step size, the step size is calculated based on the expected average number of memory accesses at a given step size, the memory usage of the information in the storage node N, and the maximum memory capacity, and the step size value is determined by adopting a heuristic algorithm (such as simulated annealing, Bayesian optimization, etc.). Based on the obtained step size, a dictionary tree is constructed. The routing device searches for the IP address required for network traffic based on the constructed dictionary tree, thereby achieving high-speed search of the IP address.
[0052] Specifically, the step size can be calculated according to the following formula:
[0053]
[0054]
[0055] Where E[T(S(N))] represents the expected average number of memory accesses for a node at a given step size, N represents the storage node, Nodes represents the total storage nodes, F(N) represents the access frequency of node N, and T lookup (S(N), R(N)) represents the number of memory accesses to perform the search operation on node N, and the function M node (S(N), R(N)) represents the memory overhead of node N, S(N) represents the step size, R(N) represents the number of rules associated with storage node N, Mmax represents the maximum allowed memory capacity, st refers to constrained, represents the constraint condition, and M(S(N)) represents the total memory overhead.
[0056] In some possible embodiments, the search tree is a binary tree, and the routing device searches for the IP address based on the binary tree.
[0057] In this embodiment, if no IP address is assigned in the lightweight cache, the routing device can use a binary tree to search for the IP address. In an IP address lookup scheme based on a binary search tree (BST), IP addresses are typically divided into different subsets based on their prefix lengths, and each subset is maintained using a hash table. These hash tables are then stored in different nodes of the BST, enabling binary searches of the prefix lengths during the search process. Each node can contain multiple rules. In some implementations, BST-based algorithms typically place hash tables with more rules closer to the root because they have a higher rule match probability, allowing for early termination of the search process and reducing average search time. However, the rule match probability is affected not only by the number of rules but also by traffic distribution. Therefore, in this embodiment, the probability of a node being matched is assessed by evaluating its popularity. Popularity, denoted as P(N), represents the probability of a node being matched. Popularity can include the number of rules and the number of times a node has been visited. A higher popularity indicates a greater chance of matching the node's rules, placing the node closer to the root of the binary tree. A binary tree is constructed based on popularity. Routing devices use this constructed binary tree to search for the IP address required by network traffic, enabling high-speed IP address lookup.
[0058] Specifically, popularity can be calculated according to the following formula:
[0059]
[0060] Where α represents the weight of the number of rules, β represents the weight of the hit count, R(N) represents the number of rules associated with storage node N, and F(N) represents the percentage of packets in historical network traffic that ultimately find a match at node N. Both weights α and β can be set as needed.
[0061] In some possible embodiments, the IP lookup method may further include: querying a lightweight cache when the locality of network traffic is high, and querying a search tree when the locality of network traffic is low.
[0062] In this embodiment, a process selector is also provided in the routing device, and the process selector can judge the locality of the network traffic. The locality of the network traffic can include time locality and space locality. High time locality means that if it is found that certain IP addresses are frequently accessed within a period of time, the traffic is considered to have high time locality. High space locality means that if it is found that a group of IP addresses are often accessed together, the search tree structure can be optimized to organize these IP addresses together for faster search. Specifically, taking time locality as an example, for time locality incoming, in a scenario where the network traffic locality is low, the exact match cache will result in an additional memory access query for each data packet. Therefore, the routing device can query the exact match cache regularly. When the hit count of the top M most frequently accessed IP addresses within a period of time accounts for a certain proportion of the total number of hash table entries, the network traffic is considered to have a high time locality, and the IP address query is performed in the lightweight cache. If the above criteria are not met, it means that the network traffic locality is low, and the data packet query is directly redirected to the search tree for query. Exemplarily, Figure 3 The following is a flow chart showing an IP lookup process provided by an embodiment of the present application. Figure 3 After receiving network traffic, the process selector on the routing device determines traffic locality based on the network traffic. In cases of high traffic locality, the process selector performs an IP lookup in the lightweight cache. If no match is found in the lightweight cache, the process selector performs a match in the search tree. In cases of low traffic locality, the process selector performs a match directly in the search tree.
[0063] In some possible embodiments, the ratio may be between 10% and 20% (inclusive).
[0064] In some possible embodiments, the method further includes: updating the search tree when the network traffic distribution changes.
[0065] In this embodiment, a search tree update module is also provided in the routing device, and the search tree is updated by the search tree update module. Given that the distribution of network traffic may change, the characteristics of the traffic will also change accordingly (i.e., the long-tail distribution of the traffic will change). At this time, searching through the existing search tree may have a certain impact on the search efficiency. Therefore, the search tree needs to be updated. Specifically, two time windows t1 and t2 are determined respectively. The first J IP entries in t1 and t2 are obtained. J can be 0.1% of the total number of IP entries. If more than half of the prefixes of the IP entries in t1 and t2 are inconsistent, it indicates that the search tree needs to be updated. The original search tree is called search tree A. During the update, a new search tree B can be established based on the current network traffic. After search tree B is established, the pointer to search tree A is redirected to search tree B, and the storage space of search tree A is released. In this way, the continuity of the search process can be guaranteed without affecting the search efficiency.
[0066] In some possible embodiments, J may be 0.1% of the total number of IP entries.
[0067] In some possible embodiments, the method further includes: updating the multiple IP addresses stored in the lightweight cache.
[0068] In this embodiment, a lightweight cache is used to accelerate the search efficiency of highly localized traffic, storing data items that contribute significantly to the traffic flow, and is implemented based on a hash table. The lightweight cache also includes a counter associated with the IP address entry, which records the frequency with which the IP address is accessed over a period of time. The counter value is updated based on changes in traffic patterns. To address cache table jitter caused by long-tail traffic distribution and bursty network traffic, the lightweight cache only stores specific data items that contribute to the majority of the traffic flow and promptly deletes entries that are no longer popular. Specifically, network traffic is sampled, and for each sampled packet, a hash operation is performed on its first IP address to find the corresponding location in the hash table. If the location is empty, a new IP address entry (the second IP address) is created, and the counter is set to 1. If the location is not empty and the first IP address matches the second IP address, the counter is incremented. If the location is not empty and the first and second IP addresses do not match, the counter is multiplied by a decay factor α. The decay factor α is used to adjust the counter value. When an IP address becomes less popular, its counter value is reduced by a decay factor to reflect the decline in its popularity. When the counter falls below 1, the IP address stored in the lightweight cache is evicted and replaced. This eviction strategy ensures that current important visitors remain in the cache because their counters are frequently incremented, while old important visitors are promptly removed due to the exponential decay of the counters. The lightweight cache is designed to quickly respond to lookup requests for those IP addresses that contribute the most to traffic, thereby improving the efficiency of the entire lookup system. By dynamically updating entries in the cache, the system can adapt to real-time changes in network traffic and maintain the timeliness and accuracy of cached content.
[0069] In some possible embodiments, the attenuation factor α is 0.99.
[0070] The above is an IPv6-based IP lookup method provided in the embodiment of the present application, which can use the characteristics of network traffic to guide the construction of the data structure (search tree) when looking up IP addresses. In this way, the characteristics of network traffic are taken into account in the construction of the search tree, and the locality of traffic distribution can be fully utilized to ensure that high-flow traffic hits the position close to the leaf node, thereby improving the efficiency of IP lookup.
[0071] It is understandable that the size of the sequence number of each step in the above-mentioned embodiments does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. In addition, in some possible implementations, the steps in the above-mentioned embodiments can be selectively executed according to actual conditions, and can be partially executed or fully executed, which is not limited here. All or part of any features of any embodiment of the present application can be freely and arbitrarily combined without contradiction. The combined technical solution is also within the scope of the present application.
[0072] Based on the method in the above embodiment, an embodiment of the present application also provides an IPv6-based IP lookup device.
[0073] For example, Figure 4 The schematic diagram of the structure of an IPv6-based IP lookup device provided by an embodiment of the present application is shown, which is deployed in a routing device. A lightweight cache is provided in the routing device. The lightweight cache stores multiple IP addresses, all of which are IPv6-based addresses. Figure 4 As shown, the IPv6-based IP lookup device 400 may include: a receiving module 401 and a lookup module 402 .
[0074] The receiving module 401 is configured to receive network traffic, the network traffic including a communication request, and query the lightweight cache based on the communication request to obtain a second IP address; wherein the communication request includes a first IP address, and the first IP address corresponds to the second IP address; and the network traffic is used to represent data packets transmitted over the network;
[0075] A search module 402 is configured to obtain the second IP address from the lightweight cache if the second IP address successfully matches any one of the multiple IP addresses;
[0076] The search module 402 is further configured to obtain the second IP address through a search tree when the second IP address fails to match any of the multiple IP addresses; the search tree is constructed based on the network traffic.
[0077] It should be understood that the above-mentioned device is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method and will not be repeated here.
[0078] The present application also provides a computing device 500. Figure 5As shown, computing device 500 includes a bus 502, a processor 504, a memory 506, and a communication interface 508. Processor 504, memory 506, and communication interface 508 communicate with each other via bus 502. Computing device 500 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 500.
[0079] The bus 502 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The fact that only one line is used in the figure does not mean that there is only one bus or only one type of bus. Bus 504 may include a path for transmitting information between various components of computing device 500 (eg, memory 506, processor 504, communication interface 508).
[0080] The processor 504 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0081] The memory 506 may include volatile memory, such as random access memory (RAM). The processor 504 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0082] The memory 506 stores executable program code, and the processor 504 executes the executable program code to implement the functions of the aforementioned receiving module 401 and the search module 402, thereby implementing all or part of the steps of the method in the above embodiment. In other words, the memory 506 stores instructions for executing all or part of the steps of the method in the above embodiment.
[0083] Alternatively, the memory 506 stores executable code, and the processor 504 executes the executable code to respectively implement the functions of the aforementioned IPv6-based IP lookup device 400, thereby implementing all or part of the steps in the above-mentioned embodiment method. In other words, the memory 506 stores instructions for executing all or part of the steps in the above-mentioned embodiment method.
[0084] The communication interface 508 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 500 and other devices or a communication network.
[0085] Based on the methods in the above embodiments, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the methods in the above embodiments.
[0086] Based on the methods in the above embodiments, an embodiment of the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the methods in the above embodiments.
[0087] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0088] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0089] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)).
[0090] It will be understood that the various numerical numbers involved in the embodiments of the present application are merely distinctions for the convenience of description and are not intended to limit the scope of the embodiments of the present application.
Claims
1. An IPv6-based IP lookup method, characterized in that: Applied to a routing device, the routing device being provided with a lightweight cache, the lightweight cache storing multiple IP addresses, the multiple IP addresses being all IPv6-based addresses, wherein the IP addresses stored in the lightweight cache are IP addresses dynamically updated based on a hit count and a decay factor, the method comprising: receiving network traffic, the network traffic including a communication request, and querying the lightweight cache based on the communication request to obtain a second IP address; wherein the communication request includes a first IP address, the first IP address corresponding to the second IP address; and the network traffic is used to represent data packets transmitted over the network; When the first IP address successfully matches any one of the multiple IP addresses, obtaining the second IP address from the lightweight cache; When the first IP address fails to match any of the multiple IP addresses, obtaining a table entry matching the first IP address through a search tree; the search tree is constructed according to the network traffic, and the search tree is a binary tree or a dictionary tree; When the search tree is a binary tree, obtaining the table entry that matches the first IP address through the search tree specifically comprises: determining, based on the network traffic, the popularity of each node in the binary tree, wherein the popularity represents the probability of a node being successfully matched; each of the nodes includes at least one table entry; constructing a binary tree based on the popularity; and obtaining the table entry that matches the first IP address through the binary tree; When the search tree is a dictionary tree, obtaining the second IP address through the search tree is specifically: determining the step length through a heuristic algorithm, including: calculating the step length based on the expected average number of memory accesses at a given step length, the memory usage of the information stored in the node N, and the maximum memory capacity, the step length representing the number of bits of the nodes in the dictionary tree that are searched simultaneously; constructing a dictionary tree based on the step length; and obtaining a table entry that matches the first IP address through the dictionary tree.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining temporal locality of network traffic, where temporal locality includes high temporal locality and low temporal locality; wherein high temporal locality is indicated by the number of hits to the most frequently accessed IP address within a time period reaching a certain ratio to the total number of hash table entries; and low temporal locality is indicated by the number of hits to the most frequently accessed IP address within a time period not reaching a certain ratio to the total number of hash table entries; In case of high temporal locality, the lightweight cache is queried, and in case of low temporal locality, the search tree is queried.
3. The method according to claim 2, characterized in that The proportion is between 10% and 20%.
4. The method according to claim 1, wherein The popularity is calculated according to the following formula Where α represents the weight of the number of rules, β represents the weight of the hit count, R(N) represents the number of rules associated with storage node N, and F(N) represents the percentage of packets in historical network traffic that ultimately find a match at node N.
5. The method according to claim 1, wherein The calculation formula for determining the step length by annealing simulation is as follows: Where, e[T(S(N))] represents the expected average number of memory accesses of a node at a given step size, N represents the storage node, Nodes represents the total storage nodes, F(N) represents the access frequency of node N, and T lookup (S(N), R(N)) represents the number of memory accesses to perform the search operation on node N, and the function M node (S(N), R(N)) represents the memory overhead of node N, S(N) represents the step size, R(N) represents the number of rules associated with storage node N, Mmax represents the maximum allowed memory capacity, st represents the constraint condition, and M(S(N)) represents the total memory overhead.
6. The method according to claim 1, characterized in that The multiple IP addresses stored in the lightweight cache are updated.
7. The method according to claim 1, characterized in that When the network traffic changes, the search tree is updated.
8. An IPv6-based IP search device, characterized in that: Deployed on a routing device, the routing device is provided with a lightweight cache, the lightweight cache stores multiple IP addresses, and the multiple IP addresses are all IPv6-based addresses. The device includes: a receiving module, configured to receive network traffic, the network traffic including a communication request, and query the lightweight cache based on the communication request to obtain a second IP address; wherein the communication request includes a first IP address, the first IP address corresponding to the second IP address; and the network traffic is used to represent data packets transmitted over the network; a search module, configured to obtain the second IP address from the lightweight cache if the second IP address successfully matches any one of the multiple IP addresses; The search module is further configured to obtain a table entry matching the first IP address through a search tree when the second IP address fails to match any of the multiple IP addresses; the search tree is constructed based on the network traffic.
Citation Information
Patent Citations
Distributed key-value query method and query engine system
CN104050250A
Routing processing method, network element equipment, network element device and readable storage medium
CN113726907A
Address matching method and device, storage medium and program product
CN117478594A