WO2016192215A1 - 网络负荷的分担方法和装置 - Google Patents

网络负荷的分担方法和装置 Download PDF

Info

Publication number
WO2016192215A1
WO2016192215A1 PCT/CN2015/088179 CN2015088179W WO2016192215A1 WO 2016192215 A1 WO2016192215 A1 WO 2016192215A1 CN 2015088179 W CN2015088179 W CN 2015088179W WO 2016192215 A1 WO2016192215 A1 WO 2016192215A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
value
ecmp
egress
count
Prior art date
Application number
PCT/CN2015/088179
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 WO2016192215A1 publication Critical patent/WO2016192215A1/zh

Links

Images

Definitions

  • the present invention relates to the field of communications, and in particular, to a network load sharing method and apparatus.
  • Equal Cost Multi-Path is a technique for improving the shortcomings of internal gateway routing protocols in IP networks.
  • the algorithm chooses the optimal one.
  • ECMP has improved it by using traffic distributed among multiple equal-cost paths.
  • the principle of allocation can be packet-by-packet or flow-by-flow sharing.
  • each ECMP is assigned a corresponding Counter, and the count of the Counter will take a lower 7-bit value to traverse the 128 egress entries that have been hashed in the modulo operation table.
  • the test case requires that the number of ECMP egress links be up to eight, when the number of egress links is 3, 5, 6, and 7, some link sharing will have a flow deviation of about 1/128. As shown in Figure 1, the box portion is not evenly divided. Therefore, in the packet-by-packet allocation process, the existing ECMP sharing method is biased and cannot be evenly distributed.
  • the main purpose of the embodiments of the present invention is to provide a network load sharing method and device, which aims to improve the sharing accuracy of the network load.
  • an embodiment of the present invention provides a network load sharing method, including:
  • the count value of the next data packet is corrected according to the count increment corresponding to the preset number of shared links, and the corrected count value is obtained.
  • the maximum count value of the lower count value of the Counter corresponding to the ECMP is 7.
  • the method further includes:
  • the encapsulation information is encapsulated and forwarded.
  • the method when a data packet enters a routing device configured with ECMP, the current data packet is counted, and before the counting value is obtained, the method further includes:
  • the routing device parses the data packet to obtain parsed data.
  • the pre-configured private network routing table is obtained, and the public-private network separation table index is obtained. Then, the pre-configured public-private network separation table is queried according to the public-private network separation table index, and the ECMP index is obtained.
  • an embodiment of the present invention further provides a network load sharing device, including:
  • the counting module is configured to count the current data packet when a data packet enters the routing device configured with ECMP, and obtain a count value;
  • the offset value determining module is configured to obtain an offset value from the preset modulo operation table according to the acquired low-order counter value of the current data packet and the number of shared links corresponding to the ECMP, to determine according to the offset value.
  • the eCMP corresponding export information, and the received data packet is forwarded by the determined egress;
  • the count correction module is configured to correct the count value of the next data packet according to the count increment corresponding to the preset number of shared links when the acquired low-order count value of the current data packet reaches the maximum count value, and obtain the correction After the count value.
  • the maximum value of the low-count value of the count value is 7.
  • the network load sharing device further includes:
  • the egress encapsulation obtaining module is configured to add the offset policy value to the base of the shared policy table in the shared link number table, and obtain the load policy table index, and query the corresponding load balancing policy table corresponding to the shared policy table index.
  • the received data packet is encapsulated by the egress package information and then forwarded.
  • the network load sharing device further includes:
  • the packet parsing module is configured to parse the data packet to obtain the parsed data when the data packet enters the routing device configured with the ECMP, and query the pre-set private network routing table according to the parsed data to obtain the public and private network separate table index. And then querying the preset public-private network separation table according to the public-private network separation table index to obtain an ECMP index.
  • the count increment value corresponding to the number of shared links is used, and when the low count value of the count counter corresponding to the ECMP is the maximum value, the count value is calculated according to the count increment value corresponding to the number of shared links. The correction is performed, so that the network load of each link can be evenly distributed, and the sharing precision of the network load is improved.
  • FIG. 1 is a schematic structural diagram of routing and forwarding of a data packet by a microcode according to the present invention
  • FIG. 2 is a schematic flowchart of a first embodiment of a network load sharing method according to the present invention
  • FIG. 3 is a diagram showing an example of a modulo operation table of a shared 7-bit count value corresponding to a shared link in a network load sharing method according to the present invention
  • FIG. 4 is a diagram showing an example of a modulo operation table of a lower 3 bit count value of a data packet corresponding to a shared link in a network load sharing method according to the present invention
  • FIG. 5 is a schematic diagram of functional modules of a first embodiment of a network load sharing device according to the present invention.
  • FIG. 6 is a schematic diagram of functional modules of a second embodiment of a network load sharing device according to the present invention.
  • FIG. 7 is a schematic diagram of functional modules of a third embodiment of a network load sharing device according to the present invention.
  • the routing device is configured with multiple ECMPs, and each EMCP has eight egress links, which are configured to share the forwarding of data packets.
  • the routing device parses the data packet to obtain the parsed data of the data packet.
  • the analytic data may include information such as a media access control (MAC), a source MAC address, a virtual local area network (VLAN), a destination IP address, a source IP address, and a label.
  • the pre-configured private network routing table can be queried to obtain the public-private network separation table index; and the pre-configured public-private network separation table is queried according to the public-private network separation table index to obtain an ECMP index, that is, ECMP. Then, the routing device determines the egress address corresponding to the ECMP based on the ECMP sharing scheme proposed by the present invention, and forwards the data packet to the next-level device by the determined ECMP egress.
  • the method for sharing the network load specifically includes the following steps:
  • Step S110 When a data packet enters the routing device, the current data packet is counted to obtain a count value
  • each ECMP is assigned a Counter counter, which counts packets entering the routing device.
  • the routing device parses the data packet, obtains the parsed data, and determines an ECMP index corresponding to the data packet according to the parsed data, and then according to the ECMP index, the ECMP corresponding Counter counter corresponding to the current data packet. Counting is performed, that is, the counter is incremented by one to obtain a count value.
  • Step S120 Obtain a number of shared links corresponding to the ECMP in the preset number of shared link numbers
  • the number of shared link numbers is set in advance, and the number of ECMP indexes and the number of shared links are recorded in the number of shared link numbers. Mapping relationship. Based on the shared link number table, the number of shared links corresponding to the ECMP index can be obtained, for example, 2-way, 4-way, 8-way, and the like. In addition, the mapping relationship between the number of shared links and the base address of the shared policy table is also recorded in the shared link number table.
  • Step S130 Obtain an offset value from a preset modulo operation table according to the acquired low-order count value of the current data packet and the number of shared links; when the acquired low-order counter value of the current data packet reaches the maximum count value And correcting the count value of the next data packet according to the count increment corresponding to the preset number of shared links, and obtaining the corrected count value;
  • a modulo operation table is set in advance.
  • the mapping relationship between the ECMP index, the number of shared links, and the offset value is recorded in the modulo operation table.
  • the current counter counter has a maximum value of 127, and 128 offset value entries are set in the offset table corresponding to each shared link number, and the offset value is cyclically set according to the number of shared links. For example, when the number of shared links is 3, there are 128 offset value entries in the offset value table, and the offset values are cyclically set by 0, 1, and 2 in sequence.
  • the count increment corresponding to the number of shared links is set in advance. Take the maximum count of the counter as 127. The count increment corresponding to the number of shared links is shown in Table 1:
  • Step S140 Add the offset policy table index according to the base address of the shared policy table in the shared link number table, and obtain an index of the load policy table, and query the export encapsulation table corresponding to the index of the share policy table in the preset share policy table. Value shift
  • the shared link number table is configured in advance, and the shared link number table records the mapping relationship between the ECMP index, the number of shared links, and the base address of the shared policy table.
  • the routing device can obtain the ECMP index by parsing the routing table by analyzing the destination IP address of the packet. Then, the number of shared links of the ECMP and the base address of the shared policy table are obtained by querying the number of shared link tables through the ECMP index.
  • the distribution policy table is a set of egress tables, and how many egress links are used to record the mapping between the load policy table index and the egress package table offset value. According to the offset policy table base address plus the offset value obtained in step S130, the share policy table index can be obtained, and the exit package table offset value corresponding to the share policy table index can be obtained.
  • Step S150 Obtain an export encapsulation table index according to the egress package table base address plus the egress package offset value, and query the egress package information corresponding to the egress encapsulation table index in the preset egress encapsulation table to receive the data packet. It is encapsulated by the egress package information and then forwarded.
  • each export information can be converted into export package information and written into the hardware table, and the hardware table has its own index. Therefore, by writing these indexes to the base address of the egress package table, for example, the base address +1 and the base address +2, all the information of the egress package table base address plus the egress package offset value to the egress package table can be obtained. And then the received data packet is encapsulated by the egress package information and then forwarded.
  • the counter When the counter counts the packets entering the ECMP, it counts from 0 to 127 by adding 1 to the log. However, if the count is 127, the counter determines the number of shared links according to the above table 1. The count increment value corresponding to 3 o'clock is used to perform counter correction based on the determined count increment value when the next packet enters, and the corrected count value is obtained. Then, according to the count value and the number of shared links, the above steps S130-S150 are performed to determine the egress package information corresponding to the ECMP.
  • the count increment value corresponding to the number of shared links is used, and when the low count value of the count counter corresponding to the ECMP is the maximum value, the count increment value corresponding to the number of shared links is used.
  • the count value is corrected so that the network load of each link can be evenly distributed.
  • the maximum value of the low-order counter value counted by the counter counter is 7.
  • the count increment value corresponding to the preset number of shared links is as shown in Table 2 below:
  • the ECMP has five egress link numbers, that is, the number of shared links corresponding to the ECMP is five.
  • offset +0 corresponds to egress link 1
  • offset +1 corresponds to egress link 2
  • offset +2 corresponds to egress link 3
  • offset +3 corresponds to the egress link 4
  • offset +4 corresponds to the egress link 5. If the low-order count value of the current data packet is 7, according to the above table 2, the corresponding count increment value is 4 when the number of shared links is 5, so when the next data packet enters the ECMP, the count value of the Counter counter is up.
  • the primary count value is increased by 4, that is, the offset value corresponding to the data packet is determined to be "offset value +3", and the data packet will be output from the egress link 4. Therefore, it can be seen that, by setting the count increment value corresponding to the number of the egress links, when the low count value of the Counter counter is the maximum value, the count of the next data packet is corrected according to the count increment value corresponding to the number of egress links, Therefore, the even load sharing of the network load by the egress sharing link is realized.
  • the maximum count value of the Counter counter is 7, so when the offset value is obtained according to the lower 3 bit value of the Counter counter and the shared link number query modulo operation table, the modulo operation table only needs to store 8 offsets. Value entries, which reduce the use of resources by the model table.
  • the present invention also provides a network load sharing device.
  • the network load sharing device of this embodiment includes:
  • the counting module 110 is configured to: when a data packet enters a routing device configured with ECMP, count the current data packet to obtain a count value;
  • the offset value determining module 120 is configured to obtain an offset value from the preset modulo operation table according to the acquired low-order counter value of the current data packet and the number of shared links corresponding to the ECMP, according to the offset value. Determining the egress corresponding to the ECMP, and forwarding the received data packet by the determined egress;
  • the count correction module 130 is configured to correct the count value of the next data packet according to the count increment corresponding to the preset number of shared links when the acquired low-order count value of the current data packet reaches the maximum count value, and obtain The corrected count value.
  • each ECMP is assigned a Counter counter, and the counter index is consistent with the ECMP index.
  • This counter is set to count packets entering the routing device.
  • the routing device parses the data packet, obtains the parsed data, and determines an ECMP index corresponding to the data packet according to the parsed data, and then according to the ECMP index, the ECMP corresponding Counter counter corresponding to the current data packet. Counting is performed, that is, the counter is incremented by one to obtain a count value.
  • a shared link number table is set in advance, and the mapping relationship between the ECMP index and the number of shared links is recorded in the shared link number table.
  • the number of shared links corresponding to the ECMP index can be obtained, for example, 2-way, 4-way, 8-way, and the like.
  • the mapping relationship between the number of shared links and the base address of the shared policy table is also recorded in the shared link number table.
  • a modulo operation table is set in advance.
  • the mapping relationship between the ECMP index, the number of shared links, and the offset value is recorded in the modulo operation table.
  • the current counter counter has a maximum value of 127, and 128 offset value entries are set in the offset table corresponding to each shared link number, and the offset value is cyclically set according to the number of shared links. For example, when the number of shared links is 3, there are 128 offset value entries in the offset value table, and the offset values are cyclically set by 0, 1, and 2 in sequence.
  • the count increment corresponding to the number of shared links is set in advance. Take the maximum count of the counter as 127. The count increment corresponding to the number of shared links is shown in Table 1:
  • the counter When the counter counts the packets entering the ECMP, it counts from 0 to 127 by adding 1 to the log. However, if the count is 127, the counter determines the number of shared links according to the above table 1. The count increment value corresponding to 3 o'clock is used to perform counter correction based on the determined count increment value when the next packet enters, and the corrected count value is obtained.
  • the count value is 127, according to the above table 1, it is determined that the corresponding count increment value is 3, and when the next data packet is entered, the corresponding offset entry in the modulo operation table is determined to be an offset +2 entry, thereby achieving The purpose of each link is evenly shared.
  • the count increment value corresponding to the number of shared links is used, and when the low count value of the count counter corresponding to the ECMP is the maximum value, the count increment value corresponding to the number of shared links is used.
  • the count value is corrected so that the network load of each link can be evenly distributed.
  • the network load sharing device of the foregoing embodiment further includes:
  • the egress encapsulation obtaining module 140 is configured to obtain the distribution policy table index according to the base address of the shared policy table in the shared link number table, and obtain the corresponding load balancing policy table corresponding to the shared policy table index.
  • the egress package table offset value is obtained according to the egress package table base address plus the egress package offset value, and the egress package table index is obtained, and the egress package information corresponding to the egress package table index in the preset egress package table is queried to The received data packet is encapsulated by the egress package information and then forwarded.
  • the network load sharing device of the foregoing embodiment further includes:
  • the packet parsing module 150 is configured to: when the microcode receives the data packet, parse the data packet to obtain parsed data; query the private network routing table according to the parsed data, and obtain an index of the public and private network separation table; The network separation table index queries the public and private network separation table to obtain an ECMP index.
  • the routing device is configured with multiple ECMPs, and each EMCP has eight egress links, which are configured to share the forwarding of data packets.
  • the routing device parses the data packet to obtain the parsed data of the data packet.
  • the parsed data may include information such as a destination MAC, a source MAC, a VLAN, a destination IP, a source IP, a label, and the like.
  • the pre-configured private network routing table can be queried to obtain the public-private network separation table index; and the pre-configured public-private network separation table is queried according to the public-private network separation table index to obtain an ECMP index, that is, ECMP.
  • the maximum count value of the lower count value of the Counter corresponding to the ECMP is 7.
  • the ECMP has five egress link numbers, that is, the number of shared links corresponding to the ECMP is five.
  • offset +0 corresponds to egress link 1
  • offset +1 corresponds to egress link 2
  • offset +2 corresponds to egress link 3
  • offset +3 corresponds to the egress link 4
  • offset +4 corresponds to the egress link 5. If the low-order count value of the current data packet is 7, according to the above table 2, the corresponding count increment value is 4 when the number of shared links is 5, so when the next data packet enters the ECMP, the count value of the Counter counter is up.
  • the primary count value is increased by 4, that is, the offset value corresponding to the data packet is determined to be "offset value +3", and the data packet will be output from the egress link 4. Therefore, it can be seen that, by setting the count increment value corresponding to the number of the egress links, when the low count value of the Counter counter is the maximum value, the count of the next data packet is corrected according to the count increment value corresponding to the number of egress links, Therefore, the even load sharing of the network load by the egress sharing link is realized.
  • the maximum count value of the Counter counter is 7, so when the offset value is obtained according to the lower 3 bit value of the Counter counter and the shared link number query modulo operation table, the modulo operation table only needs to store 8 offsets. Value entries, which reduce the use of resources by the model table.
  • the count increment value corresponding to the number of shared links is used, and when the low count value of the count counter corresponding to the ECMP is the maximum value, the count value is calculated according to the count increment value corresponding to the number of shared links. The correction is performed, so that the network load of each link can be evenly distributed, and the sharing precision of the network load is improved.

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开一种网络负荷的分担方法,包括:当有数据包进入配置有ECMP的路由设备时,对当前数据包进行计数,获得计数值;根据所获取到的当前数据包的低位计数值以及该ECMP对应的分担链路数,从预设的模运算表中获得偏移值,以根据该偏移值确定该ECMP对应的出口信息,将接收到的数据包由确定的出口进行转发;当所获取到的当前数据包的低位计数值达到最大计数值时,根据预先设置的分担链路数对应的计数增量,对下一数据包的计数值进行修正,获得修正后的计数值。本发明还公开了一种网络负担的分担装置。本发明可以实现每条链路的网络负荷均匀分配,提高了网络负荷的分担精度。

