CN107948060A - A kind of new routing table is established and IP method for searching route and device - Google Patents

A kind of new routing table is established and IP method for searching route and device Download PDF

Info

Publication number
CN107948060A
CN107948060A CN201610892179.5A CN201610892179A CN107948060A CN 107948060 A CN107948060 A CN 107948060A CN 201610892179 A CN201610892179 A CN 201610892179A CN 107948060 A CN107948060 A CN 107948060A
Authority
CN
China
Prior art keywords
node
tree
endpoint
output port
routing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201610892179.5A
Other languages
Chinese (zh)
Inventor
陈钦树
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sanechips Technology Co Ltd
Shenzhen ZTE Microelectronics Technology Co Ltd
Original Assignee
Shenzhen ZTE Microelectronics Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen ZTE Microelectronics Technology Co Ltd filed Critical Shenzhen ZTE Microelectronics Technology Co Ltd
Priority to CN201610892179.5A priority Critical patent/CN107948060A/en
Priority to PCT/CN2017/088765 priority patent/WO2018068524A1/en
Publication of CN107948060A publication Critical patent/CN107948060A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/58Association of routers
    • H04L45/586Association of routers of virtual routers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/7453Address table lookup; Address filtering using hashing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/74591Address table lookup; Address filtering using content-addressable memories [CAM]

Abstract

The embodiment of the invention discloses a kind of new routing table foundation and IP method for searching route and device, wherein, the method for building up of the routing table includes:Routing iinformation is obtained, the routing iinformation includes virtual flow-line forwarding Field Number VRF_ID, internet protocol address and the corresponding output port of the IP address;One routing entry section is combined into according to the VRF_ID and the IP address;Hash operation is carried out to the VRF_ID in the starting endpoint in the routing entry section using default hash algorithm, obtains the corresponding cryptographic Hash of the VRF_ID;A tree table is generated using the equal starting endpoint of all cryptographic Hash;Wherein, the leaf node of the tree table includes the corresponding output port of the starting endpoint, and the corresponding output port of IP address output port corresponding with the starting endpoint is identical;Main routing table is built according to all tree tables of generation.

Description

