CN100477644C - Route storage method and apparatus - Google Patents

Route storage method and apparatus Download PDF

Info

Publication number
CN100477644C
CN100477644C CNB200610140566XA CN200610140566A CN100477644C CN 100477644 C CN100477644 C CN 100477644C CN B200610140566X A CNB200610140566X A CN B200610140566XA CN 200610140566 A CN200610140566 A CN 200610140566A CN 100477644 C CN100477644 C CN 100477644C
Authority
CN
China
Prior art keywords
route
trie
address
routing iinformation
public network
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.)
Expired - Fee Related
Application number
CNB200610140566XA
Other languages
Chinese (zh)
Other versions
CN1949749A (en
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.)
Huawei Digital Technologies Chengdu Co Ltd
Huawei Digital Technologies Co Ltd
Original Assignee
Huawei Digital Technologies Chengdu 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 Huawei Digital Technologies Chengdu Co Ltd filed Critical Huawei Digital Technologies Chengdu Co Ltd
Priority to CNB200610140566XA priority Critical patent/CN100477644C/en
Publication of CN1949749A publication Critical patent/CN1949749A/en
Application granted granted Critical
Publication of CN100477644C publication Critical patent/CN100477644C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a route storing method and device, belonging to network communication field. And the method comprises the steps of: parsing protocol message and obtaining routing information, and adding the routing information to Trie table. And the invention provides a route storing device, comprising routing management module and Trie table maintaining and managing module. And the invention can make private network route storage and find without TCAM table and public network and private network routing look-up tables share dynamically stored Trie table, reducing internal memory requirements and saving costs.

Description

