WO2012130054A1 - 路由地址查询方法和装置 - Google Patents

路由地址查询方法和装置 Download PDF

Info

Publication number
WO2012130054A1
WO2012130054A1 PCT/CN2012/072443 CN2012072443W WO2012130054A1 WO 2012130054 A1 WO2012130054 A1 WO 2012130054A1 CN 2012072443 W CN2012072443 W CN 2012072443W WO 2012130054 A1 WO2012130054 A1 WO 2012130054A1
Authority
WO
WIPO (PCT)
Prior art keywords
ipv6
address
routing address
ipv4
predetermined
Prior art date
Application number
PCT/CN2012/072443
Other languages
English (en)
French (fr)
Inventor
李晚龙
钱俊
胡睿
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2012130054A1 publication Critical patent/WO2012130054A1/zh

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
    • H04L45/741Routing in networks with a plurality of addressing schemes, e.g. with both IPv4 and IPv6

Definitions

  • the present application claims priority to Chinese Patent Application No. 1 10077093.4, entitled “Routing Address Query Method and Apparatus", filed on March 29, 2011, the entire contents of which is hereby incorporated by reference. in.
  • the present invention relates to the field of communications, and in particular, to a routing address query method and apparatus.
  • IP Internet Protocol, protocol for interconnection between networks
  • the router in the network is responsible for finding routing information for IP packets. This function is called packet forwarding, and the table in the router is used to store routing information required for packet forwarding. It is called a routing forwarding table.
  • the routing and forwarding table usually consists of two parts, including a forwarding prefix table and a forwarding information table.
  • the forwarding prefix table stores the network address (also known as the network prefix) or the host address. We are collectively referred to as the address prefix.
  • the forwarding information table stores information such as the egress port and the next hop IP address required for packet forwarding.
  • the router performs the routing information search process by first using the destination IP address carried in the IP packet, searching the forwarding table to find the matching entry, and then reading the forwarding information entry associated with the entry. The routing information required for packet forwarding.
  • IPv6 and IPv4 forwarding prefix tables are usually stored in CAM, and CAM's fast matching feature is used to implement high-performance route lookup operations.
  • IPv6 is organized into two different IPV6 routing forwarding tables according to the routing prefix mask length, including: Write to or less than 72bi t
  • Embodiments of the present invention provide a method and an apparatus for querying a routing address, which can store an IPv6 short entry and an IPv4 shared storage, and implement an address query when an IPv6 short entry and an IPv4 shared storage are implemented.
  • the embodiment of the present invention provides a routing address query method, including:
  • IPv4 and IPv6 short entries are stored in the first table, and the IPv6 long entries are stored in the second table, and the IPv4 and the IPv4 are distinguished by the storage keywords corresponding to the IPv4 and the storage keywords corresponding to the IPv6 short entry.
  • IPv6 short entry
  • the first table is queried according to the predetermined IPv4 routing address and the storage keyword corresponding to the IPv4, and the corresponding predetermined IPv4 routing address is returned according to the longest matching principle;
  • the second table is queried according to the predetermined IPv6 routing address
  • the first table is queried according to the predetermined IPv6 routing address and the storage keyword corresponding to the IPv6 short entry. Returning the corresponding predetermined IPv6 routing address according to the principle of longest matching.
  • the embodiment of the present invention provides a routing address querying apparatus, including: a storage unit, configured to store an IPv4 and IPv6 short table entry in a first table, and store an IPv6 long table entry in a second table, Differentiating the IPv4 and the IPv6 short entry by using a storage keyword corresponding to the IPv4 and a storage keyword corresponding to the IPv6 short entry;
  • a first searching unit configured to query the first table according to the predetermined IPv4 routing address and the storage keyword corresponding to the IPv4 when searching for a predetermined IPv4 routing address, and return the corresponding subscription according to a longest matching principle IPv4 routing address;
  • a second searching unit configured to: when searching for a predetermined IPv6 routing address, according to the predetermined IPv6
  • the routing table queries the second table, and queries the first table according to the predetermined IPv6 routing address and the storage key corresponding to the IPv6 short entry, and returns the corresponding predetermined IPv6 route according to the longest matching principle. address.
  • the technical solution provided by the embodiment of the present invention stores the IPv4 and IPv6 short entry in the first table, which improves the storage capacity of the IPv6 short entry compared with the storage of the IPv4 and IPv6 short entries respectively in the prior art;
  • the shared storage table is queried according to the storage keyword corresponding to the IPv4 or IPv6, and the address corresponding to the IPv4 or IPv6 is obtained, and the address query of the IPv6 short table item and the IPv4 shared storage is realized. .
  • FIG. 1 is a flowchart of a method for querying a routing address according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic diagram of storage of IPv4 and IPv6 hybrid storage in Embodiment 1 of the present invention
  • FIG. 3 is a block diagram of a routing address query apparatus according to Embodiment 1 of the present invention
  • FIG. 4 is another route in Embodiment 1 of the present invention
  • FIG. 5 is a block diagram showing the composition of another routing address query apparatus according to Embodiment 2 of the present invention.
  • the embodiment of the invention provides a routing address query method, as shown in FIG. 1 , the method includes:
  • IPv4 and IPv6 short table entries are stored in the first table, and the IPv6 long table entries are stored in the second table, and the storage keywords corresponding to the IPv4 and the storage keywords corresponding to the IPv6 short table entries are used to distinguish the IPv4 and the IPv6 short entry.
  • the storing the IPv4 and IPv6 short entry in the first table may use the following method, the method includes: placing the IPv4 and IPv6 short entry in a priority block, according to the storage address from low to The high order is stored in the first table; the IPv6 long table entries are stored in the first table in order of storage address from low to high.
  • the IPv4 and IPv6 short entry are stored in the first table in the order of the storage address, in the order of the storage address, and the storage key corresponding to the IPv4 short entry.
  • the IPv4 and the IPv6 short entry are distinguished. Specifically, “00" is used to represent the IPv4 routing address, "01” is used to represent the IPv6 routing address, and "00" is used to represent the IPv6 routing address. "01" represents the IPv4 routing address, which is not limited by the embodiment of the present invention, and the user can set it according to requirements; as shown in FIG. 2, the priority block is stored in the order of storing the address from low to high. That is, the addresses are stored in the order from 0 to FF, and the IPv4 and the IPv6 short table entries are distinguished by the storage key "00" corresponding to IPv4 and the storage key "01” corresponding to the IPv6 short entry.
  • the second table is queried according to the predetermined IPv6 routing address, and the first parameter is queried according to the predetermined IPv6 routing address and the storage keyword corresponding to the IPv6 short entry.
  • a table returns the corresponding predetermined IPv6 routing address according to the principle of longest matching.
  • the second table is queried according to the predetermined IPv6 routing address, and the first table is queried according to the predetermined IPv6 routing address and the storage keyword corresponding to the IPv6 short entry. And returning the corresponding predetermined IPv6 routing address according to the principle of longest matching, which can be implemented by the following methods, including:
  • the corresponding predetermined IPv6 routing address is returned according to the longest matching principle. If the at least two addresses corresponding to the predetermined IPv6 routing address are found, the corresponding predetermined IPv6 routing address is returned according to the principle of the longest matching, including: the address stored in the first table, Returning the predetermined IPv6 routing address corresponding to the lower address in the first table; and storing the address in the second table, returning the predetermined IPv6 routing address corresponding to the lower address in the second table;
  • the number of the IPv4 and IPv6 short table entries in the first table may be adjusted according to the requirements of the current network. To achieve dynamic storage of IPv4 and IPv6 short entries, to meet the needs of IPv4 and IPv6 dynamics.
  • the number of IPv4 and the storage capacity requirement may be corresponding according to the IPv4 and IPv6 storage capacity requirements.
  • the IPv6 short entry is stored in the first table. For example, when the requirement for the storage capacity of the IPv4 is higher than the requirement for the IPv6 storage capacity, the number of IPv4 stored in the first table is more than the number of IPv6 short entries; specifically, for example, when the maximum storage for IPv4 is used. When the capacity is tested, all the storage spaces of the first table may be stored as IPv4. When the maximum storage capacity of the IPv6 is tested, all the storage spaces of the first table may be stored as IPv6 short entries.
  • the IPv4 and IPv6 short entries are stored in the first table, which improves the storage capacity of the IPv6 short entry compared with the storage of the IPv4 and IPv6 short entries respectively in the prior art;
  • the shared storage table is queried according to the storage key corresponding to the IPv4 or IPv6, and the address corresponding to IPv4 or IPv6 is obtained, and the address query of the IPv6 short table item and the IPv4 shared storage is realized.
  • the number of IPv4 and IPv6 corresponding to the storage capacity requirement may be shorter according to the IPv4 and IPv6 storage capacity requirements.
  • the entries are stored in the first table to implement dynamic storage of IPv4 and IPv6 short entries, and meet the requirements of IPv4 and IPv6 dynamics.
  • the embodiment of the present invention provides a routing address query device. As shown in FIG. 3, the device includes: a storage unit 21, a first searching unit 22, and a second searching unit 23.
  • the storage unit 21 is configured to store the IPv4 and IPv6 short entry in the first table, and store the IPv6 long entry in the second table, and use the storage keyword corresponding to the IPv4 and the storage keyword corresponding to the IPv6 short entry. Distinguishing the IPv4 and the IPv6 short entry.
  • the first searching unit 22 is configured to: when searching for a predetermined IPv4 routing address, query the first table according to the predetermined IPv4 routing address and the storage keyword corresponding to the IPv4, and return the corresponding according to the longest matching principle. Schedule an IPv4 routing address.
  • a second searching unit 23 configured to: when searching for a predetermined IPv6 routing address, according to the predetermined Querying the second table by using the IPv6 routing address, and querying the first table according to the predetermined IPv6 routing address and the storage key corresponding to the IPv6 short entry, and returning the corresponding predetermined IPv6 according to the longest matching principle. Routing address.
  • the storage unit 21 includes: a first storage module 211 and a second storage module 212.
  • the first storage module 211 is configured to store the IPv4 and the IPv6 short table entries in the first table according to the storage address in the order of the priority block.
  • the first storage module 211 will be the IPv4.
  • the IPv6 short table entry, in the order of the priority block is stored in the first table according to the storage address from the lowest to the highest, and can refer to the corresponding description in FIG. 2, and the embodiment of the present invention will no longer Narration.
  • the second storage module 212 is configured to store the IPv6 long table entries in the first table according to a storage address from low to high.
  • the second searching unit 23 includes a first searching module 231, a second searching module 232, a first operating module 233, and a second operating module 234.
  • the first searching module 231 is configured to query the second table according to the predetermined IPv6 routing address.
  • the second searching module 232 is configured to query the first table according to the predetermined IPv6 routing address and a storage keyword corresponding to the IPv6 short entry.
  • the first operation module 233 is configured to: when the first search module 231 or the second search module 232 finds an address corresponding to the predetermined IPv6 routing address, return the searched address.
  • the second operation module 234 is configured to: when the first search module 231 and/or the second search module 232 find at least two addresses corresponding to the predetermined IPv6 routing address, return according to the principle of longest matching Corresponding to the predetermined IPv6 routing address.
  • At least two of the predetermined IPv6 routing addresses found by the second searching unit 23 The corresponding address, when the address is found by the first searching module 231, returns the predetermined IPv6 routing address corresponding to the lower address in the first table.
  • the predetermined IPv6 routing address corresponding to the lower address in the second table is returned.
  • the storage unit 21 may also use the IPv4 and IPv6 short tables corresponding to the storage capacity requirements according to the IPv4 and IPv6 storage capacity requirements. Items are stored in the first table. For example, when the requirement for the storage capacity of the IPv4 is higher than the requirement for the IPv6 storage capacity, the number of IPv4 stored in the first table is more than the number of IPv6 short entries; specifically, for example, when the maximum storage for IPv4 is used. When the capacity is tested, the storage unit 21 may store all the storage spaces of the first table as IPv4; when testing the maximum storage capacity of the IPv6, the storage unit 21 may store all the first tables. Spaces are stored as IPv6 short entries.
  • the IPv4 and IPv6 short entries are stored in the first table, which improves the storage capacity of the IPv6 short entry compared with the storage of the IPv4 and IPv6 short entries respectively in the prior art;
  • the shared storage table is queried according to the storage key corresponding to the IPv4 or IPv6, and the address corresponding to IPv4 or IPv6 is obtained, and the address query of the IPv6 short table item and the IPv4 shared storage is realized.
  • the storage capacity requirement may be determined according to the IPv4 and IPv6 storage capacity requirements.
  • a corresponding number of IPv4 and IPv6 short entries are stored in the first table to implement dynamic storage of IPv4 and IPv6 short entries, and meet the requirements of IPv4 and IPv6 dynamics.
  • the present invention can be implemented by means of software plus necessary general hardware, and of course, by hardware, but in many cases, the former is better.
  • Implementation Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a readable storage medium, such as a floppy disk of a computer.
  • a hard disk or optical disk or the like includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Description

