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?
The rule is to find the entry in a table which has the longest prefix matching with the incoming packet's destination IP and forward the packet to the corresponding next hope. In the above example, all packets in overlapping range (192.24.
Therefore, the longest prefix matching technique is used in networks to handle the overlapping problem of packet forwarding. Moreover, a data packet comes with a destination IP address to a router. Therefore, each router has to decide the router node to which the data packet should be sent next.
Instead, classless routing protocols use a rule called longest prefix match . By this rule, the destination IP address from the packet header is matched bit-by-bit against every destination IP address in the routing table.
In other words, the most specific prefix. When a router receives the IP packet, it compares the destination IP address bit-by-bit with prefixes in the routing table. The prefix with the most matching bits is the prefix that the router will use.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With