Embodiments of the present invention relate to the field of communications technologies, and in particular, to a packet processing method and a router.
In a Segment Routing (SR) technology, a control plane uses an Interior Gateway Protocol (IGP) based on a link state, such as the Intermediate System to Intermediate System (IS-IS) protocol or the Open Shortest Path First (OSPF) protocol to transfer a Multiprotocol Label Switching (MPLS) Tunnel Label (TL) that is of a Label Switching Router (LSR) and has global significance, and a data plane forwards an MPLS packet based on the TL that is sent by the control plane and has global significance. Compared with an existing MPLS technology system, the segment routing technology simplifies operation, maintenance, and management of an MPLS network, and an existing label advertisement protocol such as the Label Distribution Protocol (LDP), the Resource Reservation Protocol-Traffic Engineering (RSVP-TE), or the Border Gateway Protocol (BGP) is not required in an SR network.
An Entropy Label (EL) technology is a method for implementing a load balancing capability of an MPLS network, and a basic idea is as follows: An ingress (Ingress) LSR of an MPLS tunnel inserts an Entropy Label Indicator (ELI) and an entropy label (Entropy Label) into an MPLS label stack (Label Stack), where the ELI is a reserved label, and a value of the label is 7, indicating that an MPLS label following the ELI is an EL. In this case, when an MPLS packet that carries the foregoing ELI and EL passes through a transit (Transit) LSR, the Transit LSR can obtain the EL, perform hash (Hash) processing on the EL, and perform load balancing processing on the MPLS packet based on a Hash result. In an SR network, the Ingress LSR of the MPLS tunnel cannot determine whether an egress (Egress) LSR of the MPLS tunnel has Entropy Label Capability (ELC); therefore, the SR network does not support the EL technology and the Transit LSR cannot use the EL technology to implement load balancing for forwarding of the MPLS packet.
Embodiments of the present invention provide a packet processing method and an LSR, which help resolve a problem in the prior art that an SR network does not support an EL technology.
According to a first aspect, a method of receiving an entropy label capability is provided, where the method is applicable to an SR network, and the method includes: receiving, by a first node, a notification packet that is based on an Interior Gateway Protocol (IGP) and is flooded by a second node, wherein the notification packet is generated by the second node, the notification packet comprises a entropy label capability (ELC) flag, the first ELC flag is used to indicate that the second node has ELC.
According to a second aspect, a method of sending an entropy label capability is provided, where the method is applicable to an SR network, and the method includes: flooding, by the second node, a notification packet that is based on an Interior Gateway Protocol (IGP), wherein the notification packet comprises an entropy label capability (ELC) flag, and wherein the ELC flag is used to indicate that the second node has EL.
According to a third aspect, an first node is provided, where the first node is applicable to an SR network, and the first node includes: a receiver, configured to receive a notification packet that is based on an Interior Gateway Protocol (IGP) and is flooded by a second node, wherein the notification packet is generated by the second node, the notification packet comprises a entropy label capability (ELC) flag, the first ELC flag is used to indicate that the second node has ELC.
According to a fourth aspect, an second node is provided, where the second node is applicable to an SR network, and the second node includes: a sender, configured to flood a notification packet that is based on an Interior Gateway Protocol (IGP), wherein the notification packet comprises an entropy label capability (ELC) flag, and wherein the ELC flag is used to indicate that the second node has ELC.
In the foregoing technical solutions, the ELC can be obtained in the SR network, which helps implement an EL technology in the SR network.
To describe the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings in the following description show merely some embodiments of the present invention, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.
To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following clearly describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some rather than all of the embodiments of the present invention. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
Referring to
101. An Ingress LSR receives a first notification packet that is based on an IGP and is sent by a first Egress LSR, where the first notification packet is generated by the first Egress LSR, the first notification packet includes a first ELC flag, the first ELC flag is used to indicate that the first Egress LSR has ELC, the Ingress LSR is an Ingress LSR of a first MPLS tunnel, and the first Egress LSR is an Egress LSR of the first MPLS tunnel.
102. When the Ingress LSR learns from the first notification packet that the first Egress LSR has ELC, the Ingress LSR inserts a label into a first packet that enters the first MPLS tunnel, to generate a second packet, where the label forms an MPLS label stack, the MPLS label stack includes, from bottom to top, a first EL, a first ELI, and a first TL, the first TL is a label that identifies the first MPLS tunnel, and the first TL is allocated by the first Egress LSR in the first MPLS tunnel.
103. Send the second packet to the first Egress LSR through the first MPLS tunnel.
Optionally, when a neighbor relationship is established between network nodes in the SR network by using OSPF, the first notification packet is an OSPF Router Information LSA that includes an OSPF Router Informational Capabilities TLV. For a format of the OSPF Router Information LSA, refer to RFC 4970 released by the Internet Engineering Task Force (Internet Engineering Task Force, IETF). Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by running IS-IS, the first notification packet is an IS-IS LSP that includes an ELC Sub-TLV, and the ELC Sub-TLV is added to an IS-IS Router Capability TLV in the LSP to carry the first ELC flag. For a definition of the IS-IS Router Capability TLV, refer to RFC 4971 released by the IETF, and for a format of the ELC Sub-TLV, refer to
A Type field is used to indicate that a TLV including Type is the ELC Sub-TLV, and a value of Type is assigned by the Internet Assigned Numbers Authority (Internet Assigned Numbers Authority, IANA).
A Length field is used to identify a length of a Value field of the ELC Sub-TLV.
The Value field is used to carry the first ELC flag, where when a value of the Value field is 1, it indicates that the first Egress LSR has ELC; when the value of the Value field is 0, it indicates that the first Egress LSR does not have ELC.
Optionally, to reduce a total length of the ELC Sub-TLV, the ELC Sub-TLV shown in
When receiving the second packet, a Transit LSR in the first MPLS tunnel parses the second packet to obtain the first EL, performs Hash processing on the first EL, and performs, according to a Hash result, load balancing when forwarding the second packet. Because the first Egress LSR has ELC, when the second packet arrives at the first Egress LSR, and the first Egress LSR determines that a topmost label of the MPLS label stack is the first ELI, the first Egress LSR pops up the first EL and the first ELI in the MPLS label stack to generate the first packet and processes the first packet. To describe the foregoing packet processing process more clearly, an example is used for description. As shown in
Optionally, if the first MPLS tunnel traverses a second MPLS tunnel, the method further includes: receiving, by the Ingress LSR, a second notification packet that is based on an IGP and is flooded by a second Egress LSR, where the second notification packet includes a second ELC flag, the second ELC flag is used to indicate that the second Egress LSR has ELC, the second Egress LSR is an Egress LSR of the second MPLS tunnel, the MPLS label stack further includes a second TL above the first TL, the second TL is a label that identifies the second MPLS tunnel, and the second TL is allocated by the second Egress LSR in the second MPLS tunnel; and when the Ingress LSR determines that the MPLS label stack has already included the first EL, omitting to insert a second EL and a second ELI between the first TL and the second TL in the MPLS label stack. Because inserting the second EL and the second ELI into the MPLS label stack is omitted, a depth of the MPLS label stack can be effectively reduced, thereby reducing a total length of the second packet and avoiding excessive occupation of network bandwidth.
Optionally, when a neighbor relationship is established between network nodes in the SR network by using OSPF, the second notification packet is an OSPF Router Information LSA that includes an OSPF Router Informational Capabilities TLV. Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by running IS-IS, the second notification packet is an IS-IS LSP that includes an ELC Sub-TLV, and the ELC Sub-TLV is added to an IS-IS Router Capability TLV in the LSP to carry the second ELC flag. For a format of the ELC Sub-TLV, refer to
To describe the foregoing packet processing process more clearly, an example is used for description. As shown in
In the foregoing technical solution, by receiving a first notification packet generated by a first Egress LSR, an Ingress LSR can learn that the first Egress LSR has ELC, and then insert a first EL, a first ELI, and a first TL label into a first packet that enters a first MPLS tunnel, to generate a second packet. In this way, a Transit LSR of the first MPLS tunnel can perform, according to the first EL, load balancing when forwarding the second packet. When receiving the second packet and determining that a topmost label of a first MPLS label stack is the ELI, the first Egress LSR pops up the ELI and the EL to restore the first packet and continues to process the first packet, so that an EL technology can be implemented in an SR network.
Referring to
601. An Egress LSR of an MPLS tunnel generates a notification packet that is based on an IGP, where the notification packet includes an ELC flag, and the ELC flag is used to indicate that the Egress LSR has ELC.
602. Flood the notification packet to the SR network, where the notification packet is used to enable an Ingress LSR of the MPLS tunnel to learn that the Egress LSR has ELC.
603. Receive a second packet from the Ingress LSR, where an MPLS label stack of the second packet includes an EL and an ELI.
604. When it is determined that a topmost label of the MPLS label stack is the ELI, pop up the EL and the ELI in the MPLS label stack to generate a first packet.
605. Process the first packet.
Optionally, when a neighbor relationship is established between network nodes in the SR network by using OSPF, the notification packet is an OSPF Router Information LSA that includes an OSPF Router Informational Capabilities TLV. Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by running IS-IS, the first notification packet is an IS-IS LSP that includes an ELC Sub-TLV, and the ELC Sub-TLV is added to an IS-IS Router Capability TLV in the LSP to carry the ELC flag. For a format of the ELC Sub-TLV, refer to
When the Ingress LSR determines that the Egress LSR has ELC, the Ingress LSR inserts the EL and the ELI into the first packet that enters the MPLS tunnel, to generate a second packet. When receiving the second packet, a Transit LSR in the MPLS tunnel parses the second packet to obtain the EL, performs Hash processing on the EL, and performs, according to a Hash result, load balancing when forwarding the second packet. Because the Egress LSR has ELC, when the second packet arrives at the Egress LSR, and the Egress LSR determines that the topmost label of the MPLS label stack is the ELI, the Egress LSR pops up the ELI and the EL to restore the first packet and continues to process the first packet.
Optionally, the processing the first packet specifically includes: when the MPLS label stack in a packet header of the first packet further includes a label corresponding to another LSR, performing forwarding according to the label of the another LSR, or when a packet header of the first packet does not include a label of another LSR, and a destination address in the packet header of the first packet is an address of the Egress LSR, performing corresponding processing on the first packet according to a payload of the first packet, or when a packet header of the first packet does not include a label of another LSR, and a destination address in the packet header of the first packet is not an address of the Egress LSR, performing forwarding according to the destination address.
According to the technical solution provided in this embodiment of the present invention, an Egress LSR generates a notification packet that includes an ELC flag, and sends the notification packet to an Ingress LSR of an MPLS tunnel. In this way, the Ingress LSR can determine that the Egress LSR has ELC; further, the Ingress LSR inserts an EL and an ELI into a first packet that enters the MPLS tunnel, to generate a second packet. A Transit LSR of the MPLS tunnel can perform, according to the EL, load balancing when forwarding the second packet. When receiving the second packet and determining that a topmost label of an MPLS label stack is the ELI, the Egress LSR pops up the ELI and the EL to restore the first packet and continues to process the first packet, so that an EL technology can be implemented in an SR network.
Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by using OSPF, the first notification packet is an OSPF Router Information LSA that includes an OSPF Router Informational Capabilities TLV. Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by running IS-IS, the notification packet is an IS-IS LSP that includes an ELC Sub-TLV, and the ELC Sub-TLV is added to an IS-IS Router Capability TLV in the LSP to carry the first ELC flag. For a format of the ELC Sub-TLV, refer to
When receiving the second packet, a Transit LSR in the first MPLS tunnel parses the second packet to obtain the first EL, performs Hash processing on the first EL, and performs, according to a Hash result, load balancing when forwarding the second packet. Because the first Egress LSR has ELC, when the second packet arrives at the first Egress LSR, and the first Egress LSR determines that a topmost label of the MPLS label stack is the first ELI, the first Egress LSR pops up the first EL and the first ELI in the MPLS label stack to restore the first packet and continues to process the first packet.
Optionally, when the first MPLS tunnel traverses a second MPLS tunnel, the receiving unit 701 is further configured to receive a second notification packet that is based on an IGP and is flooded by a second Egress LSR, where the second notification packet includes a second ELC flag, the second ELC flag is used to indicate that the second Egress LSR has ELC, the second Egress LSR is an Egress LSR of the second MPLS tunnel, the MPLS label stack further includes a second TL above the first TL, the second TL is a label that identifies the second MPLS tunnel, and the second TL is allocated by the second Egress LSR in the second MPLS tunnel.
The processing unit 703 is further configured to: when it is determined that the MPLS label stack has already included the first EL, omit to insert a second EL and a second ELI between the first TL and the second TL in the MPLS label stack. When performing MPLS forwarding, a Transit LSR in the second MPLS tunnel may perform, according to the first EL, load balancing during forwarding. Because inserting the second EL and the second ELI between the first TL and the second TL is omitted, a depth of the MPLS label stack can be effectively reduced, thereby reducing a total length of the second packet and avoiding excessive occupation of network bandwidth.
According to the technical solution provided in this embodiment of the present invention, by receiving a first notification packet generated by a first Egress LSR, an LSR 700 can learn that the first Egress LSR has ELC, and further insert a first EL, a first ELI, and a first TL label into a first packet that enters a first MPLS tunnel, to generate a second packet. In this way, a Transit LSR of the first MPLS tunnel can perform, according to the first EL, load balancing when forwarding the second packet. When receiving the second packet and determining that a topmost label of a first MPLS label stack is the ELI, the first Egress LSR pops up the ELI and the EL to restore the first packet and continues to process the first packet, so that an EL technology can be implemented in an SR network.
Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by using OSPF, the first notification packet is an OSPF Router Information LSA that includes an OSPF Router Informational Capabilities TLV. Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by running IS-IS, the notification packet is an IS-IS LSP that includes an ELC Sub-TLV, and the ELC Sub-TLV is added to an IS-IS Router Capability TLV in the LSP to carry the ELC flag. For a format of the ELC Sub-TLV, refer to
When receiving the second packet, a Transit LSR in the first MPLS tunnel parses the second packet to obtain the first EL, performs Hash processing on the first EL, and performs, according to a Hash result, load balancing when forwarding the second packet. Because the first Egress LSR has ELC, when the second packet arrives at the first Egress LSR, and the first Egress LSR determines that a topmost label of the MPLS label stack is the first ELI, the first Egress LSR pops up the first EL and the first ELI in the MPLS label stack to restore the first packet and continues to process the first packet.
Optionally, when the first MPLS tunnel traverses a second MPLS tunnel, the processor 804 is further configured to invoke the program instructions stored in the memory 801 to perform the following operations: triggering the receiver 802 to receive a second notification packet that is based on an IGP and is flooded by a second Egress LSR, where the second notification packet includes a second ELC flag, the second ELC flag is used to indicate that the second Egress LSR has ELC, the second Egress LSR is an Egress LSR of the second MPLS tunnel, the MPLS label stack further includes a second TL above the first TL, and the second TL is a label in the second MPLS tunnel and corresponding to the second Egress LSR; and when it is determined that the MPLS label stack has already included the first EL, omitting to insert a second EL and a second ELI between the first TL and the second TL in the MPLS label stack.
When performing MPLS forwarding, a Transit LSR in the second MPLS tunnel may perform, according to the first EL, load balancing during forwarding. Because inserting the second EL and the second ELI between the first TL and the second TL is omitted, a depth of the MPLS label stack can be effectively reduced, thereby reducing a total length of the second packet and avoiding excessive occupation of network bandwidth.
Optionally, the processor 804 may be a Central Processing Unit (CPU), the memory 801 may be an internal memory of a random access memory (Random Access Memory, RAM) type, the receiver 802 and the transmitter 803 may include a common physical interface, and the physical interface may be an Ethernet interface or an Asynchronous Transfer Mode (ATM) interface. The processor 804, the receiver 802, the transmitter 803, and the memory 801 may be integrated into one or more independent circuits or hardware, for example, an Application Specific Integrated Circuit (ASIC).
According to the technical solution provided in this embodiment of the present invention, by receiving a first notification packet generated by a first Egress LSR, an LSR 800 can learn that the first Egress LSR has ELC, and further insert a first EL, a first ELI, and a first TL label into a first packet that enters a first MPLS tunnel, to generate a second packet. In this way, a Transit LSR of the first MPLS tunnel can perform, according to the first EL, load balancing when forwarding the second packet. When receiving the second packet and determining that a topmost label of a first MPLS label stack is the ELI, the first Egress LSR pops up the ELI and the EL to restore the first packet and continues to process the first packet, so that an EL technology can be implemented in an SR network.
Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by using OSPF, the first notification packet is an OSPF Router Information LSA that includes an OSPF Router Informational Capabilities TLV. Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by running IS-IS, the first notification packet is an IS-IS LSP that includes an ELC Sub-TLV, and the ELC Sub-TLV is added to an IS-IS Router Capability TLV in the LSP to carry the ELC flag. For a format of the ELC Sub-TLV, refer to
When the Ingress LSR determines that the LSR 900 has ELC, the Ingress LSR inserts the EL and the ELI into the first packet that enters the MPLS tunnel, to generate the second packet. When receiving the second packet, a Transit LSR in the MPLS tunnel parses the second packet to obtain the EL, performs Hash processing on the EL, and performs, according to a Hash result, load balancing when forwarding the second packet. Because the LSR 900 has ELC, when the second packet arrives at the LSR 900, and the LSR 900 determines that the topmost label of the MPLS label stack is the ELI, the LSR 900 pops up the ELI and the EL to restore the first packet and continues to forward the first packet.
According to the technical solution provided in this embodiment of the present invention, an LSR 900 generates a notification packet that includes an ELC flag, and sends the notification packet to an Ingress LSR of an MPLS tunnel. In this way, the Ingress LSR can determine that the LSR 900 has ELC; further, the Ingress LSR inserts an EL and an ELI into a first packet that enters an MPLS tunnel, to generate a second packet. A Transit LSR of the MPLS tunnel can perform, according to the EL, load balancing when forwarding the second packet. When receiving the second packet and determining that a topmost label of an MPLS label stack is the ELI, the LSR 900 pops up the ELI and the EL to restore the first packet and continues to process the first packet, so that an EL technology can be implemented in an SR network.
Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by using OSPF, the first notification packet is an OSPF Router Information LSA that includes an OSPF Router Informational Capabilities TLV. Referring to
Optionally, when a neighbor relationship is established between network nodes in the SR network by running IS-IS, the first notification packet is an IS-IS LSP that includes an ELC Sub-TLV, and the ELC Sub-TLV is added to an IS-IS Router Capability TLV in the LSP to carry the ELC flag. For a format of the ELC Sub-TLV, refer to
When the Ingress LSR determines that the LSR 1000 has ELC, the Ingress LSR inserts the EL and the ELI into the first packet that enters the MPLS tunnel, to generate a second packet. When receiving the second packet, a Transit LSR in the MPLS tunnel parses the second packet to obtain the EL, performs Hash processing on the EL, and performs, according to a Hash result, load balancing when forwarding the second packet. Because the LSR 1000 has ELC, when the second packet arrives at the LSR 1000, and the LSR 1000 determines that the topmost label of the MPLS label stack is the ELI, the LSR 1000 pops up the ELI and the EL to restore the first packet and continues to process the first packet.
Optionally, the processor 1004 may be a CPU, the memory 1001 may be an internal memory of a RAM type, the receiver 1002 and the transmitter 1003 may include a common physical interface, and the physical interface may be an Ethernet interface or an ATM interface. The processor 1004, the receiver 1002, the transmitter 1003, and the memory 1001 may be integrated into one or more independent circuits or hardware, for example, an ASIC.
According to the technical solution provided in this embodiment of the present invention, an LSR 1000 generates a notification packet that includes an ELC flag and sends the notification packet to an Ingress LSR of an MPLS tunnel. In this way, the Ingress LSR can determine that the LSR 1000 has ELC; further, the Ingress LSR inserts an EL and an ELI into a first packet that enters the MPLS tunnel, to generate a second packet. A Transit LSR of the MPLS tunnel can perform, according to the EL, load balancing when forwarding the second packet. When receiving the second packet and determining that a topmost label of an MPLS label stack is the ELI, the LSR 1000 pops up the ELI and the EL to restore the first packet and continues to performing process on the first packet, so that an EL technology can be implemented in an SR network.
In the embodiments of the present invention, the word “first” in a first MPLS tunnel, a first Egress LSR, a first TL, a first packet, and a first EL is only used as a name identifier, and does not indicate the first in a sequence. This rule is also applicable to the word “second”, “third”, and “fourth”.
A person of ordinary skill in the art may understand that all or some of the steps of the foregoing method embodiments may be implemented by program instructing related hardware. The program may be stored in a computer readable storage medium. When the program runs, the steps of the foregoing method embodiments are performed. The foregoing storage medium may be at least one of the following mediums: any medium that can store program code, such as a read-only memory (Read-Only Memory, ROM), a RAM, a magnetic disk, or an optical disc.
Finally, it should be noted that the foregoing embodiments are merely intended for exemplarily describing the technical solutions of the present invention other than limiting the present invention. Although the present invention and benefits of the present invention are described in detail with reference to the foregoing embodiments, persons of ordinary skill in the art should understand that they may still make modifications to the technical solutions described in the foregoing embodiments or make equivalent replacements to some technical features thereof, without departing from the scope of the claims of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
201310227560.6 | Jun 2013 | CN | national |
This application is a continuation of U.S. patent application Ser. No. 16/442,146, filed on Jun. 14, 2019, now U.S. Pat. No. 10,965,590, which is a continuation of U.S. patent application Ser. No. 15/910,865, filed on Mar. 2, 2018, now U.S. Pat. No. 10,326,693. which is a continuation of U.S. patent application Ser. No. 14/960,971, filed on Dec. 7, 2015, now U.S. Pat. No. 9,942,136, which is a continuation of International Patent Application No. PCT/CN2014/077659, filed on May 16, 2014, which claims priority to Chinese Patent Application No. 201310227560.6, filed on Jun. 8, 2013. All of the afore-mentioned patent applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | 16442146 | Jun 2019 | US |
Child | 17216116 | US | |
Parent | 15910865 | Mar 2018 | US |
Child | 16442146 | US | |
Parent | 14960971 | Dec 2015 | US |
Child | 15910865 | US | |
Parent | PCT/CN2014/077659 | May 2014 | US |
Child | 14960971 | US |