路由地址查询方法和装置
本申请要求于 201 1 年 3 月 29 日提交中国专利局、 申请号为 1 10077093.4、 发明名称为 "路由地址查询方法和装置" 的中国专利申 请的优先权, 其全部内容通过引用结合在本申请中。 技术领域 本发明涉及通信领域, 尤其涉及一种路由地址查询方法和装置。
背景技术
IP ( Internet Protocol , 网络之间互连的协议) 网络中的路由器负责 为 IP报文查找路由信息, 这个功能称为报文转发, 而路由器中用于存储报 文转发所需的路由信息的表格称为路由转发表。 路由转发表通常包含两部 分, 包括转发前缀表和转发信息表。 转发前缀表中存储的是网络地址(也 称为网络前缀)或主机地址, 我们统称为地址前缀; 转发信息表中存储的 是报文转发所需的出端口和下一跳 IP地址等信息。 路由器进行路由信息查 找的过程包括, 首先用 IP报文中携带的目的 IP地址, 到转发前缀表中去 查找匹配的表项, 然后去读取与该表项关联的转发信息表项, 从而获得报 文转发所需的路由信息。
在转发前缀表中查找与报文目的 IP地址相匹配的表项是一项复杂的操 作, 这项操作完成的速度基本上就决定了一台路由器的转发性能。 在高性 能路由器中, 通常将 IPv6和 IPv4转发前缀表存储在 CAM中, 利用 CAM的 快速匹配特点, 实现高性能的路由查找操作。
目前虽然为了方便路由地址的查询, 将 IPv6 , 按照路由前缀掩码长度 组织成两种不同的 IPV6 路由转发表, 包括: 小于等于 72bi t 的写入到
FIBv6 _72表中, 大于 72bi t的写到 FIBv6_ 144中。 但是当 IPv6和 IPv4共 存时, IPv6短表项和 IPv4还分别存储的, IPv6短表项存储容量较低。
发明内容 本发明的实施例提供一种路由地址查询方法和装置, 能够将 IPv6短表 项和 IPv4共享存储, 并且实现了 IPv6短表项和 IPv4共享存储时的地址查 询。
为达到上述目的, 本发明的实施例釆用如下技术方案:
一方面, 本发明实施例提供一种路由地址查询方法, 包括:
将 IPv4和 IPv6短表项存储在第一表中, 并将 IPv6长表项存储在第二 表中, 通过 IPv4对应的存储关键字和 IPv6短表项对应的存储关键字, 区 分所述 IPv4和所述 IPv6短表项;
当查找预定 IPv4路由地址时,依据所述预定 IPv4路由地址和所述 IPv4 对应的存储关键字查询所述第一表, 按照最长匹配的原则返回对应的所述 预定 IPv4路由地址;
当查找预定 IPv6路由地址时, 才艮据所述预定 IPv6路由地址查询所述 第二表, 以及依据所述预定 IPv6路由地址和所述 IPv6短表项对应的存储 关键字查询所述第一表, 按照最长匹配的原则返回对应的所述预定 IPv6路 由地址。
另一方面, 本发明实施例提供一种路由地址查询装置, 包括: 存储单元, 用于将 IPv4和 IPv6短表项存储在第一表中, 并将 IPv6长 表项存储在第二表中, 通过 IPv4对应的存储关键字和 IPv6短表项对应的 存储关键字, 区分所述 IPv4和所述 IPv6短表项;
第一查找单元, 用于当查找预定 IPv4路由地址时,依据所述预定 IPv4 路由地址和所述 IPv4对应的存储关键字查询所述第一表, 按照最长匹配的 原则返回对应的所述预定 IPv4路由地址;
第二查找单元, 用于当查找预定 IPv6路由地址时,根据所述预定 IPv6 路由地址查询所述第二表, 以及依据所述预定 IPv6 路由地址和所述 IPv6 短表项对应的存储关键字查询所述第一表, 按照最长匹配的原则返回对应 的所述预定 IPv6路由地址。
本发明实施例提供的技术方案, 将 IPv4和 IPv6短表项存储在第一表 中, 与现有技术中将 IPv4和 IPv6短表项分别存储相比, 提升了 IPv6短表 项存储容量; 并且, 当查找 IPv4或 IPv6时, 才艮据所述 IPv4或 IPv6对应 的存储关键字查询所述共享存储表, 获取 IPv4或 IPv6对应的地址, 实现 了 IPv6短表项和 IPv4共享存储时的地址查询。
附图说明 为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对 实施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员 来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附 图。
图 1为本发明实施例 1中路由地址查询方法流程图;
图 2为本发明实施例 1中 IPv4和 IPv6混合存储的存储示意图; 图 3为本发明实施例 1中一种路由地址查询装置的组成框图; 图 4为本发明实施例 1中另一种路由地址查询装置的组成框图; 图 5为本发明实施例 2中另一种路由地址查询装置的组成框图。
具体实施方式 下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进 行清楚、完整地描述,显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没 有作出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的 范围。
实施例 1
本发明实施例提供一种路由地址查询方法,如图 1所示,该方法包括:
101、 将 IPv4和 IPv6短表项存储在第一表中, 并将 IPv6长表项存储 在第二表中, 通过 IPv4对应的存储关键字和 IPv6短表项对应的存储关键 字, 区分所述 IPv4和所述 IPv6短表项。
其中, 所述将 IPv4和 IPv6短表项存储在第一表中, 可以釆用以下的 方法, 该方法包括: 将 IPv4和 IPv6短表项, 以优先级块为单位, 按照存 储地址从低到高的顺序存储在第一表中; 将所述 IPv6长表项按照存储地址 从低到高的顺序存储在第一表中。
例如, 将 IPv4和 IPv6短表项, 以优先级块为单位, 按照存储地址从 低到高的顺序存储在第一表中, 通过 IPv4对应的存储关键字和 IPv6短表 项对应的存储关键字, 区分所述 IPv4和所述 IPv6短表项, 具体的, 可以 用 "00" 代表 IPv4的路由地址, 用 "01" 代表 IPv6的路由地址, 也可以 用 "00" 代表 IPv6的路由地址, 用 "01" 代表 IPv4的路由地址, 本发明 实施例对此不进行限制, 用户可以根据需求自行设置; 如图 2 所示, 以优 先级块为单位, 按照存储地址从低到高的顺序存储, 即按照地址从 0到 FF 的顺序存储, 并通过 IPv4对应的存储关键字 "00" 和 IPv6短表项对应的 存储关键字 "01 " 区分所述 IPv4和所述 IPv6短表项。
102、 当查找预定 IPv4路由地址时, 依据所述预定 IPv4路由地址和所 述 IPv4对应的存储关键字查询所述第一表, 按照最长匹配的原则返回对应 的所述预定 IPv4路由地址。
103、 当查找预定 IPv6路由地址时, 才艮据所述预定 IPv6路由地址查询 所述第二表, 以及依据所述预定 IPv6路由地址和所述 IPv6短表项对应的 存储关键字查询所述第一表, 按照最长匹配的原则返回对应的所述预定 IPv6路由地址。 其中, 当查找预定 IPv6路由地址时, 根据所述预定 IPv6路由地址查 询所述第二表, 以及依据所述预定 IPv6路由地址和所述 IPv6短表项对应 的存储关键字查询所述第一表, 按照最长匹配的原则返回对应的所述预定 IPv6路由地址, 可以釆用以下的方法实现, 包括:
根据所述预定 IPv6路由地址查询所述第二表,以及依据所述预定 IPv6 路由地址和所述 IPv6短表项对应的存储关键字查询所述第一表;
若查找到一个与所述预定 IPv6路由地址对应的地址, 则将所述查找到 的一个地址返回;
若查找到至少两个与所述预定 IPv6路由地址对应的地址, 则根据最长 匹配的原则返回对应的所述预定 IPv6路由地址。 其中, 若查找到至少两个 与所述预定 IPv6路由地址对应的地址, 则根据最长匹配的原则返回对应的 所述预定 IPv6路由地址, 包括: 储在所述第一表中的地址, 则返回所述第一表中低地址对应的所述预定 IPv6路由地址; 储在所述第二表中的地址, 则返回所述第二表中低地址对应的所述预定 IPv6路由地址;
若查找到的所述至少两个与所述预定 IPv6路由地址对应的地址, 至少 一个为存储在所述第一表中的地址, 另外至少一个为存储在所述第二表中 的地址, 则返回所述第二表中低地址对应的所述预定 IPv6路由地址。
另外, 需要说明的是, 所述将 IPv4和 IPv6短表项按照预定规则混合 存储在第一表中时, 可以按照当前网络的需求, 调整第一表中所述 IPv4和 IPv6短表项的数量, 以实现 IPv4和 IPv6短表项的动态存储, 满足 IPv4以 及 IPv6动态的需求。
进一步的, 在将 IPv4和 IPv6短表项存储在第一表中时, 还可以根据 对 IPv4和 IPv6存储容量要求, 将与所述存储容量要求对应数量的 IPv4和 IPv6 短表项存储在第一表中。 例如, 当对 IPv4 的存储容量的要求高于对 IPv6存储容量的要求时, 所述第一表中存储的 IPv4的数量多于 IPv6短表 项的数量; 具体的, 例如当对 IPv4的最大存储容量进行测试时, 可以将所 述第一表的全部存储空间都存储为 IPv4; 当对 IPv6的最大存储容量进行测 试, 可以将第一表的全部存储空间都存储为 IPv6短表项。
本发明实施例中, 将 IPv4和 IPv6短表项存储在第一表中, 与现有技 术中将 IPv4和 IPv6短表项分别存储相比, 提升了 IPv6短表项存储容量; 当查找 IPv4或 IPv6时, 才艮据所述 IPv4或 IPv6对应的存储关键字查询所 述共享存储表, 获取 IPv4或 IPv6对应的地址, 实现了 IPv6短表项和 IPv4 共享存储时的地址查询。
并且在查找 IPv6的预定路由地址时, 同时执行查找所述第一表和所述 第二表, 与现有技术中先查找 IPv6长表项, 再查找 IPv6短表项的两次查 找相比, 缩短了查询 IPv6的预定路由地址的时间, 节省了 TCAM的功耗。
进一步的, 本发明实施例中, 在将 IPv4和 IPv6短表项存储在第一表 中时, 还可以根据对 IPv4和 IPv6存储容量要求, 将与所述存储容量要求 对应数量的 IPv4和 IPv6短表项存储在第一表中, 以实现 IPv4和 IPv6短 表项的动态存储, 满足 IPv4以及 IPv6动态的需求。
实施例 2
本发明实施例提供一种路由地址查询装置,如图 3所示,该装置包括: 存储单元 21、 第一查找单元 22和第二查找单元 23。
存储单元 21 , 用于将 IPv4和 IPv6短表项存储在第一表中, 并将 IPv6 长表项存储在第二表中, 通过 IPv4对应的存储关键字和 IPv6短表项对应 的存储关键字, 区分所述 IPv4和所述 IPv6短表项。
第一查找单元 22 , 用于当查找预定 IPv4路由地址时, 依据所述预定 IPv4路由地址和所述 IPv4对应的存储关键字查询所述第一表,按照最长匹 配的原则返回对应的所述预定 IPv4路由地址。
第二查找单元 23 , 用于当查找预定 IPv6路由地址时, 根据所述预定 IPv6 路由地址查询所述第二表, 以及依据所述预定 IPv6 路由地址和所述 IPv6短表项对应的存储关键字查询所述第一表, 按照最长匹配的原则返回 对应的所述预定 IPv6路由地址。
其中, 如图 4所示, 所述存储单元 21包括: 第一存储模块 211和第二 存储模块 212。
第一存储模块 211 , 用于将 IPv4和 IPv6短表项, 以优先级块为单位, 按照存储地址从低到高的顺序存储在第一表中; 其中, 所述第一存储模块 211将 IPv4和 IPv6短表项, 以优先级块为单位,按照存储地址从低到高的 顺序存储在第一表中的具体描述, 可以参考图 2 中的相应描述, 本发明实 施例此处将不再赘述。
第二存储模块 212 , 用于将所述 IPv6长表项按照存储地址从低到高的 顺序存储在第一表中。
进一步的,如图 5所示,所述第二查找单元 23包括:第一查找模块 231、 第二查找模块 232、 第一操作模块 233和第二操作模块 234。
第一查找模块 231 ,用于根据所述预定 IPv6路由地址查询所述第二表。 第二查找模块 232 ,用于依据所述预定 IPv6路由地址和所述 IPv6短表 项对应的存储关键字查询所述第一表。
第一操作模块 233 ,用于在所述第一查找模块 231或所述第二查找模块 232查找到一个与所述预定 IPv6路由地址对应的地址时, 将所述查找到的 一个地址返回。
第二操作模块 234 , 用于在所述第一查找模块 231和\或所述第二查找 模块 232查找到至少两个与所述预定 IPv6路由地址对应的地址时, 根据最 长匹配的原则返回对应的所述预定 IPv6路由地址。 其中, 所述第二操作模 块 234在所述第一查找模块 231和\或所述第二查找模块 232查找到至少两 个与所述预定 IPv6路由地址对应的地址时, 根据最长匹配的原则返回对应 的所述预定 I P V 6路由地址, 具体用于:
在所述第二查找单元 23查找到的至少两个与所述预定 IPv6路由地址 对应的地址, 为所述第一查找模块 231 查找到的地址时, 返回所述第一表 中低地址对应的所述预定 IPv6路由地址。
在所述第二查找单元 23查找到的至少两个与所述预定 IPv6路由地址 对应的地址, 为所述第二查找模块 232 查找到的地址时, 返回所述第二表 中低地址对应的所述预定 IPv6路由地址。
在所述第二查找单元 23查找到的至少两个与所述预定 IPv6路由地址 对应的地址, 至少一个为所述第一查找模块 231 查找到的地址, 另外至少 一个为所述第二查找模块 232 查找到的地址时, 返回所述第二表中低地址 对应的所述预定 IPv6路由地址。
进一步的, 所述存储单元 21在将 IPv4和 IPv6短表项存储在第一表中 时, 还可以根据对 IPv4和 IPv6存储容量要求, 将与所述存储容量要求对 应数量的 IPv4和 IPv6短表项存储在第一表中。 例如, 当对 IPv4的存储容 量的要求高于对 IPv6存储容量的要求时, 所述第一表中存储的 IPv4的数 量多于 IPv6短表项的数量; 具体的例如, 当对 IPv4的最大存储容量进行 测试时,所述存储单元 21可以将所述第一表的全部存储空间都存储为 IPv4; 当对 IPv6的最大存储容量进行测试时, 所述存储单元 21可以将第一表的 全部存储空间都存储为 IPv6短表项。
本发明实施例中, 将 IPv4和 IPv6短表项存储在第一表中, 与现有技 术中将 IPv4和 IPv6短表项分别存储相比, 提升了 IPv6短表项存储容量; 当查 IPv4或 IPv6时, 才艮据所述 IPv4或 IPv6对应的存储关键字查询所述 共享存储表, 获取 IPv4或 IPv6对应的地址, 实现了 IPv6短表项和 IPv4 共享存储时的地址查询。
并且在查找 IPv6的预定路由地址时, 同时执行查找所述第一表和所述 第二表, 与现有技术中先查找 IPv6长表项, 再查找 IPv6短表项的两次查 找相比, 缩短了查询 IPv6的预定路由地址的时间, 节省了 TCAM的功耗。
进一步的, 本发明实施例中, 在将 IPv4和 IPv6短表项存储在第一表 中时, 还可以根据对 IPv4和 IPv6存储容量要求, 将与所述存储容量要求 对应数量的 IPv4和 IPv6短表项存储在第一表中, 以实现 IPv4和 IPv6短 表项的动态存储, 满足 IPv4以及 IPv6动态的需求。
通过以上的实施方式的描述, 所属领域的技术人员可以清楚地了解到 本发明可借助软件加必需的通用硬件的方式来实现, 当然也可以通过硬件, 但 [艮多情况下前者是更佳的实施方式。 基于这样的理解, 本发明的技术方 案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出 来, 该计算机软件产品存储在可读取的存储介质中, 如计算机的软盘, 硬 盘或光盘等, 包括若干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者网络设备等)执行本发明各个实施例所述的方法。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局 限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可 轻易想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明 的保护范围应以所述权利要求的保护范围为准。