Description

网络负荷的分担方法和装置 技术领域
本发明涉及通信领域,尤其涉及一种网络负荷的分担方法和装置。
背景技术
等价多路径(Equal Cost Multi-Path,ECMP)是改进IP网络中基于最短路径的内部网关路由协议不足的一种技术。在传统最短路径算法中,如果两条或多条最短路径同时存在,算法会选择最优的一条。而ECMP对其作了改进,采用流量在多条等价路径中分配,分配的原则可以是逐包或者逐流分担。
现有的ECMP算法中,每个ECMP均分配对应的Counter,而且通过该Counter的计数将取低7bit值遍历模运算表中已经散列好的128个出口条目。另外,由于测试用例要求ECMP的出口链路数最多为8个,因此当出口链路数为3、5、6、7时,某些链路分担会有1/128左右的流量偏差。如图1所示,方框部分为不能被均分部分。因此,在逐包分担的分配过程中,现有的ECMP分担方法存在偏差,无法达到均匀分担。
发明内容
本发明实施例的主要目的在于提供一种网络负荷的分担方法和装置,旨在提高网络负荷的分担精度。
为了达到上述目的,本发明实施例提供了一种网络负荷的分担方法,包括:
当有数据包进入配置有ECMP的路由设备时,对当前数据包进行计数,获得计数值;
根据所获取到的当前数据包的低位计数值以及该ECMP对应的分担链路数,从预设的模运算表中获得偏移值,以根据该偏移值确定该ECMP对应的出口信息,将接收到的数据包由确定的出口进行转发;
当所获取到的当前数据包的低位计数值达到最大计数值时,根据预先设置的分担链路数对应的计数增量,对下一数据包的计数值进行修正,获得修正后的计数值。
在本发明实施例中,所述ECMP对应的Counter的低位计数值的最大计数值为7。
在本发明实施例中,所述根据所获取到的当前数据包的低位计数值以及该ECMP对应的分担链路数,从预设的模运算表中获得偏移值之后还包括:
根据分担链路数表中的分担策略表基址加上所述偏移值,获得分担策略表索引,并查询预设的分担策略表中与分担策略表索引对应的出口封装表偏移值;
根据出口封装表基址加上出口封装偏移值,获得出口封装表索引,并查询预设的出口封装表中与出口封装表索引对应的出口封装信息,以将接收到的数据包由该出口封装信息封装后进行转发。
在本发明实施例中,所述当有数据包进入配置有ECMP的路由设备时,对当前数据包进行计数,获得计数值之前还包括:
当有数据包进入配置有ECMP的路由设备时,该路由设备对该数据包进行解析,获得解析数据;
根据解析数据,查询预先配置的私网路由表,获得公私网分离表索引;进而根据该公私网分离表索引查询预先配置的公私网分离表,获得ECMP索引。
此外,为实现上述目的,本发明实施例还提供了一种网络负荷的分担装置,包括:
计数模块,设置为当有数据包进入配置有ECMP的路由设备时,对当前数据包进行计数,获得计数值;
偏移值确定模块,设置为根据所获取到的当前数据包的低位计数值以及该ECMP对应的分担链路数,从预设的模运算表中获得偏移值,以根据该偏移值确定该ECMP对应的出口信息,将接收到的数据包由确定的出口进行转发;
计数修正模块,设置为当所获取到的当前数据包的低位计数值达到最大计数值时,根据预先设置的分担链路数对应的计数增量,对下一数据包的计数值进行修正,获得修正后的计数值。
在本发明实施例中,所述计数模块中,所述计数值的低位计数值的最大值为7。
在本发明实施例中,所述网络负荷的分担装置还包括:
出口封装获取模块,设置为根据分担链路数表中的分担策略表基址加上所述偏移值,获得分担策略表索引,并查询预设的分担策略表中与分担策略表索引对应的出口封装表偏移值;根据出口封装表基址加上出口封装偏移值,获得出口封装表索引,并查询预设的出口封装表中与出口封装表索引对应的出口封装信息,以将接收到的数据包由该出口封装信息封装后进行转发。
在本发明实施例中,所述网路负荷的分担装置还包括:
数据包解析模块,设置为当有数据包进入配置有ECMP的路由设备时,对该数据包进行解析,获得解析数据;根据解析数据,查询预先设置的私网路由表,获得公私网分离表索引;进而根据该公私网分离表索引查询预先设置的公私网分离表,获得ECMP索引。
本发明实施例通过预设分担链路数对应的计数增量值,在ECMP对应的Counter计数器进行计数的低位计数值为最大值时,根据分担链路数对应的计数增量值,对计数值进行修正,从而可以实现每条链路的网络负荷均匀分配,提高了网络负荷的分担精度。
附图说明
图1为本发明微码进行数据包的路由转发的结构示意图;
图2为本发明网络负荷的分担方法第一实施例的流程示意图;
图3为本发明网络负荷的分担方法中数据包的低7bit计数值对应分担链路的模运算表的示例图;
图4为本发明网络负荷的分担方法中数据包的低3bit计数值对应分担链路的模运算表的示例图;
图5为本发明网络负荷的分担装置第一实施例的功能模块示意图;
图6为本发明网络负荷的分担装置第二实施例的功能模块示意图;
图7为本发明网络负荷的分担装置第三实施例的功能模块示意图。
为了使本发明的技术方案更加清楚、明了,下面将结合附图作进一步详述。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
如图1所示,该路由设备中配置有多个ECMP,每个EMCP均设有8个出口链路,设置为分担数据包的转发。该路由设备收到上一级设备发送过来的数据包后,对该数据包进行解析,获得数据包的解析数据。该解析数据可包括目的媒体接入控制(Media Access Control,简称为MAC)、源MAC、虚拟局域网(Virtual Local Area Network,简称为VLAN)、目的IP、源IP、标签等信息。根据该解析数据,可以查询预先配置的私网路由表,获得公私网分离表索引;进而根据该公私网分离表索引查询预先配置的公私网分离表,获得ECMP索引,即ECMP。然后,路由设备基于本发明提出的ECMP分担方案,确定该ECMP对应的出口地址,并将数据包由所确定的ECMP出口转发至下一级设备。
如图2所示,基于上述路由设备,提出一种网络负荷的分担方法,供路由设备确定数据包的ECMP出口地址。该网络负荷的分担方法具体包括以下步骤:
步骤S110、当有数据包进入路由设备时,对当前数据包进行计数,获得计数值;
路由设备中,每个ECMP均分配有一个Counter计数器,该计数器对进入路由设备的数据包进行计数。当路由设备收到数据包后,对其进行解析,获得解析数据,并根据解析数据确定该数据包对应的ECMP索引,然后根据该ECMP索引,由ECMP索引的ECMP对应的Counter计数器对当前数据包进行计数,即该计数器进行加1,获得计数值。
步骤S120、获取预设的分担链路数表中与该ECMP对应的分担链路数;
本实施例中,预先设置分担链路数表,该分担链路数表中记录ECMP索引与分担链路数 的映射关系。基于该分担链路数表,可以获得与ECMP索引对应的分担链路数,例如2路、4路、8路等等。另外,该分担链路数表中还记录分担链路数与分担策略表基址的映射关系。
步骤S130、根据所获取到的当前数据包的低位计数值以及分担链路数,从预设的模运算表中获得偏移值;当所获取到的当前数据包的低位计数值达到最大计数值时,根据预先设置的分担链路数对应的计数增量,对下一数据包的计数值进行修正,获得修正后的计数值;
本实施例中,预先设置模运算表。该模运算表中记录ECMP索引、分担链路数与偏移值的映射关系。如图3所示,当前Counter计数器的计数最大值为127,每个分担链路数对应的偏移表中设置128个偏移值条目,且偏移值根据分担链路数进行循环设置。例如,分担链路数为3时,偏移值表中存在128个偏移值条目,且偏移值依次按0、1、2循环设置。
另外,本实施例中,预先设置分担链路数对应的计数增量。以计数器的计数最大值为127为例,具体的分担链路数对应的计数增量如下表1所示:
表1.分担链路数与计数增量值的映射关系
分担链路数 Counter遇127时对应的计数增量值
2 1
3 3
4 1
5 4
6 3
7 3
8 1
步骤S140、根据分担链路数表中的分担策略表基址加上所述偏移值,获得分担策略表索引,并查询预设的分担策略表中与分担策略表索引对应的出口封装表偏移值;
本发明实施例中,将预先配置分担链路数表,该分担链路数表记录ECMP索引与分担链路数、分担策略表基址的映射关系。路由设备通过解析数据包的目的IP,查路由表可以获得ECMP索引。然后通过ECMP索引查询分担链路数表,就可以得到该ECMP的分担链路数和分担策略表基址。分担策略表是一组出口表的集合,有多少个出口链路,记录分担策略表索引与出口封装表偏移值的映射关系。根据该分担策略表基址加上步骤S130获得的偏移值,可以获得分担策略表索引,进而获得该分担策略表索引对应的出口封装表偏移值。
步骤S150、根据出口封装表基址加上出口封装偏移值,获得出口封装表索引,并查询预设的出口封装表中与出口封装表索引对应的出口封装信息,以将接收到的数据包由该出口封装信息封装后进行转发。
假设ECMP有3个出口,则每个出口信息都可以转化成出口封装信息并写入硬件表中,而且该硬件表都具有自己的索引。因此,将这些索引分别写到出口封装表基址,例如、基址+1和基址+2中,就可以实现出口封装表基址加上出口封装偏移值获取到出口封装表的所有信息,进而将接收到的数据包由该出口封装信息封装后进行转发。
假设分担链路数为3,Counter对进入该ECMP的数据包进行计数时,从0-127都是按加1来计数,但是若计数值为127,Counter根据上表1中确定分担链路数为3时对应的计数增量值,以在下一数据包进入时,根据该确定的计数增量值进行计数修正,获得修正后的计数值。然后根据该计数值以及分担链路数,执行上述步骤S130-步骤S150确定该ECMP对应的出口封装信息。当计数值为127时,根据上表1确定对应的计数增量值为3,则在下一数据包进入时,确定模运算表中对应的偏移条目为偏移+2的条目,从而达到了每条链路均匀分担的目的。
因此,本发明实施例通过预设分担链路数对应的计数增量值,在ECMP对应的Counter计数器进行计数的低位计数值为最大值时,根据分担链路数对应的计数增量值,对计数值进行修正,从而可以实现每条链路的网络负荷均匀分配。
在本发明实施例中,上述Counter计数器进行计数的低位计数值的最大值为7。对应地,该预先设置的分担链路数对应的计数增量值如下表2所示:
表2.分担链路数与计数增量值的映射关系
分担链路数 Counter遇7时对应的计数增量值
2 1
3 3
4 1
5 4
6 3
7 2
8 1
假设该ECMP具有5个出口链路数,即该ECMP对应的分担链路数为5。如图4所示,该分担链路数对应的模运算表中,偏移+0对应出口链路1,偏移+1对应出口链路2,偏移+2对应出口链路3,偏移+3对应出口链路4,偏移+4对应出口链路5。若当前数据包的低位计数值为7时,根据上表2可知分担链路数为5时对应的计数增量值为4,因此下一数据包进入该ECMP时,Counter计数器的计数值为上一次计数值加4,即确定该数据包对应的偏移值为“偏移值+3”,该数据包将从出口链路4输出。由此可知,通过上述出口链路数对应的计数增量值设置,在Counter计数器的低位计数值为最大值时,根据出口链路数对应计数增量值对下一数据包的计数进行修正,从而实现了出口分担链路对网络负荷的均匀分担。
另外,本发明实施例中Counter计数器最大计数值为7,因此根据Counter计数器的低3bit的值与分担链路数查询模运算表获得偏移值时,该模运算表只需存储8个偏移值条目,从而降低了模表占用资源。
对应地,本发明还提供了一种网络负荷的分担装置。如图5所示,该实施例的网络负荷的分担装置包括:
计数模块110,设置为当有数据包进入配置有ECMP的路由设备时,对当前数据包进行计数,获得计数值;
偏移值确定模块120,设置为根据所获取到的当前数据包的低位计数值以及该ECMP对应的分担链路数,从预设的模运算表中获得偏移值,以根据该偏移值确定该ECMP对应的出口信息,将接收到的数据包由确定的出口进行转发;
计数修正模块130,设置为当所获取到的当前数据包的低位计数值达到最大计数值时,根据预先设置的分担链路数对应的计数增量,对下一数据包的计数值进行修正,获得修正后的计数值。
路由设备中,每个ECMP均分配有一个Counter计数器,且计数器索引和ECMP索引一致。该计数器设置为对进入路由设备的数据包进行计数。当路由设备收到数据包后,对其进行解析,获得解析数据,并根据解析数据确定该数据包对应的ECMP索引,然后根据该ECMP索引,由ECMP索引的ECMP对应的Counter计数器对当前数据包进行计数,即该计数器进行加1,获得计数值。本实施例中,预先设置分担链路数表,该分担链路数表中记录ECMP索引与分担链路数的映射关系。基于该分担链路数表,可以获得与ECMP索引对应的分担链路数,例如2路、4路、8路等等。另外,该分担链路数表中还记录分担链路数与分担策略表基址的映射关系。
本实施例中,预先设置模运算表。该模运算表中记录ECMP索引、分担链路数与偏移值的映射关系。如图3所示,当前Counter计数器的计数最大值为127,每个分担链路数对应的偏移表中设置128个偏移值条目,且偏移值根据分担链路数进行循环设置。例如,分担链路数为3时,偏移值表中存在128个偏移值条目,且偏移值依次按0、1、2循环设置。
另外,本实施例中,预先设置分担链路数对应的计数增量。以计数器的计数最大值为127为例,具体的分担链路数对应的计数增量如下表1所示:
表1.分担链路数与计数增量值的映射关系
分担链路数 Counter遇127时对应的计数增量值
2 1
3 3
4 1
5 4
6 3
7 3
8 1
假设分担链路数为3,Counter对进入该ECMP的数据包进行计数时,从0-127都是按加1来计数,但是若计数值为127,Counter根据上表1中确定分担链路数为3时对应的计数增量值,以在下一数据包进入时,根据该确定的计数增量值进行计数修正,获得修正后的计数值。当计数值为127时,根据上表1确定对应的计数增量值为3,则在下一数据包进入时,确定模运算表中对应的偏移条目为偏移+2的条目,从而达到了每条链路均匀分担的目的。
因此,本发明实施例通过预设分担链路数对应的计数增量值,在ECMP对应的Counter计数器进行计数的低位计数值为最大值时,根据分担链路数对应的计数增量值,对计数值进行修正,从而可以实现每条链路的网络负荷均匀分配。
在本发明实施例中,如图6所示,上述实施例的网络负荷的分担装置还包括:
出口封装获取模块140,设置为根据分担链路数表中的分担策略表基址加上所述偏移值,获得分担策略表索引,并查询预设的分担策略表中与分担策略表索引对应的出口封装表偏移值;根据出口封装表基址加上出口封装偏移值,获得出口封装表索引,并查询预设的出口封装表中与出口封装表索引对应的出口封装信息,以将接收到的数据包由该出口封装信息封装后进行转发。
在本发明实施例中,如图7所示,上述实施例的网络负荷的分担装置还包括:
数据包解析模块150,设置为所述微码接收到数据包时,对该数据包进行解析,获得解析数据;根据解析数据,查询私网路由表,获得公私网分离表索引;进而根据该公私网分离表索引查询公私网分离表,获得ECMP索引。
如图1所示,该路由设备中配置有多个ECMP,每个EMCP均设有8个出口链路,设置为分担数据包的转发。该路由设备收到上一级设备发送过来的数据包后,对该数据包进行解析,获得数据包的解析数据。该解析数据可包括目的MAC、源MAC、VLAN、目的IP、源IP、标签等信息。根据该解析数据,可以查询预先配置的私网路由表,获得公私网分离表索引;进而根据该公私网分离表索引查询预先配置的公私网分离表,获得ECMP索引,即ECMP。
在本发明实施例中,所述计数模块中,所述ECMP对应的Counter的低位计数值的最大计数值为7。
对应地,该预先设置的分担链路数对应的计数增量值如下表2所示:
表2.分担链路数与计数增量值的映射关系
分担链路数 Counter遇7时对应的计数增量值
2 1
3 3
4 1
5 4
6 3
7 2
8 1
假设该ECMP具有5个出口链路数,即该ECMP对应的分担链路数为5。如图4所示,该分担链路数对应的模运算表中,偏移+0对应出口链路1,偏移+1对应出口链路2,偏移+2对应出口链路3,偏移+3对应出口链路4,偏移+4对应出口链路5。若当前数据包的低位计数值为7时,根据上表2可知分担链路数为5时对应的计数增量值为4,因此下一数据包进入该ECMP时,Counter计数器的计数值为上一次计数值加4,即确定该数据包对应的偏移值为“偏移值+3”,该数据包将从出口链路4输出。由此可知,通过上述出口链路数对应的计数增量值设置,在Counter计数器的低位计数值为最大值时,根据出口链路数对应计数增量值对下一数据包的计数进行修正,从而实现了出口分担链路对网络负荷的均匀分担。
另外,本发明实施例中Counter计数器最大计数值为7,因此根据Counter计数器的低3bit的值与分担链路数查询模运算表获得偏移值时,该模运算表只需存储8个偏移值条目,从而降低了模表占用资源。
以上所述仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或流程变换,或直接或间接运用在其它相关的技术领域,均同理包括在本发明的专利保护范围内。
工业实用性
本发明实施例通过预设分担链路数对应的计数增量值,在ECMP对应的Counter计数器进行计数的低位计数值为最大值时,根据分担链路数对应的计数增量值,对计数值进行修正,从而可以实现每条链路的网络负荷均匀分配,提高了网络负荷的分担精度。