A kind of route storage method and device
Technical field
The present invention relates to network communication field, particularly a kind of route storage method and device.
Background technology
It is a basic function of data communications equipment that data communications equipment is transmitted the IP message.For the router of distributed architecture, generally finish the IP message forwarding by Hardware Forwarding Engine.Method according to the purpose IP address search routing table of IP message is a lot, can use the hardware searching of TCAM (Ternary Content Addressable Memory, Ternary Content Addressable Memory), also can search with software algorithm.The benefit of the maximum that TCAM searches is: regardless of list item what, search the time basic fixed, can guarantee to search performance.But TCAM device price comparison costliness, power consumption is very big.Software algorithm is searched, only use DRAM (Dynamic Random Access Memory, dynamic random access memory) internal memory or general SRAM (Static Random Access Memory, static RAM) to finish and search, price is very low, has cost advantage.The Trie table is that a kind of DRAM of utilization internal memory or general SRAM tree table are searched algorithm, and adopts the method for longest prefix match.
The application of more common router is three-layer VPN (Virtual Private Network, a VPN).Router generally creates different VPN routing tables for different private networks at edge router when realizing the function of three-layer VPN, and the index of route querying is that purpose IP address adds VRF (VPN Routing Forwarding, VPN routing forwarding) index.The corresponding VPN of VRF index, the IP address of private network can be distributed in VPN inside.The private network IP address of different VPN internal distribution can be identical, but on same edge router, different VPN can corresponding different VRF index.Because the index of route querying is that purpose IP address adds the VRF index, in the time of so just can guaranteeing that the interior message of each VPN is searched the VPN route of VPN, the situation of wrong routing table can not appear searching.
For the router of not supporting the VPN characteristic, the LPM (Longest Prefix Match, longest prefix match) that the mode of utilizing Trie to show is carried out IPV4 searches.Its scheme is as follows:
The length of IP address is 32bit, and the 32bit of IP address is split as the part of 16-4-4-4-4, the high 16bit of IP address is split as the part of 8-4-4.Be greater than or equal to 16 route for prefix length, be filled into the route querying table of 16-4-4-4-4; Less than 16 route, be filled into the route querying table of 8-4-4 for prefix length.The elementary cell of route querying table is the Trie table, the structure such as the table 1 of Trie table.
Nexthop index (pointing to the index of next skip list) Trie index (pointing to the index of next Trie)
Table 1
For the route querying table of 16-4-4-4-4, the highest 16bit of 16 corresponding IP addresses, 16bit shows corresponding to 64K first order Trie, is called the hi64k table, and it is must fixed allocation that hi64k shows.
For the route querying table of 8-4-4, the highest 8bit of 8 corresponding IP addresses, 8bit shows corresponding to 256 first order Trie, is called the hi256 table, and it is must fixed allocation that hi256 shows.
For the 4bit in 16-4-4-4-4 and the 8-4-4 route querying table, corresponding Trie, there are 16 Trie tables each Trie the inside, by the 4bit index.
Trie table in the distribution of internal memory as shown in Figure 1, internal memory can be DRAM, also can be SRAM.
Referring to table 2, be 0x59900000 (hexadecimal 59 corresponding metric 89) with purpose IP address, the mask of prefix is that the route of 0xfff00000 is an example, it is 12 that the mask by prefix obtains prefix length, so insert the route querying table of 8-4-4.
Figure C20061014056600051
Table 2
Corresponding to last table, for purpose IP address is the message of 89.144.5.5, look into the route querying table of hi256 earlier for index with the most-significant byte 89 of purpose IP address, the index of finding the sensing next skip list is 0, the route that does not have prefix 89 correspondences is described, the index of finding the next Trie of sensing simultaneously is effective, so obtain the address of corresponding Trie according to this index, in Trie, carry out index ([23:20] position of corresponding 89.144.5.5 is 9) according to [23:20] position of IP address, the index of finding the sensing next skip list is an effective value, the index that points to next Trie simultaneously is invalid, illustrate that the length that IP address 89.144.5.5 can search the longest-prefix that obtains at the route querying table is exactly 12, index according to the sensing next skip list that obtains from the Trie table removes to look into the next skip list relevant with route again, finally obtains the outgoing interface information of message.
The shortcoming of prior art is:
The index that the LPM that utilizes the mode of Trie table to carry out IPV4 searches does not have the VRF index, for the routing table of VPN distribution, can not support VPN.
And VPN application TCAM table of the prior art carries out the route storage and searches, and TCAM device price comparison costliness, power consumption are very big.
Summary of the invention
The present invention uses the TCAM table to carry out VPN route to search the high problem of expense, a kind of route storage method and device are provided in order to solve in the prior art.Described technical scheme is as follows:
The invention provides a kind of route storage method, said method comprising the steps of:
Steps A: after receiving protocol massages, resolve described message and obtain routing iinformation, described routing iinformation comprises IP address and prefix length;
Step B: judge according to described routing iinformation whether described IP address is the public network route, if described routing iinformation is added in the Trie table of public network correspondence; Otherwise, described routing iinformation is added in the Trie table of private network correspondence.
When described IP address is the public network route, read the prefix length of IP address, if the prefix length of described IP address more than or equal to 16, adds described routing iinformation in the hi64k table of public network route; If the prefix length of described IP address less than 16, adds described routing iinformation in the hi256 table to;
Perhaps
When described IP address is VPN route, obtain the index of VPN route, judge whether the Trie table that the needs application is new, if desired, then apply for the Trie table, described routing iinformation is added to the Trie table of new application according to described routing iinformation by protocol massages; Otherwise directly add in the corresponding Trie table.
Add by 8-4-4-4-4-4-4 or 4-4-4-4-4-4-4-4 form in the described Trie table that described routing iinformation is added to the private network correspondence.
Described method also comprises:
Step C: when needing the deletion route, judge whether it is the public network route, if, this route table items of deletion in the Trie of public network correspondence table; Otherwise, this route table items of deletion in the Trie of private network correspondence table;
Step D: judge whether the Trie table after the described route of deletion can discharge, if described Trie table is reclaimed.
The present invention also provides a kind of route storage device, and described device comprises with lower module:
Routing management module, after being used to receive protocol massages, analytic message obtains routing iinformation, and described routing iinformation comprises IP address and prefix length;
Judge module is used to judge that described IP address is public network route or VPN route;
Trie table maintenance management module is used for adding the routing iinformation that obtains to corresponding Trie table according to the judged result of described judge module.
Described routing management module specifically comprises:
Application Trie unit is used for to new Trie table of Trie table maintenance management module application;
Adding device is used for the route querying table is added in the address of the Trie of new application table;
Delete cells is used to discharge the Trie table and gives Trie table maintenance management module.
Described Trie table maintenance management module specifically comprises:
Maintenance unit, the Trie that is used for the maintenance and management free time shows;
Allocation units are used for when needs increase new route entry, distribution T rie table;
Reclaim the unit, be used for when the deletion route entry, the Trie table that discharges being reclaimed.
Using the beneficial effect that technical scheme provided by the invention brings is:
The route storage method and the device that are provided is provided, the storage that can carry out VPN route without the TCAM table with search, and the Trie of public network route querying table and the shared dynamic memory of VPN route look-up table table has reduced memory requirements, provides cost savings.
Description of drawings
Fig. 1 is the distribution schematic diagram of Trie table in internal memory in the prior art;
Fig. 2 is the route storage method flow chart that provides in the embodiment of the invention 1;
Fig. 3 is the schematic diagram after the route querying table interpolation route in the embodiment of the invention 1;
Fig. 4 is the route querying flow chart that provides in the embodiment of the invention 2;
Fig. 5 is the route storage device schematic diagram that provides in the embodiment of the invention 3.
Embodiment
The invention will be further described below in conjunction with the drawings and specific embodiments, but not as a limitation of the invention.
Embodiments of the invention are realized searching of public network route and VPN route by set up a dynamic Trie table on router.
For the router of distributed frame, the number of the VPN of each interface board support is certain, and the number of routes of the VPN of Zhi Chiing also has certain limitation simultaneously, and such as supporting 4K VPN, all VPN support 1,000,000 routes altogether.
The public network router can adopt the Trie list structure of 16-4-4-4-4 and 8-4-4, and wherein the highest 16bit of the corresponding IP of 16bit address reads the prefix length of IP address earlier, if more than or equal to 16, then adds in the hi64k table of public network route.If less than 16, then add in the hi256 table of public network route.
VPN VPN route device can adopt the 8-4-4-4-4-4-4 Trie list structure of (not comprising VPN Index), and wherein the highest 8bit of the corresponding IP of 8bit address is the same with the route querying table of public network, and the first order Trie table of 8bit correspondence is also referred to as the hi256 table.Distribute an independently hi256 table for each VPN,, then need to 4K hi256 table of VPN route assignment if veneer is supported 4K VPN.
Embodiment 1
Referring to Fig. 2, a kind of route storage method, this method specifically may further comprise the steps:
Step 101: after router was received protocol massages, the content in the analysis protocol message was obtained routing iinformation, and this routing iinformation comprises IP address, prefix length and route classification.
Step 102: judge that according to the route classification in the described routing iinformation (being public network route or VPN route) route of obtaining is public network route or VPN route, if the public network route, execution in step 103; Otherwise execution in step 104.
Step 103: search public network route querying table, judge whether the Trie table that needs application new, if the list item that route querying table the inside is not complementary with the IP address then needs application, execution in step 105; Otherwise do not need application, execution in step 106.
Step 104: search the VPN route look-up table, judge whether the Trie table that needs application new, if the list item that route querying table the inside is not complementary with the IP address then needs application, execution in step 105; Otherwise do not need application, execution in step 106.
Step 105: apply for a new Trie table, the routing iinformation that obtains is added in the Trie table.
Step 106: otherwise routing iinformation is directly added in the corresponding Trie table.
For example: support that the Trie table memory map of VPN is as shown in table 3.
Figure C20061014056600091
Table 3
The space of fixed allocation can comprise: the hi64k table of public network route and hi256 table, the hi256 table of 4k VPN route.
Trie is a dynamic assignment, and VPN2 in the last table is not because have distribution T rie without route.Total number of Trie is certain, and this sum is relevant with the maximum route specification that router is supported.Because the number of VPN is certain, simultaneously the hi256 table has only 256 Trie tables, and is so that the hi256 of 4k VPN route shows to take the space of fixed allocation is smaller, little to the consumption of internal memory.
Table 4 is that the IP address is arranged is 0x59900000 in VPN 1 inside, and the mask of prefix is an example of the route of 0xfff00000.
Figure C20061014056600101
Table 4
On the basis of table 4, increase by three routes again at VPN 1, these three routes are respectively: the IP address is 0x59980000, and the mask of prefix is 0xffff0000; The IP address is 0x60600000, and the mask of prefix is 0xfff0000; The IP address is 0x60670000, and the mask of prefix is 0xffff0000.In order to increase this three routes, need three trie of reallocation.Concrete interpolation process is as follows:
Because the list item of IP address 0x59900000 has been arranged in table 4, when adding IP address 0x59980000, when the mask of prefix is 0xffff0000, apply for a Trie table (b), the address of adding the Trie table of new application in the Next trie (address of next Trie table) with offset address 9 correspondences in the current Trie table (a).In the Trie of new application table, add the Next hop information (next hop information shows the way by the interface number of correspondence) of this route in the route table items of offset address 8 correspondences.
When adding IP address 0x60600000, when the mask of prefix is 0xfff0000, because hexadecimal 60 corresponding metric values are 96, and the Next trie list item of offset address 96 correspondences of the hi256 of VPN 1 table is 0, at this moment apply for a Trie table (being (c) among Fig. 2), and this table address is filled out in the Next trie list item of offset address 96 correspondences of hi256 table of VPN 1, in Route (route) of offset address 6 correspondences of Trie table (c), insert Next hop information (next hop information) simultaneously;
When adding IP address 0x60670000, when the mask of prefix was 0xffff0000, with adding IP address 0x59980000, the mask of prefix was that 0xffff0000 is the same, and the Trie table of application is (d) among Fig. 2, no longer describes in detail here.
The Trie of the shared dynamic assignment of Trie of the 4bit correspondence in the Trie of the 4bit correspondence in the 8-4-4-4-4-4-4 route querying table index and the public network route querying table index, these Trie tables are safeguarded by Trie table maintenance management module, if Trie table of i.e. public network route deletion (release), when private network application Trie shows, that Trie table with the deletion of public network route adds, in like manner, when private network discharges a Trie table, when adding, public network also can show with the Trie of this release.Concrete maintenance process is as follows:
When routing management module finds that a route need be deleted, judge it is public network route or VPN route earlier, in corresponding route querying table, search deletion according to the result who judges, after deletion finishes, whether can discharge a Trie table after this route of judgement deletion.Just give Trie table maintenance management module this Trie table if can discharge a Trie table, finish the recovery of Trie by Trie table maintenance management module.
VPN VPN route described above, employing be the route querying sheet format of 8-4-4-4-4-4-4, wherein first order index is 8bit, mainly weighs between performance and committed memory.Also can adopt other route querying sheet formats, for example the route querying sheet format of 4-4-4-4-4-4-4-4.
Referring to Fig. 3, be the structural representation after the route querying table has increased above-mentioned three routes.
Embodiment 2
Referring to Fig. 4, be to use the method that above-mentioned route querying table carries out route querying, this method may further comprise the steps:
Step 201: after receiving message, read the control information of routing iinformation and routing table.
Step 202: judge whether to search for smugglers and smuggling goods the networking by, if do not need, execution in step 203, otherwise execution in step 204.
Step 203: the route querying table of looking into public network carries out address search.
Step 204: the index of getting the VPN routing table.
Step 205: check the Trie table of answering according to the index of the VPN routing table of obtaining.
Embodiment 3
Referring to Fig. 5, a kind of route storage device, this device comprise with lower module:
Routing management module, after being used to receive protocol massages, analytic message obtains routing iinformation, and this routing iinformation comprises IP address and prefix length;
Trie table maintenance management module, the routing iinformation that is used for obtaining adds the Trie table to.
Wherein, routing management module specifically comprises:
Judging unit is used to judge that the IP address is public network route or VPN route;
Application Trie unit is used for to new Trie table of Trie table maintenance management module application,
Adding device is used for application Trie table address is added to the route querying table;
Delete cells is used to discharge the Trie table and gives Trie table maintenance management module.
Trie table maintenance management module specifically comprises:
Maintenance unit, the Trie that is used for the maintenance and management free time shows;
Allocation units are used for when needs increase new route entry, distribution T rie table;
Reclaim the unit, be used for when the deletion route entry, the Trie table that discharges being reclaimed.
Above-described embodiment is more preferably a kind of embodiment of the present invention, and common variation that those skilled in the art carries out in the technical solution of the present invention scope and replacement all should be included in protection scope of the present invention.