A kind of new routing table is established and IP method for searching route and device
Technical field
The present invention relates to packet-switch technology field, more particularly to a kind of new routing table is established and IP routes are looked into Look for method and apparatus.
Background technology
With the fast development of internet (Internet), the scale of routing table also increases therewith.In order to reduce road By the growth rate of table scale and the utilization rate of raising address space, Internet engineering task force (IETF, Internet Engineering Task Force) it is that Internet proposes a kind of referred to as classless inter-domain routing (CIDR, Classless Inter-Domain Routing) address structure, CIDR abandoned traditional class-based address distribution, it is specified that can make With the net address part of random length, therefore generate the concept of " network prefix ".Before CIDR is using the network of random length Sew to replace the network number and subnet number in traditional classification address, rather than as 1 byte, 2 bytes can only be used in Categories Address With the network number of 3 bytes;Therefore, under cidr address structural system, the scale of routing table has obtained certain control;But net The lookup of network prefix allows design to become extremely complex, and the lookup of network prefix not only needs to carry out matching with prefix bits position to look into Look for, it is also necessary to consider the length of network prefix.
In the prior art, existing Internet protocol (IP, Internet Protocol) route exchange device is usually adopted Before realizing that IP address is most long with three-state content addressing memory (TCAM, Ternary Content Addressable Memory) The lookup sewed.TCAM uses parallel search technology so that the number of entries for searching speed and list item is unrelated.Meanwhile in order to realize Higher lookup speed simultaneously obtains the address of longest prefix match (LPM, Longest Prefix Matching), in TCAM All kinds of list items are arranged according to the length order from long to short of IP address prefix, routing table may finally be realized more than 100 ten thousand In the case of rule purpose, the lookup speed of more than one hundred million times per second.
The advantage of above-mentioned TCAM technologies is:Parallel search allows a clock cycle to complete search procedure, and can Increase look-up table capacity to cascade multiple TCAM, it realizes fairly simple.But TCAM technologies still have some shortcomings: Firstth, TCAM needs to be compared each entry in keyword to be found and TCAM routing tables within the same clock cycle Compared with so power consumption is bigger;Secondth, since the TCAM structures realized are each bars of the routing table of keyword to be found and configuration Mesh, which is carried out at the same time, to be compared, therefore each entry corresponds to a comparator, so as to cause that TCAM device costs are higher, and price is held high It is expensive;3rd, since the comparator sum needed for being realized using TCAM technologies is equal with the routing entry sum in routing table, because This, in practical applications, limits the scale using the TCAM routing tables realized to a certain extent.
The content of the invention
In order to solve the above technical problems, an embodiment of the present invention is intended to provide a kind of new routing table foundation and IP roads By lookup method and device, to reduce the number of comparisons of routing entry, so as to reduce the number of comparator in circuit, reduce real Existing cost and power consumption.
The technical proposal of the invention is realized in this way:
In a first aspect, an embodiment of the present invention provides a kind of new routing table method for building up, the described method includes:
Obtain routing iinformation;Wherein, the routing iinformation includes virtual flow-line forwarding Field Number VRF_ID, Internet protocol IP address and the corresponding output port of the IP address;
One routing entry section is combined into according to the VRF_ID and the IP address;
Hash operation is carried out to the VRF_ID in the starting endpoint in the routing entry section using default hash algorithm, Obtain the corresponding cryptographic Hash of the VRF_ID;
A tree table is generated using the equal starting endpoint of all cryptographic Hash;Wherein, the leaf node of the tree table Comprising the corresponding output port of the starting endpoint, and the corresponding output port of the IP address is corresponding with the starting endpoint Output port is identical;
Main routing table is built according to all tree tables of generation.
In such scheme, the starting endpoint equal using all cryptographic Hash generates a tree table;Wherein, institute The tree node for stating tree table is applied not only to determine matched endpoint, is additionally operable to determine searching route.
In such scheme, when the tree table is 2-3 tree tables, the initiating terminal equal using all cryptographic Hash Point one tree table of generation, specifically includes:
The equal starting endpoint of all cryptographic Hash is sorted according to ascending order, and will be all after sequence Starting endpoint is stored in array a [n];
From the array a [n] data of extraction a [2 × (i-1)] as the tree table first layer from left to right the The left end point of i node;Wherein, 1≤i≤(n+1)/2, n >=1;
From the array a [n] data of extraction a [2 × (i-1)+1] as the tree table first layer from left to right The right endpoint of i-th of node;
The extraction a [2 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] pth of the data as the tree table The left end point of k-th of the node of layer from left to right;Wherein, p >=2,1≤k≤(log3T) -1, t is the node total number of -1 layer of pth;
The extraction a [4 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] pth of the data as the tree table The right endpoint of k-th of the node of layer from left to right.
It is described to build main routing table according to all tree tables of generation in such scheme, specifically include:According to the Hash The corresponding main routing table memory block of storage address write-in router of value index, completes the structure of the main routing table.
Second aspect, an embodiment of the present invention provides a kind of IP method for searching route, the described method includes:
The IP data are obtained according to the input port of the IP data packets of reception and virtual LAN numbering VLAN_ID mappings Wrap corresponding VRF_ID;
The purpose IP address in the IP data packets is read, and the destination IP address and the VRF_ID are combined into one Bar routing entry to be found;
Hash operation is carried out to the VRF_ID in the routing entry to be found using the hash algorithm and obtains cryptographic Hash;
The main routing table is searched according to the cryptographic Hash, determines the output port of the IP data packets;Wherein, the master Routing table is the main routing table of Claims 1-4 any one of them.
It is described that the main routing table is searched according to the cryptographic Hash in such scheme, determine the defeated of the IP data packets Exit port, specifically includes:
Index using the cryptographic Hash as the main routing table list item storage address, indexes from the main routing table and obtains Obtain the corresponding tree table node of the cryptographic Hash;Wherein, the tree table node is the list item of the main routing table;
According to the content of the tree table node, the endpoint for obtaining and matching with the routing entry to be found is searched, is obtained The output port of the IP data packets.
In such scheme, the content according to the tree table node, searches and obtains and the routing entry to be found The endpoint to match, obtains the output port of the IP data packets, specifically includes:
When the node type in the node content is root node or intermediate node, according to the route bar to be found Mesh takes out the corresponding pointer in the node with the relation of the node endpoint, and reads the tree table node pointed by the pointer In node content;
When the node type in the node content is leaf node, according to the routing entry to be found and the leaf The relation of child node endpoint, obtains the output port of the IP data packets.
In such scheme, when the tree table is 2-3 tree tables, the node type worked as in the node content is root When node or intermediate node, taken out according to the routing entry to be found and the relation of the node endpoint in the node Corresponding pointer, and the node content in the tree table node pointed by the pointer is read, specifically include:
When the routing entry to be found is less than the left end point of the node, the left pointer in the node is taken out, is read Take the node content in the tree table node pointed by the left pointer;
When left end point of the routing entry to be found more than or equal to the node, and less than the right endpoint of the node When, the middle pointer in the node is taken out, reads the node content in the tree table node pointed by the middle pointer;
When the routing entry to be found is greater than or equal to the right endpoint of the node, the right finger in the node is taken out Pin, reads the node content in the tree table node pointed by the right pointer.
In such scheme, when the tree table is 2-3 tree tables, the node type worked as in the node content is leaf During child node, according to the routing entry to be found and the relation of the leaf node endpoint, the defeated of the IP data packets is obtained Exit port, specifically includes:
When the routing entry to be found is equal with the left end point of the leaf node, by the left end of the leaf node Output port of the corresponding output port of point as the IP data packets;
When the routing entry to be found is equal with the right endpoint of the leaf node, by the right end of the leaf node Output port of the corresponding output port of point as the IP data packets;
When the routing entry to be found is more than the left end point of the leaf node and less than the right end of the leaf node During point, the corresponding output port in section that the left end point of the leaf node and right endpoint are formed is as the IP data packets Output port;
When the routing entry to be found is more than the right endpoint of the leaf node, the leaf node right end will be greater than Output port of the correspondence output port of point as the IP data packets.
In such scheme, after this node layer has handled the route querying of current IP data packets, the method further includes: Described node layer is given the current IP data packets to next node layer immediately and is handled, and carries out IP to next IP data packets Route querying.
In such scheme, the method further includes:While completing the main routing table and establishing, to the main road by Table is backed up.
In such scheme, when needing to be updated the main routing table, the method further includes:
The data structure of the tree table is adjusted according to new configuration rule;
The route stand-by table is updated according to the tree table after adjustment;
The lookup that IP routes are carried out on the route stand-by table is switched to from the main routing table;
The main routing table is updated according to the tree table after adjustment;
The lookup that IP routes are carried out in the main routing table is switched to from the route stand-by table.
The third aspect, an embodiment of the present invention provides a kind of new routing table to establish device, and described device includes:First Acquiring unit, the first assembled unit, the first arithmetic element, tree table generation unit, construction unit and updating block;Wherein,
The first acquisition unit, for obtaining routing iinformation;Wherein, the routing iinformation includes virtual flow-line forwarding domain Numbering VRF_ID, IP address and the corresponding output port of the IP address;
First assembled unit, for being combined into a routing entry area according to the VRF_ID and the IP address Between;
First arithmetic element, for utilizing default hash algorithm in the starting endpoint in the routing entry section VRF_ID carry out Hash operation, obtain the corresponding cryptographic Hash of the VRF_ID;
The tree table generation unit, for generating a tree table using the equal starting endpoint of all cryptographic Hash;Its In, the leaf node of the tree table includes the corresponding output port of the starting endpoint, and the corresponding output terminal of the IP address Mouth output port corresponding with the starting endpoint is identical;
The construction unit, for building main routing table according to all tree tables of generation.
In such scheme, the tree node for the tree table that the tree table generation unit generates is applied not only to determine matched Endpoint, is additionally operable to determine searching route.
In such scheme, when the tree table is 2-3 tree tables, the tree table generation unit, is specifically used for:
The equal starting endpoint of all cryptographic Hash is sorted according to ascending order, and will be all after sequence Starting endpoint is stored in array a [n];
From the array a [n] data of extraction a [2 × (i-1)] as the tree table first layer from left to right the The left end point of i node;Wherein, 1≤i≤(n+1)/2, n >=1;
From the array a [n] data of extraction a [2 × (i-1)+1] as the tree table first layer from left to right The right endpoint of i-th of node;
The extraction a [2 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] pth of the data as the tree table The left end point of k-th of the node of layer from left to right;Wherein, p >=2,1≤k≤(log3T) -1, t is the node total number of -1 layer of pth;
The extraction a [4 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] pth of the data as the tree table The right endpoint of k-th of the node of layer from left to right.
In such scheme, the construction unit, is specifically used for:The storage address indexed according to the cryptographic Hash writes road By the corresponding main routing table memory block of device, the structure of the completion main routing table.
Fourth aspect, an embodiment of the present invention provides a kind of new IP device for searching route, described device includes:Second Acquiring unit, the second assembled unit, the second arithmetic element and searching unit;Wherein,
The second acquisition unit, input port and virtual LAN numbering for the IP data packets according to reception VLAN_ID mappings obtain the corresponding VRF_ID of the IP data packets;
Second assembled unit, for reading the purpose IP address in the IP data packets, and by the destination IP Location is combined into a routing entry to be found with the VRF_ID;
Second arithmetic element, for using the hash algorithm to the VRF_ID in the routing entry to be found into Row Hash operation obtains cryptographic Hash;
The searching unit, for searching the main routing table according to the cryptographic Hash, determines the defeated of the IP data packets Exit port;Wherein, the main routing table establishes the main routing table constructed by device for the routing table.
In such scheme, the searching unit, is specifically used for:
Index using the cryptographic Hash as the main routing table list item storage address, indexes from the main routing table and obtains Obtain the corresponding tree table node of the cryptographic Hash;Wherein, the tree table node is the list item of the main routing table;
According to the content of the tree table node, the endpoint for obtaining and matching with the routing entry to be found is searched, is obtained The output port of the IP data packets.
In such scheme, the searching unit, is specifically used for:
When the node type in the node content is root node or intermediate node, according to the route bar to be found Mesh takes out the corresponding pointer in the node with the relation of the node endpoint, and reads the tree table node pointed by the pointer In node content;
When the node type in the node content is leaf node, according to the routing entry to be found and the leaf The relation of child node endpoint, obtains the output port of the IP data packets.
In such scheme, when the tree table is 2-3 tree tables, the searching unit, is specifically used for:
When the routing entry to be found is less than the left end point of the node, the left pointer in the node is taken out, is read Take the node content in the tree table node pointed by the left pointer;
When left end point of the routing entry to be found more than or equal to the node, and less than the right endpoint of the node When, the middle pointer in the node is taken out, reads the node content in the tree table node pointed by the middle pointer;
When the routing entry to be found is greater than or equal to the right endpoint of the node, the right finger in the node is taken out Pin, reads the node content in the tree table node pointed by the right pointer.
In such scheme, when the tree table is 2-3 tree tables, the searching unit, is specifically used for:
When the routing entry to be found is equal with the left end point of the leaf node, by the left end of the leaf node Output port of the corresponding output port of point as the IP data packets;
When the routing entry to be found is equal with the right endpoint of the leaf node, by the right end of the leaf node Output port of the corresponding output port of point as the IP data packets;
When the routing entry to be found is more than the left end point of the leaf node and less than the right end of the leaf node During point, the corresponding output port in section that the left end point of the leaf node and right endpoint are formed is as the IP data packets Output port;
When the routing entry to be found is more than the right endpoint of the leaf node, the leaf node right end will be greater than Output port of the correspondence output port of point as the IP data packets.
In such scheme, the searching unit, is specifically additionally operable to:When this node layer has handled the road of current IP data packets After searching, give the current IP data packets to next node layer immediately and handle, and IP roads are carried out to next IP data packets By searching.
In such scheme, the construction unit, is specifically additionally operable to:The main routing table is backed up.
In such scheme, the updating block, is specifically used for:
The data structure of the tree table is adjusted according to new configuration rule;
The route stand-by table is updated according to the tree table after adjustment;
The lookup that IP routes are carried out on the route stand-by table is switched to from the main routing table;
The main routing table is updated according to the tree table after adjustment;
The lookup that IP routes are carried out in the main routing table is switched to from the route stand-by table.
An embodiment of the present invention provides a kind of new routing table foundation and IP method for searching route and device, the party Method is respectively completed the structure of the main routing table and the lookup of IP routes using double Hash operations, and uses tree form data structure The main routing table is built, so that realizing the circuit structure of this method becomes simple possible.In addition, in IP route querying ranks Section, this method carry out cryptographic Hash extraction to corresponding VRF_ID using Hash operation, are completed by the cryptographic Hash to the master The quick lookup of routing table, realizes the Rapid matching of purpose IP address, so as to reduce the number of comparisons of routing entry, reduces Cost of implementation.In addition, from the perspective of hardware realization, this method causes the area realized and power consumption to be all far smaller than TCAM.
Brief description of the drawings
Fig. 1 realizes flow chart for a kind of routing table method for building up provided in an embodiment of the present invention;
Fig. 2 is a kind of tree table generation method schematic diagram provided in an embodiment of the present invention;
Fig. 3 is a kind of IP method for searching route schematic diagram provided in an embodiment of the present invention;
Fig. 4 is that a kind of specific method that the main routing table is searched according to the cryptographic Hash provided in an embodiment of the present invention shows It is intended to;
Fig. 5 is provided in an embodiment of the present invention a kind of according to the specific of the content of tree table node progress IP route queryings Method schematic diagram;
Fig. 6 is a kind of specific method signal that IP route queryings are carried out by taking 2-3 tree tables as an example provided in an embodiment of the present invention Figure;
Fig. 7 is a kind of routing table update method schematic diagram provided in an embodiment of the present invention;
Fig. 8 is a kind of structure diagram of 2-3 tree tables provided in an embodiment of the present invention;
Fig. 9 is a kind of storage format schematic diagram of the 2-3 tree tables provided in an embodiment of the present invention in the main routing table;
Figure 10 is the structure diagram that a kind of new routing table provided in an embodiment of the present invention establishes device;
Figure 11 is a kind of structure diagram of new IP device for searching route provided in an embodiment of the present invention.
Embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete Site preparation describes.
Embodiment one
As shown in Figure 1, it gives a kind of new routing table method for building up provided in an embodiment of the present invention, the side Method can specifically include:
S110, obtain routing iinformation;Wherein, the routing iinformation include virtual flow-line forwarding Field Number (VRF_ID, Virtual Route Forwarding ID), internet protocol address and the corresponding output port of the IP address;
S120, according to the VRF_ID and the IP address be combined into a routing entry section;
For example, the VRF_ID that the routing iinformation obtained includes is 8, purpose IP address 192.168.10.*, then the mesh The corresponding routing entry section of IP address be 8.192.168.10.0~8.192.168.10.255.
S130, using default hash algorithm in the starting endpoint in the routing entry section VRF_ID carry out Hash Computing, obtains the corresponding cryptographic Hash of the VRF_ID;
Such as above-mentioned example, routing entry section is 8.192.168.10.0~8.192.168.10.255, is readily obtained this The starting endpoint in routing entry section is 8.192.168.10.0, and the VRF_ID of the endpoint is the first character section of the endpoint.
S140, utilize equal starting endpoint one tree table of generation of all cryptographic Hash;Wherein, the leaf node of the tree table Comprising the corresponding output port of the starting endpoint, and the corresponding output port of the IP address is corresponding with the starting endpoint Output port is identical;
It should be noted that the tree table can be 2-3 tree tables or y-bend tree table or multi-fork tree table, simply 2-3 tree tables, which can obtain, preferably searches the time.In addition, the tree table is different from the tree table on common data structure, the tree The tree node of table is applied not only to determine matched endpoint, is additionally operable to determine searching route.By taking 2-3 tree tables as an example, to the structure of tree table Into illustrating.Under normal conditions, 2-3 tree tables are made of root node, intermediate node and leaf node;Wherein, root node includes Node type, left pointer, middle pointer, right pointer and two starting endpoints;Similarly, intermediate node also includes node type, a left side Pointer, middle pointer, right pointer and two starting endpoints;Leaf node includes node type, two starting endpoints and two startings The corresponding output port of endpoint.It is readily appreciated that ground, pointer is used to be directed toward the node that pointer address is specified, in practical application In, our left end points using that less starting endpoint in two starting endpoints as node, that larger starting endpoint As the right endpoint of node, and indicate with 1 bit the type of node.
S150, according to all tree tables of generation build main routing table.
It should be noted that described build main routing table according to all tree tables of generation, specifically, by all trees of generation The corresponding main routing table memory block of storage address write-in router that table is indexed according to the cryptographic Hash, completes the main routing table Structure.The subsequently renewal to the main routing table, and avoid the occurrence of and lose while the main routing table update for convenience The situation of bag, while the main routing table structure is completed, the main routing table is backed up, writes route stand-by table pair In the memory block answered.
Exemplarily, when the tree table is 2-3 tree tables, the starting endpoint generation one equal using all cryptographic Hash A tree table, as shown in Fig. 2, can specifically include:
S210, sort the equal starting endpoint of all cryptographic Hash according to ascending order, and by the institute after sequence There is starting endpoint to be stored in array a [n];
It should be noted that the structure in order to facilitate tree table, it is generally the case that first by the starting endpoint for building tree table Sort according to ascending order.Wherein, in array a [n] n value for the equal starting endpoint of all cryptographic Hash sum;
S220, from the data of extraction a [2 × (i-1)] in the array a [n] as the tree table first layer from a left side to The left end point of i-th right of node;Wherein, 1≤i≤(n+1)/2, n >=1;
S230, from the array a [n] extraction a [2 × (i-1)+1] data as the tree table first layer from a left side To the right endpoint of i-th right of node;
S240, the extraction a [2 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] data as the tree table Pth layer k-th of node from left to right left end point;Wherein, p >=2,1≤k≤(log3T) -1, t is the node of -1 layer of pth Sum;
S250, the extraction a [4 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] data as the tree table Pth layer k-th of node from left to right right endpoint.
It should be noted that the bottom of 2-3 tree tables is leaf layer, first layer is denoted as;The last layer of leaf layer is second Layer, the number of plies are from bottom to top incremented by successively.The generation method of y-bend tree table and multi-fork tree table is similar with 2-3 tree tables, is all from array a Corresponding data composition tree structure is extracted in [n], simply the subscript of array is different.
After the foundation of the main routing table is completed, as shown in figure 3, the embodiment of the present invention additionally provides a kind of new IP Method for searching route, the method can specifically include:
S310, input port and virtual LAN numbering (VLAN_ID, Virtual according to the IP data packets of reception Local Area Network ID) the corresponding VRF_ID of the mapping acquisition IP data packets;
It should be noted that router can be according to the input port and VLAN_ID of the IP data packets of reception by tabling look-up Obtain the corresponding VRF_ID of the IP data packets.
S320, read purpose IP address in the IP data packets, and by the destination IP address and the VRF_ID groups Synthesize a routing entry to be found;
S330, using the hash algorithm in the routing entry to be found VRF_ID carry out Hash operation breathed out Uncommon value;
It should be noted that hash algorithm employed in IP method for searching route with the main routing table method for building up Used hash algorithm is identical.
S340, according to the cryptographic Hash search the main routing table, determines the output port of the IP data packets.
Exemplarily, the main routing table is searched according to the cryptographic Hash, determines the output port of the IP data packets, such as Shown in Fig. 4, it can specifically include:
S410, the index using the cryptographic Hash as the main routing table list item storage address, from the main routing table Index obtains the corresponding tree table node of the cryptographic Hash;Wherein, the tree table node is exactly the list item of the main routing table;
S420, the content according to the tree table node, search the endpoint for obtaining and matching with the routing entry to be found, Obtain the output port of the IP data packets.
Exemplarily, according to the content of the tree table node, search and obtain what is matched with the routing entry to be found Endpoint, obtains the output port of the IP data packets, as shown in figure 5, can specifically include:
S510, judge whether the node type in the node content is leaf node;If so, perform step S530; Otherwise, step S520 is performed;
S520, corresponding refer to according to what the relation of the routing entry to be found and the node endpoint was taken out in the node Pin, reads the node content in the tree table node pointed by the pointer, and returns and perform step S510;
S530, the relation according to the routing entry to be found and the leaf node endpoint, obtain the IP data packets Output port.
The understanding of specific search procedure is route to above-mentioned IP for convenience, it is right below by taking the tree table is 2-3 tree tables as an example The content according to the tree table node, searches the endpoint for obtaining and matching with the routing entry to be found, described in acquisition The concrete methods of realizing of the output port of IP data packets illustrates, as shown in fig. 6, can specifically include:
S610, judge whether the node type in the node content is leaf node;If it is, perform step S630;Otherwise, step S620 is performed;
S620, judge whether the routing entry to be found is less than the left end point of the node;If so, perform step S621;Otherwise, step S622 is performed;
Left pointer in S621, the taking-up node, reads in the node in the tree table node pointed by the left pointer Hold, and return and perform step S610;
S622, judge whether the routing entry to be found is greater than or equal to the left end point of the node, and less than described The right endpoint of node;If so, perform step S623;Otherwise, step S624 is performed;
Middle pointer in S623, the taking-up node, reads in the node in the tree table node pointed by the middle pointer Hold, and return and perform step S610;
Right pointer in S624, the taking-up node, reads in the node in the tree table node pointed by the right pointer Hold, and return and perform step S610;
S630, judge whether the routing entry to be found is equal with the left end point of the leaf node;If so, perform Step S631;Otherwise, step S632 is performed;
S631, the output port using the corresponding output port of the left end point of the leaf node as the IP data packets;
S632, judge whether the routing entry to be found is equal with the right endpoint of the leaf node;If so, perform Step S633;Otherwise, step S634 is performed;
S633, the output port using the corresponding output port of the right endpoint of the leaf node as the IP data packets;
S634, judge whether the routing entry to be found falls between the left end point and right endpoint of the leaf node; If so, perform step S635;Otherwise, step S636 is performed;
S635, the corresponding output port in section for forming the left end point and the right endpoint are as the IP data packets Output port;
S636, will be greater than output port of the correspondence output port of the right endpoint as the IP data packets.
It should be noted that due to the growth of information explosion, so network traffics also increase rapidly, in order to set exchange The standby needs that can adapt to network traffics, switching equipment should reach linear speed and exchange disposal ability, therefore the route of destination IP is looked into Look for and be also required to that line-speed processing ability can be reached.If the destination IP route querying engine of said one IP data packets meets equipment Line-speed processing ability, then in practical applications, in order to adapt to the demand of network traffics, tree table can be carried out horizontal point Cut, i.e., after Lookup engine has handled the lookup of this node layer, currently processed IP data packets are given next node layer and searched and are drawn Processing is held up, at this time, this node layer Lookup engine immediately treats next IP data packets, the lookup without waiting whole tree table Journey terminates just to handle next IP data packets.
In addition, carrier class switching equipment is required to uninterruptedly work and reach a less packet loss, Also do not allow packet loss when the main routing table is updated;Therefore, in practical applications, as shown in fig. 7, the main road It can specifically be included by the update method of table:
S710, the data structure according to the new configuration rule adjustment tree table;
S720, central processor CPU start to update the route stand-by table according to the tree table after adjustment;
S730, after completing the renewal of the route stand-by table, CPU request hardware is switched to described standby from the main routing table The lookup of IP routes is carried out in part routing table;
S740, hardware complete routing table switching after reporting interruption to CPU, CPU receive interruption after start described in renewal Main routing table;
S750, CPU ask hardware to be switched to the master from the route stand-by table after completing the renewal of the main routing table The lookup of IP routes is carried out in routing table.
An embodiment of the present invention provides a kind of new IP method for searching route, this method has been distinguished using double Hash operations Into the lookup of structure and the IP route of the main routing table, and the main routing table is built using tree form data structure, so that So that realizing the circuit structure of this method becomes simple possible.In addition, in the IP route querying stages, this method utilizes Hash operation Cryptographic Hash extraction is carried out to corresponding VRF_ID, completes to search the quick of the main routing table by the cryptographic Hash, realizes The Rapid matching of purpose IP address, so as to reduce the number of comparisons of routing entry, reduces cost of implementation.In addition, from hardware From the perspective of realization, this method causes the area realized and power consumption to be all far smaller than TCAM.
Embodiment two
Based on the identical technical concept of previous embodiment, the present embodiment will combine technical solutions of the Fig. 8 to previous embodiment Make more directly perceived, detailed description.
Assuming that the main routing table is made of a 2-3 tree table, as shown in figure 8, and the tree table include 9 leaf nodes, Each leaf node includes 2 starting endpoints, an entry using each starting endpoint as the main routing table, then the main road It is 18 by the entry sum of table, the list item of each main routing table includes two entries.When router receives an IP data packet When, its VRF_ID is 8, purpose IP address 192.168.10.19, then routing entry to be found is 8.192.168.10.19.VRF_ID is taken to do Hash operation first, it is assumed that hash function is except 8 round numbers parts, then 8 divided by 8 Business be 1, i.e. cryptographic Hash hash_idx be 1.The list item of the main routing table is read with the address of hash_idx instructions, in list item Hold for the root vertex of the 2-3 tree tables shown in Fig. 8, i.e. 9.192.168.10.0/10.192.168.10.0.The class of decision node Type is root node, is then compared with the left and right endpoint of routing entry 8.192.168.10.19 to be found and the root node, knot Fruit is less than the left end point 9.192.168.10.0 of root node, is corresponded to so taking left pointer to be read as the address of the main routing table List item, obtain 8.192.168.70.0/8.192.168.110.0.The type of decision node is intermediate node at this time, then with treating The left and right endpoint for searching routing entry 8.192.168.10.19 and the intermediate node is compared, and finds routing entry to be found 8.192.168.10.19 it is less than the left end point 8.192.168.70.0 of the intermediate node, so taking left pointer as the main road Corresponding list item is read by the address of table, node 8.192.168.10.0/8.192.168.20.0 is obtained, judges the node for leaf Child node, routing entry 8.192.168.10.19 to be found be more than the leaf node left end point 8.192.168.10.0 and , should so taking the corresponding output ports of 8.192.168.10.0 to be used as less than the right endpoint 8.192.168.20.0 of the leaf node The output port of data packet.
In addition, it is necessary to explanation, Fig. 9 is storage formats of the Fig. 8 in the main routing table, wherein:
Key1 is 8.192.168.10.0, and corresponding output port is 1;
Key2 is 8.192.168.20.0, and corresponding output port is 2;
Key3 is 8.192.168.70.0, and corresponding output port is 3;
Key4 is 8.192.168.90.0, and corresponding output port is 4;
Key5 is 8.192.168.110.0, and corresponding output port is 5;
Key6 is 8.192.168.140.0, and corresponding output port is 6;
Key7 is 9.192.168.10.0, and corresponding output port is 7;
……
Key13 is 10.192.168.10.0, and corresponding output port is 13;
……
Key18 is 10.192.168.140.0, and corresponding output port is 18.
Node type is root node, intermediate node and leaf node.Root node is as the entry format of intermediate node, all Starting endpoint comprising two routing entry sections, left pointer, middle pointer, right pointer and node type (root node or middle node Point).The form of leaf node entry is starting endpoint, the corresponding output port of each endpoint and the section in two routing entry sections Vertex type (leaf node).
It can be seen that the main routing table of corresponding 18 entries from above-mentioned search procedure, only needed using above-mentioned lookup method Want 3 comparisons or can complete this lookup using 3 comparators;But need 18 comparators complete using TCAM Into this lookup.Therefore, understood according to formula (1), realize that IP longest prefix match ratio is adopted using method provided by the present invention 15 comparisons or 15 comparators are lacked with the TCAM IP longest prefix match realized.
Wherein, N is the entry sum of main routing table, while N is also using the number of comparisons needed for TCAM technologies or compares Device number,Represent the number of comparisons or comparator number needed for being realized using method provided by the present invention.
Can be readily apparent that from examples detailed above, compared to existing TCAM technologies, the embodiment of the present invention provided one The new method for searching route of kind greatly reduces the resource for searching number or realization, its cost of implementation is low, small power consumption.This Outside, since the present invention is realized using common RAM or DDR, it can be adapted for needing the router of extensive routing table, and TCAM It is only applicable to need the router of small-scale routing table due to physics realization.
Embodiment three
Based on the identical technical concept of previous embodiment, referring to Figure 10, it illustrates one kind provided in an embodiment of the present invention New routing table establishes device 100, and described device can include:First acquisition unit 1010, the first assembled unit 1020, One arithmetic element 1030, tree table generation unit 1040, construction unit 1050 and updating block 1060;Wherein,
The first acquisition unit 1010, for obtaining routing iinformation;Wherein, the routing iinformation turns including virtual flow-line Send out Field Number VRF_ID, IP address and the corresponding output port of the IP address;
First assembled unit 1020, for being combined into a routing entry according to the VRF_ID and the IP address Section;
First arithmetic element 1030, for the initiating terminal using default hash algorithm to the routing entry section VRF_ID in point carries out Hash operation, obtains the corresponding cryptographic Hash of the VRF_ID;
The tree table generation unit 1040, for generating a tree using the equal starting endpoint of all cryptographic Hash Table;Wherein, the leaf node of the tree table includes the corresponding output port of the starting endpoint, and the IP address is corresponding defeated Exit port output port corresponding with the starting endpoint is identical;
The construction unit 1050, for building main routing table according to all tree tables of generation.
In such scheme, the tree node for the tree table that the tree table generation unit 1040 generates is applied not only to definite The endpoint matched somebody with somebody, is additionally operable to determine searching route.
In such scheme, when the tree table is 2-3 tree tables, the tree table generation unit 1040, is specifically used for:
The equal starting endpoint of all cryptographic Hash is sorted according to ascending order, and will be all after sequence Starting endpoint is stored in array a [n];
From the array a [n] data of extraction a [2 × (i-1)] as the tree table first layer from left to right the The left end point of i node;Wherein, 1≤i≤(n+1)/2, n >=1;
From the array a [n] data of extraction a [2 × (i-1)+1] as the tree table first layer from left to right The right endpoint of i-th of node;
The extraction a [2 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] pth of the data as the tree table The left end point of k-th of the node of layer from left to right;Wherein, p >=2,1≤k≤(log3T) -1, t is the node total number of -1 layer of pth;
The extraction a [4 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] pth of the data as the tree table The right endpoint of k-th of the node of layer from left to right.
In such scheme, the construction unit 1050, is specifically used for:Write according to the storage address that the cryptographic Hash indexes Enter the corresponding main routing table memory block of router, complete the structure of the main routing table.
In addition, on the basis of completing the main routing table and establishing, the embodiment of the present invention also provides a kind of new IP roads By lookup device 110, as shown in figure 11, described device includes:Second acquisition unit 1110, the second assembled unit 1120, second Arithmetic element 1130 and searching unit 1140;Wherein,
The second acquisition unit 1110, input port and virtual LAN numbering for the IP data packets according to reception VLAN_ID mappings obtain the corresponding VRF_ID of the IP data packets;
Second assembled unit 1120, for reading the purpose IP address in the IP data packets, and by the purpose IP address is combined into a routing entry to be found with the VRF_ID;
Second arithmetic element 1130, for utilizing the hash algorithm to the VRF_ in the routing entry to be found ID carries out Hash operation and obtains cryptographic Hash;
It should be noted that hash algorithm and first arithmetic element employed in second arithmetic element 1130 Hash algorithm employed in 103 is identical.
The searching unit 1140, for searching the main routing table according to the cryptographic Hash, determines the IP data packets Output port;Wherein, the main routing table establishes the main routing table constructed by device 100 for the routing table.
In such scheme, the searching unit 1140, is specifically used for:
Index using the cryptographic Hash as the main routing table list item storage address, indexes from the main routing table and obtains Obtain the corresponding tree table node of the cryptographic Hash;Wherein, the tree table node is the list item of the main routing table;
According to the content of the tree table node, the endpoint for obtaining and matching with the routing entry to be found is searched, is obtained The output port of the IP data packets.
In such scheme, the searching unit 1140, is specifically used for:
When the node type in the node content is root node or intermediate node, according to the route bar to be found Mesh takes out the corresponding pointer in the node with the relation of the node endpoint, and reads the tree table node pointed by the pointer In node content;
When the node type in the node content is leaf node, according to the routing entry to be found and the leaf The relation of child node endpoint, obtains the output port of the IP data packets.
In such scheme, when the tree table is 2-3 tree tables, the searching unit 1140, is specifically used for:
When the routing entry to be found is less than the left end point of the node, the left pointer in the node is taken out, is read Take the node content in the tree table node pointed by the left pointer;
When left end point of the routing entry to be found more than or equal to the node, and less than the right endpoint of the node When, the middle pointer in the node is taken out, reads the node content in the tree table node pointed by the middle pointer;
When the routing entry to be found is greater than or equal to the right endpoint of the node, the right finger in the node is taken out Pin, reads the node content in the tree table node pointed by the right pointer.
In such scheme, when the tree table is 2-3 tree tables, the searching unit 1140, is specifically additionally operable to:
When the routing entry to be found is equal with the left end point of the leaf node, by the left end of the leaf node Output port of the corresponding output port of point as the IP data packets;
When the routing entry to be found is equal with the right endpoint of the leaf node, by the right end of the leaf node Output port of the corresponding output port of point as the IP data packets;
When the routing entry to be found is more than the left end point of the leaf node and less than the right end of the leaf node During point, the corresponding output port in section that the left end point of the leaf node and right endpoint are formed is as the IP data packets Output port;
When the routing entry to be found is more than the right endpoint of the leaf node, the leaf node right end will be greater than Output port of the correspondence output port of point as the IP data packets.
In such scheme, the searching unit 1140, is specifically additionally operable to:When this node layer has handled current IP data packets Route querying after, give the current IP data packets to next node layer immediately and handle, and next IP data packets are carried out IP route queryings.
In such scheme, the construction unit 1050, is specifically additionally operable to:The main routing table is backed up.
In such scheme, the routing table establishes the updating block 1060 in device 100, is specifically used for:
The data structure of the tree table is adjusted according to new configuration rule;
The route stand-by table is updated according to the tree table after adjustment;
The lookup that IP routes are carried out on the route stand-by table is switched to from the main routing table;
The main routing table is updated according to the tree table after adjustment;
The lookup that IP routes are carried out in the main routing table is switched to from the route stand-by table.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, system or computer program Product.Therefore, the shape of the embodiment in terms of the present invention can use hardware embodiment, software implementation or combination software and hardware Formula.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more to use storage The form for the computer program product that medium is implemented on (including but not limited to magnetic disk storage and optical memory etc.).
The present invention be with reference to according to the method for the embodiment of the present invention, the flow of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagram The combination of flow and/or square frame in journey and/or square frame and flowchart and/or the block diagram.These computer programs can be provided The processors of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that the instruction performed by computer or the processor of other programmable data processing devices, which produces, to be used in fact The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, thus in computer or The instruction performed on other programmable devices is provided and is used for realization in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in a square frame or multiple square frames.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the scope of the present invention.

