为ipv6实现最长前缀匹配的最佳方法是什么?

编程入门 行业动态 更新时间:2024-10-16 20:25:18
本文介绍了为ipv6实现最长前缀匹配的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

ipv6路由器将许多路由存储为地址的前 n 位。在2000年,研究人员在1500 ipv6路由中仅发现14种不同的前缀长度。传入的数据包会根据最长前缀匹配而路由到不同的出站端口,因此,如果数据包x的前8位与8位路由相匹配,但同一数据包的前48位与48位路由相匹配,则路由器必须选择48位路由。

An ipv6 router stores a number of routes as the first n bits of the address. In 2000, researchers found only 14 distinct prefix lengths in 1500 ipv6 routes. Incoming packets are routed to different outgoing ports based on the longest prefix match, so if the first 8 bits of packet x match an 8 bit route but the first 48 bits of the same packet match a 48-bit route then the router must choose the 48-bit route.

我的路由器处理的数据包太多,因此内存对路由表的查找速度是一个限制因素。在路由表中找到最长匹配前缀的好的算法是什么?

My router is processing so many packets that the speed of memory lookup into the routing table is a limiting factor. What is a good algorithm to find the longest matching prefix in my routing table?

推荐答案

使用 trie 或 radix-tree 来存储标准前缀。后缀树/数组是不必要的过度杀伤;它们用于查找后缀之间的匹配项(使用任何后缀均是后缀的前缀这一事实,如果要在多个字符串之间找到匹配项,则将它们彼此连接),而不是只是在前缀之间。

Use either a trie or a radix-tree to store the "standard" prefixes. A suffix tree/array is an unnecessary over-kill; they are used to find matches between infixes (using the fact that any infix is a prefix of a suffix, and if you want to find a match between several strings, concatenate them to one another), and not just between prefixes.

更多推荐

为ipv6实现最长前缀匹配的最佳方法是什么?

本文发布于:2023-10-26 18:32:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1531000.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:前缀   最长   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!