Claims (7)

1. a route storage method is characterized in that, said method comprising the steps of:
Steps A: after receiving protocol massages, resolve described message and obtain routing iinformation, described routing iinformation comprises IP address and prefix length;
Step B: judge according to described routing iinformation whether described IP address is the public network route, if described routing iinformation is added in the Trie table of public network correspondence; Otherwise, described routing iinformation is added in the Trie table of private network correspondence.
2. route storage method as claimed in claim 1 is characterized in that,
When described IP address is the public network route, read the prefix length of IP address, if the prefix length of described IP address more than or equal to 16, adds described routing iinformation in the hi64k table of public network route; If the prefix length of described IP address less than 16, adds described routing iinformation in the hi256 table to;
Perhaps
When described IP address is VPN route, obtain the index of VPN route, judge whether the Trie table that the needs application is new, if desired, then apply for the Trie table, described routing iinformation is added to the Trie table of new application according to described routing iinformation by protocol massages; Otherwise directly add in the corresponding Trie table.
3. route storage method as claimed in claim 1 is characterized in that, adds by 8-4-4-4-4-4-4 or 4-4-4-4-4-4-4-4 form in the described Trie table that described routing iinformation is added to the private network correspondence.
4. route storage method as claimed in claim 1 is characterized in that, described method also comprises:
Step C: when needing the deletion route, judge whether it is the public network route, if, this route table items of deletion in the Trie of public network correspondence table; Otherwise, this route table items of deletion in the Trie of private network correspondence table;
Step D: judge whether the Trie table after the described route of deletion can discharge, if described Trie table is reclaimed.
5. a route storage device is characterized in that, described device comprises with lower module:
Routing management module, after being used to receive protocol massages, analytic message obtains routing iinformation, and described routing iinformation comprises IP address and prefix length;
Judge module is used to judge that described IP address is public network route or VPN route;
Trie table maintenance management module is used for adding the routing iinformation that obtains to corresponding Trie table according to the judged result of described judge module.
6. route storage device as claimed in claim 5 is characterized in that, described routing management module specifically comprises:
Application Trie unit is used for to new Trie table of Trie table maintenance management module application;
Adding device is used for the route querying table is added in the address of the Trie of new application table;
Delete cells is used to discharge the Trie table and gives Trie table maintenance management module.
7. route storage device as claimed in claim 5 is characterized in that, described Trie table maintenance management module specifically comprises:
Maintenance unit, the Trie that is used for the maintenance and management free time shows;
Allocation units are used for when needs increase new route entry, distribution T rie table;
Reclaim the unit, be used for when the deletion route entry, the Trie table that discharges being reclaimed.
CNB200610140566XA 2006-10-17 2006-10-17 Route storage method and apparatus Expired - Fee Related CN100477644C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB200610140566XA CN100477644C (en) 2006-10-17 2006-10-17 Route storage method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB200610140566XA CN100477644C (en) 2006-10-17 2006-10-17 Route storage method and apparatus