Claims (24)

  1. A kind of 1. new routing table method for building up, it is characterised in that the described method includes:
    Obtain routing iinformation;Wherein, the routing iinformation includes virtual flow-line with forwarding Field Number VRF_ID, Internet protocol IP Location and the corresponding output port of the IP address;
    One routing entry section is combined into according to the VRF_ID and the IP address;
    Hash operation is carried out to the VRF_ID in the starting endpoint in the routing entry section using default hash algorithm, is obtained The corresponding cryptographic Hash of the VRF_ID;
    A tree table is generated using the equal starting endpoint of all cryptographic Hash;Wherein, the leaf node of the tree table includes The corresponding output port of the starting endpoint, and the output corresponding with the starting endpoint of the corresponding output port of the IP address Port is identical;
    Main routing table is built according to all tree tables of generation.
  2. 2. the according to the method described in claim 1, it is characterized in that, starting endpoint equal using all cryptographic Hash Generate a tree table;Wherein, the tree node of the tree table is applied not only to determine matched endpoint, is additionally operable to determine searching route.
  3. It is 3. described to utilize all institutes according to the method described in claim 1, it is characterized in that, when the tree table is 2-3 tree tables State the equal starting endpoint of cryptographic Hash and generate a tree table, specifically include:
    The equal starting endpoint of all cryptographic Hash is sorted according to ascending order, and by all startings after sequence Endpoint is stored in array a [n];
    First layer from left to right i-th of the data of extraction a [2 × (i-1)] as the tree table from the array a [n] The left end point of node;Wherein, 1≤i≤(n+1)/2, n >=1;
    From the array a [n] data of extraction a [2 × (i-1)+1] as the tree table first layer from left to right i-th The right endpoint of a node;
    The extraction a [2 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] data as the tree table pth layer from The left end point of k-th of node of left-to-right;Wherein, p >=2,1≤k≤(log3T) -1, t is the node total number of -1 layer of pth;
    The extraction a [4 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] data as the tree table pth layer from The right endpoint of k-th of node of left-to-right.
  4. 4. according to the method described in claim 1, it is characterized in that, described build main routing table according to all tree tables of generation, Specifically include:The corresponding main routing table memory block of storage address write-in router indexed according to the cryptographic Hash, described in completion The structure of main routing table.
  5. A kind of 5. IP method for searching route, it is characterised in that the described method includes:
    The IP data packets pair are obtained according to the input port of the IP data packets of reception and virtual LAN numbering VLAN_ID mappings The VRF_ID answered;
    The purpose IP address in the IP data packets is read, and the destination IP address is combined into one with the VRF_ID and is treated Search routing entry;
    Hash operation is carried out to the VRF_ID in the routing entry to be found using the hash algorithm and obtains cryptographic Hash;
    The main routing table is searched according to the cryptographic Hash, determines the output port of the IP data packets;Wherein, the main road by Table is the main routing table of Claims 1-4 any one of them.
  6. 6. according to the method described in claim 5, it is characterized in that, described search the main routing table according to the cryptographic Hash, Determine the output port of the IP data packets, specifically include:
    Index using the cryptographic Hash as the main routing table list item storage address, index obtains institute from the main routing table State the corresponding tree table node of cryptographic Hash;Wherein, the tree table node is the list item of the main routing table;
    According to the content of the tree table node, the endpoint for obtaining and matching with the routing entry to be found is searched, described in acquisition The output port of IP data packets.
  7. 7. according to the method described in claim 6, it is characterized in that, the content according to the tree table node, searches and obtains The endpoint to match with the routing entry to be found, obtains the output port of the IP data packets, specifically includes:
    When the node type in the node content is root node or intermediate node, according to the routing entry to be found with The relation of the node endpoint takes out the correspondence pointer in the node, and reads in the tree table node pointed by the pointer Node content;
    When the node type in the node content is leaf node, according to the routing entry to be found and the leaf section The relation of point endpoint, obtains the output port of the IP data packets.
  8. It is 8. described to work as the node the method according to the description of claim 7 is characterized in that when the tree table is 2-3 tree tables When node type in content is root node or intermediate node, according to the routing entry to be found and the node endpoint Relation takes out the correspondence pointer in the node, and reads the node content in the tree table node pointed by the pointer, specifically Including:
    When the routing entry to be found is less than the left end point of the node, the left pointer in the node is taken out, reads institute State the node content in the tree table node pointed by left pointer;
    When the routing entry to be found is greater than or equal to the left end point of the node, and is less than the right endpoint of the node, The middle pointer in the node is taken out, reads the node content in the tree table node pointed by the middle pointer;
    When the routing entry to be found is greater than or equal to the right endpoint of the node, the right pointer in the node is taken out, Read the node content in the tree table node pointed by the right pointer.
  9. It is 9. described to work as the node the method according to the description of claim 7 is characterized in that when the tree table is 2-3 tree tables When node type in content is leaf node, according to the relation of the routing entry to be found and the leaf node endpoint, The output port of the IP data packets is obtained, is specifically included:
    When the routing entry to be found is equal with the left end point of the leaf node, by the left end point pair of the leaf node Output port of the output port answered as the IP data packets;
    When the routing entry to be found is equal with the right endpoint of the leaf node, by the right endpoint pair of the leaf node Output port of the output port answered as the IP data packets;
    When the routing entry to be found is more than the left end point of the leaf node and the right endpoint less than the leaf node, Output using the corresponding output port in section that the left end point of the leaf node and right endpoint form as the IP data packets Port;
    When the routing entry to be found is more than the right endpoint of the leaf node, the leaf node right endpoint will be greater than Output port of the corresponding output port as the IP data packets.
  10. 10. according to the method described in any one of claim 7 to 9, it is characterised in that when this node layer has handled current IP numbers After the route querying of bag, the method further includes:Described node layer gives the current IP data packets to next layer immediately Node processing, and IP route queryings are carried out to next IP data packets.
  11. 11. according to the method described in claim 1, it is characterized in that, the method further includes:Built completing the main routing table While vertical, the main routing table is backed up.
  12. 12. according to the method described in claim 1, it is characterized in that, when need the main routing table is updated when, it is described Method further includes:
    The data structure of the tree table is adjusted according to new configuration rule;
    The route stand-by table is updated according to the tree table after adjustment;
    The lookup that IP routes are carried out on the route stand-by table is switched to from the main routing table;
    The main routing table is updated according to the tree table after adjustment;
    The lookup that IP routes are carried out in the main routing table is switched to from the route stand-by table.
  13. 13. a kind of new routing table establishes device, it is characterised in that described device includes:First acquisition unit, the first combination Unit, the first arithmetic element, tree table generation unit, construction unit and updating block;Wherein,
    The first acquisition unit, for obtaining routing iinformation;Wherein, the routing iinformation includes virtual flow-line forwarding Field Number VRF_ID, IP address and the corresponding output port of the IP address;
    First assembled unit, for being combined into a routing entry section according to the VRF_ID and the IP address;
    First arithmetic element, for utilizing default hash algorithm in the starting endpoint in the routing entry section VRF_ID carries out Hash operation, obtains the corresponding cryptographic Hash of the VRF_ID;
    The tree table generation unit, for generating a tree table using the equal starting endpoint of all cryptographic Hash;Wherein, institute The leaf node for stating tree table includes the corresponding output port of the starting endpoint, and the corresponding output port of the IP address and institute It is identical to state the corresponding output port of starting endpoint;
    The construction unit, for building main routing table according to all tree tables of generation.
  14. 14. device according to claim 13, it is characterised in that the tree of the tree table of the tree table generation unit generation Node is applied not only to determine matched endpoint, is additionally operable to determine searching route.
  15. 15. device according to claim 13, it is characterised in that when the tree table is 2-3 tree tables, the tree table generation Unit, is specifically used for:
    The equal starting endpoint of all cryptographic Hash is sorted according to ascending order, and by all startings after sequence Endpoint is stored in array a [n];
    First layer from left to right i-th of the data of extraction a [2 × (i-1)] as the tree table from the array a [n] The left end point of node;Wherein, 1≤i≤(n+1)/2, n >=1;
    From the array a [n] data of extraction a [2 × (i-1)+1] as the tree table first layer from left to right i-th The right endpoint of a node;
    The extraction a [2 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] data as the tree table pth layer from The left end point of k-th of node of left-to-right;Wherein, p >=2,1≤k≤(log3T) -1, t is the node total number of -1 layer of pth;
    The extraction a [4 × 3 from the array a [n](p-2)+2×3(p-1)× (k-1)] data as the tree table pth layer from The right endpoint of k-th of node of left-to-right.
  16. 16. device according to claim 13, it is characterised in that the construction unit, is specifically used for:According to the Hash The corresponding main routing table memory block of storage address write-in router of value index, completes the structure of the main routing table.
  17. 17. a kind of new IP device for searching route, it is characterised in that described device includes:Second acquisition unit, the second combination Unit, the second arithmetic element and searching unit;Wherein,
    The second acquisition unit, input port and virtual LAN numbering VLAN_ID for the IP data packets according to reception Mapping obtains the corresponding VRF_ID of the IP data packets;
    Second assembled unit, for reading the purpose IP address in the IP data packets, and by the destination IP address with The VRF_ID is combined into a routing entry to be found;
    Second arithmetic element, for being breathed out using the hash algorithm to the VRF_ID in the routing entry to be found Uncommon computing obtains cryptographic Hash;
    The searching unit, for searching the main routing table according to the cryptographic Hash, determines the output terminal of the IP data packets Mouthful;Wherein, the main routing table establishes the main routing table constructed by device for the routing table.
  18. 18. device according to claim 17, it is characterised in that the searching unit, is specifically used for:
    Index using the cryptographic Hash as the main routing table list item storage address, index obtains institute from the main routing table State the corresponding tree table node of cryptographic Hash;Wherein, the tree table node is the list item of the main routing table;
    According to the content of the tree table node, the endpoint for obtaining and matching with the routing entry to be found is searched, described in acquisition The output port of IP data packets.
  19. 19. device according to claim 18, it is characterised in that the searching unit, is specifically used for:
    When the node type in the node content is root node or intermediate node, according to the routing entry to be found with The relation of the node endpoint takes out the correspondence pointer in the node, and reads in the tree table node pointed by the pointer Node content;
    When the node type in the node content is leaf node, according to the routing entry to be found and the leaf section The relation of point endpoint, obtains the output port of the IP data packets.
  20. 20. device according to claim 19, it is characterised in that described to search list when the tree table is 2-3 tree tables Member, is specifically used for:
    When the routing entry to be found is less than the left end point of the node, the left pointer in the node is taken out, reads institute State the node content in the tree table node pointed by left pointer;
    When the routing entry to be found is greater than or equal to the left end point of the node, and is less than the right endpoint of the node, The middle pointer in the node is taken out, reads the node content in the tree table node pointed by the middle pointer;
    When the routing entry to be found is greater than or equal to the right endpoint of the node, the right pointer in the node is taken out, Read the node content in the tree table node pointed by the right pointer.
  21. 21. device according to claim 19, it is characterised in that described to search list when the tree table is 2-3 tree tables Member, is specifically used for:
    When the routing entry to be found is equal with the left end point of the leaf node, by the left end point pair of the leaf node Output port of the output port answered as the IP data packets;
    When the routing entry to be found is equal with the right endpoint of the leaf node, by the right endpoint pair of the leaf node Output port of the output port answered as the IP data packets;
    When the routing entry to be found is more than the left end point of the leaf node and the right endpoint less than the leaf node, Output using the corresponding output port in section that the left end point of the leaf node and right endpoint form as the IP data packets Port;
    When the routing entry to be found is more than the right endpoint of the leaf node, the leaf node right endpoint will be greater than Output port of the corresponding output port as the IP data packets.
  22. 22. device according to claim 17, it is characterised in that the searching unit, is specifically additionally operable to:When this node layer After the route querying for having handled current IP data packets, give the current IP data packets to next node layer immediately and handle, and it is right Next IP data packets carry out IP route queryings.
  23. 23. device according to claim 13, it is characterised in that the construction unit, is specifically additionally operable to:To the main road Backed up by table.
  24. 24. device according to claim 13, it is characterised in that the updating block, is specifically used for:
    The data structure of the tree table is adjusted according to new configuration rule;
    The route stand-by table is updated according to the tree table after adjustment;
    The lookup that IP routes are carried out on the route stand-by table is switched to from the main routing table;
    The main routing table is updated according to the tree table after adjustment;
    The lookup that IP routes are carried out in the main routing table is switched to from the route stand-by table.