Claims

权利要求
1、 一种路由地址查询方法, 其特征在于, 包括:
将 IPv4和 IPv6短表项存储在第一表中, 并将 IPv6长表项存储在第二 表中, 通过 IPv4对应的存储关键字和 IPv6短表项对应的存储关键字, 区 分所述 IPv4和所述 IPv6短表项;
当查找预定 IPv4路由地址时,依据所述预定 IPv4路由地址和所述 IPv4 对应的存储关键字查询所述第一表, 按照最长匹配的原则返回对应的所述 预定 IPv4路由地址;
当查找预定 IPv6路由地址时, 才艮据所述预定 IPv6路由地址查询所述 第二表, 以及依据所述预定 IPv6路由地址和所述 IPv6短表项对应的存储 关键字查询所述第一表, 按照最长匹配的原则返回对应的所述预定 IPv6路 由地址。
2、 根据权利要求 1 所述的路由地址查询方法, 其特征在于, 将 IPv4 和 IPv6短表项存储在第一表中,并将 IPv6长表项存储在第二表中, 包括: 将 IPv4和 IPv6短表项, 以优先级块为单位, 按照存储地址从低到高 的顺序存储在第一表中;
将所述 IPv6长表项按照存储地址从低到高的顺序存储在第一表中。
3、 根据权利要求 1所述的路由地址查询方法, 其特征在于, 所述当查 找预定 IPv6路由地址时, 根据所述预定 IPv6路由地址查询所述第二表, 以及依据所述预定 IPv6路由地址和所述 IPv6短表项对应的存储关键字查 询所述第一表, 按照最长匹配的原则返回对应的所述预定 IPv6路由地址, 包括:
根据所述预定 IPv6路由地址查询所述第二表,以及依据所述预定 IPv6 路由地址和所述 IPv6短表项对应的存储关键字查询所述第一表;
若查找到一个与所述预定 IPv6路由地址对应的地址, 则将所述查找到 的一个地址返回; 若查找到至少两个与所述预定 IPv6路由地址对应的地址, 则根据最长 匹配的原则返回对应的所述预定 IPv6路由地址。
4、 根据权利要求 3所述的路由地址查询方法, 其特征在于, 所述若查 找到至少两个与所述预定 IPv6路由地址对应的地址, 则才艮据最长匹配的原 则返回对应的所述预定 IPv6路由地址, 包括: 储在所述第一表中的地址, 则返回所述第一表中低地址对应的所述预定 IPv6路由地址; 储在所述第二表中的地址, 则返回所述第二表中低地址对应的所述预定 IPv6路由地址;
若查找到的所述至少两个与所述预定 IPv6路由地址对应的地址, 至少 一个为存储在所述第一表中的地址, 另外至少一个为存储在所述第二表中 的地址, 则返回所述第二表中低地址对应的所述预定 IPv6路由地址。
5、根据权利要求 1-4中任一项所述的路由地址查询方法,其特征在于, 在将 IPv4和 IPv6短表项存储在第一表中时, 还包括:
根据对 IPv4和 IPv6存储容量要求, 将与所述存储容量要求对应数量 的 IPv4和 IPv6短表项存储在第一表中。
6、 一种路由地址查询装置, 其特征在于, 包括:
存储单元, 用于将 IPv4和 IPv6短表项存储在第一表中, 并将 IPv6长 表项存储在第二表中, 通过 IPv4对应的存储关键字和 IPv6短表项对应的 存储关键字, 区分所述 IPv4和所述 IPv6短表项;
第一查找单元, 用于当查找预定 IPv4路由地址时,依据所述预定 IPv4 路由地址和所述 IPv4对应的存储关键字查询所述第一表, 按照最长匹配的 原则返回对应的所述预定 IPv4路由地址;
第二查找单元, 用于当查找预定 IPv6路由地址时,根据所述预定 IPv6 路由地址查询所述第二表, 以及依据所述预定 IPv6 路由地址和所述 IPv6 短表项对应的存储关键字查询所述第一表, 按照最长匹配的原则返回对应 的所述预定 IPv6路由地址。
7、 根据权利要求 6所述的路由地址查询装置, 其特征在于, 所述存储 单元包括:
第一存储模块, 用于将 IPv4和 IPv6短表项, 以优先级块为单位, 按 照存储地址从低到高的顺序存储在第一表中;
第二存储模块, 用于将所述 IPv6长表项按照存储地址从低到高的顺序 存储在第一表中。
8、 根据权利要求 6所述的路由地址查询装置, 其特征在于, 所述第二 查找单元包括:
第一查找模块, 用于根据所述预定 IPv6路由地址查询所述第二表; 第二查找模块, 用于依据所述预定 IPv6路由地址和所述 IPv6短表项 对应的存储关键字查询所述第一表;
第一操作模块, 用于在所述第一查找模块或所述第二查找模块查找到 一个与所述预定 IPv6路由地址对应的地址时, 将所述查找到的一个地址返 回;
第二操作模块, 用于在所述第一查找模块和 \或所述第二查找模块查找 到至少两个与所述预定 IPv6路由地址对应的地址时, 才艮据最长匹配的原则 返回对应的所述预定 IPv6路由地址。
9、 根据权利要求 8所述的路由地址查询装置, 其特征在于,
所述第二操作模块用于, 在所述第二查找单元查找到的至少两个与所 述预定 IPv6路由地址对应的地址, 为所述第一查找模块查找到的地址时, 返回所述第一表中低地址对应的所述预定 IPv6路由地址;
所述第二操作模块还用于, 在所述第二查找单元查找到的至少两个与 所述预定 IPv6路由地址对应的地址,为所述第二查找模块查找到的地址时, 返回所述第二表中低地址对应的所述预定 IPv6路由地址;
所述第二操作模块还用于, 在所述第二查找单元查找到的至少两个与 所述预定 IPv6路由地址对应的地址, 至少一个为所述第一查找模块查找到 的地址, 另外至少一个为所述第二查找模块查找到的地址时, 返回所述第 二表中低地址对应的所述预定 IPv6路由地址。
10、 根据权利要求 6至 8中任一项所述的路由地址查询装置, 其特征 在于, 所述存储单元还用于, 根据对 IPv4和 IPv6存储容量要求, 将与所 述存储容量要求对应数量的 IPv4和 IPv6短表项存储在第一表中。
PCT/CN2012/072443 2011-03-29 2012-03-16 路由地址查询方法和装置 WO2012130054A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110077093.4 2011-03-29
CN201110077093.4A CN102164080B (zh) 2011-03-29 2011-03-29 路由地址查询方法和装置

