Hash routing method, electronic device, and computer-readable storage medium

By identifying the message type and determining the hash factor based on the mapping relationship for hash calculation, the problem of complex configuration and easy misconfiguration of hash routing method is solved, and flexible and accurate hash routing is achieved.

WO2025138921A1PCT designated stage expired Publication Date: 2025-07-03ZTE CORP
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/113414
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-27
Filing Date
2024-08-20
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

After the network complexity of the existing hash routing method increases, the configuration commands are increased, resulting in complex hash configuration and easy to misconfigure, making it difficult to meet the load sharing needs of different scenarios.

Method used

By obtaining the type of message data, the target hash factor is determined based on the preset message mapping relationship, and hash calculation is performed to determine the forwarding path, reducing dependence on external command lines, and realizing intelligent hash routing.

Benefits of technology

It reduces the configuration difficulty of hash routing method, avoids misconfiguration, ensures that load sharing is carried out in accordance with established rules, and improves the flexibility and accuracy of hash routing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024113414_03072025_PF_FP_ABST
    Figure CN2024113414_03072025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of communications, and discloses a hash routing method, an electronic device, and a computer-readable storage medium. According to the present application, current packet data is acquired, and a target packet type of the packet data is identified; a target hash factor mapped by the target packet type is determined on the basis of a preset packet mapping relationship; and hash calculation is performed on the basis of the target hash factor to obtain a target hash value, the target hash value being used for determining a forwarding path of the packet data.
Need to check novelty before this filing date? Find Prior Art

Description

Hash routing method, electronic device, and computer-readable storage medium

[0001] Related applications

[0002] This application claims priority to Chinese patent application No. 202311834262.3 filed on December 27, 2023, the entire contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of communication technology, and in particular to a hash routing method, an electronic device, and a computer-readable storage medium. Background Art

[0004] Currently, communication products from major manufacturers all have their own default implementations for hash routing. The hash routing algorithms used by these manufacturers are largely the same. For example, in common Layer 3 forwarding scenarios, the bottom layer generally defaults to using a five-tuple as the hash factor for routing.

[0005] As the complexity of existing networks increases, the roles played by devices at different locations vary. This results in an increasing number of factors requiring hash calculations for communication products at all levels, leading to the emergence of various configuration commands to implement different hash routing methods. However, while the current hash routing method can ensure the normal load balancing function of the product, as the complexity of existing networks increases, the number of configuration commands continues to increase, making the hash configuration within the entire network complex and prone to misconfiguration. For example, whether it is a simple IP (Internet Protocol) forwarding scenario or a complex MPLS (Multi Protocol Label Switching) and SRV6 (Segment Routing IPv6) application scenario, different commands need to be configured to control different hash calculations.

[0006] In other words, the industry controls the routing calculation of ECMP (Equal Cost Multi-path Routing) factors through command lines. Different scenarios require additional configuration of different commands, which increases the configuration difficulty of product presentation and makes the hash configuration within the entire network complex and prone to misconfiguration.

[0007] Summary of the Invention

[0008] The main purpose of this application is to provide a hash routing method, an electronic device and a computer-readable storage medium, aiming to solve the technical problem that the hash configuration of the current hash routing method is complex and prone to misconfiguration.

[0009] To achieve the above-mentioned purpose, the present application provides a hash routing method, comprising the following steps: obtaining current message data and identifying the message type of the target message data; determining the target hash factor of the target message type mapping based on a preset message mapping relationship; performing a hash calculation based on the target hash factor to obtain a target hash value, wherein the target hash value is used to determine the forwarding path of the message data.

[0010] In addition, to achieve the above-mentioned purpose, the present application also provides an electronic device, which includes: a memory, a processor, and a hash routing program stored on the memory and runnable on the processor, and when the hash routing program is executed by the processor, it implements the hash routing method as described above.

[0011] In addition, to achieve the above-mentioned purpose, the present application also provides a storage medium, which is a computer-readable storage medium. A hash routing program is stored on the computer-readable storage medium. When the hash routing program is executed by the processor, the hash routing method as described above is implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.

[0013] FIG1 is a flow chart of a first embodiment of the hash routing method of the present application;

[0014] FIG2 is a schematic diagram of a detailed flow chart of step S30 in the second embodiment of the hash routing method of the present application;

[0015] FIG3 is a flowchart of an implementation of a hash routing method in related art;

[0016] FIG4 is a flowchart of a hash routing method according to a specific embodiment of the present application;

[0017] FIG5 is a schematic diagram of the hardware structure of the electronic device involved in the embodiment of the present application.

[0018] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0019] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.