Claims (8)

  1. 一种网络负荷的分担方法,包括:
    当有数据包进入配置有ECMP的路由设备时,对当前数据包进行计数,获得计数值;
    根据所获取到的当前数据包的低位计数值以及该ECMP对应的分担链路数,从预设的模运算表中获得偏移值,以根据该偏移值确定该ECMP对应的出口信息,将接收到的数据包由确定的出口进行转发;
    当所获取到的当前数据包的低位计数值达到最大计数值时,根据预先设置的分担链路数对应的计数增量,对下一数据包的计数值进行修正,获得修正后的计数值。
  2. 如权利要求1所述的网络负荷的分担方法,其中,所述ECMP对应的Counter计数器的低位计数值的最大计数值为7。
  3. 如权利要求1或2所述的网络负荷的分担方法,其中,所述根据所获取到的当前数据包的低位计数值以及该ECMP对应的分担链路数,从预设的模运算表中获得偏移值之后还包括:
    根据分担链路数表中的分担策略表基址加上所述偏移值,获得分担策略表索引,并查询预设的分担策略表中与分担策略表索引对应的出口封装表偏移值;
    根据出口封装表基址加上出口封装偏移值,获得出口封装表索引,并查询预设的出口封装表中与出口封装表索引对应的出口封装信息,以将接收到的数据包由该出口封装信息封装后进行转发。
  4. 如权利要求1或2所述的网络负荷的分担方法,其中,所述当有数据包进入配置有ECMP的路由设备时,对当前数据包进行计数,获得计数值之前还包括:
    当有数据包进入配置有ECMP的路由设备时,该路由设备对该数据包进行解析,获得解析数据;
    根据解析数据,查询私网路由表,获得公私网分离表索引;进而根据该公私网分离表索引查询公私网分离表,获得ECMP索引。
  5. 一种网络负荷的分担装置,包括:
    计数模块,设置为当有数据包进入配置有ECMP的路由设备时,对当前数据包进行计数,获得计数值;
    偏移值确定模块,设置为根据所获取到的当前数据包的低位计数值以及该ECMP对应的分担链路数,从预设的模运算表中获得偏移值,以根据该偏移值确定该ECMP对应的出口信息,将接收到的数据包由确定的出口进行转发;
    计数修正模块,设置为当所获取到的当前数据包的低位计数值达到最大计数值时,根据预先设置的分担链路数对应的计数增量,对下一数据包的计数值进行修正,获得修正后的计数值。
  6. 如权利要求5所述的网络负荷的分担装置,其中,所述计数模块中,所述计数值的低位计数值的最大值为7。
  7. 如权利要求5或6所述的网络负荷的分担装置,其中,所述网络负荷的分担装置还包括:
    出口封装获取模块,设置为根据分担链路数表中的分担策略表基址加上所述偏移值,获得分担策略表索引,并查询预设的分担策略表中与分担策略表索引对应的出口封装表偏移值;根据出口封装表基址加上出口封装偏移值,获得出口封装表索引,并查询预设的出口封装表中与出口封装表索引对应的出口封装信息,以将接收到的数据包由该出口封装信息封装后进行转发。
  8. 如权利要求5或6所述的网络负荷的分担装置,其中,所述网络负荷的分担装置还包括:
    数据包解析模块,设置为当有数据包进入配置有ECMP的路由设备时,对该数据包进行解析,获得解析数据;根据解析数据,查询私网路由表,获得公私网分离表索引;进而根据该公私网分离表索引查询公私网分离表,获得ECMP索引。