Publications (1)

Publication Number Publication Date
WO2012130054A1 true WO2012130054A1 (zh) 2012-10-04

Family

ID=44465061

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/072443 WO2012130054A1 (zh) 2011-03-29 2012-03-16 路由地址查询方法和装置

Country Status (2)

Country Link
CN (1) CN102164080B (zh)
WO (1) WO2012130054A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102164080B (zh) * 2011-03-29 2014-03-12 华为技术有限公司 路由地址查询方法和装置
CN102291472A (zh) * 2011-09-09 2011-12-21 华为数字技术有限公司 一种网络地址查找方法及装置
CN103581020B (zh) * 2013-10-18 2016-08-10 华为技术有限公司 一种报文转发的方法、装置及系统
CN104539537B (zh) * 2014-12-25 2018-04-20 北京华为数字技术有限公司 一种路由查找方法和装置
CN113923191B (zh) * 2021-10-09 2024-01-12 天翼物联科技有限公司 Ip地址的存储方法、装置、nb终端及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007088174A1 (en) * 2006-01-31 2007-08-09 Telefonaktiebolaget Lm Ericsson (Publ) Packet redirection in a communication network
CN101039252A (zh) * 2006-03-15 2007-09-19 中兴通讯股份有限公司 一种三重内容可寻址存储器路由表管理方法
CN101179508A (zh) * 2007-11-29 2008-05-14 中兴通讯股份有限公司 Ipv4和ipv6复用路由表生成装置及该装置生成复用路由表方法
CN101582851A (zh) * 2009-06-12 2009-11-18 中兴通讯股份有限公司 一种实现双栈路由器上共享路由容量的方法和系统
CN101616090A (zh) * 2009-07-28 2009-12-30 华为技术有限公司 一种划分树节点资源方法及装置
CN102164080A (zh) * 2011-03-29 2011-08-24 华为技术有限公司 路由地址查询方法和装置

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100466627C (zh) * 2006-06-01 2009-03-04 华为技术有限公司 地址前缀查找方法和装置以及报文转发方法和系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007088174A1 (en) * 2006-01-31 2007-08-09 Telefonaktiebolaget Lm Ericsson (Publ) Packet redirection in a communication network
CN101039252A (zh) * 2006-03-15 2007-09-19 中兴通讯股份有限公司 一种三重内容可寻址存储器路由表管理方法
CN101179508A (zh) * 2007-11-29 2008-05-14 中兴通讯股份有限公司 Ipv4和ipv6复用路由表生成装置及该装置生成复用路由表方法
CN101582851A (zh) * 2009-06-12 2009-11-18 中兴通讯股份有限公司 一种实现双栈路由器上共享路由容量的方法和系统
CN101616090A (zh) * 2009-07-28 2009-12-30 华为技术有限公司 一种划分树节点资源方法及装置
CN102164080A (zh) * 2011-03-29 2011-08-24 华为技术有限公司 路由地址查询方法和装置