[0020] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0021] It should be noted that all directional indications in the embodiments of the present application (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the various components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0022] In this application, unless otherwise specified or limited, the terms "connection" and "fixation" should be understood in a broad sense. For example, "fixation" can mean fixed connection, detachable connection, or integration; mechanical connection or electrical connection; direct connection or indirect connection through an intermediate medium; internal communication between two elements or interaction between two elements, unless otherwise specified. For those skilled in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0023] In addition, the descriptions of "first", "second", etc. in this application are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0024] As the complexity of existing networks increases, the roles played by devices at different locations vary. This results in an increasing number of factors requiring hash calculations for communication products at all levels, leading to the emergence of various configuration commands to implement different hash routing methods. However, while the current hash routing method can ensure the normal load balancing function of the product, as the complexity of existing networks increases, the number of configuration commands continues to increase, making the hash configuration within the entire network complex and prone to misconfiguration. For example, whether it is a simple IP (Internet Protocol) forwarding scenario or a complex MPLS (Multi Protocol Label Switching) and SRV6 (Segment Routing IPv6) application scenario, different commands need to be configured to control different hash calculations.

[0025] In other words, the industry controls the routing calculation of ECMP (Equal Cost Multi-path Routing) factors through command lines. Different scenarios require additional configuration of different commands, which increases the configuration difficulty of product presentation and makes the hash configuration within the entire network complex and prone to misconfiguration.

[0026] Based on this, an embodiment of the present application provides a hash routing method, with reference to Figure 1, which is a flowchart of a first embodiment of the hash routing method of the present application. In this embodiment, the hash routing method includes the following steps.

[0027] Step S10: Acquire current message data and identify the target message type of the message data.

[0028] In this embodiment, the current message data refers to the message data currently to be forwarded. The target message type refers to the message type corresponding to the current message data. Among them, the message type includes but is not limited to non-IP (Internet Protocol, Network Interconnection Protocol) messages, IP (Internet Protocol, Network Interconnection Protocol) messages, IP-in-IP (IP Encapsulation within IP, Mobile IP data encapsulation and tunneling) messages, GRE (Generic Routing Encapsulation, Generic Routing Encapsulation) messages, SRV6 (Segment Routing over IPv6, Segment Routing based on IPv6 forwarding plane) messages, VXLAN (Virtual Extensible LAN, Virtual Extended Local Area Network) messages and MPLS (Multi-Protocol Label Switching, Multi-Protocol Label Switching) messages, and this embodiment does not make specific limitations on this.

[0029] The target message type of the message data can be identified by obtaining information from each layer header and message processing information in the message data, and classifying and processing the input message data based on the information from each layer header and message processing information. For example, the information from each layer header in the message data can be obtained by a parser, and the message processing information can be obtained through forwarding and processing logic. In hardware implementation, the input message data can be classified and processed by setting a TCAM (ternary content addressable memory), thereby identifying the target message type of the message data. The TCAM can be used to quickly search for ACL (Access Control List) and routing entries.

[0030] Step S20: determining a target hash factor for the target message type mapping based on a preset message mapping relationship.

[0031] The target hash factor refers to the hash factor mapped to the target message type. Those skilled in the art will appreciate that the hash factor refers to the hash parameter used to perform a hash calculation to obtain a hash routing value. To facilitate understanding, in one embodiment, the hash factor mapped to message data A may be a triplet of message data. In another embodiment, the hash factor mapped to message data B may be a quintuple of message data. In yet another embodiment, the hash factor mapped to message data C may be the inner IP message of the message data.

[0032] In this embodiment, the message mapping relationship stores a one-to-one mapping relationship between each message type and a hash factor. Therefore, based on the target message type, the target hash factor mapped to the target message type can be obtained from the message mapping relationship. It is easy to understand that in order to map different types of message data to different routing values ​​to meet the efficient forwarding of different business traffic and improve the accuracy of load sharing, different message types are often mapped to different hash factors in the message mapping relationship.

[0033] Step S30: Perform hash calculation based on the target hash factor to obtain a target hash value, wherein the target hash value is used to determine a forwarding path for the message data.

[0034] Those skilled in the art will appreciate that the calculated target hash value is the hash routing value used to determine the message forwarding path.

[0035] The technical solution of the embodiment of the present application is to obtain the current message data, identify the target message type of the message data, and determine the target hash factor of the target message type mapping based on a preset message mapping relationship, and then perform hash calculation based on the target hash factor to obtain a target hash value, wherein the target hash value is used to determine the forwarding path of the message data, so that the routing calculation of the ECMP factor in the embodiment of the present application does not need to be controlled by additional configuration command lines, and hash routing can be achieved through different hash factors in different scenarios. That is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty in product presentation, and effectively solving the technical problem that the hash configuration of the current hash routing method is complex and easy to misconfigure.

