Method and apparatus for forwarding packets by obtaining addresses of the packets using a preset forwarding information base entry
First Claim
1. A method for forwarding packets, comprising:
- extracting a first group of bits from a destination Internet Protocol (IP) address of a received packet, wherein the first group of bits comprises a predetermined number of bits from the destination IP address;
searching a Ternary Content Addressable Memory (TCAM) for a TCAM entry that matches the predetermined number of bits from the destination IP address;
returning an index value from the TCAM entry when the TCAM entry is found that matches the predetermined number of bits;
combining the index value with a second group of bits from the destination IP address of the received packet to form a key value, wherein the second group of bits includes all bits from the destination IP address that are not included in the first group of bits; and
searching a random-access memory (RAM) for a preset Forwarding Information Base (FIB) entry according to the key value to obtain a forwarding IP address of the received packet.
1 Assignment
0 Petitions
Accused Products
Abstract
The present invention relates to the field of communication technologies, and discloses a method and an apparatus for forwarding packets to solve the problems in the prior art, namely, if a long Internet Protocol (IP) address needs to be searched for at the time of forwarding a packet, the number of Ternary Content Addressable Memories (TCAMs) need to be increased, or an external Random Access Memory (RAM) needs to be accessed for more times, which leads to a high cost and low performance. The method includes: extracting a first bit sequence from a destination address of a received packet, and using the first bit sequence as a key value; searching for a preset TCAM entry by using the key value, and obtaining an index value returned by the TCAM entry; and using the index value and a second group of bits in the destination address of the packet as conditions for searching, according to a predetermined algorithm, for a preset Forwarding Information Base (FIB) entry, and obtaining a forwarding address of the packet. The technical solution under the present invention is applicable to searching a table for an Internet Protocol version 6 (IPv6) address in a router.
17 Citations
19 Claims
-
1. A method for forwarding packets, comprising:
-
extracting a first group of bits from a destination Internet Protocol (IP) address of a received packet, wherein the first group of bits comprises a predetermined number of bits from the destination IP address; searching a Ternary Content Addressable Memory (TCAM) for a TCAM entry that matches the predetermined number of bits from the destination IP address; returning an index value from the TCAM entry when the TCAM entry is found that matches the predetermined number of bits; combining the index value with a second group of bits from the destination IP address of the received packet to form a key value, wherein the second group of bits includes all bits from the destination IP address that are not included in the first group of bits; and searching a random-access memory (RAM) for a preset Forwarding Information Base (FIB) entry according to the key value to obtain a forwarding IP address of the received packet. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
-
-
13. A non-transitory computer readable storage medium comprising instructions, which when executed by a processor, perform steps of:
-
extracting a first group of bits from a destination Internet Protocol (IP) address of a received packet, wherein the first group of bits comprises a predetermined number of bits from the destination IP address; searching a Ternary Content Addressable Memory (TCAM) for a TCAM entry that matches the predetermined number of bits from the destination IP address and receive an index value from the TCAM entry when the TCAM entry is found that matches the predetermined number of bits; combining the index value with a second group of bits from the destination IP address of the received packet to form a key value, wherein the second group of bits includes all bits from the destination IP address that are not included in the first group of bits; and searching a random-access memory (RAM) for a preset Forwarding Information Base (FIB) entry according to the key value to obtain a forwarding IP address of the received packet from the preset FIB entry. - View Dependent Claims (14, 15)
-
-
16. A method for forwarding packets, comprising:
-
extracting a first group of bits from a destination Internet Protocol (IP) address of a received packet, wherein the first group of bits comprises a predetermined number of bits that is less than a total number of bits in the destination address of the received packet; searching a Ternary Content Addressable Memory (TCAM) for a TCAM entry that matches the predetermined number of bits from the destination IP address; returning an index value from the TCAM entry when the TCAM entry is found that matches the predetermined number of bits; forming a key value by combining the index value from the TCAM entry with a second group of bits from the destination IP address of the received packet, wherein the second group of bits comprises all bits from the destination IP address that are not included in the first group of bits; and searching a random-access memory (RAM) for a preset Forwarding Information Base (FIB) entry using the key value to obtain a forwarding IP address of the received packet. - View Dependent Claims (17, 18, 19)
-
Specification