PCT/CN2015/088179 2015-05-29 2015-08-26 网络负荷的分担方法和装置 WO2016192215A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510290598.7A CN106302218A (zh) 2015-05-29 2015-05-29 网络负荷的分担方法和装置
CN201510290598.7 2015-05-29

Publications (1)

Publication Number Publication Date
WO2016192215A1 true WO2016192215A1 (zh) 2016-12-08

Family

ID=57439946

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/088179 WO2016192215A1 (zh) 2015-05-29 2015-08-26 网络负荷的分担方法和装置

Country Status (2)

Country Link
CN (1) CN106302218A (zh)
WO (1) WO2016192215A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111343611B (zh) * 2018-12-18 2022-11-22 阿里巴巴集团控股有限公司 一种信息同步的方法和装置
CN113660160B (zh) * 2021-08-20 2023-04-28 烽火通信科技股份有限公司 一种ucmp负载分担的方法和装置
CN115914098A (zh) * 2021-09-30 2023-04-04 中兴通讯股份有限公司 基于等价多路径的选路方法、设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101404620A (zh) * 2008-11-17 2009-04-08 杭州华三通信技术有限公司 一种创建路由表项的方法和交换设备
CN101572667A (zh) * 2009-05-22 2009-11-04 中兴通讯股份有限公司 一种ip路由等价多路径的实现方法及装置
CN101753455A (zh) * 2009-12-15 2010-06-23 中兴通讯股份有限公司 转发方法及装置
CN102143074A (zh) * 2011-03-25 2011-08-03 中兴通讯股份有限公司 网络负荷的分担方法、系统及网络处理器
CN104539552A (zh) * 2015-01-12 2015-04-22 盛科网络(苏州)有限公司 一种基于网络芯片的动态ecmp的实现方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101425973B (zh) * 2008-11-25 2011-05-11 中兴通讯股份有限公司 一种ip组播在等价多路径上的选路方法
CN101789949B (zh) * 2010-02-04 2014-07-02 中兴通讯股份有限公司 一种实现负荷分担的方法和路由设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101404620A (zh) * 2008-11-17 2009-04-08 杭州华三通信技术有限公司 一种创建路由表项的方法和交换设备
CN101572667A (zh) * 2009-05-22 2009-11-04 中兴通讯股份有限公司 一种ip路由等价多路径的实现方法及装置
CN101753455A (zh) * 2009-12-15 2010-06-23 中兴通讯股份有限公司 转发方法及装置
CN102143074A (zh) * 2011-03-25 2011-08-03 中兴通讯股份有限公司 网络负荷的分担方法、系统及网络处理器
CN104539552A (zh) * 2015-01-12 2015-04-22 盛科网络(苏州)有限公司 一种基于网络芯片的动态ecmp的实现方法