[0036] It is worth mentioning that the embodiment of the present application performs intelligent hash calculations for multiple message types (the hash routing method of the embodiment of the present application is set at the bottom layer of the product, and its priority is higher than the external configuration command). For devices with load sharing configuration command errors, it can ensure that the erroneous commands do not take effect, so that the sharing is implemented according to the established rules, effectively avoiding the problem that the hash configuration of the hash routing method is complex and easy to misconfigure.

[0037] Based on the above-mentioned first embodiment of the present application, a second embodiment of the hash routing method of the present application is proposed. Please refer to Figure 2. Figure 2 is a detailed flow chart of step S30 in the second embodiment of the hash routing method of the present application. Step S30 of the above-mentioned embodiment performs a hash calculation based on the target hash factor to obtain a target hash value, which includes the following steps.

[0038] Step S31: Locate and obtain a target characteristic field in the message data according to the target hash factor.

[0039] The target feature field refers to the feature field corresponding to the target hash factor.

[0040] It can be understood that the characteristic field can be a five-tuple information, or at least one of the following parameters: MAC address, IP address and port number, that is, the preset parameters can be selected as the characteristic field, so as to calculate the corresponding hash routing value (i.e., target hash value), thereby generating a message routing entry to forward the message data, and the characteristic field can be based on the physical address (Media Access Control Address, MAC address), including but not limited to the source MAC address + destination MAC address, source MAC address or destination MAC address, or based on the logical address (Internet Protocol Address, IP address), including but not limited to the source IP address + destination IP address, source IP address or destination IP address, or based on the port number (i.e., source port information), including but not limited to the User Datagram Protocol (UDP) port number, Transmission Control Protocol (TCP) port number, etc. The following introduces the characteristic fields set based on the source IP address + destination IP address. The forwarding layer calculates the hash routing value by performing a hash algorithm on the characteristic fields. The hash routing value corresponds to different egress links of user messages. When users switch to different services, the source IP address or destination IP address in the characteristic field will change, thereby obtaining different routing values ​​to ensure efficient forwarding of different service traffic.

[0041] To facilitate understanding, as an example, when the target hash factor is a triplet, the target feature field refers to the feature fields corresponding to the destination IP address, destination port, and transport layer protocol in the message data. As another example, when the target hash factor is a quintuple, the target feature field refers to the feature fields corresponding to the source IP address, destination port, and transport layer protocol in the message data. As another example, when the target hash factor is an inner IP message, the target feature field refers to the feature field corresponding to the inner IP message in the message data. Therefore, the target feature field can be located in the message data based on the target hash factor.

[0042] Step S32: Identify the content in the target feature field, and perform hash calculation based on the identified content to obtain a target hash value.

[0043] In this embodiment, a hash calculation may be performed on the content of the identified target feature field according to a preset hash algorithm to obtain the target hash value for hash routing. The hash algorithm may be an XOR algorithm or one or a combination of cyclic redundancy check (CRC) 8, CRC16, or CRC32, which is not limited in this embodiment.

[0044] This embodiment locates the target characteristic field in the message data according to the target hash factor, identifies the content in the target characteristic field, and performs hash calculation according to the identified content, thereby accurately obtaining the target hash value for hash routing, and facilitating accurate determination of the forwarding path of the message data according to the target hash value. As a result, the routing calculation of the ECMP factor in the embodiment of the present application does not need to be controlled by additional configuration command lines, and hash routing can be achieved through different hash factors in different scenarios. That is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty in product presentation.

[0045] As a feasible implementation method, when the target message type is a first message type, the message mapping relationship is a mapping relationship between a message type and a hash factor, wherein the first message type includes at least one of a non-IP message, an IP message, an IP-in-IP message, a Generic Routing Encapsulation Protocol GRE message, and an SRV6 message.

[0046] That is, when the target message type is the first message type, the message mapping relationship is a mapping relationship between a message type and a hash factor. Step S20 determines the target hash factor of the target message type mapping based on a preset message mapping relationship, including the following steps.

[0047] Step A10: According to the target message type, obtain the target hash factor of the target message type mapping from the message mapping relationship.

[0048] The first message type includes at least one of a non-IP message, an IP message, an IP-in-IP message, a Generic Routing Encapsulation Protocol (GRE) message, and an SRV6 message.

[0049] In this embodiment, when the target message type is the first message type, the message mapping relationship is a mapping relationship between the message type and the hash factor, wherein the first message type includes at least one of a non-IP message, an IP message, an IP-in-IP message, a General Routing Encapsulation Protocol GRE message, and an SRV6 message. Therefore, when the target message type is the first message type, the target hash factor of the target message type mapping is directly queried from the message mapping relationship according to the target message type, so as to facilitate subsequent hash calculation based on the target hash factor to obtain the target hash value, and determine the forwarding path of the message data based on the target hash value. As a result, the routing calculation of the ECMP factor in the embodiment of the present application does not need to be controlled by additional configuration command lines, and hash routing can be achieved through different hash factors in different scenarios. That is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty in product presentation, and effectively solving the technical problem that the hash configuration of the current hash routing method is complex and easy to misconfigure.

