# A Multi-stage IPv6 Routing Lookup Algorithm Based on Hash Table and Multibit Trie Xing-ya HE * and Yun YANG

Save this PDF as:

Size: px
Start display at page:

Download "A Multi-stage IPv6 Routing Lookup Algorithm Based on Hash Table and Multibit Trie Xing-ya HE * and Yun YANG"

## Transcription

5 and [43,47] contain almost the same number of address prefixes, the step width is set to 6, 5 and 4,which can make the multi-bit tree more balanced and easy to optimize. Due to the characteristics of the multi-bit tree, 6-5-4Trie also requires to extend prefix. The prefix with a prefix length of less than 6 bits is extended to 6 bits, a prefix greater than 6 bits and less than 12 bits is extended to 5 bits and a prefix greater than 12 bits and less than 16 bits is extended to 4 bits. As the height of 6-5-4Trie up to only 4, in the worst case, it completes searching only need to access storage three times, which greatly improve the search performance. Hash Function Design and Conflict Handling. The performance of the routing lookup algorithm based on hash table is mainly determined by the hash function. Conflict of hash functions is unavoidable. Each excellent performance of the routing algorithm cannot be separated from a good hash function, as well as the strategy of conflict handling. According to the analysis of IPv6 address prefix, we can see that the probability of conflict between LFT0 and LFT1 is higher, and the probability of conflict between LFT2 and LFT3 is lower. Therefore, for different LFT, the algorithm will use different hash functions and conflict handling strategies, as shown in table 2. Table 2. Hash Functions and Conflict Handling Strategy. Five algorithms of H48, H32, H16, H64, H48c and H32c are designed for LFT0, LFT1, LFT2, LFT3, LFT0c and LFT1c. HT hash function uses MD5 to calculate. The rest are calculated using the XOR-Folding. The specific design of each hash function is shown in figure 6. Figure 6. Hash Functions. Implementation of Algorithm The algorithm flow is shown in Figure 7. The search process is divided into hash table lookup phase and 6-5-4Trie lookup phase. 202

6 Figure 7. Flow Chart of the Algorithm. Lookup of Hash Table. 1. When the IPv6 packet arrives, it determines whether the prefix of the destination IP address starts with 20, 24, 26, 28, and 2a. If not, it is compared with HT after Hash. The matching success is forwarded according to the next hop routing information pointed to by the NP. If the match fails, it is forwarded by default route. 2. If the destination IP address starts with 20, 24, 26, 28 and 2a, then the hash calculation is performed according to the first 48 bits of the destination IP address in the packet. Then, the calculated results are compared with the LFT0 table. If the match is successful and there is no conflict (cflag = 0) and no longer match (nflag = 0), then, the packet is forwarded by the next hop routing information pointed to by NP and the algorithm ends. If the match is successful and there is no conflict, but there is a longer match, then NP point to T0 into the next searching phase. 3. When the second step finds a conflict (cflag = 1), it matches the prefix with the current address prefix information. If match successfully, the process will still be followed by the second step process. If the prefix does not match the current address prefix information, it enters the query of LFT0c table. After matching with hash, if the match is successful, then forward. If fails, enter LFT1. 4. If the match with LFT0 fails in the second step, it enters LFT1. The LFT1 is compared with the result, which is produced by the first 32 bits of the destination IP address matching in the packet. The process is similar to the second step. 5. If it still fails to match until LFT3, the packet is forwarded by default route. Lookup of 6-5-4Trie. When a longer match is encountered in the hash table lookup phase, then the second phase is entered. That is the searching phase of 6-5-4Trie 1. Take T0 as an example, the 49th to 54th bits of the intercepted destination IP address are matched with the first layer of T0. If the matching is successful and the leaf node has no child nodes, it is forwarded according to the next hop routing information in the leaf node. 2. If the leaf node has a leaf node, the next hop routing information NHP is recorded at this time. And the 55th to 59th bits of the destination IP address are matched with T0. If matching succeeds, the next hop routing information NHP is updated. If fails, it will be forwarded according to NHP. 3. If there is still a leaf node in the second step, the next hop routing information NHP of the leaf node is recorded. The 60th to 64th bits of the destination IP address are matched with T0. If match succeeds, the next hop routing information of the node is forwarded. If fails, it is forwarded according to NHP. 203

8 For the 6-5-4Trie structure, each node contains pointers and NHP, so a full 6-5-4Trie requires a total storage space is: (26*6bits) + (25*5bits+16bits)*26+(24*4bits+16bits)*25*26+16bits*24*25*26=854KB In practical use, 6-5-4Trie nodes are relatively sparse, so we can use compression and other means to further reduce the consumption of storage space. Hash Collisions As can be seen from Figure 6, LFT0c and LFT1c will exist when LFT0 and LFT1 conflict. AS6939 is an autonomous network with the largest number of IPv6 routing information in the Internet. It contains prefixes with prefix length of 16, 32, 48, and 64. After processing, these address prefix information by hash functions, LFT0c and LFT1c contain 43 entries. When entries are stored in LFT, 43 conflicts occur. For these 43 entries, in addition to the need to access the LFT table, but also need to visit a conflict resolution table. The probability of collision is 0.17%, so the hash function is excellent. Experiment Simulation This paper collects the routing tables of AS174, AS3356 and AS6939 with IPv6 routing information, and gives the prefix length distribution in Table 4. Table 4. Prefix Length Distribution. This paper collects the routing tables of AS174, AS3356 and AS6939 with IPv6 routing information, and gives the prefix length distribution in Table 4. In order to illustrate the efficiency of the algorithm and avoid the error caused by the difference of the computer performance and the influence of the program, the experiment uses the number of memory access to determine the search efficiency. According to the data of Table 4, the hash function, the search speed and the storage space of the algorithm are evaluated. The algorithm is implemented in Python. Hash Function Performance First of all, the proposed hash function is tested. The data structures are created using the data in AS6939, AS174, and A3356, the experimental results shown in Table 5. Table 5. Number of hash collisions. Through the experimental simulation results, we can know that the probability of hash conflict is less than 0.2%, combined with the proposed hash conflict processing strategy, LFT can effectively store the address prefix information. Lookup Performance In the lookup performance test, the experimental results shown in Figure