Also Published As

Publication number Publication date
CN102164080A (zh) 2011-08-24
CN102164080B (zh) 2014-03-12

Similar Documents

Publication Publication Date Title
US9680747B2 (en) Internet protocol and Ethernet lookup via a unified hashed trie
US9871728B2 (en) Exact match hash lookup databases in network switch devices
US7039018B2 (en) Technique to improve network routing using best-match and exact-match techniques
JP4716909B2 (ja) ネットワーク接続テーブルを提供するための方法および装置
US20090304005A1 (en) Routing table lookup algorithm employing search key having destination address and interface component
TWI661698B (zh) 轉發乙太網路封包的方法和裝置
WO2009089772A1 (fr) Procédé de recherche d'un dispositif de réseau et dispositif de réseau
US8848707B2 (en) Method for IP longest prefix match using prefix length sorting
WO2012130054A1 (zh) 路由地址查询方法和装置
WO2009103225A1 (zh) 一种报文转发的方法和设备
WO2011120459A2 (zh) 报文转发方法、装置及网络设备
US10313154B2 (en) Packet forwarding
US20070140264A1 (en) Address translation device and method for forwarding packets for the same
CN101651628A (zh) 一种三状态内容可寻址存储器实现方法及装置
WO2018068524A1 (zh) 路由表建立、以及ip路由查找方法、装置、存储介质
US20180351878A1 (en) Multicast data packet forwarding
US9183322B2 (en) Increasing internet protocol version 6 host table scalability in top of rack switches for data center deployments
CN102291472A (zh) 一种网络地址查找方法及装置
WO2014166073A1 (zh) 报文转发方法和网络设备
WO2008028412A1 (fr) Procédé et appareil de routage, et procédé d'enregistrement d'informations de routage
CN102325077B (zh) 分支机构间的通信方法及分支机构的出口路由器
CN106453091B (zh) 路由器转发平面的等价路由管理方法和装置
CN103973571A (zh) 网络处理器及其路由查找方法
US20230041395A1 (en) Method and Device for Processing Routing Table Entries
TWI239476B (en) Address search

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12764649

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12764649

Country of ref document: EP

Kind code of ref document: A1