[0050] In one embodiment, the first message type includes a non-IP message. When the target message type is a non-IP message, the step of determining the target hash factor of the target message type mapping based on a preset message mapping relationship includes the following steps.

[0051] Step B10: According to the target message type, from the message mapping relationship, it is queried that the target hash factor of the target message type mapping is a MAC address and a five-tuple.

[0052] Those skilled in the art will appreciate that the quintet may also be referred to as an IP quintet.

[0053] In the related art, when the type of message data is a non-IP message, the first step is to identify the export type of the non-IP message. For example, when the export type of the non-IP message is an ECMP export (i.e., an equal-cost multi-path routing port), it is controlled by manually configuring command line A. The command line A configured in this scenario performs hash routing calculation according to the five-tuple. When the export type of the non-IP message is an SG export (i.e., an aggregation port), it is controlled by manually configuring command line B. The command line B configured in this scenario performs hash routing calculation according to MAC (Media Access Control, media access control sublayer). The embodiment of the present application directly takes mac+five-tuple as the target hash factor, thereby realizing a unified solution. There is no need to identify the export type of the non-IP message, and the target hash factor for hash routing calculation can be directly determined. It is compatible with both ECMP export and SG export, reducing the configuration difficulty of the product presentation. In addition, it can also ensure that messages of the same message type are evenly shared on the same link or the same forwarding unit when hashing, thereby realizing orderly forwarding of message data.

[0054] In another embodiment, the first message type includes an IP message. In a case where the target message type is an IP message, the step of determining the target hash factor of the target message type mapping based on a preset message mapping relationship includes the following steps.

[0055] Step C10: According to the target message type, from the message mapping relationship, it is found that the target hash factor of the target message type mapping is a triple or a quintuple.

[0056] Those skilled in the art will appreciate that this triplet may also be referred to as an IP triplet.

[0057] In this embodiment, when the target message type is an IP message, the target hash factor of the target message type mapping is queried from the message mapping relationship as a triple or a quintuple, so that when the target message type is an IP message, the application embodiment directly queries and obtains the target hash factor as a triple or a quintuple from the message mapping relationship according to the target message type, which facilitates the subsequent hash calculation based on the triple or quintuple of the message data to obtain the target hash value, and determines the forwarding path of the message data based on the target hash value. As a result, the routing calculation of the ECMP factor in the embodiment of the application does not need to be controlled by additional configuration command lines, and hash routing can be achieved through different hash factors in different scenarios. That is, the embodiment of the application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty in product presentation.

[0058] In another embodiment, the first message type includes an encapsulated message, wherein the encapsulated message is an IP-in-IP message or a General Routing Encapsulation Protocol (GRE) message. When the target message type is the encapsulated message, the step of determining the target hash factor of the target message type mapping based on a preset message mapping relationship includes the following steps.

[0059] In step D10, according to the target message type, from the message mapping relationship, it is found that the target hash factor of the target message type mapping is an inner message.

[0060] In this embodiment, those skilled in the art will understand that the message encapsulated in the inner layer of the IP-in-IP message or the General Routing Encapsulation Protocol GRE message is an IP message, so the inner layer message of the encapsulated message is an IP message (or called an inner IP message).

[0061] Since other products in the related art require configuration commands to take effect when implementing the hash of the inner message, this embodiment, when the target message type is an IP-in-IP message or a general routing encapsulation protocol GRE message, queries and obtains the target hash factor of the target message type mapping from the message mapping relationship as the inner message, that is, when the target message type is an IP-in-IP message or a general routing encapsulation protocol GRE message, the embodiment of the present application directly queries and obtains the target hash factor as the inner message from the message mapping relationship according to the target message type, which facilitates the subsequent hash calculation based on the inner message of the message data to obtain the target hash value, and determines the forwarding path of the message data based on the target hash value, thereby making it possible for the embodiment of the present application to control the routing calculation of the ECMP factor through additional configuration command lines, and to implement hash routing through different hash factors in different scenarios, that is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty of product presentation.

[0062] In another embodiment, the first message type includes an SRV6 message. When the target message type is the SRV6 message, the step of determining the target hash factor of the target message type mapping based on a preset message mapping relationship includes the following steps.

[0063] In step E10, according to the target message type, from the message mapping relationship, a target hash factor of the target message type mapping is obtained as an inner message, and a flow label of an outer message is obtained.