CN201610892179.5A 2016-10-12 2016-10-12 A kind of new routing table is established and IP method for searching route and device Withdrawn CN107948060A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610892179.5A CN107948060A (en) 2016-10-12 2016-10-12 A kind of new routing table is established and IP method for searching route and device
PCT/CN2017/088765 WO2018068524A1 (en) 2016-10-12 2017-06-16 Routing-table establishment and ip routing lookup method, device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610892179.5A CN107948060A (en) 2016-10-12 2016-10-12 A kind of new routing table is established and IP method for searching route and device

Publications (1)

Publication Number Publication Date
CN107948060A true CN107948060A (en) 2018-04-20

Family

ID=61905016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610892179.5A Withdrawn CN107948060A (en) 2016-10-12 2016-10-12 A kind of new routing table is established and IP method for searching route and device

Country Status (2)

Country Link
CN (1) CN107948060A (en)
WO (1) WO2018068524A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108737276A (en) * 2018-06-19 2018-11-02 中国科学技术大学 A method of structure routing table data structure simultaneously realizes routing forwarding

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10764135B2 (en) * 2019-01-29 2020-09-01 Dell Products L.P. Method and system for solution integration labeling
CN113098727A (en) * 2019-12-23 2021-07-09 上海云盾信息技术有限公司 Data packet detection processing method and device
CN113132261B (en) * 2019-12-31 2023-01-03 北京金山云网络技术有限公司 Traffic data packet classification method and device and electronic equipment
CN111404820B (en) * 2020-03-09 2022-04-29 深信服科技股份有限公司 Route query method, device, equipment and readable storage medium
CN113726660B (en) * 2021-08-27 2022-11-15 西安微电子技术研究所 Route finder and method based on perfect hash algorithm
CN116456422A (en) * 2022-01-10 2023-07-18 中兴通讯股份有限公司 Microwave network root node query method and device, microwave system and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101707617A (en) * 2009-12-04 2010-05-12 福建星网锐捷网络有限公司 Message filtering method, device and network device
CN103546380A (en) * 2013-11-05 2014-01-29 迈普通信技术股份有限公司 Message forwarding method and device based on strategy routing
CN103544258A (en) * 2013-10-16 2014-01-29 国家计算机网络与信息安全管理中心 Cardinal number estimating method and cardinal number estimating device under multi-section query condition of big data
EP2887584A1 (en) * 2013-12-23 2015-06-24 BAE Systems PLC Data Capture
CN104866502A (en) * 2014-02-25 2015-08-26 深圳市中兴微电子技术有限公司 Data matching method and device
US20150281073A1 (en) * 2014-03-31 2015-10-01 Dell Products, L.P. System and method for context aware network
CN105391634A (en) * 2015-12-08 2016-03-09 福建星网锐捷网络有限公司 Message processing method, device and switch

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101707617A (en) * 2009-12-04 2010-05-12 福建星网锐捷网络有限公司 Message filtering method, device and network device
CN103544258A (en) * 2013-10-16 2014-01-29 国家计算机网络与信息安全管理中心 Cardinal number estimating method and cardinal number estimating device under multi-section query condition of big data
CN103546380A (en) * 2013-11-05 2014-01-29 迈普通信技术股份有限公司 Message forwarding method and device based on strategy routing
EP2887584A1 (en) * 2013-12-23 2015-06-24 BAE Systems PLC Data Capture
CN104866502A (en) * 2014-02-25 2015-08-26 深圳市中兴微电子技术有限公司 Data matching method and device
US20150281073A1 (en) * 2014-03-31 2015-10-01 Dell Products, L.P. System and method for context aware network
CN105391634A (en) * 2015-12-08 2016-03-09 福建星网锐捷网络有限公司 Message processing method, device and switch

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘尉悦等: ""基于Hash和二叉树的路由表查找算法"", 《中国科学技术大学学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108737276A (en) * 2018-06-19 2018-11-02 中国科学技术大学 A method of structure routing table data structure simultaneously realizes routing forwarding
CN108737276B (en) * 2018-06-19 2020-08-25 中国科学技术大学 Method for constructing routing table data structure and realizing routing forwarding