Also Published As

Publication number Publication date
CN106302218A (zh) 2017-01-04

Similar Documents

Publication Publication Date Title
US9455967B2 (en) Load balancing hash computation for network switches
US9843504B2 (en) Extending OpenFlow to support packet encapsulation for transport over software-defined networks
US9571392B2 (en) Forwarding packets
US9967183B2 (en) Source routing with entropy-header
WO2016095439A1 (zh) 基于等价多路径ecmp的报文传输方法及装置
US8311039B2 (en) Traffic information aggregating apparatus
US20150010003A1 (en) Accessing ip network and edge devices
CN102136989B (zh) 报文传输的方法、系统和设备
US20130003727A1 (en) Hybrid port range encoding
EP2677704B1 (en) Unicast data frame transmission method and apparatus
US20160112299A1 (en) Configuring forwarding information
US10505759B2 (en) Access layer-2 virtual private network from layer-3 virtual private network
EP3190754B1 (en) Method and apparatus for processing a modified packet
WO2013026384A1 (zh) 业务数据传输的方法、网络节点及系统
EP2478677B1 (en) An apparatus for analyzing a data packet, a data packet processing system and a method
WO2016192215A1 (zh) 网络负荷的分担方法和装置
US11621853B1 (en) Protocol-independent multi-table packet routing using shared memory resource
WO2011095017A1 (zh) 一种实现负荷分担的方法和路由设备
US20160099859A1 (en) Reverse Path Validation for Source Routed Networks
US20240179095A1 (en) Method and apparatus for determining hash algorithm information for load balancing, and storage medium
WO2012000349A1 (zh) 一种网络流量分担的方法、装置及系统
US10313274B2 (en) Packet forwarding
US11888727B2 (en) Extending BGP protection for SR path ingress protection
WO2023226633A1 (zh) 故障处理方法、相关设备和系统
CN108900406B (zh) 一种流量转发方法及装置

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: 15893871

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: 15893871

Country of ref document: EP

Kind code of ref document: A1