[0064] In the related art, when the type of message data is an SRV6 message, it is often controlled by manually configuring command line C. In this scenario, the command line C configured is to perform hash routing calculation according to the inner message. However, this embodiment, on the basis of the target hash factor including the inner message, adds the flow label of the outer message, so that the embodiment of the present application can obtain the hash change of the flow label of the SRV6 message, and then provide more diverse message forwarding paths for SRV6 messages with different flow labels, so as to facilitate the even distribution of message data flow to each egress link, improve the accuracy of shared traffic, and effectively solve the problems of uneven link sharing and excessive shared traffic accuracy.

[0065] In addition, the embodiment of the present application does not require additional configuration command lines to control the routing calculation of the ECMP factor, and can implement hash routing through different hash factors in different scenarios. That is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty of product presentation, and effectively solving the technical problem that the hash configuration of the current hash routing method is complex and easy to misconfigure.

[0066] As another feasible implementation, when the target message type is a second message type, the message mapping relationship is a mapping relationship between the message type and the inner message information, and a hash factor, wherein the inner message information is obtained by parsing the inner message of the message data, and the second message type includes at least one of a virtual extended local area network VXLAN message and a multi-protocol label switching MPLS message.

[0067] That is, in the case where the target message type is the second message type, the step of determining the target hash factor of the target message type mapping based on the preset message mapping relationship includes the following steps.

[0068] Step F10: parsing the inner message of the message data to obtain inner message information.

[0069] Step F20 , according to the target message type and the inner message information, query and obtain the target hash factor of the inner message information mapping under the target message type from the message mapping relationship.

[0070] The inner message information is obtained by parsing the inner message of the message data, and the second message type includes at least one of a virtual extended local area network VXLAN message and a multi-protocol label switching MPLS message.

[0071] In this embodiment, when the target message type is the second message type, the message mapping relationship is a mapping relationship between the message type and the inner message information and the hash factor, wherein the inner message information is obtained by parsing the inner message of the message data, and the second message type includes at least one of a virtual extended local area network VXLAN message and a multi-protocol label switching MPLS message. Therefore, when the target message type is the second message type, according to the target message type, the target hash factor mapped to the inner message information under the target message type is queried from the message mapping relationship, which facilitates subsequent hash calculation based on the target hash factor to obtain the target hash value, and determines the forwarding path of the message data based on the target hash value. As a result, the routing calculation of the ECMP factor in the embodiment of the present application does not need to be controlled by additional configuration command lines, and hash routing can be achieved through different hash factors in different scenarios. That is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty in product presentation, and effectively solving the technical problem that the hash configuration of the current hash routing method is complex and easy to misconfigure.

[0072] In another embodiment, the second message type includes a virtual extended local area network VXLAN message, the inner message information is an inner message type corresponding to the inner message, and when the target message type is a virtual extended local area network VXLAN message and the inner message type is a non-IP message, the step of determining the target hash factor of the target message type mapping based on a preset message mapping relationship includes the following steps.

[0073] Step G10, according to the target message type and the inner message type, from the message mapping relationship, it is queried that under the target message type, the target hash factor of the inner message information mapping is the source port information and MAC information of the inner message.

[0074] When the target message type is a virtual extended local area network VXLAN message and the inner message type is an IP message, the step of determining the target hash factor of the target message type mapping based on a preset message mapping relationship includes the following steps.

[0075] Step H10, according to the target message type and the inner message type, from the message mapping relationship, query and obtain that under the target message type, the target hash factor of the inner message information mapping is one of the triplet and quintuple of the inner message, as well as the source port information of the inner message.

[0076] In this embodiment, when the target message type is a virtual extended local area network VXLAN message and the inner message type corresponding to the inner message is a non-IP message, the source port information and MAC information of the inner message are queried from the message mapping relationship. When the target message type is a virtual extended local area network VXLAN message and the inner message type is an IP message, the target hash factor is queried from the message mapping relationship. One of the triplet and the five-tuple, as well as the source port information of the inner message, is obtained. This enables the embodiment of the present application to support VXLAN messages with special marks. If the inner layer of the VXLAN message is a non-IP message, the inner layer MAC (i.e., MAC information) + V The port (i.e., source port information) in the XLAN header is hashed to obtain a hash routing value (i.e., target hash value). If the inner layer of the VXLAN message is an IP message, a hash calculation is performed according to the inner IP triplet or quintuple + the port (i.e., source port information) in the VXLAN header to obtain a hash routing value, which facilitates the subsequent determination of the forwarding path of the message data based on the hash routing value. As a result, the routing calculation of the ECMP factor in the embodiment of the present application does not need to be controlled by additional configuration command lines, and hash routing can be achieved through different hash factors in different scenarios. That is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty of product presentation.