Also Published As

Publication number Publication date
WO2018068524A1 (en) 2018-04-19

Similar Documents

Publication Publication Date Title
CN107948060A (en) A kind of new routing table is established and IP method for searching route and device
US11102120B2 (en) Storing keys with variable sizes in a multi-bank database
Lim et al. Priority tries for IP address lookup
EP3035613B1 (en) Ccn routing using hardware-assisted hash tables
US6985483B2 (en) Methods and systems for fast packet forwarding
US6792423B1 (en) Hybrid longest prefix match and fixed match searches
CN102945249B (en) A kind of policing rule matching inquiry tree generation method, matching process and device
WO2015127721A1 (en) Data matching method and apparatus and computer storage medium
EP3280104B1 (en) Ip routing lookup
US9485179B2 (en) Apparatus and method for scalable and flexible table search in a network switch
CN107276916B (en) Switch flow table management method based on protocol non-perception forwarding technology
CN104780101B (en) Content center network Forwarding plane fib table structure and its search method
Le et al. Memory-efficient and scalable virtual routers using FPGA
CN101110778A (en) Method for compressing path transmitting table by router
CN106487769B (en) Method and device for realizing Access Control List (ACL)
WO2014206208A1 (en) Data searching method, device, and system
CN104253754A (en) ACL (access control list) fast matching method and equipment
Lim et al. Two-dimensional packet classification algorithm using a quad-tree
EP3018871B1 (en) Content name compression method and apparatus
CN103457855B (en) Classless inter-domain routing table is established and the method and apparatus of message forwarding
Shen et al. High-performance IPv6 lookup with real-time updates using hierarchical-balanced search tree
CN106302178B (en) Route query method and device
CN106603415A (en) Data processing method and device
EP3319279B1 (en) Ip routing lookup
Huang et al. Memory-efficient IP lookup using trie merging for scalable virtual routers

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20180420

WW01 Invention patent application withdrawn after publication