Publications (2)

Publication Number Publication Date
CN1949749A CN1949749A (en) 2007-04-18
CN100477644C true CN100477644C (en) 2009-04-08

Family

ID=38019136

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB200610140566XA Expired - Fee Related CN100477644C (en) 2006-10-17 2006-10-17 Route storage method and apparatus

Country Status (1)

Country Link
CN (1) CN100477644C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101141389B (en) * 2007-09-29 2010-06-16 华为技术有限公司 Reinforcement multidigit Trie tree searching method and apparatus
CN102064999B (en) * 2009-11-18 2013-04-03 杭州华三通信技术有限公司 Method and equipment for forwarding multicast message
CN102664811B (en) * 2012-05-04 2015-08-12 杭州华三通信技术有限公司 Message forwarding method and device
CN112235197B (en) * 2020-10-23 2022-07-15 烽火通信科技股份有限公司 Parallel route searching method and system
CN116208553A (en) * 2023-03-13 2023-06-02 苏州盛科通信股份有限公司 Chip implementation method and application for expanding VRF routing table item

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
数据结构Trie及其应用. 郑丽英.现代计算机,第总第193期. 2004
数据结构Trie及其应用. 郑丽英.现代计算机,第总第193期. 2004 *

Also Published As

Publication number Publication date
CN1949749A (en) 2007-04-18