[0077] In another embodiment, the second message type includes a Multi-Protocol Label Switching (MPLS) message, and the inner message information is content information corresponding to the inner message. When the target message type is a Multi-Protocol Label Switching (MPLS) message and the content information is IP information, the step of determining the hash factor of the inner message information mapping based on a preset message mapping relationship includes the following steps.

[0078] Step I10, based on the target message type and the content information, query from the message mapping relationship and obtain that under the target message type, the target hash factor of the inner message information mapping is one of the triplet and quintuple of the inner message, as well as the bottom stack label of the inner message.

[0079] In another embodiment, when the target message type is a Multi-Protocol Label Switching (MPLS) message and the content information is MAC information, the step of determining the hash factor of the inner message information mapping based on a preset message mapping relationship includes the following steps.

[0080] Step J10, according to the target message type and the content information, from the message mapping relationship, it is queried that under the target message type, the target hash factor of the inner message information mapping is the stack bottom label and MAC information of the inner message.

[0081] In this embodiment, when the target message type is a multi-protocol label switching MPLS message and the content information is IP information, the target hash factor is queried from the message mapping relationship to obtain one of the triplet and the quintuple of the inner message and the bottom label of the inner message, and when the target message type is a multi-protocol label switching MPLS message and the content information is MAC information, the target hash factor is queried to obtain the bottom label and MAC information of the inner message, so that when the target message type is an MPLS message, if the inner IP information can be parsed out, the inner IP triplet or quintuple is used to obtain the target hash factor. The IP five-tuple + the bottom label of the stack are hashed to obtain a hash routing value (i.e., the target hash value). If only the inner MAC information is parsed, the inner MAC + the bottom label are hashed to obtain a hash routing value, and the forwarding path of the message data is determined based on the target hash value. As a result, the routing calculation of the ECMP factor in the embodiment of the present application does not need to be controlled by additional configuration command lines, and hash routing can be achieved through different hash factors in different scenarios. That is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty of product presentation.

[0082] In one embodiment, when the target message type is a Multi-Protocol Label Switching (MPLS) message and the content information includes IP information and MAC information, the step of determining the hash factor of the inner message information mapping based on a preset message mapping relationship includes the following steps.

[0083] Step K10, based on the target message type and the content information, query from the message mapping relationship and obtain that under the target message type, the target hash factor of the inner message information mapping is one of the triplet and quintuple of the inner message, as well as the bottom stack label of the inner message.

[0084] In another embodiment, when the target message type is a Multi-Protocol Label Switching (MPLS) message and the content information does not include IP information and MAC information, the step of determining the hash factor of the inner message information mapping based on a preset message mapping relationship includes the following steps.

[0085] Step L10, according to the target message type and the content information, query from the message mapping relationship to obtain that under the target message type, the target hash factor of the inner message information mapping is the stack bottom label of the inner message.

[0086] In this embodiment, when the target message type is a multi-protocol label switching MPLS message and the content information includes IP information and MAC information, the target hash factor is queried from the message mapping relationship to obtain one of the triplet and the quintuple of the inner message and the bottom label of the inner message. In the case that the target message type is a multi-protocol label switching MPLS message and the content information does not include IP information and MAC information, the target hash factor is queried from the message mapping relationship to obtain the bottom label of the inner message. Therefore, when the target message type is an MPLS message, if the inner MAC and inner IP are both parsed out, the hash is fixedly performed according to the inner IP triplet or the IP quintuple + bottom label. The target hash value is obtained by hash calculation. If the inner MAC or inner IP is not parsed (that is, the content information of the inner message is neither IP information nor MAC information), the hash calculation is performed according to the bottom label of the stack to obtain the target hash value. However, the related art can only share in one way by default, and cannot perform intelligent hash calculation for multiple message types. The embodiment of the present application aims at the different content information of the inner message of the MPLS message, improves more diversified message forwarding paths, facilitates the uniform sharing of message data streams to each link, and each message stream is forwarded through the same link exit, thereby improving the accuracy of shared traffic. In the scenario where the target message type is an MPLS message, the diversity of message characteristics is retained, which can achieve load balancing in the network.

[0087] In addition, the embodiment of the present application does not require additional configuration command lines to control the routing calculation of the ECMP factor, and can implement hash routing through different hash factors in different scenarios. That is, the embodiment of the present application does not rely on the issuance of external command lines to achieve load sharing routing, thereby reducing the configuration difficulty of product presentation, and effectively solving the technical problem that the hash configuration of the current hash routing method is complex and easy to misconfigure.

[0088] In order to help understand the technical concept of the embodiments of the present application, a hash routing method of a specific embodiment is listed, with reference to Figures 3 and 4. Figure 3 is an implementation flow chart of the hash routing method in the related art, and Figure 4 is an implementation flow chart of the hash routing method of a specific embodiment of the present application, including the following main process steps:

[0089] The technical solution of the present application is further described below in conjunction with the accompanying drawings.

