WO2011012081A1 - 一种通信设备路由转发表的压缩方法和装置 - Google Patents
一种通信设备路由转发表的压缩方法和装置 Download PDFInfo
- Publication number
- WO2011012081A1 WO2011012081A1 PCT/CN2010/075553 CN2010075553W WO2011012081A1 WO 2011012081 A1 WO2011012081 A1 WO 2011012081A1 CN 2010075553 W CN2010075553 W CN 2010075553W WO 2011012081 A1 WO2011012081 A1 WO 2011012081A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- route
- network
- forwarding table
- routing
- added
- 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.)
- Ceased
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/02—Topology update or discovery
Definitions
- the present invention relates to the field of communications, and in particular, to a method and apparatus for compressing a routing table of a communication device.
- the Transmission Control Protocol/Internet Protocol (TCP/IP) protocol stack relies on a routing table for data transmission/reception processing.
- the routing table is often too large, and our routing table load container is too small. Especially in some low-end network routing devices, this contradiction is particularly prominent. Therefore, the use of equal-cost routing to effectively reduce the size of the routing table is a more effective means to solve such problems.
- the existing compression forwarding table there is a method of compressing the routing forwarding table by using a default route, for example, Chinese patent CN200710130487.5; there is a method for performing route compression processing using characters, such as Chinese patent CN200710073936.7;
- the destination address and the gateway network element are used for routing compression of keywords, such as Chinese patent CN02131448.9.
- the compression method described above may achieve the effect of being more complicated or failing to achieve the maximum possible compression routing table.
- the technical problem to be solved by the present invention is to provide a compression method and device for a routing forwarding table of a communication device, which utilizes IP planning to reduce the size of the routing forwarding table and solves the problem that the routing forwarding table is too large.
- the present invention provides a compression method for a routing forwarding table of a communication device, including:
- the networking of the communication device configure IP addresses of different network segments for each transmission node in the networking, and select one of the multiple host routing interfaces between two adjacent transit nodes as the network routing interface of the same network segment; as well as
- the route forwarding table is updated, it is determined whether the type of the route to be joined is a host route or a network route. If it is a host route, it is determined whether there is a network route in the routing forwarding table that is on the same network segment as the host route to be added. If yes, the route to be added is discarded, and the route to be added is replaced by the network route; if not, the route to be added is added to the route forwarding table.
- the step of determining whether the type of the route to be added is a host route or a network route includes: determining the type of the route to be added by using the length of the subnet mask, if the subnet mask of the route to be added is converted into binary data
- the length is 32 bits, which is the host route; otherwise, it is the network route.
- the step of determining whether there is a network route in the routing forwarding table that is in the same network segment as the to-be-joined host route includes: searching for the existence and the waiting by using the destination address and the subnet mask as keywords Join the host to route network routes on the same network segment.
- the method further includes: determining, when the routing forwarding table is updated, that the route to be added is a network route, determining whether the routing forwarding table has a larger network than the network segment to be joined. Routing, if yes, discarding the to-be-joined network route; otherwise, further determining whether there is a smaller network route in the routing forwarding table than to be added to the network routing network segment, and if not present, The network route to be joined is added to the routing forwarding table.
- the method further includes: if it is determined that there is a smaller network route in the routing forwarding table than the network routing network segment to be added, determining that all network routes in the system are smaller than the network routing network segment to be added to the network, Whether the route to be added to the network already exists in the route forwarding table, and if not, the route to be added to the network is added to the route forwarding table.
- the method further includes: discarding the to-be-joined network route if it is determined that the to-be-joined network route already exists in the routing forwarding table.
- the step of determining whether there is a smaller network route in the routing forwarding table than the network routing network segment to be added includes: determining the size of the network segment according to the length of the subnet mask, and the shorter the length of the subnet mask, corresponding to The larger the network segment.
- the present invention further provides a compression device for a communication device routing forwarding table, which includes:
- IP address configuration module which is set as: In the networking of the communication device, it is the transmission section in the networking. Point to configure IP addresses of different network segments, and select one of multiple host routing interfaces between two adjacent transit nodes as the network routing interface of the same network segment;
- the route forwarding table update module is configured to: determine, when the route forwarding table is updated, whether the type of the route to be added is a host route or a network route, and if it is a host route, determine whether the route forwarding table exists and Join the network route of the host to the same network segment. If yes, discard the route to be added to the host and replace the route to be added with the network route. If not, add the route to be added to the route. In the forwarding table.
- the route forwarding table update module is configured to determine whether the type of the route to be added is a host route or a network route in the following manner: determining the type of the to-be-joined route by using the length of the subnet mask, if the sub-route to be added After the netmask is converted to binary data, the length is 32 bits, which is the host route; otherwise, it is the network route.
- the routing forwarding table update module is configured to determine, in the manner that the routing forwarding table has a network route that is in the same network segment as the to-be-joined host route: using a destination address and a subnet mask as keywords, The route forwarding table searches for a network route that is on the same network segment as the route to be added to the host.
- the routing and forwarding table update module is further configured to: if it is determined that the to-be-joined route is a network route, when the route forwarding table is updated, determining whether there is a route to be added to the route forwarding table If the network segment is larger, the network route is discarded. If it does not exist, it is determined whether there is a smaller network route than the network segment to be added to the network. And adding the to-join network route to the routing forwarding table if it does not exist.
- the routing forwarding table update module is further configured to: if it is determined that there is a smaller network route in the routing forwarding table than the network routing network segment to be added, all the deletion systems are smaller than the network routing network segment to be added to the network. At the same time as the network route, it is determined whether the network route to be joined already exists in the route forwarding table.
- the routing and forwarding table update module is further configured to: if it is determined that the to-be-joined network route already exists in the routing forwarding table, discard the to-be-joined network route.
- the routing forwarding table update module is configured to determine whether the routing forwarding table is in the following manner There is a smaller network route than the network segment to be added to the network: The size of the network segment is determined according to the length of the subnet mask. The shorter the length of the subnet mask, the larger the corresponding network segment.
- the invention provides a method and a device for implementing a compressed routing forwarding table by using a planned IP address, so that the network routing can directly replace the host routing, effectively reducing the size of the routing forwarding table, thereby improving the efficiency of routing forwarding, reducing memory resource conflicts, and reducing CPU.
- the load of the Central Processing Unit (Central Processing Unit); and the feature of the present invention is that the compression algorithm and the implementation rules are relatively simple.
- FIG. 1 is a diagram showing an example of an IP planning method of a compressed routing forwarding table according to the present invention
- FIG. 2 is a flowchart of injecting a route to a route forwarding table according to an embodiment of the present invention
- FIG. 3 is a diagram showing an example of a host route write routing forwarding table according to the present invention.
- FIG. 4 is a diagram showing an example of a network route write route forwarding table according to an application example of the present invention
- FIG. 5 is a diagram showing an example of a network route write route forwarding table according to another application example of the present invention
- the core idea of the present invention is: in the networking of the communication device, configure the IP address of the transmission node (or router) in the networking, configure the IP address of different network segments for each router, and from the two routers.
- One of the multiple host routing interfaces is selected as the network routing interface, and the purpose of using the network route instead of the host route is achieved, so that the size of the routing forwarding table can be reduced, and the problem that the routing forwarding table is too large is solved.
- the implementation method of the present invention includes the following contents:
- each network device becomes a local area network.
- each network device belongs to a different subnet.
- Each network device is assigned an address of the Ethernet port of the subnet and runs a routing protocol.
- the initialization of the routing forwarding table Create a structure that stores routing information to record routing forwarding tables.
- the driver When the driver adds a routing entry to the routing forwarding table, it checks the type of the added route.
- route to be added is the host route, check whether there is a destination route in the current forwarding routing table of the system that is on the same network segment as the route to be added. If not, add the route entry to be added to the route.
- the routing entry is injected into the operating system at the same time; if it exists, no action is taken on the route to be added, and the operation is directly exited.
- route to be added is a network route, check whether there is a network larger than the route to be added in the current route forwarding table of the system. If it exists, do not perform any operation on the route to be added, and directly exit; if it does not exist Then, check whether there is a smaller route than the route segment to be added to the route forwarding table. If it exists, delete all routes in the system that are smaller than the network segment to be added to the route entry.
- the processing device for reducing the routing forwarding table in the planned IP network of the present invention includes: an internet protocol address configuration module, configured to: configure different network segments for each transmission node in the networking in the networking of the communication device An IP address, and selecting one of a plurality of host routing interfaces between two adjacent transit nodes as a network routing interface of the same network segment; and a routing forwarding table update module, configured to: when updating the routing forwarding table, Determining whether the type of the route to be added is a host route or a network route, and if it is a host route, determining whether there is a network route in the routing forwarding table that is in the same network segment as the route to be added to the host, and if yes, discarding the to-be-joined The host routes, and replaces the to-be-joined host route with the network route; if not, adds the to-be-joined host route to the route forwarding table.
- an internet protocol address configuration module configured to: configure different network segments for each transmission node in the
- the routing forwarding table update module determines that the to-be-joined is determined by the length of the subnet mask.
- the route forwarding table update module searches for the network route of the same network segment as the to-be-joined host route by using the destination address and the subnet mask as keywords.
- the routing forwarding table update module is further configured to: determine, if the route to be added is a network route, when the routing forwarding table is updated, determine whether the routing forwarding table exists to be added If the network routing segment has a larger network route, if it exists, discard the route to be added to the network; if not, determine whether there is a smaller network route in the routing forwarding table than the network segment to be added to the network. And adding the to-join network route to the routing forwarding table if it does not exist.
- the routing forwarding table update module is further configured to: if it is determined that there is a smaller network route in the routing forwarding table than that to be added to the network routing network segment, all the deleting systems are more than the network routing network segment to be added to the network. At the same time as the small network route, it is determined whether the network route to be joined already exists in the routing forwarding table.
- the routing and forwarding table update module is further configured to: if it is determined that the to-be-joined network route already exists in the routing forwarding table, discard the to-be-joined network route.
- the routing forwarding table update module determines the size of the network segment according to the length of the subnet mask. The shorter the length of the subnet mask, the larger the corresponding network segment.
- the items in the routing forwarding table are minimized, which solves the problem of various resource shortages caused by the routing table being too large, and greatly improves the problem.
- the lookup speed of the routing forwarding table is minimized.
- the routing forwarding table is compressed, and the network routing in the same network segment is replaced by the network routing.
- the IP address planning method of the embodiment of the present invention is as shown in FIG. 1.
- an IP address of a different network segment is configured for each router: an IP of the network segment 192.192.1.XXX is allocated to the A route. Address, assign the IP address of the 192.192.2.XXX network segment to the B route, and assign the IP address of the 192.192.3.XXX network segment to the C route.
- the communication between the two adjacent routers and the routing and forwarding are implemented by the same gateway. That is, all the parallel interfaces between the two routers have the same gateway to the destination address at a certain moment.
- the driver layer interface when the connection in the networking is changed, for example, when an interface is disconnected or a new interface is added, after the route is recalculated according to the routing protocol of the IP layer, the driver layer interface is invoked to update the routing forwarding table. After receiving the routing information to be processed, the driver layer interface compresses dynamic host routes and dynamic network routes.
- the present invention only performs route compression on the dynamic route calculated by the routing protocol.
- the static route including the flood of the local network element and other network elements is not in the compression category of the present invention.
- the processing method for reducing the routing forwarding table in the planned IP network is as shown in FIG. 2, and the processing flow after the driving layer receives the dynamic routing information to be injected includes the following steps: Step 101: First, through the converter The length of the netmask, determining whether the route to be added is a host route, if yes, executing step 102, otherwise, performing step 103;
- the length of the subnet mask converted to binary data is 32 bits, and if so, it is the host route.
- Step 102 Determine whether there is a network route to the same network in the current routing forwarding table. If the network route of the same network segment exists, the destination address identified by the route is included in the next hop information of the routing forwarding table. If the route is discarded, the process ends. Otherwise, the process proceeds to step 108. In this step, the destination address and the subnet mask are used as keywords, and the structure of the dynamic routing information is searched for whether there is a network that is in the same network segment as the route to be added. Routing
- Step 103 if the length of the converted subnet mask is less than 32 bits, that is, network routing, step 104 is performed;
- Step 104 Search for the structure of the dynamic routing information by searching to determine whether there is a network route of the network segment larger than the network route to be added in the dynamic routing database, if there is already a larger network.
- Step 105 further searching whether there is a network route in the dynamic routing database that is smaller than the network segment to be added to the route, if yes, executing step 106, otherwise, performing step 108;
- Step 106 Delete all network routes with smaller network segments in the forwarding routing table, and perform the next step.
- Step 107 Search for the network route to be added in the routing forwarding table. If it exists, the update is meaningless, and the process ends directly. If not, step 108 is performed; Step 108, the route is added to the ingress route. After forwarding the table, this host route compression process ends.
- the process description of the host route being added to the route forwarding table is shown on the left side of Figure 3. Assume that the current route forwarding table does not contain any routes on the network segment 195.0.0.0/8 (that is, the IP address is 195.0.0.0 and the subnet mask is 255.0.0.0).
- a route 195.2.2.0/24 (that is, the IP address is 195.2.2.0, and the subnet mask is 255.255.255.0).
- the route forwarding table Before adding the route forwarding table, it is determined that there is no route larger than the A route network segment in the current route forwarding table, and there is no route. A smaller route than the A route network segment, then directly write to the route forwarding table.
- B. Route 195.2.2.19/32 that is, the IP address is 195.2.2.19 and the subnet mask is 255.255.255.255).
- the B route is the host route.
- search for the same network segment in the route forwarding table The network route; as a result, it is found that the A route is a network route of the same network segment as the B route. Then do not write to the routing forwarding table, and exit.
- a route 195.2.0.0/16 (that is, the IP address is 195.2.0.0 and the subnet mask is 255.255.0.0) is added to the routing forwarding table. It is determined that there is no larger route in the current routing forwarding table than the A routing network segment. A smaller route than the A route network segment, then directly write to the route forwarding table.
- the B route 195.2.3.0/24 it is first checked whether there is a larger route than the B route network segment. The search finds that the previously added A route is larger than the added B route network segment. Then exit the update process of the routing forwarding table.
- routing forwarding table Before A route 195.2.2.0/24 is added to the routing forwarding table, it is determined that there is no larger route in the current routing forwarding table than the A routing network segment, and there is no smaller route than the A routing network segment, so the routing forwarding table is directly written.
- the B route 195.2.0.0/16 is judged before writing, and it is first checked whether there is a larger route than the B route network segment. After the traversal, I found no.
- the second step is to check whether there is a route that is smaller than the route of the B route. In this case, the route segment of the A route that is added to the route segment is included in the network segment of the B route to be added. So the next thing to do is to update the routing forwarding table: First delete the route A to the route, and then add the B route to the route forwarding table.
- a and B are compressed by using the compression method of the present invention, and then aggregated into a route indicating a network segment of 195.2.0.0/255.255.0.0, as shown in the right frame of FIG. Application example four:
- Step 1 Before A route 195.2.2.0/24 joins the routing forwarding table, it is determined that there is no larger route in the current routing forwarding table than the A routing network segment, and there is no smaller route than the A routing network segment, then the direct writing is performed. Routing forwarding table.
- Step 2 The B route is the same as the A route judgment process. After the judgment, the route forwarding table is also added.
- the third step is to judge the C route 195.2.0.0/16 before writing, first check whether there is a larger route than the C route network segment. After the traversal, I found no. In the second step, it is checked whether there is a route that is smaller than the C route network segment. In this case, the A route network segment that has been added is included in the network segment of the B route to be added. So the next thing to do is to update the routing forwarding table: First delete the route to the eight, B route, and then add the B route to the routing forwarding table.
- A, B, and C are compressed by using the compression method of the present invention, and a single route representing the network segment of 195.2.0.0/255.255.0.0 is aggregated, as shown in the lower frame of FIG.
- the biggest advantage of this method in the transmission equipment is that the routing of parallel data channels in the two transmission nodes can be aggregated to reach the maximum compression ratio of the routing table.
- the invention provides a method for implementing a compressed routing forwarding table by using a planned IP address, so that the network is The routing can directly replace the host routing, effectively reducing the size of the routing forwarding table, thereby improving the efficiency of routing forwarding, reducing memory resource conflicts, and reducing CPU load; and the invention is characterized in that the compression algorithm and the implementation rules are relatively simple.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Description
一种通信设备路由转发表的压缩方法和装置
技术领域
本发明涉及通信领域, 尤其涉及一种通信设备路由转发表的压缩方法和 装置。
背景技术
在一般的网络设备中,传输控制协议 /互联网络协议( Transmission Control Protocol/Internet Protocol, TCP/IP )协议栈依靠路由表进行数据收发 /转发处理 工作。 实际使用中常常出现路由表太大, 而我们的路由表装载容器太小的问 题。 特别是在一些中低端的网络路由设备中, 这种矛盾尤其突出。 因此利用 等价路由来有效缩小路由表大小, 是解决此类问题比较有效的手段。
在现有的压缩转发表的实现中, 有利用默认路由来压缩路由转发表的方 法,例如中国专利 CN200710130487.5;有利用字符进行路由压缩处理的方法, 例如中国专利 CN200710073936.7; 还有使用目的地址与网关网元为关键字进 行路由压缩的方法, 例如中国专利 CN02131448.9。
但以上所述压缩方法, 或实现较复杂、 或不能达到最大可能压缩路由表 的效果。
发明内容
本发明要解决的技术问题是提供一种通信设备路由转发表的压缩方法和 装置, 利用 IP规划实现缩小路由转发表的大小, 解决了路由转发表过大的问 题。
为了解决上述问题,本发明提供了一种通信设备路由转发表的压缩方法, 包括:
在通讯设备的组网中, 为组网中各传输节点配置不同网段的 IP地址, 并 选择邻接的两个传输节点间的多个主机路由接口中的一个作为同一网段的网 络路由接口; 以及
在对路由转发表进行更新时, 判断待加入路由的类型是主机路由还是网 络路由, 如果是主机路由, 则判断所述路由转发表中是否存在与该待加入主 机路由同一网段的网络路由, 如果存在, 则丟弃该待加入主机路由, 并用所 述网络路由代替该待加入主机路由; 如果不存在, 则将该待加入主机路由加 入到所述路由转发表中。
所述判断待加入路由的类型是主机路由还是网络路由的步骤包括: 通过 子网掩码的长度判断所述待加入路由的类型, 如果所述待加入路由的子网掩 码转换为二进制数据后的长度为 32位, 则为主机路由; 否则, 为网络路由。
所述判断路由转发表中是否存在与该待加入主机路由同一网段的网络路 由的步骤包括: 以目的地址与子网掩码为关键字, 从所述路由转发表中搜索 是否存在与该待加入主机路由同一网段的网络路由。
该方法还包括: 在对所述路由转发表进行更新时, 如果判断出所述待加 入路由为网络路由, 则判断所述路由转发表中是否存在比该待加入网络路由 网段更大的网络路由, 如果存在, 则丟弃该待加入网络路由; 否则, 再进一 步判断所述路由转发表中是否存在比待加入网络路由网段更小的网络路由, 并在不存在的情况下将所述待加入网络路由加入到所述路由转发表中。
该方法还包括: 如果判断出所述路由转发表中存在比待加入网络路由网 段更小的网络路由, 则在删除系统中所有比待加入网络路由网段更小的网络 路由的同时, 判断所述路由转发表中是否已经存在所述待加入网络路由, 如 果不存在, 则将所述待加入网络路由加入到所述路由转发表中。
该方法还包括: 如果判断出所述路由转发表中已经存在所述待加入网络 路由, 则丟弃所述待加入网络路由。
判断所述路由转发表中是否存在比待加入网络路由网段更小的网络路由 的步骤包括: 根据子网掩码的长度大小判断网段的大小, 子网掩码的长度越 短, 则对应的网段越大。
为了解决上述问题, 本发明还提供了一种通信设备路由转发表的压缩装 置, 其包括:
IP地址配置模块, 其设置为: 在通讯设备的组网中, 为组网中各传输节
点配置不同网段的 IP地址, 并选择邻接的两个传输节点间的多个主机路由接 口中的一个作为同一网段的网络路由接口; 以及
路由转发表更新模块, 其设置为: 在对路由转发表进行更新时, 判断待 加入路由的类型是主机路由还是网络路由, 如果是主机路由, 则判断所述路 由转发表中是否存在与该待加入主机路由同一网段的网络路由, 如果存在, 则丟弃该待加入主机路由, 并用所述网络路由代替该待加入主机路由; 如果 不存在, 则将该待加入主机路由加入到所述路由转发表中。
所述路由转发表更新模块是设置为以如下方式判断待加入路由的类型是 主机路由还是网络路由: 通过子网掩码的长度判断所述待加入路由的类型, 如果所述待加入路由的子网掩码转换为二进制数据后的长度为 32位,则为主 机路由; 否则, 为网络路由。
所述路由转发表更新模块是设置为以如下方式判断所述路由转发表中是 否存在与该待加入主机路由同一网段的网络路由: 以目的地址与子网掩码为 关键字, 从所述路由转发表中搜索是否存在与该待加入主机路由同一网段的 网络路由。
所述路由转发表更新模块还设置为: 在对所述路由转发表进行更新时, 如果判断出所述待加入路由为网络路由, 则判断所述路由转发表中是否存在 比该待加入网络路由网段更大的网络路由, 如果存在, 则丟弃该待力 p入网络 路由; 如果不存在, 则再判断所述路由转发表中是否存在比待加入网络路由 网段更小的网络路由, 并在不存在的情况下将所述待加入网络路由加入到所 述路由转发表中。
所述路由转发表更新模块还设置为: 如果判断出所述路由转发表中存在 比待加入网络路由网段更小的网络路由, 则在删除系统中所有比待加入网络 路由网段更小的网络路由的同时, 判断所述路由转发表中是否已经存在所述 待加入网络路由。
所述路由转发表更新模块还设置为: 如果判断出所述路由转发表中已经 存在所述待加入网络路由, 则丟弃所述待加入网络路由。
所述路由转发表更新模块是设置以如下方式判断所述路由转发表中是否
存在比待加入网络路由网段更小的网络路由: 根据子网掩码的长度大小判断 网段的大小, 子网掩码的长度越短, 则对应的网段越大。
本发明提出了一种利用规划 IP地址实现压缩路由转发表的方法和装置, 使网络路由能够直接替换主机路由, 有效缩小路由转发表大小, 从而提高路 由转发的效率、 减少内存资源冲突、 降低 CPU ( Central Processing Unit, 中央 处理单元) 的负荷; 并且本发明的特点是压缩算法和实施规则均较为简单。
附图概述
图 1为本发明的压缩路由转发表的 IP规划方法示例图;
图 2为本发明实施例的注入路由到路由转发表的流程图;
图 3为本发明主机路由写入路由转发表的示例图;
图 4 为本发明一个应用示例的网络路由写入路由转发表的示例图; 图 5 为本发明另一应用示例的网络路由写入路由转发表的示例图; 图 6 为本发明又一应用示例的网络路由写入路由转发表的示例图。
本发明的较佳实施方式
本发明的核心思想是: 在通讯设备的组网中, 对组网中的传输节点 (或 路由器) 的 IP地址做配置规划, 为每个路由器配置不同网段的 IP地址, 并 从两个路由器间的多个主机路由接口中选择一个作为网络路由接口, 达到利 用网络路由代替主机路由的目的, 从而可以缩小路由转发表的大小, 解决路 由转发表过大的问题。
具体地, 本发明的实现方法包括如下内容:
1、 IP地址配置规划
在通讯网络中, 每个网络设备自成一个局域网。 在全网通讯设备中, 每 个网络设备都属于不同的子网。 每个网络设备上都分配一个本子网的以太网 口的地址, 运行路由协议。
2、 路由转发表的初始化
创建一个存储路由信息的结构, 以记录路由转发表。
3、 检查路由类型
驱动每加入一条路由表项到路由转发表的时候, 检查添加路由的类型,
4、 查询及修改路由转发表
1 )如果待加入路由为主机路由, 则检查系统当前的转发路由表中是否存 在与待加入路由在同一个网段的目的路由, 如果不存在, 则将此待加入路由 表项添加到路由转发表中, 同时将此路由表项注入到操作系统; 如果存在, 则对待加入路由不做任何操作, 直接退出。
2)如果待加入的路由为网络路由, 则检查系统当前的路由转发表中是否 存在比待加入的路由更大的网络, 如果存在, 则对待加入路由不做任何操作, 直接退出; 如果不存在, 则再检查路由转发表中是否存在比待加入路由网段 更小的路由, 如果存在, 则删除系统中所有比待加入路由表项网段更小的路 由。
3)如果检索出转发路由表中存在比待加入的网络路由网段更小的路由, 则在删除所有比待加入路由表项网段更小的路由后, 将此路由表项添加到路 由转发表中, 同时将此路由表项注入到操作系统。
本发明的在规划配置的 IP网络下缩小路由转发表的处理装置包括: 互联网络协议地址配置模块, 其用于: 在通讯设备的组网中, 为组网中 各传输节点配置不同网段的 IP地址, 并选择邻接的两个传输节点间的多个主 机路由接口中的一个作为同一网段的网络路由接口; 以及 路由转发表更新模块, 其用于: 在对路由转发表进行更新时, 判断待加 入路由的类型是主机路由还是网络路由, 如果是主机路由, 则判断所述路由 转发表中是否存在与该待加入主机路由同一网段的网络路由, 如果存在, 则 丟弃该待加入主机路由, 并用所述网络路由代替该待加入主机路由; 如果不 存在, 则将该待加入主机路由加入到所述路由转发表中。
其中, 所述路由转发表更新模块是通过子网掩码的长度判断所述待加入
路由的类型, 如果所述待加入路由的子网掩码转换为二进制数据后的长度为
32位, 则为主机路由; 否则, 为网络路由。
其中, 所述路由转发表更新模块是以目的地址与子网掩码为关键字, 从 所述路由转发表中搜索是否存在与该待加入主机路由同一网段的网络路由。
其中, 所述路由转发表更新模块还用于: 在对所述路由转发表进行更新 时, 如果判断出所述待加入路由为网络路由, 则判断所述路由转发表中是否 存在比该待加入网络路由网段更大的网络路由, 如果存在, 则丟弃该待加入 网络路由; 如果不存在, 则再判断所述路由转发表中是否存在比待加入网络 路由网段更小的网络路由, 并在不存在的情况下将所述待加入网络路由加入 到所述路由转发表中。
其中, 所述路由转发表更新模块还用于: 如果判断出所述路由转发表中 存在比待加入网络路由网段更小的网络路由, 则在删除系统中所有比待加入 网络路由网段更小的网络路由的同时, 判断所述路由转发表中是否已经存在 所述待加入网络路由。
其中, 所述路由转发表更新模块还用于: 如果判断出所述路由转发表中 已经存在所述待加入网络路由, 则丟弃所述待加入网络路由。
其中, 所述路由转发表更新模块是根据子网掩码的长度大小判断网段的 大小, 子网掩码的长度越短, 则对应的网段越大。
通过以上所描述的压缩路由转发表的方法和装置, 最大程度地减小了路 由转发表中的项, 很好的解决了路由表太大带来的各种资源短缺问题, 同时 也大大提高了路由转发表的查找速度。
在任何时候对路由转发表进行压缩, 用其中的网络路由替换掉同一网段的主 机路由。
下面结合附图及具体实例对本发明技术方案的实施进行详细描述。
本发明实施例的 IP地址规划方法如图 1所示, 在通讯设备的组网中, 为 每个路由器配置不同网段的 IP地址:为 A路由分配 192.192.1.XXX网段的 IP
地址, 为 B 路由分配 192.192.2.XXX 网段的 IP 地址, 为 C 路由分配 192.192.3.XXX网段的 IP地址。
邻接的两个路由器之间的通讯、 路由转发, 都由同一个网关实现, 即两 个路由器之间的所有平行接口在某一时刻都有相同的网关通向对方目的地 址。
这样, 当组网中的连接发生变更, 如某个接口断开或新增接口时, 根据 IP层的路由协议重新计算路由后, 调用驱动层接口对路由转发表进行更新操 作。 驱动层接口收到待处理的路由信息后, 分别对动态主机路由和动态网络 路由进行压缩处理。
需要说明的是,本发明只针对路由协议计算出的动态路由进行路由压缩。 对于静态路由, 包括本网元和其它网元洪泛过来的静态路由均不在本发明所 指的压缩范畴。
本发明实施例的在规划配置的 IP网络下缩小路由转发表的处理方法如图 2所示, 驱动层收到需要注入的动态路由信息后的处理流程包括以下步骤: 步骤 101 , 首先通过转换子网掩码的长度, 判断待加入路由是否为主机 路由, 如果是, 则执行步骤 102, 否则, 执行步骤 103;
在判断所述待加入路由的类型时, 判断其子网掩码转换为二进制数据后 的长度是否为 32位, 如果是, 即是主机路由。
步骤 102, 判断当前的路由转发表中是否存在到达同一网络的网络路由, 如果存在同一网段的网络路由, 说明此路由所标识的目的地址已经包含在路 由转发表的下一跳信息里面, 则丟弃此路由, 结束; 否则, 执行步骤 108; 该步骤中, 以目的地址与子网掩码为关键字, 从记录动态路由信息的结 构中搜索是否存在与此待加入路由同网段的网络路由;
步骤 103 , 如果转换后的子网掩码的长度小于 32位, 即为网络路由, 则 执行步骤 104;
步骤 104, 通过搜索记录动态路由信息的结构, 确定此动态路由库中, 是否存在比待加入的网络路由更大的网段的网络路由, 如果已经有更大的网
段存在, 说明此目的网络的路由已经存在, 则将此路由丟弃, 结束; 否则, 说明此网段的路由需要更新, 则执行步骤 105;
步骤 105 , 进一步搜索此动态路由库中是否存在比待加入路由更小的网 段的网络路由, 如果存在, 则执行步骤 106, 否则, 执行步骤 108;
步骤 106 , 删除转发路由表中网段更小的所有网络路由, 并执行下一步
107;
步骤 107 , 搜索路由转发表中是否已经存在待加入的网络路由, 如果已 经存在, 则更新无意义, 直接结束该流程; 如果不存在, 则执行步骤 108; 步骤 108 , 将此路由添加至进路由转发表中后, 结束此主机路由压缩过 程。
上述流程中, 在判断网段的大小时, 是根据子网掩码的长度大小进行判 断, 子网掩码的长度越短, 则对应的网段越大。
下面结合若干应用示例对本发明的技术方案的实施作进一步详细介绍。 应用示例一:
主机路由加入到路由转发表的过程说明。 需要加入路由转发表的路由信 息如图 3左侧所示。 假设当前路由转发表中没有包含 195.0.0.0/8 (即 IP地址 为 195.0.0.0, 子网掩码为 255.0.0.0 ) 网段的任何路由。
A路由 195.2.2.0/24 (即 IP地址为 195.2.2.0, 子网掩码为 255.255.255.0 ) 加入路由转发表前, 判断当前路由转发表中没有比 A路由网段更大的路由, 也没有比 A路由网段更小的路由, 那么直接写入路由转发表。
B 路由 195.2.2.19/32 ( 即 IP 地址为 195.2.2.19 , 子网掩码为 255.255.255.255 )加入路由转发表前, 检查到 B路由为主机路由, 首先搜索 路由转发表中是否存在同网段的网络路由; 结果发现存在 A路由为与 B路由 同网段的网络路由。 那么不写入路由转发表, 退出。
此时, 经过两次写路由后, 得到路由转发表的路由条目如图 3的右框所 示。
应用示例二:
网络路由加入到路由转发表情况一的过程说明。 需要加入路由转发表的 路由信息如图 4左侧所示。 假设此时路由转发表为空。
A路由 195.2.0.0/16 (即 IP地址为 195.2.0.0, 子网掩码为 255.255.0.0 )加 入路由转发表前, 判断当前路由转发表中没有比 A路由网段更大的路由, 也 没有比 A路由网段更小的路由, 那么直接写入路由转发表。
随后, 对 B路由 195.2.3.0/24做写入前的判断, 首先检查是否存在比 B 路由网段更大的路由。 查找发现先前加入的 A路由比等加入的 B路由网段更 大。 那么退出此次路由转发表的更新过程。
此时, 经过两次写路由后, 经过聚合过的路由转发表结果如图 4的右框 所示。
应用示例三:
网络路由加入到路由转发表情况三的过程说明。 需要加入路由转发表的 路由信息如图 5左侧所示, 假设此时路由转发表为空。
A路由 195.2.2.0/24加入路由转发表前,判断当前路由转发表中没有比 A 路由网段更大的路由, 也没有比 A路由网段更小的路由, 那么直接写入路由 转发表。
随后, 对 B路由 195.2.0.0/16做写入前的判断, 首先检查是否存在比 B 路由网段更大的路由。 遍历过后发现没有。 第二步, 检查是否存在比 B路由 网段小的路由存在, 此时, 发现已经加入的 A路由网段是包含在待加入的 B 路由的网段中。 所以接下来要做的操作是更新路由转发表: 首先删除路由转 发表中的 A路由, 然后把 B路由加入到路由转发表。
经过两次写路由后, A、 B在使用本发明的压缩方法进行压缩后, 聚合成 一条 1条表示 195.2.0.0/255.255.0.0网段的路由, 如图 5右框所示。
应用示例四:
网络路由加入到路由转发表情况四的过程说明。 需要加入路由转发表的 路由信息如图 6上侧所示。 假设此时路由转发表为空。
第一步: A路由 195.2.2.0/24加入路由转发表前, 判断当前路由转发表中 没有比 A路由网段更大的路由, 也没有比 A路由网段更小的路由, 那么直接 写入路由转发表。
第二步: B路由与 A路由判断过程相同, 判断过后亦加入路由转发表。 第三步:对 C路由 195.2.0.0/16做写入前的判断, 首先检查是否存在比 C 路由网段更大的路由。 遍历过后发现没有。 第二步, 检查是否存在比 C路由 网段小的路由存在, 此时, 发现已经加入的 A路由网段是包含在待加入的 B 路由的网段中。 所以接下来要做的操作是更新路由转发表: 首先删除路由转 发表中的八、 B路由, 然后把 B路由加入到路由转发表。
经过三次写路由后, A、 B、 C在使用本发明的压缩方法进行压缩后, 聚 合成一条 1条表示 195.2.0.0/255.255.0.0网段的路由, 如图 6下框所示。
此种方法在传输设备中应用的最大优点是, 两传输节点中的平行数据通 道的路由可以聚合, 达到路由表的最大压缩比。
以上所述仅是本发明的优选实施方式, 应当指出, 对于本技术领域的普 通技术人员来说, 在不脱离本发明原理的前提下, 还可以做出若干改进, 这 些改进应视为本发明的保护范围。 本领域普通技术人员可以理解上述方法中 的全部或部分步骤可通过程序来指令相关硬件完成, 所述程序可以存储于计 算机可读存储介质中, 如只读存储器、 磁盘或光盘等。 可选地, 上述实施例 的全部或部分步骤也可以使用一个或多个集成电路来实现。 相应地, 上述实 施例中的各模块 /单元可以釆用硬件的形式实现, 也可以釆用软件功能模块的 形式实现。 本发明不限制于任何特定形式的硬件和软件的结合。
工业实用性
本发明提出了一种利用规划 IP地址实现压缩路由转发表的方法,使网络
路由能够直接替换主机路由, 有效缩小路由转发表大小, 从而提高路由转发 的效率、 减少内存资源冲突、 降低 CPU的负荷; 并且本发明的特点是压缩算 法和实施规则均较为简单。
Claims
1、 一种通信设备路由转发表的压缩方法, 其包括:
在通讯设备的组网中, 为组网中各传输节点配置不同网段的互联网络协 议(IP )地址, 并选择邻接的两个传输节点间的多个主机路由接口中的一个 作为同一网段的网络路由接口; 以及
在对路由转发表进行更新时, 判断待加入路由的类型是主机路由还是网 络路由, 如果是主机路由, 则判断所述路由转发表中是否存在与该待加入主 机路由同一网段的网络路由, 如果存在, 则丟弃该待加入主机路由, 并用所 述网络路由代替该待加入主机路由; 如果不存在, 则将该待加入主机路由加 入到所述路由转发表中。
2、 如权利要求 1所述的方法, 其中,
所述判断待加入路由的类型是主机路由还是网络路由的步骤包括: 通过 子网掩码的长度判断所述待加入路由的类型, 如果所述待加入路由的子网掩 码转换为二进制数据后的长度为 32位, 则为主机路由; 否则, 为网络路由。
3、 如权利要求 1或 2所述的方法, 其中,
所述判断所述路由转发表中是否存在与该待加入主机路由同一网段的网 络路由的步骤包括: 以目的地址与子网掩码为关键字, 从所述路由转发表中 搜索是否存在与该待加入主机路由同一网段的网络路由。
4、 如权利要求 1所述的方法, 该方法还包括:
在对所述路由转发表进行更新时, 如果判断出所述待加入路由为网络路 由, 则判断所述路由转发表中是否存在比该待加入网络路由网段更大的网络 路由, 如果存在, 则丟弃该待加入网络路由; 如果不存在, 则再判断所述路 由转发表中是否存在比待加入网络路由网段更小的网络路由, 并在不存在的 情况下将所述待加入网络路由加入到所述路由转发表中。
5、 如权利要求 4所述的方法, 该方法还包括:
如果判断出所述路由转发表中存在比待加入网络路由网段更小的网络路 由, 则在删除系统中所有比待加入网络路由网段更小的网络路由的同时, 判 断所述路由转发表中是否已经存在所述待加入网络路由。
6、 如权利要求 5所述的方法, 该方法包括:
如果判断出所述路由转发表中已经存在所述待加入网络路由, 则丟弃所 述待加入网络路由。
7、 如权利要求 5或 6所述的方法, 其中,
判断所述路由转发表中是否存在比待加入网络路由网段更小的网络路由 的步骤包括: 根据子网掩码的长度大小判断网段的大小, 子网掩码的长度越 短, 则对应的网段越大。
8、 一种通信设备路由转发表的压缩装置, 其包括:
互联网络协议(IP )地址配置模块, 其设置为: 在通讯设备的组网中, 为组网中各传输节点配置不同网段的 IP地址, 并选择邻接的两个传输节点间 的多个主机路由接口中的一个作为同一网段的网络路由接口; 以及
路由转发表更新模块, 其设置为: 在对路由转发表进行更新时, 判断待 加入路由的类型是主机路由还是网络路由, 如果是主机路由, 则判断所述路 由转发表中是否存在与该待加入主机路由同一网段的网络路由, 如果存在, 则丟弃该待加入主机路由, 并用所述网络路由代替该待加入主机路由; 如果 不存在, 则将该待加入主机路由加入到所述路由转发表中。
9、 如权利要求 8所述的装置, 其中,
所述路由转发表更新模块是设置为以如下方式判断待加入路由的类型是 主机路由还是网络路由: 通过子网掩码的长度判断所述待加入路由的类型, 如果所述待加入路由的子网掩码转换为二进制数据后的长度为 32位,则为主 机路由; 否则, 为网络路由。
10、 如权利要求 8或 9所述的装置, 其中,
所述路由转发表更新模块是设置为以如下方式判断所述路由转发表中是 否存在与该待加入主机路由同一网段的网络路由: 以目的地址与子网掩码为 关键字, 从所述路由转发表中搜索是否存在与该待加入主机路由同一网段的 网络路由。
11、 如权利要求 8所述的装置, 其中,
所述路由转发表更新模块还设置为: 在对所述路由转发表进行更新时,
如果判断出所述待加入路由为网络路由, 则判断所述路由转发表中是否存在 比该待加入网络路由网段更大的网络路由, 如果存在, 则丟弃该待力 P入网络 路由; 如果不存在, 则再判断所述路由转发表中是否存在比待加入网络路由 网段更小的网络路由, 并在不存在的情况下将所述待加入网络路由加入到所 述路由转发表中。
12、 如权利要求 11所述的装置, 其中,
所述路由转发表更新模块还设置为: 如果判断出所述路由转发表中存在 比待加入网络路由网段更小的网络路由, 则在删除系统中所有比待加入网络 路由网段更小的网络路由的同时, 判断所述路由转发表中是否已经存在所述 待加入网络路由。
13、 如权利要求 12所述的装置, 其中,
所述路由转发表更新模块还设置为: 如果判断出所述路由转发表中已经 存在所述待加入网络路由, 则丟弃所述待加入网络路由。
14、 如权利要求 12或 13所述的装置, 其中,
所述路由转发表更新模块是设置以如下方式判断所述路由转发表中是否 存在比待加入网络路由网段更小的网络路由: 根据子网掩码的长度大小判断 网段的大小, 子网掩码的长度越短, 则对应的网段越大。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN200910161033.3 | 2009-07-30 | ||
| CN2009101610333A CN101989946B (zh) | 2009-07-30 | 2009-07-30 | 一种通信设备路由转发表的压缩方法 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2011012081A1 true WO2011012081A1 (zh) | 2011-02-03 |
Family
ID=43528783
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2010/075553 Ceased WO2011012081A1 (zh) | 2009-07-30 | 2010-07-29 | 一种通信设备路由转发表的压缩方法和装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN101989946B (zh) |
| WO (1) | WO2011012081A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9065677B2 (en) | 2012-07-25 | 2015-06-23 | Qualcomm Incorporated | Forwarding tables for hybrid communication networks |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105939265B (zh) * | 2015-08-13 | 2019-05-07 | 杭州迪普科技股份有限公司 | 路由处理方法和装置 |
| CN112187636B (zh) * | 2020-09-22 | 2022-08-16 | 锐捷网络股份有限公司 | Ecmp路由的存储方法及装置 |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1402488A (zh) * | 2002-10-14 | 2003-03-12 | 北京港湾网络有限公司 | 一种路由表压缩方法 |
| CN1152516C (zh) * | 2001-06-26 | 2004-06-02 | 华为技术有限公司 | Ip网络节点发现方法 |
| CN101110778A (zh) * | 2007-07-23 | 2008-01-23 | 中兴通讯股份有限公司 | 一种利用默认路由压缩路由转发表的方法 |
-
2009
- 2009-07-30 CN CN2009101610333A patent/CN101989946B/zh not_active Expired - Fee Related
-
2010
- 2010-07-29 WO PCT/CN2010/075553 patent/WO2011012081A1/zh not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1152516C (zh) * | 2001-06-26 | 2004-06-02 | 华为技术有限公司 | Ip网络节点发现方法 |
| CN1402488A (zh) * | 2002-10-14 | 2003-03-12 | 北京港湾网络有限公司 | 一种路由表压缩方法 |
| CN101110778A (zh) * | 2007-07-23 | 2008-01-23 | 中兴通讯股份有限公司 | 一种利用默认路由压缩路由转发表的方法 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9065677B2 (en) | 2012-07-25 | 2015-06-23 | Qualcomm Incorporated | Forwarding tables for hybrid communication networks |
| US9294309B2 (en) | 2012-07-25 | 2016-03-22 | Qualcomm Incorporated | Forwarding tables for hybrid communication networks |
Also Published As
| Publication number | Publication date |
|---|---|
| CN101989946A (zh) | 2011-03-23 |
| CN101989946B (zh) | 2012-07-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3841483B1 (en) | Asynchronous object manager in a network routing environment | |
| CN113300949B (zh) | 转发报文的方法、发布路由信息的方法、装置及系统 | |
| CN112448900B (zh) | 一种数据传输方法及装置 | |
| US7260096B2 (en) | Method and router for forwarding internet data packets | |
| CN105830406B (zh) | 用于支持软件定义网络中的灵活查找关键字的方法、设备和系统 | |
| CN104704779B (zh) | 用于加速软件定义网络中的转发的方法和设备 | |
| JP5862769B2 (ja) | 通信システム、制御装置、通信方法及びプログラム | |
| CN106059924B (zh) | 一种管理信息的方法,装置及系统 | |
| US9203743B2 (en) | Packet forwarding system, control device, forwarding device and method and program for preparing processing rules | |
| EP3054634B1 (en) | Scheme for performing one-pass tunnel forwarding function on two-layer network structure | |
| JP2001298475A (ja) | ラベルスイッチングネットワークにおけるパス設定装置および方法 | |
| JPWO2011162215A1 (ja) | 通信システム、制御装置、ノードの制御方法およびプログラム | |
| CN107426097B (zh) | 一种基于增量最短路径优先的域内路由保护方法 | |
| WO2018032962A1 (zh) | 一种信息同步的方法,装置及系统 | |
| CN111147372B (zh) | 下行报文发送、转发方法和装置 | |
| WO2017190559A1 (zh) | 路由查找方法、装置、分配节点、查找节点及入口节点 | |
| CN102014065A (zh) | 报文包头的解析方法、包头解析预处理装置和网络处理器 | |
| CN101114989B (zh) | 一种三层以太网交换机直连主机路由的处理方法 | |
| CN106209554B (zh) | 跨虚拟可扩展局域网的报文转发方法和设备 | |
| CN114401222B (zh) | 一种基于策略路由的数据转发方法、装置及存储介质 | |
| WO2011012081A1 (zh) | 一种通信设备路由转发表的压缩方法和装置 | |
| CN106034075B (zh) | 一种为vpn路由分配标签的方法及装置 | |
| CN115665027A (zh) | 一种报文转发方法及设备 | |
| CN100505683C (zh) | 路由下一跳负荷分担的方法 | |
| US12166659B2 (en) | Dynamic packet routing using prioritized groups |
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: 10803914 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: 10803914 Country of ref document: EP Kind code of ref document: A1 |