Similar Documents

Publication Publication Date Title
Gupta et al. Routing lookups in hardware at memory access speeds
US6661787B1 (en) Integrated data table in a network
US6615336B1 (en) Method for performing a medium access control address lookup in a network switch of an ethernet network
US8938469B1 (en) Dynamically adjusting hash table capacity
US8792497B2 (en) Method and apparatus for performing link aggregation
EP1002402A4 (en) Trunking support in a high performance network device
US8830857B2 (en) Name-to-address mapping system, data transmission method and name-to-address mapping maintenance method
US6922410B1 (en) Organization of databases in network switches for packet-based data communications networks
CN101594319B (en) Entry lookup method and entry lookup device
CN100477644C (en) Route storage method and apparatus
CN101005461B (en) IPv6 route list checking and repeating method
CN101505279B (en) Route searching method and apparatus
CN101094179A (en) Method and device for looking up route indexed in multiple stages
US20200228449A1 (en) Exact match and ternary content addressable memory (tcam) hybrid lookup for network device
US20090282167A1 (en) Method and apparatus for bridging
US8015315B2 (en) Compression of IPV6 addresses in a netflow directory
US8989189B2 (en) Scaling IPv4 in data center networks employing ECMP to reach hosts in a directly connected subnet
US7142541B2 (en) Determining routing information for an information packet in accordance with a destination address and a device address
CN101478488B (en) Packet forwarding method, forwarding engine chip and routing device
CN101557341B (en) Message forwarding method based on forwarding table of medium access control and system
CN114143257A (en) Method for generating table entry, method, device and system for sending message
US8125991B1 (en) Network switch using managed addresses for fast route lookup
CN103973571A (en) Network processor and routing searching method
US20080123663A1 (en) Method and apparatus for managing ternary content addressable memory entries for use in a data packet routing device
CN109039911B (en) Method and system for sharing RAM based on HASH searching mode

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090408

Termination date: 20121017