[0090] As can be seen from Figure 4, according to the implementation process of the embodiment of the present application, it is possible to implement hash routing through different hash factors in different scenarios without the need for control through configuration command lines. Compared with the traditional implementation shown in Figure 3, the entire process is simpler and clearer. The embodiment of the present application is based on providing a load sharing method based on an intelligent hash algorithm (this method is applicable to product ECMP and aggregation port sharing). The priority of the intelligent hash algorithm is greater than the configuration command. Therefore, for devices with load sharing configuration command errors, this embodiment can ensure that the erroneous command does not take effect, so that the sharing is implemented according to the established rules.

[0091] Referring to the implementation process in Figure 4 , it can be seen that during configuration, the priority of the intelligent hash algorithm in this embodiment is higher than the priority of the configuration command. Therefore, for devices with load sharing configuration commands, incorrectly configured commands can be disabled, and the intelligent hash algorithm in this embodiment can be used to select load sharing routes. In addition, this intelligent hash algorithm can be improved and customized according to user needs, improving compatibility.

[0092] The above specific embodiments are only used to help understand the technical concept of the embodiments of this application and do not constitute a limitation of this application. More simple transformations based on the technical concept should all be within the scope of protection of this application.

[0093] In addition, an embodiment of the present application also provides an electronic device, which may be, for example, a router or switch product, or a PC (Personal Computer), or an RG (Residential Gateway), CPE (Customer Premise Equipment), VoIP (Voice over Internet Protocol), IPTV (Internet Protocol Television), STB (Set Top Box), IAD (Integrated Access Device), and other electronic devices with a message forwarding function. This embodiment does not make specific limitations on this.

[0094] Referring to Figure 5, Figure 5 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. As shown in Figure 5, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0095] Those skilled in the art will appreciate that the structure shown in FIG5 does not limit the electronic device and may include more or fewer components than shown, or combine certain components, or arrange the components differently. As shown in FIG5 , the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module, and a hash routing program.

[0096] In the electronic device shown in Figure 5, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in this embodiment can be set in the communication device, and the communication device calls the hash routing program stored in the memory 1005 through the processor 1001, and executes the hash routing method provided in any of the above embodiments.

[0097] The terminal proposed in this embodiment and the hash routing method proposed in the above embodiment belong to the same inventive concept. Technical details not fully described in this embodiment can be referred to any of the above embodiments, and this embodiment has the same beneficial effects as executing the hash routing method.

[0098] In addition, an embodiment of the present application also proposes a computer-readable storage medium, which may be a non-volatile computer-readable storage medium. A hash routing program is stored on the computer-readable storage medium, and when the hash routing program is executed by a processor, the hash routing method of the present application as described above is implemented.

[0099] The various embodiments of the electronic device and computer-readable storage medium of the present application can refer to the various embodiments of the hash routing method of the present application, and will not be repeated here.

[0100] As used herein, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or system that includes the element.

[0101] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0102] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling an electronic device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0103] The above are only some embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A hash routing method, comprising: Obtaining current packet data and identifying a target packet type of the packet data; Determining a target hash factor mapped by the target packet type based on a preset packet mapping relationship; Performing hash calculation based on the target hash factor to obtain a target hash value, where the target hash value is used to determine a forwarding path of the packet data.

2. The hash routing method according to claim 1, wherein, The step of performing hash calculation based on the target hash factor to obtain a target hash value includes: Locating a target feature field in the packet data according to the target hash factor; Identifying the content in the target feature field and performing hash calculation according to the identified content to obtain a target hash value.

3. The hash routing method according to claim 1, wherein, When the target packet type is a first packet type, the packet mapping relationship is a mapping relationship between a packet type and a hash factor, where the first packet type includes at least one of a non-IP packet, an IP packet, an IP-in-IP packet, a Generic Routing Encapsulation (GRE) packet, and an SRv6 packet.

4. The hash routing method according to claim 3, wherein, The first packet type includes a non-IP packet. When the target packet type is a non-IP packet, the step of determining a target hash factor mapped by the target packet type based on the preset packet mapping relationship includes: Querying from the packet mapping relationship according to the target packet type to obtain that the target hash factor mapped by the target packet type is a MAC address and a five-tuple.

5. The hash routing method according to claim 3, wherein, The first packet type includes an IP packet. When the target packet type is an IP packet, the step of determining a target hash factor mapped by the target packet type based on the preset packet mapping relationship includes: Querying from the packet mapping relationship according to the target packet type to obtain that the target hash factor mapped by the target packet type is a three-tuple or a five-tuple.

