[go: up one dir, main page]

CN100450037C - A method and device for implementing IP packet load sharing - Google Patents

A method and device for implementing IP packet load sharing Download PDF

Info

Publication number
CN100450037C
CN100450037C CNB2006101119935A CN200610111993A CN100450037C CN 100450037 C CN100450037 C CN 100450037C CN B2006101119935 A CNB2006101119935 A CN B2006101119935A CN 200610111993 A CN200610111993 A CN 200610111993A CN 100450037 C CN100450037 C CN 100450037C
Authority
CN
China
Prior art keywords
load sharing
message
address
hash
sharing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB2006101119935A
Other languages
Chinese (zh)
Other versions
CN1913454A (en
Inventor
俞致伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CNB2006101119935A priority Critical patent/CN100450037C/en
Publication of CN1913454A publication Critical patent/CN1913454A/en
Application granted granted Critical
Publication of CN100450037C publication Critical patent/CN100450037C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

This invention relates to a method and a device for realizing sharing of IP message load, in which, the method includes: utilizing the IP address of a message source, target IP address and an exclusive identified field identifying a part of a message as the key of the load sharing hash algorithm based on the data flow to get the result of digit corresponding to the load sharing path number, taking the result as an index to look for the corresponding load sharing path to transmit the IP message, which integrates the advantages of the load sharing algorithms based on data flow and messages to share messages to all of the sharing paths both multiple data flows and a single data flow.

Description

一种IP报文负载分担实现方法及装置 A method and device for implementing IP packet load sharing

技术领域 technical field

本发明涉及通信技术领域,尤其涉及一种IP报文负载分担实现方法及装置。The present invention relates to the field of communication technology, in particular to a method and device for implementing IP message load sharing.

背景技术 Background technique

随着网络应用的日益普及和网络规模日益庞大,Internet上需要传送的信息量大大增加。对于路由器来说,他们需要为大量报文提供寻径、转发功能,此时路由器的负载能力和性能就成为必须面对的一个实际问题:在网络流量增大的情况下,甚至接口故障的情况下,如何能够使路由器仍然提供可靠的高质量的服务?其中一种可行的方法就是负载分担。所谓的负载分担就是到达一个给定的目的地址允许使用多条路径的技术。这些路径可能来源于静态路由或者动态路由协议,一种负载分担组网如图1所示。With the increasing popularity of network applications and the increasing scale of the network, the amount of information that needs to be transmitted on the Internet has greatly increased. For routers, they need to provide routing and forwarding functions for a large number of packets. At this time, the load capacity and performance of routers become a practical problem that must be faced: in the case of increased network traffic, or even interface failures How can the router still provide reliable and high-quality services? One of the feasible methods is load sharing. The so-called load sharing is a technology that allows the use of multiple paths to a given destination address. These paths may come from static routes or dynamic routing protocols. A load sharing network is shown in Figure 1.

如图1,用户需要访问远端服务器,数据流在路由器A查询路由表后,找到两条路径:A-B-D和A-C-D。这时通过负载分担处理将数据流量平均分担到两条路径上,因此对于单一路径上的流量针对于不负载分担的情况都减少到一半,这就大大缓解了路由器B和C的承受能力。As shown in Figure 1, the user needs to access the remote server. After the data flow queries the routing table of router A, it finds two paths: A-B-D and A-C-D. At this time, the data traffic is evenly distributed to the two paths through load sharing processing, so the traffic on a single path is reduced to half for the case of no load sharing, which greatly eases the bearing capacity of routers B and C.

此外,负载分担也被使用在trunk上。trunk是将多个物理端口聚合在一起形成一个汇聚组,实现出、入负荷在各成员端口中的分担,同时提供更高的连接可靠性的技术。每个trunk端口可以配置同一IP地址,即逻辑上可以被看作一个实际端口来使用,数据流通过负载分担被平均分担到trunk组内的不同物理端口上,达到减少端口负荷能力的目的。典型的组网如图2所示。In addition, load sharing is also used on the trunk. Trunk is a technology that aggregates multiple physical ports together to form an aggregation group, realizes the sharing of outgoing and incoming loads among member ports, and provides higher connection reliability at the same time. Each trunk port can be configured with the same IP address, that is, it can be used as an actual port logically, and the data flow is evenly distributed to different physical ports in the trunk group through load sharing, so as to reduce the port load capacity. A typical networking is shown in Figure 2.

不难发现,无论对于多条路由的负载分担,还是trunk的负载分担,要想最大可能的提高分担链路的负荷能力和性能,充分利用网络资源,就要尽可能的将数据流量平均的分担到每条链路上,因此好的负载分担算法的选择则成为关键。It is not difficult to find that, regardless of the load sharing of multiple routes or the load sharing of trunks, in order to maximize the load capacity and performance of shared links and make full use of network resources, it is necessary to evenly share data traffic as much as possible to each link, so the choice of a good load sharing algorithm becomes the key.

负载分担的基本算法通常有两种:基于数据流的负载分担和基于报文的负载分担。基于数据流的负载分担,是利用数据流包含的特定信息来分发报文,最常见的是路由器针对源地址 & 目的地址对来分发报文:假设到达同一个主机有N条路径,在目的地址相同的情况下,源地址是访问者1地址的所有报文走第一条路,源地址是访问者2地址的所有报文走第二条路……,依此类推,源地址是访问者N地址的所有报文走第N条路。There are generally two basic algorithms for load sharing: data flow-based load sharing and packet-based load sharing. Load sharing based on data flow is to use the specific information contained in the data flow to distribute packets. The most common way is for routers to distribute packets based on source address & destination address pairs: assuming that there are N paths to the same host, the destination address Under the same circumstances, all packets whose source address is the address of visitor 1 go through the first path, all packets whose source address is the address of visitor 2 go through the second path..., and so on, the source address is visitor All packets of address N go through the Nth path.

对于IP报文来说,使用报文源IP地址 & 目的IP地址作为key进行hash处理,最简单的hash算法是使用源IP与目的IP进行异或操作,之后将32bit长度的结果再进行多次折半异或操作,每次折半异或操作后结果长度减半,折半异或次数与最后需要获得的hash结果位长有关,例如需要获得4bit的hash结果,那么需要折半异或3次。最后将hash结果作为分担链路标识选择对应的负载分担链路转发报文。For IP messages, the source IP address & destination IP address of the message are used as the key for hash processing. The simplest hash algorithm is to use the source IP and destination IP to perform XOR operation, and then perform multiple times on the result of 32bit length In the halved XOR operation, the length of the result is halved after each halved XOR operation. The number of halved XOR operations is related to the bit length of the final hash result to be obtained. For example, if you need to obtain a 4-bit hash result, you need to halve the XOR 3 times. Finally, the hash result is used as the sharing link identifier to select the corresponding load sharing link to forward the message.

上述分担算法简单描述如下:The above sharing algorithm is briefly described as follows:

key1=源IP地址,key1 = source IP address,

key2=目的IP地址,key2=destination IP address,

key1 XOR key2=key’,key1 XOR key2=key',

key’_H16 XOR key’_L16=key”,key'_H16 XOR key'_L16=key",

key”_H8 XOR key”_L8=key”’,key”_H8 XOR key”_L8=key”’,

key”’_H4 XOR key”’_L4=key””,key"'_H4 XOR key"'_L4=key"",

key””低4bit作为hash的最后结果The lower 4 bits of key"" are used as the final result of the hash

上述操作详细流程如图3所示,对于给定的源地址和目的地址对即使有多条可用路径也只能选择同一条路径。若只有一条流则只会走一条分担链路,根本无法进行负载分担。在实际环境中,到达各个目的地址的流量可能相差很多,到达某个目的地址的报文又总是选择同一条路径,这种工作方式可能会导致负载分担不均衡。The detailed flow of the above operations is shown in FIG. 3 . For a given source address and destination address pair, only one path can be selected even if there are multiple available paths. If there is only one flow, only one sharing link will go, and load sharing cannot be performed at all. In an actual environment, the traffic to each destination address may vary greatly, and packets to a certain destination address always use the same path. This working method may lead to unbalanced load sharing.

基于报文的负载分担就是说路由器将目的地址是A的一个报文从第一条路径发送,目的地址是A(目的地址相同)的第二个报文从第二条路径发送。Packet-based load balancing means that the router sends a packet with the destination address A through the first path, and sends a second packet with the destination address A (the same destination address) through the second path.

基于报文的负载分担算法实现思想是为每条需要进行负载分担的路由或trunk接口分配一个计数器,每收到一个报文,将对应的计数器加1,根据计数器值轮询各条对应的分担路径,按顺序从相应分担路径转发报文,以达到负载分担效果。The realization idea of the message-based load sharing algorithm is to allocate a counter for each route or trunk interface that needs to be load-sharing. Every time a message is received, the corresponding counter is incremented by 1, and each corresponding load sharing is polled according to the counter value. Paths forward packets from corresponding sharing paths in order to achieve load sharing.

此种方法的缺点是:需要为每条需要进行负载分担的路由或trunk接口都分配一个计数器,路由器上往往会存在大量路由,这样会导致要分配管理大量计数器,造成存储资源的严重浪费。此外,对计数器的频繁操作也会大量占用存储器访问带宽,影响转发性能。The disadvantage of this method is that a counter needs to be allocated for each route or trunk interface that needs to be load-balanced, and there are often a large number of routes on the router, which will lead to the allocation and management of a large number of counters, resulting in a serious waste of storage resources. In addition, frequent operations on the counter will also occupy a large amount of memory access bandwidth and affect forwarding performance.

发明内容 Contents of the invention

本发明的目的在于提供一种IP报文负载分担实现方法及装置,解决了基于数据流的负载分担算法的分担不均衡问题及基于报文的负载分担算法的存储资源的严重浪费和影响转发性能问题。The purpose of the present invention is to provide a method and device for implementing IP message load sharing, which solves the unbalanced sharing problem of the load sharing algorithm based on data flow and the serious waste of storage resources of the message-based load sharing algorithm and affects the forwarding performance question.

本发明的目的是通过以下技术方案实现的:The purpose of the present invention is achieved through the following technical solutions:

一种IP报文负载分担实现方法,包括:A method for implementing IP packet load sharing, comprising:

利用报文源IP地址、目的IP地址及唯一标识一份报文的标识字段作为基于数据流的负载分担hash计算中的key,进行hash计算操作,获得与负载分担路径数量相关位数的结果;Use the source IP address of the message, the destination IP address and the identification field that uniquely identifies a message as the key in the hash calculation of the load sharing based on the data flow, perform the hash calculation operation, and obtain the result of the number of digits related to the number of load sharing paths;

将所述结果作为索引,在该条路由对应的分担链路表中查找对应的负载分担路径;Using the result as an index, look up the corresponding load sharing path in the sharing link table corresponding to the route;

利用查找到的负载分担路径转发IP报文。Use the found load balancing path to forward IP packets.

所述标识字段仅与相同位数的hash计算结果进行相应的hash操作。The identification field only performs the corresponding hash operation with the hash calculation result of the same number of digits.

所述标识字段在每发送一份报文时,其值加1。The value of the identification field is increased by 1 each time a message is sent.

所述标识字段为报文头部中的标识信息。The identification field is identification information in the packet header.

一种IP报文负载分担实现装置,包括:A device for implementing IP message load sharing, comprising:

标识字段获取模块,用于获取报文中唯一标识一份报文的标识字段;An identification field acquisition module, configured to acquire an identification field that uniquely identifies a message in the message;

负载分担计算模块,用于将报文源IP地址、目的IP地址及标识字段作为hash计算中的key进行hash计算操作,获得负载分担路径;其进一步包括:负载分担hash计算子模块,用于将报文源IP地址、目的IP地址及标识字段作为key进行hash计算操作,得到与负载分担路径数量相关位数的结果;负载分担路径查找子模块,用于将所述hash算法操作获得的结果作为索引在该条路由对应的分担链路表中查找对应的负载分担路径;The load sharing calculation module is used to carry out the hash calculation operation using the message source IP address, the destination IP address and the identification field as the key in the hash calculation to obtain the load sharing path; it further includes: a load sharing hash calculation sub-module for The source IP address of the message, the destination IP address and the identification field are used as the key to carry out the hash calculation operation, and the result of the number of digits related to the number of load sharing paths is obtained; the load sharing path search sub-module is used to use the result obtained by the hash algorithm operation as The index looks up the corresponding load sharing path in the sharing link table corresponding to the route;

报文转发模块,用于根据负载分担计算模块获得的负载分担路径转发IP报文。The packet forwarding module is configured to forward the IP packet according to the load sharing path obtained by the load sharing calculation module.

所述装置设置于路由器中。The device is set in the router.

由上述本发明提供的技术方案可以看出,本发明由于在基于数据流的分担hash算法中引入了IP报文的唯一标识,相当于引入了基于报文的负载分担算法的特点,即当同一条数据流,报文源地址和目的地址均不变的情况下,hash结果也会根据报文携带的16位标识不同而不断变化,使相同数据流的报文也能够均衡的分担到全部分担链路上。同时,由于使用报文自己携带的标识,而不用再为每条需要进行负载分担的路由或trunk接口都分配计数器,大大减少了存储资源的浪费,也不会因为频繁访问存储器影响转发性能。As can be seen from the technical solution provided by the present invention above, the present invention introduces the unique identifier of the IP message in the sharing hash algorithm based on the data flow, which is equivalent to introducing the characteristics of the load sharing algorithm based on the message, that is, when the same For a data stream, when the source address and destination address of the message are unchanged, the hash result will also change continuously according to the 16-bit identifier carried by the message, so that the messages of the same data stream can be evenly shared to all on the link. At the same time, because the identifier carried by the packet itself is used, there is no need to allocate counters for each route or trunk interface that needs to be load-balanced, which greatly reduces the waste of storage resources and does not affect the forwarding performance due to frequent memory access.

因此本发明实现了综合基于数据流负载分担算法和基于报文的负载分担算法的优点,对于多条数据流和单条数据流的情况都可以使报文能够均衡的分担到全部分担链路上。且算法实现简单,也不会占用和访问大量存储空间,对转发性能没有影响。Therefore, the present invention realizes the advantages of both the load sharing algorithm based on the data stream and the load sharing algorithm based on the message, and the message can be evenly shared on all sharing links for the situation of multiple data streams and a single data stream. Moreover, the algorithm is simple to implement, does not occupy and access a large amount of storage space, and has no impact on forwarding performance.

附图说明 Description of drawings

图1为现有技术负载分担组网示意图;FIG. 1 is a schematic diagram of a load sharing network in the prior art;

图2为现有技术trunk组网示意图;FIG. 2 is a schematic diagram of trunk networking in the prior art;

图3为现有技术逐流hash算法实现流程图;Fig. 3 is the implementation flow diagram of prior art flow-by-flow hash algorithm;

图4为IP数据报格式及首部中的各字段;Fig. 4 is each field in IP datagram format and header;

图5为本发明所述方法一种实施例操作流程图;Fig. 5 is a flow chart of the operation of an embodiment of the method of the present invention;

图6为本发明所述装置一种实施例模块示意图。Fig. 6 is a schematic diagram of a module of an embodiment of the device of the present invention.

具体实施方式 Detailed ways

本发明的核心思想是提供一种IP报文负载分担实现方法及装置,综合基于数据流和基于报文的负载分担算法,在进行hash计算时引入IP报文头部中唯一标识一份数据报的16位标识信息,对于多条数据流或单条数据流的情况都可以使报文均衡的分担到全部分担链路上。The core idea of the present invention is to provide a method and device for implementing IP message load sharing, which integrates data flow-based and message-based load sharing algorithms, and introduces a data packet uniquely identified in the IP message header when performing hash calculation. The 16-bit identification information, for the case of multiple data streams or a single data stream, can make the message evenly distributed to all sharing links.

所述IP数据报格式及首部中的各字段如图4所示,各字段说明如下:The IP datagram format and each field in the header are as shown in Figure 4, and each field is described as follows:

版本:表示IP协议的版本,通常有4和6两种,图4是IPV4报文格式。Version: Indicates the version of the IP protocol, usually 4 and 6. Figure 4 is the IPV4 packet format.

首部长度:表示IP首部占32bit字的数目,包括可能的选项部分。Header length: Indicates the number of 32-bit words occupied by the IP header, including possible options.

服务类型:包括一个3bit的优先级子字段,4bit的TOS(服务类型)子字段和1bit未用位,但必须置0。4bit的TOS分别代表:最小时延、最大吞吐量、最高可靠性和最小费用。Service type: including a 3bit priority subfield, 4bit TOS (service type) subfield and 1bit unused bit, but must be set to 0. 4bit TOS respectively represent: minimum delay, maximum throughput, highest reliability and Minimum fee.

总长度:指整个IP数据报的长度,以字节为单位。Total length: refers to the length of the entire IP datagram, in bytes.

标识字段:唯一地标识主机发送的每一份数据报,也就是下文中用到的16位标识字段。Identification field: uniquely identifies each datagram sent by the host, which is the 16-bit identification field used below.

片偏移:当报文需要分片时,标识该片偏移原始数据报开始处的位置。Fragment Offset: When a packet needs to be fragmented, it identifies the location where the fragment offsets the original datagram.

生存时间:设置了数据报可以经过的最多路由器数,它指定了数据报的生存时间。Time to live: Set the maximum number of routers that a datagram can pass through, and it specifies the time to live for a datagram.

协议:标识以此IP报文承载的高层协议类型。Protocol: identifies the type of high-layer protocol carried by this IP packet.

首部检验和:是根据IP首部计算的检验和码。它不对首部后面的数据进行计算。Header checksum: It is the checksum code calculated according to the IP header. It does not perform calculations on the data following the header.

源IP地址和目的IP地址:标识报文发出的起始地址和最终到达的目的地址。Source IP address and destination IP address: identify the starting address of the packet and the final destination address of the packet.

任选项:是数据报中的一个可变长的可选信息,这些选项很少被使用,并非所有的主机和路由器都支持这些选项。Optional: It is a variable-length optional information in the datagram. These options are rarely used, and not all hosts and routers support these options.

16位标识字段唯一地标识主机发送的每一份数据报。通常每发送一份报文此标识字段的值就会加1。此标识最初是用于在IP报文分片时,在目的地通过相同标识来确定相同报文进行分片重组使用的。The 16-bit identification field uniquely identifies each datagram sent by the host. Usually, the value of this identification field will increase by 1 each time a message is sent. This identifier is originally used to determine the fragment reassembly of the same packet by the same identifier at the destination when the IP packet is fragmented.

此处利用该标识唯一标识每一个报文的特点,代替基于报文的负载分担的分配计数器使用,将该标识与报文源IP地址和目的IP地址共同作为hash算法的key,重新改进hash算法,最简单的方法可以仍然为异或操作,例如:Here, the identifier is used to uniquely identify the characteristics of each message, instead of the distribution counter based on the load sharing of the message, and the identifier, the source IP address and the destination IP address of the message are used together as the key of the hash algorithm, and the hash algorithm is improved again , the easiest way can still be an XOR operation, for example:

key1=源IP地址,key1 = source IP address,

key2=目的IP地址,key2=destination IP address,

key3=16位标识,key3 = 16-bit identifier,

key1 XOR key2=key’,key1 XOR key2=key',

key’_H16 XOR key’_L16 XOR key3=key”,key'_H16 XOR key'_L16 XOR key3=key",

key”_H8 XOR key”_L8=key’”,key"_H8 XOR key"_L8=key'",

key’”_H4 XOR key’”_L4=key””,key'"_H4 XOR key'"_L4=key"",

key””低4bit作为hash的最后结果。最后将hash结果作为分担链路标识,选择对应的负载分担链路转发报文。The lower 4 bits of key"" are used as the final result of the hash. Finally, the hash result is used as the sharing link identifier, and the corresponding load sharing link is selected to forward the message.

本发明所述方法一种实施例操作流程如图5所示,假设负载分担路径共16条,则在得到4位长度结果时,即为最终的结果。具体操作步骤如下:The operation flow of an embodiment of the method of the present invention is shown in FIG. 5 . Assuming that there are 16 load sharing paths in total, the final result is obtained when the result of 4 bits is obtained. The specific operation steps are as follows:

步骤1:取报文源IP地址作为HASH_key1,取报文目的地址作为HASH_key2,取报文16位标识作为HASH_key3;Step 1: Take the source IP address of the message as HASH_key1, take the destination address of the message as HASH_key2, and take the 16-bit identifier of the message as HASH_key3;

路由器接收到报文后,在分配路由前,为了实现负载分担,需要进行负载分担计算,首先获取报文文源IP地址及目的地址。取报文源IP地址作为HASH_key1,取报文目的地址作为HASH_key2,同时取报文头部唯一标识所述报文的16位标识作为HASH_key3;After the router receives the packet, before assigning the route, in order to realize the load sharing, it needs to carry out the load sharing calculation, first obtain the source IP address and the destination address of the packet. Take the source IP address of the message as HASH_key1, take the destination address of the message as HASH_key2, and take the 16-bit identifier uniquely identifying the message in the header of the message as HASH_key3;

步骤2:将HASH_key1与HASH_key2进行异或操作,得到32位长度的结果作为HASH_key’;Step 2: Perform XOR operation on HASH_key1 and HASH_key2 to get the result of 32-bit length as HASH_key';

一般报文的源IP地址及目的IP地址均为32位,在进行hash算法时,由于HASH_key3为16位的字段,所以第一次执行的异或操作为HASH_key1与HASH_key2进行异或操作,得到一个32位长度的结果,记作HASH_key’;Generally, the source IP address and destination IP address of the message are both 32 bits. When performing the hash algorithm, since HASH_key3 is a 16-bit field, the XOR operation performed for the first time is the XOR operation of HASH_key1 and HASH_key2 to obtain a The result of 32-bit length is denoted as HASH_key';

步骤3:取HASH_key’的高16位数据与低16位数据进行异或操作,得到16位长度结果,再次与HASH_key3进行异或操作,得到16位长度结果作为HASH_key”;Step 3: Take the high 16-bit data of HASH_key’ and perform XOR operation with the low 16-bit data to get the 16-bit length result, and then perform XOR operation with HASH_key3 again to get the 16-bit length result as HASH_key”;

将上述HASH_key1与HASH_key2进行异或操作得到的32位长度结果HASH_key’的高16位数据与低16位数据进行异或操作,得到16位长度结果,由于HASH_key3为16位的字段,因此将所述得到的16位长度结果再次与HASH_key3进行异或操作,得到另一个16位长度结果,记作HASH_key”;The 32-bit length result HASH_key' obtained by XORing the above HASH_key1 and HASH_key2 is XORed with the upper 16-bit data and the lower 16-bit data to obtain a 16-bit length result. Since HASH_key3 is a 16-bit field, the above The obtained 16-bit length result is XORed with HASH_key3 again to obtain another 16-bit length result, which is recorded as HASH_key”;

步骤4:取HASH_key”的高8位数据与低8位数据进行异或操作,得到8位长度结果作为HASH_key’”;Step 4: Take the high 8-bit data of HASH_key” and perform XOR operation with the low 8-bit data, and get the 8-bit length result as HASH_key’”;

步骤5:取HASH_key’”的高4位数据与低4位数据进行异或操作,得到4位长度结果作为HASH_key””,这是hash的最终结果;Step 5: Take the high 4-bit data of HASH_key’” and perform XOR operation with the low 4-bit data, and get the 4-bit length result as HASH_key””, which is the final result of hash;

由于负载分担路径一共16条,因此得到的4位长度的结果即为最终结果;Since there are 16 load sharing paths in total, the 4-bit result obtained is the final result;

步骤6:将所述HASH_key””的值作为索引,在该条路由对应的分担链路表中查找对应的负载分担路径,利用查找到的路径进行报文的转发。Step 6: Use the value of the HASH_key"" as an index, search for the corresponding load sharing path in the sharing link table corresponding to the route, and use the found path to forward the message.

本发明提供一种IP报文负载分担实现装置,所述装置设置于路由器中,其一种实施例模块示意图如图6所示,包括:标识字段获取模块、负载分担计算模块及报文转发模块。The present invention provides a device for realizing load sharing of IP packets. The device is arranged in a router. The module schematic diagram of an embodiment thereof is shown in FIG. 6 , including: an identification field acquisition module, a load sharing calculation module and a message forwarding module .

所述标识字段获取模块,用于获取报文中唯一标识一份报文的标识字段。The identification field acquiring module is configured to acquire an identification field that uniquely identifies a message in the message.

所述负载分担计算模块,用于将报文源IP地址、目的IP地址及标识字段作为key获得负载分担路径。该模块进一步包括:The load sharing calculation module is used to use the message source IP address, destination IP address and identification field as keys to obtain a load sharing path. This module further includes:

负载分担hash计算子模块,用于将报文源IP地址、目的IP地址及标识字段作为key进行hash计算操作,得到与负载分担路径数量相关位数的结果。The load sharing hash calculation sub-module is used to use the source IP address, destination IP address and identification field of the message as the key to perform hash calculation operations, and obtain the result of the number of bits related to the number of load sharing paths.

负载分担路径查找子模块,用于将所述hasn算法操作获得的结果作为索引查找对应的负载分担路径。The load sharing path search submodule is used to use the result obtained by the hasn algorithm operation as an index to search for the corresponding load sharing path.

所述报文转发模块,用于根据所述获得的负载分担路径转发报文。The packet forwarding module is configured to forward packets according to the obtained load sharing path.

综上所述,本发明所述方法由于在基于数据流的分担hash算法中引入了IP报文的唯一标识,相当于引入了基于报文的负载分担算法的特点,即当同一条数据流,报文源地址和目的地址均不变的情况下,hash结果也会根据报文携带的16位标识不同而不断变化,使相同数据流的报文也能够均衡的分担到全部分担链路上。同时,由于使用报文自己携带的标识,而不用再为每条需要进行负载分担的路由或trunk接口都分配计数器,大大减少了存储资源的浪费,也不会因为频繁访问存储器影响转发性能。In summary, because the method of the present invention introduces the unique identifier of the IP message in the sharing hash algorithm based on the data flow, it is equivalent to introducing the characteristics of the load sharing algorithm based on the message, that is, when the same data flow, When the source address and destination address of the message are unchanged, the hash result will also change according to the 16-bit identifier carried by the message, so that the messages of the same data flow can be evenly distributed to all sharing links. At the same time, because the identifier carried by the packet itself is used, there is no need to allocate counters for each route or trunk interface that needs to be load-balanced, which greatly reduces the waste of storage resources and does not affect the forwarding performance due to frequent memory access.

以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应该以权利要求的保护范围为准。The above is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present invention can easily think of changes or Replacement should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.

Claims (6)

1、一种IP报文负载分担实现方法,其特征在于,包括:1. A method for implementing IP message load sharing, characterized in that, comprising: 利用报文源IP地址、目的IP地址及唯一标识一份报文的标识字段作为基于数据流的负载分担hash计算中的key,进行hash计算操作,获得与负载分担路径数量相关位数的结果;Use the source IP address of the message, the destination IP address and the identification field that uniquely identifies a message as the key in the hash calculation of the load sharing based on the data flow, perform the hash calculation operation, and obtain the result of the number of digits related to the number of load sharing paths; 将所述结果作为索引,在该条路由对应的分担链路表中查找对应的负载分担路径;Using the result as an index, look up the corresponding load sharing path in the sharing link table corresponding to the route; 利用查找到的负载分担路径转发IP报文。Use the found load balancing path to forward IP packets. 2、如权利要求1所述的一种IP报文负载分担实现方法,其特征在于,所述标识字段仅与相同位数的hash计算结果进行相应的hash操作。2. The method for implementing IP packet load sharing according to claim 1, wherein the identification field is only subjected to a corresponding hash operation with the hash calculation result of the same number of digits. 3、如权利要求1所述的一种IP报文负载分担实现方法,其特征在于,所述标识字段在每发送一份报文时,其值加1。3. The method for implementing IP packet load sharing according to claim 1, wherein the value of the identification field is increased by 1 each time a packet is sent. 4、如权利要求1至3中任一项所述的一种IP报文负载分担实现方法,其特征在于,所述标识字段为报文头部中的标识信息。4. A method for implementing IP packet load sharing according to any one of claims 1 to 3, wherein the identification field is identification information in the packet header. 5、一种IP报文负载分担实现装置,其特征在于,包括:5. A device for implementing IP message load sharing, characterized in that, comprising: 标识字段获取模块,用于获取报文中唯一标识一份报文的标识字段;An identification field acquisition module, configured to acquire an identification field that uniquely identifies a message in the message; 负载分担计算模块,用于将报文源IP地址、目的IP地址及标识字段作为hash计算中的key进行hash计算操作,获得负载分担路径;其进一步包括:负载分担hash计算子模块,用于将报文源IP地址、目的IP地址及标识字段作为key进行hash计算操作,得到与负载分担路径数量相关位数的结果;负载分担路径查找子模块,用于将所述hash算法操作获得的结果作为索引在该条路由对应的分担链路表中查找对应的负载分担路径;The load sharing calculation module is used to carry out the hash calculation operation using the message source IP address, the destination IP address and the identification field as the key in the hash calculation to obtain the load sharing path; it further includes: a load sharing hash calculation sub-module for The source IP address of the message, the destination IP address and the identification field are used as the key to carry out the hash calculation operation, and the result of the number of digits related to the number of load sharing paths is obtained; the load sharing path search sub-module is used to use the result obtained by the hash algorithm operation as The index looks up the corresponding load sharing path in the sharing link table corresponding to the route; 报文转发模块,用于根据负载分担计算模块获得的负载分担路径转发IP报文。A message forwarding module, configured to forward IP messages according to the load sharing path obtained by the load sharing calculation module. 6、如权利要求5所述的一种IP报文负载分担实现装置,其特征在于,所述装置设置于路由器中。6. The device for implementing IP packet load sharing according to claim 5, characterized in that the device is set in a router.
CNB2006101119935A 2006-08-30 2006-08-30 A method and device for implementing IP packet load sharing Expired - Fee Related CN100450037C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006101119935A CN100450037C (en) 2006-08-30 2006-08-30 A method and device for implementing IP packet load sharing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006101119935A CN100450037C (en) 2006-08-30 2006-08-30 A method and device for implementing IP packet load sharing

Publications (2)

Publication Number Publication Date
CN1913454A CN1913454A (en) 2007-02-14
CN100450037C true CN100450037C (en) 2009-01-07

Family

ID=37722233

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006101119935A Expired - Fee Related CN100450037C (en) 2006-08-30 2006-08-30 A method and device for implementing IP packet load sharing

Country Status (1)

Country Link
CN (1) CN100450037C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102209019A (en) * 2010-03-30 2011-10-05 杭州华三通信技术有限公司 Load balancing method and load balancing equipment based on message payload

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101399746B (en) * 2007-09-26 2011-03-16 华为技术有限公司 Packet routing method, system, device and method, system for selecting backup resource
CN102098224B (en) * 2011-02-16 2015-06-03 中兴通讯股份有限公司 Method and device for sharing data stream loads
CN102447619B (en) * 2011-11-10 2014-09-17 华为技术有限公司 Load sharing mode selecting method, device and system
CN103765837B (en) * 2012-08-10 2016-08-10 华为技术有限公司 Multi-CPU message processing method and system, switching unit, single board
CN102868631B (en) 2012-09-28 2016-09-21 华为技术有限公司 Load sharing method and device
CN104734984B (en) * 2013-12-24 2017-11-21 中国移动通信集团公司 A kind of message forwarding method and device
CN106656842A (en) * 2015-10-29 2017-05-10 华为数字技术(苏州)有限公司 Load balancing method and flow forwarding device
CN111147390B (en) * 2019-11-22 2023-06-30 国家计算机网络与信息安全管理中心 Load sharing residual solving method and device
CN113206793B (en) * 2021-03-15 2022-05-27 新华三信息安全技术有限公司 Data stream forwarding method and device
CN116319564A (en) * 2021-12-21 2023-06-23 华为技术有限公司 Load sharing method of link aggregation group and network equipment
CN118474096A (en) * 2024-06-07 2024-08-09 北京开源芯片研究院 Message transmission method, system, electronic device and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003041355A1 (en) * 2001-11-05 2003-05-15 Nokia Corporation A method and a system for stateless load sharing for a server cluster in an ip-based telecommunications network
US20040258073A1 (en) * 2001-08-14 2004-12-23 Cedell Alexander Load-sharing technique for distributing multi-protocol label switching protocol encapsulated flows across multiple physical links
CN1719805A (en) * 2005-07-15 2006-01-11 中国人民解放军国防科学技术大学 Multipath Routing Method for Packet Order Preservation in 3D Torus Switching Network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040258073A1 (en) * 2001-08-14 2004-12-23 Cedell Alexander Load-sharing technique for distributing multi-protocol label switching protocol encapsulated flows across multiple physical links
WO2003041355A1 (en) * 2001-11-05 2003-05-15 Nokia Corporation A method and a system for stateless load sharing for a server cluster in an ip-based telecommunications network
CN1719805A (en) * 2005-07-15 2006-01-11 中国人民解放军国防科学技术大学 Multipath Routing Method for Packet Order Preservation in 3D Torus Switching Network

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102209019A (en) * 2010-03-30 2011-10-05 杭州华三通信技术有限公司 Load balancing method and load balancing equipment based on message payload

Also Published As

Publication number Publication date
CN1913454A (en) 2007-02-14

Similar Documents

Publication Publication Date Title
CN100450037C (en) A method and device for implementing IP packet load sharing
US11374848B2 (en) Explicit routing with network function encoding
CN109861924B (en) Message sending and processing method and device, PE node and node
CN102694721B (en) Method for the packet switch in network
US8792497B2 (en) Method and apparatus for performing link aggregation
CN111385199B (en) Compressed routing header
US9680751B2 (en) Methods and devices for providing service insertion in a TRILL network
US7697527B2 (en) Method and apparatus for direct frame switching using frame contained destination information
JP5373625B2 (en) Method and apparatus for multicast routing
CN106105130B (en) A method and apparatus for providing a source of entropy in source routing
US10425327B2 (en) System and method for routing in software defined networks using a flow header
US20150036513A1 (en) Multicore processing of bidirectional traffic flows
CN102439948B (en) Determining the group address for an ethernet-based multicast communication
US9467367B2 (en) Universal labels in internetworking
WO2016029345A1 (en) Network flow information statistics method and apparatus
Iannone et al. Implementing the locator/id separation protocol: Design and experience
CN112532563A (en) Message sending method and device
JP6055553B2 (en) Queue scheduling method, apparatus and system
CN100417138C (en) A method of load sharing
CN115643222A (en) Message transmission method, device and storage medium
US20060239196A1 (en) System and method for performing load balancing across a plurality of servers
Ren et al. On Scalable Service Function Chaining with $\mathcal {O}(1) $ Flowtable Entries
KR101333814B1 (en) High speed data communication apparatus used plural communicating interface, Gateway, Router, High speed data transmitting and receiving method, IP registration method for high speed data transmitting and receiving
AU2014204529A1 (en) A method of assigning a core to process a packet and a device for multicore processing

Legal Events

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

Granted publication date: 20090107

Termination date: 20160830

CF01 Termination of patent right due to non-payment of annual fee