6. The hash routing method according to claim 3, wherein The first packet type includes an encapsulated packet, where the encapsulated packet is an IP-in-IP packet or a GRE packet. When the target packet type is the encapsulated packet, the step of determining a target hash factor mapped by the target packet type based on the preset packet mapping relationship includes: Querying from the packet mapping relationship according to the target packet type to obtain that the target hash factor mapped by the target packet type is an inner-layer packet.

7. The hash routing method according to claim 3, wherein, The first packet type includes an SRv6 packet. When the target packet type is the SRv6 packet, the step of determining a target hash factor mapped by the target packet type based on the preset packet mapping relationship includes: Querying from the packet mapping relationship according to the target packet type to obtain that the target hash factor mapped by the target packet type is an inner-layer packet and a flow label of an outer-layer packet.

8. The hash routing method according to claim 1, wherein When the target message type is the second message type, the message mapping relationship is the mapping relationship between the message type and the inner message information, and the hash factor, where the inner message information is obtained by parsing the inner message of the message data, and the second message type includes at least one of a Virtual eXtensible Local Area Network (VXLAN) message and a Multiprotocol Label Switching (MPLS) message.

9. The hash routing method according to claim 8, wherein, When the target message type is the second message type, the step of determining the target hash factor mapped by the target message type based on the preset message mapping relationship includes: Parsing the inner message of the message data to obtain the inner message information; Querying from the message mapping relationship according to the target message type and the inner message information to obtain the target hash factor mapped by the inner message information under the target message type.

10. The hash routing method according to claim 8, wherein, The second message type includes a Virtual eXtensible Local Area Network (VXLAN) message, and the inner message information is the inner message type corresponding to the inner message. When the target message type is a Virtual eXtensible Local Area Network (VXLAN) message and the inner message type is a non-IP message, the step of determining the target hash factor mapped by the target message type based on the preset message mapping relationship includes: Querying from the message mapping relationship according to the target message type and the inner message type to obtain that the target hash factor mapped by the inner message information under the target message type is the source port information and MAC information of the inner message.

11. The hash routing method according to claim 10, wherein, When the target message type is a Virtual eXtensible Local Area Network (VXLAN) message and the inner message type is an IP message, the step of determining the target hash factor mapped by the target message type based on the preset message mapping relationship includes: Querying from the message mapping relationship according to the target message type and the inner message type to obtain that the target hash factor mapped by the inner message information under the target message type is one of the triple and quintuple of the inner message, and the source port information of the inner message.

12. The hash routing method according to claim 8, wherein, The second message type includes a Multiprotocol Label Switching (MPLS) message, and the inner message information is the content information corresponding to the inner message. When the target message type is a Multiprotocol Label Switching (MPLS) message and the content information is IP information, the step of determining the hash factor mapped by the inner message information based on the preset message mapping relationship includes: Querying from the message mapping relationship according to the target message type and the content information to obtain that the target hash factor mapped by the inner message information under the target message type is one of the triple and quintuple of the inner message, and the bottom label of the inner message stack.

13. The hash routing method according to claim 12, wherein, When the target message type is a Multiprotocol Label Switching (MPLS) message and the content information is MAC information, the step of determining the hash factor mapped by the inner message information based on the preset message mapping relationship includes: According to the target message type and the content information, from the message mapping relationship, it is queried that under the target message type, the target hash factor mapped by the inner message information is the bottom stack label and MAC information of the inner message.

14. The hash routing method according to claim 13, wherein, When the target message type is a Multiprotocol Label Switching (MPLS) message and the content information all includes IP information and MAC information, the step of determining the hash factor mapped by the inner message information based on the preset message mapping relationship includes: According to the target message type and the content information, from the message mapping relationship, it is queried that under the target message type, the target hash factor mapped by the inner message information is one of the triple and quintuple of the inner message, and the bottom stack label of the inner message.

15. The hash routing method according to claim 13, wherein, When the target message type is a Multiprotocol Label Switching (MPLS) message and the content information does not include IP information and MAC information, the step of determining the hash factor mapped by the inner message information based on the preset message mapping relationship includes: According to the target message type and the content information, from the message mapping relationship, it is queried that under the target message type, the target hash factor mapped by the inner message information is the bottom stack label of the inner message.

16. An electronic device, comprising: A memory, a processor, and a hash routing program stored on the memory and executable on the processor, where when the hash routing program is executed by the processor, it implements the hash routing method according to any one of claims 1 to 15.

17. A computer-readable storage medium, wherein, A hash routing program is stored on the computer-readable storage medium, and when the hash routing program is executed by the processor, it implements the hash routing method according to any one of claims 1 to 15.

Citation Information

Patent Citations

  • Message forwarding method and device

    CN113542131A

  • Method and system for flexibly generating hash value for network load sharing application

    CN116192730A

  • Hash load balancing method and device, equipment and medium

    CN116996446A

  • Network processing apparatus and packet processing method

    JP2018033017A