PACKET SENDING METHOD AND DEVICE
20230198891 · 2023-06-22
Inventors
Cpc classification
H04L43/106
ELECTRICITY
H04L45/50
ELECTRICITY
International classification
Abstract
Embodiments of this application provide a packet sending method and a device, to improve packet transmission efficiency. The method includes: A first network device receives a first packet from a second network device, where the first packet includes information about a first forwarding path, and the first forwarding path is a forwarding path for sending the first packet from the second network device to the first network device. The first network device obtains information about a second forwarding path based on the information about the first forwarding path, where the second forwarding path is a reverse path of the first forwarding path. The first network device sends a second packet to the second network device through the second forwarding path, where the second packet carries the information about the second forwarding path.
Claims
1. A packet sending method, wherein the method comprises: receiving, by a first network device, a first packet from a second network device, wherein the first packet comprises information about a first forwarding path, and the first forwarding path is a forwarding path for sending the first packet from the second network device to the first network device; obtaining, by the first network device, information about a second forwarding path based on the information about the first forwarding path, wherein the second forwarding path is a reverse path of the first forwarding path; and sending, by the first network device, a second packet to the second network device through the second forwarding path, wherein the second packet carries the information about the second forwarding path.
2. The method according to claim 1, wherein the first packet comprises indication information, and the obtaining, by the first network device, information about a second forwarding path based on the information about the first forwarding path comprises: obtaining, by the first network device, the information about the second forwarding path based on the information about the first forwarding path and an indication of the indication information.
3. The method according to claim 2, wherein the first packet is a bidirectional forwarding detection (BFD) packet, and the indication information is carried in a reserved R field of the BFD packet; or the first packet is a two-way active measurement protocol (TWAMP) packet or a simple two-way active measurement protocol (STAMP) packet, and the indication information is carried in a type length value (TLV) field of the TWAMP packet or the STAMP packet; or the first packet is a seamless bidirectional forwarding detection (SBFD) packet, and the indication information is carried in an internet protocol version 6 (IPv6) extension header of the SBFD packet.
4. The method according to claim 1, wherein the first forwarding path passes through a third network device, and the information about the first forwarding path comprises an identifier of the third network device.
5. The method according to claim 1, wherein the first forwarding path passes through a third network device, and the information about the first forwarding path comprises a segment identifier (SID) corresponding to an interface used by the third network device to receive the first packet.
6. The method according to claim 1, wherein the first packet comprises in-band operations, administration and maintenance (IOAM) or in-band network telemetry (INT), and the IOAM or the INT comprises the information about the first forwarding path.
7. The method according to claim 1, wherein the first packet comprises a segment routing header (SRH), and the information about the first forwarding path is carried in the SRH.
8. The method according to claim 7, wherein the information about the first forwarding path comprises a first segment identifier list (SID) list, the information about the second forwarding path comprises a second SID list, and segment identifier SIDS comprised in the second SID list and SIDS comprised in the first SID list are the same, and are arranged in sequences reverse to each other.
9. An apparatus, comprising: at least one processor; at least one non-transitory computer-readable storage medium storing a program to be executed by the at least one processor, the program including instructions to: receive a first packet from a second network device, wherein the first packet comprises information about a first forwarding path, and the first forwarding path is a forwarding path for sending the first packet from the second network device to the first network device; obtain information about a second forwarding path based on the information about the first forwarding path, wherein the second forwarding path is a reverse path of the first forwarding path; and send a second packet to the second network device through the second forwarding path, wherein the second packet carries the information about the second forwarding path.
10. The apparatus according to claim 9, wherein the instructions further include instructions to: obtain the information about the second forwarding path based on the information about the first forwarding path and an indication of indication information, wherein the first packet comprises indication information.
11. The apparatus according to claim 10, wherein the first packet is a bidirectional forwarding detection (BFD) packet, and the indication information is carried in a reserved R field of the BFD packet; or the first packet is a two-way active measurement protocol (TWAMP) packet or a simple two-way active measurement protocol (STAMP) packet, and the indication information is carried in a type length value (TLV) field of the TWAMP packet or the STAMP packet; or the first packet is a seamless bidirectional forwarding detection (SBFD) packet, and the indication information is carried in an internet protocol version 6 IPv6 extension header of the SBFD packet.
12. The apparatus according to claim 9, wherein the first forwarding path passes through a third network device, and the information about the first forwarding path comprises an identifier of the third network device.
13. The apparatus according to claim 9, wherein the first forwarding path passes through a third network device, and the information about the first forwarding path comprises a segment identifier (SID) corresponding to an interface used by the third network device to receive the first packet.
14. The apparatus according to claim 9, wherein the first packet comprises in-band operations, administration and maintenance (IOAM) or in-band network telemetry (INT), and the IOAM or the INT comprises the information about the first forwarding path.
15. The apparatus according to claim 9, wherein the first packet comprises a segment routing header (SRH), and the information about the first forwarding path is carried in the SRH.
16. The apparatus according to claim 15, wherein the information about the first forwarding path comprises a first segment identifier list (SID) list, the information about the second forwarding path comprises a second SID list, and segment identifier SIDS comprised in the second SID list and SIDS comprised in the first SID list are the same, and are arranged in sequences reverse to each other.
17. A non-transitory storage medium storing a program, which when executed by one or more processors, cause the one or more processors to perform operations, the operations comprising: receiving a first packet from a second network device, wherein the first packet comprises information about a first forwarding path, and the first forwarding path is a forwarding path for sending the first packet from the second network device to the first network device; obtaining information about a second forwarding path based on the information about the first forwarding path, wherein the second forwarding path is a reverse path of the first forwarding path; and sending a second packet to the second network device through the second forwarding path, wherein the second packet carries the information about the second forwarding path.
18. The non-transitory storage medium according to claim 17, wherein the first packet comprises indication information, the operations further comprise: obtaining, by the first network device, the information about the second forwarding path based on the information about the first forwarding path and an indication of the indication information.
19. The non-transitory storage medium according to claim 18, wherein the first packet is a bidirectional forwarding detection (BFD) packet, and the indication information is carried in a reserved R field of the BFD packet; or the first packet is a two-way active measurement protocol (TWAMP) packet or a simple two-way active measurement protocol (STAMP) packet, and the indication information is carried in a type length value (TLV) field of the TWAMP packet or the STAMP packet; or the first packet is a seamless bidirectional forwarding detection (SBFD) packet, and the indication information is carried in an internet protocol version 6 (IPv6) extension header of the SBFD packet.
20. The non-transitory storage medium according to claim 17, wherein the first forwarding path passes through a third network device, and the information about the first forwarding path comprises an identifier of the third network device.
Description
BRIEF DESCRIPTION OF DRAWINGS
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
DESCRIPTION OF EMBODIMENTS
[0066] To make a forward path and a return path between network devices co-routed, in a conventional manner, a controller obtains the co-routed forward path and return path through calculation, and delivers information about the forward path and the return path to a source device, and the source device includes the information about the forward path and the return path in a packet, so that a destination device of the packet sends the packet to the source device along an original path based on the information about the return path.
[0067] For example,
[0068] A label of the network device 101 is 16001, a label of the network device 102 is 16002, a label of the network device 103 is 16003, a label of the network device 104 is 16004, and a label of the network device 105 is 16005.
[0069] A controller obtains, through calculation according to an SR policy (policy) of a data packet that needs to be transmitted, a forward path from the network device 101 to the network device 105 and a return path from the network device 105 to the network device 101, and generates a label stack corresponding to a forward-return path that includes the forward path and the return path. The label stack includes the labels 16003, 16004, 16005, 16004, 16003, and 16001.
[0070] The controller delivers the label stack to the network device 101. The network device 101 includes the label stack in a packet 1 that arrives at the network device 105 when generating the packet 1, and sends the packet 1 to the network device 103 based on a topmost label of the label stack, namely, the label 16003. The packet 1 arrives at the network device 105 after passing through the network device 103 and the network device 104. After receiving the packet 1, the network device 105 obtains a label corresponding to the return path, and adds a label stack that includes the labels 16004, 16003, and 16001 in a packet 2 sent to the network device 101, so that the packet 2 arrives at the network device 101 along a path reverse to the path of the packet 1.
[0071] If the network device 101 receives the packet 2, it indicates that both the forward path and the return path between the network device 101 and the network device 105 are normal, and the network device 101 may continue to send the packet to the network device 105. If the network device 101 fails to receive the packet 2, it indicates that both the forward path and the return path between the network device 101 and the network device 105 are faulty, and the network device 101 does not continue to send the packet to the network device 105.
[0072] It can be learned that in a conventional manner, the forward packet carries a relatively large amount of information, resulting in a long length of the packet. This affects packet transmission efficiency.
[0073] To resolve the foregoing technical problem, embodiments of this application provide a packet sending method and a device, to decrease the length of the forward packet and improve the packet transmission efficiency while making the forward path and the return path co-routed.
[0074] The following uses the network architecture shown in
[0075]
[0076] The packet sending method provided in this embodiment of this application includes the following steps.
[0077] S101: A network device 101 generates a packet M1.
[0078] In this embodiment of this application, the packet M1 may be a detection packet used to detect whether a path between a source device (namely, the network device 101) and a destination device (namely, the network device 105) is faulty or to obtain network performance measurement information such as a latency. The packet M1 may be a bidirectional forwarding detection (Bidirectional Forwarding Detection, BFD) packet, a two-way active measurement protocol (Two-Way Active Measurement Protocol, TWAMP) packet, a simple two-way active measurement protocol (Simple Two-Way Active Measurement Protocol, STAMP) packet, a seamless bidirectional forwarding detection (Seamless Bidirectional Forwarding Detection, SBFD) packet, or the like. This is not specifically limited in this application.
[0079] In this embodiment of this application, the packet M1 may include a segment routing header (segment routing header, SRH), the SRH includes a segment identifier list (SID list), and the segment identifier list identifies a first forwarding path. The first forwarding path is a forward path from the source device to the destination device. The segment identifier list includes a segment identifier of one or more network devices through which the first forwarding path passes. For example, the segment identifier list includes an SID 20003 of the network device 103 and an SID 20005 of the network device 105. In other words, the segment identifier list may not include SIDs corresponding to all network devices through which the packet M1 passes, but include an SID corresponding to some network devices.
[0080] Optionally, the packet M1 may further include an identifier of the source device. The identifier of the source device may be carried in the packet M1 as a part of information about the first forwarding path. The information about the first forwarding path may be used to determine a second forwarding path. The second forwarding path is a return path from the destination device to the source device. In this embodiment of this application, the second forwarding path is a reverse path of the first forwarding path. To be specific, network devices through which the second forwarding path passes are the same as network devices through which the first forwarding path passes, and sequences of passing through the network devices are reverse to each other. In this embodiment of this application, the information about the first forwarding path may be carried in a payload (payload) of the packet M1.
[0081] In addition, the packet M1 may further include indication information, where the indication information indicates the destination device to obtain information about the second forwarding path based on the information about the first forwarding path, so that the information about the second forwarding path is carried in a packet M5 forwarded to the source device (for details, see the following), and the packet M5 can arrive at the source device along the second forwarding path.
[0082] In this embodiment of this application, due to a different type of the packet M1, the indication information may also be carried in a different position of the packet M1.
[0083]
[0084] If the packet M1 is the BFD packet, the indication information may be carried in the reserved R field or another field of the BFD packet. This is not specifically limited in this embodiment of this application.
[0085]
[0086] If the packet M1 is the TWAMP packet, the indication information may be carried in the TLV field of the TWAMP packet or an STAMP packet. A format of the STAMP packet is similar to that of the TWAMP packet. Details are not described herein again. If the packet M1 is an STAMP packet, the indication information may be carried in a TLV field of the STAMP packet.
[0087] If the packet M1 is an SBFD packet, the indication information may be carried in an IPv6 extension header of the SBFD packet, for example, an SRH.
[0088] Certainly, there may be further another possible implementation for the carried position of the indication information, and persons skilled in the art may design an implementation based on an actual situation. Details are not described herein again.
[0089] S102: The network device 101 sends the packet M1 to a network device 102.
[0090] S103: The network device 102 receives the packet M1, and adds an SID of the network device 102 in the packet M1, to obtain a packet M2.
[0091] In this embodiment of this application, the information about the first forwarding path includes the SID 20002 of the network device 102. In other words, the network device 102 adds the SID of the network device 102 in the payload of the packet M1, to obtain the packet M2.
[0092] S104: The network device 102 sends the packet M2 to a network device 103.
[0093] S105: The network device 103 receives the packet M2, and adds an SID of the network device 103 in the packet M2, to obtain a packet M3.
[0094] In this embodiment of this application, the information about the first forwarding path further includes the SID 20003 of the network device 103. In other words, the network device 103 adds the SID of the network device 103 in a payload of the packet M2, to obtain the packet M3.
[0095] In this embodiment of this application, there may be a plurality of links between the network device 102 and the network device 103. The plurality of links may be physical links or logical links, and are used for load sharing. It is assumed that the network device 102 is connected to the network device 103 over a link 1 and a link 2. When sending the packet M2, the network device 102 determines, through calculation of load sharing, to send the packet M3 to the network device 103 over the link 1.
[0096] To ensure that the forward path and the return path are co-routed, the network device 103 may add, in the packet M2, an SID corresponding to an interface used by the network device 103 to receive the packet M2, where the SID identifies the link between the network device 102 and the network device 103. It is assumed that an SID of an interface corresponding to the link 1 is 32001, and an SID of an interface corresponding to the link 2 is 32002. Because the network device 103 receives the packet M2 over the link 1, the network device 103 may add the SID 32001 of the interface corresponding to the link 1 in the packet M2, to obtain the packet M3. The SID 32001 may be an SID of an END.X type.
[0097] Optionally, to decrease a packet length without affecting packet forwarding, when the information about the first forwarding path includes the SID 32001, the network device 103 may delete the SID 20002 of the network device 102 from the packet M2, in other words, replace the SID 20002 with the SID 32001.
[0098] S106: The network device 103 sends the packet M3 to a network device 104.
[0099] S107: The network device 104 receives the packet M3, and adds an SID of the network device 104 in the packet M3, to obtain a packet M4.
[0100] In this embodiment of this application, the information about the first forwarding path further includes the SID 20004 of the network device 104. In other words, the network device 104 adds the SID of the network device 104 in a payload of the packet M3, to obtain the packet M4.
[0101] S108: The network device 104 sends the packet M4 to a network device 105.
[0102] S109: The network device 105 receives the packet M4, determines information about a second forwarding path based on information about a first forwarding path in the packet M4, and generates a packet M5, where the packet M5 carries the information about the second forwarding path.
[0103] In a possible implementation, the packet M1 to the packet M4 may carry in-band operations, administration and maintenance (in-band operations, administration and maintenance, IOAM).
[0104] In another possible implementation, the packet M1 to the packet M4 may carry in-band network telemetry (in-band network telemetry, INT), and the SID list corresponding to the first forwarding path may be carried in the INT.
[0105] In this embodiment of this application, if there are no a plurality of links between the network device 102 and the network device 103, in other words, in a scenario without load sharing, the information about the first forwarding path in the packet M4 may include the following SID list: 20001, 20002, 20003, and 20004. In the foregoing scenario with load sharing, the information about the first forwarding path in the packet M4 may include the following SID list: 20001, 32001, 20003, and 20004.
[0106] Regardless of the foregoing scenarios, the network device 105 may determine the information about the second forwarding path based on the information about the first forwarding path. Specifically, the network device 105 reverses a sequence of the SIDS in the SID list corresponding to the first forwarding path, to obtain an SID list corresponding to the second forwarding path. In other words, the SIDS included in the SID list corresponding to the first forwarding path and SIDS included in the SID list corresponding to the second forwarding path are the same, and are arranged in sequences reverse to each other.
[0107] For example, if the SID list corresponding to the first forwarding path is: 20001, 20002, 20003, and 20004, the SID list corresponding to the second forwarding path may be: 20004, 20003, 20002, and 20001. If the SID list corresponding to the first forwarding path is: 20001, 32001, 20003, and 20004, the SID list corresponding to the second forwarding path may be: 20004, 20003, 32001, and 20001.
[0108] After obtaining the SID list corresponding to the second forwarding path, the network device 105 may generate a packet M5 including the SID list. The SID list corresponding to the second forwarding path may be carried in an SRH of the packet M5, to guide forwarding of the packet M5.
[0109] S110: The network device 105 sends the packet M5 to a network device 101.
[0110] In this embodiment of this application, S110 is specifically as follows: The network device 105 sends a packet M5 to the network device 104, the network device 104 sends the packet M5 to the network device 103, the network device 103 sends the packet M5 to the network device 102, the network device 102 sends the packet M5 to the network device 101, and finally, the packet M5 arrives at the network device 101.
[0111] It should be noted that, if there are a plurality of links between the network device 103 and the network device 102, when the network device 103 determines, based on a destination address in the packet M5 (namely, the SID of the network device 102), that a next-hop network device is the network device 102, the network device 103 may send the packet M5 through an outbound interface corresponding to the SID 32001 in the SID list, so that the packet M5 is transmitted to the network device 102 over the link 1. This ensures that the forward path and the return path are co-routed.
[0112] After receiving the packet M5, the network device 101 may determine that both the forward path and the return path between the network device 101 and the network device 105 are normal, and may continue to send the packet to the network device 105, which includes a data packet. If the network device 101 fails to receive the packet M5, it is considered that the forward path and the return path between the network device 101 and the network device 105 are faulty, and therefore, the network device 101 does not continue to send the packet to the network device 105.
[0113] In conclusion, because the packet M4 carries only the information about the forward path (namely, the first forwarding path) from the network device 101 to the network device 105, and does not carry the information about the return path (namely, the second forwarding path), after receiving the packet M4, the network device obtains the information about the return path based on the information about the forward path, so that the length of the packet sent by the network device 101 decreases while the forward path and the return path are co-routed, and packet transmission efficiency is improved.
[0114] In addition, in this embodiment of this application, the information about the return path is obtained by the network device 105 based on the information about the forward path in the packet M4, but is not obtained by using the controller through calculation. Therefore, there is no need to rely on the controller. This embodiment of this application expands an application scope compared with a conventional technology, for example, is applicable to some cross-domain scenarios.
[0115] For example, it is assumed that the network device 101 and the network device 102 belong to a network domain 1, the network device 103 to the network device 105 belong to a network domain 2, the network domain 1 corresponds to a controller 1, and the network domain 2 corresponds to a controller 2. To be specific, the controller 1 can obtain, through calculation, only a forwarding path between the network devices in the network domain 1, and the controller 2 can obtain, through calculation, only a forwarding path between the network devices in the network domain 2. Therefore, if obtaining the return path through calculation in a conventional manner, the controller cannot obtain the path through calculation across domains. As a result, the forward path and the return path cannot be co-routed. However, in the packet sending method shown in
[0116] In addition, the scenario with load sharing is not applicable when the return path is obtained through pre-calculation in the conventional manner. The reason is that load sharing means that after receiving a packet, a specific network device determines, through calculation, to use one of a plurality of links to forward the packet, and the information cannot be reflected in the obtained forward path and return path through pre-calculation. In other words, in the conventional manner, it can only be ensured that both the forward path and the return path pass through the same network device, but it cannot be ensured that the forward path and the return path also pass through the same link in the scenario with load sharing. However, according to the packet sending method provided in this embodiment of this application, the forward packet carries the SID for return corresponding to the interface used by the network device that needs to perform load sharing to receive the forward packet, so that it can be ensured that a return packet also passes through the same link as the forward packet, and the forward path and the return path are co-routed truly.
[0117]
[0118] The packet sending method provided in this embodiment of this application includes the following steps.
[0119] S201: A network device 101 generates a packet N1, where the packet N1 includes information about a first forwarding path.
[0120] In this embodiment of this application, the packet N1 may be a detection packet used to detect whether a path between a source device (namely, the network device 101) and a destination device (namely, the network device 105) is faulty or to obtain network performance measurement information such as a latency. A packet type of the packet N1 is similar to a packet type of the packet M1. Details are not described herein again.
[0121] In this embodiment of this application, the packet N1 includes an SRH, the SRH includes an SID list, the SID list includes the information about the first forwarding path, and the first forwarding path is a forward path from the network device 101 to the network device 105. For example, the SID list includes 20001, 20002, 20003, 20004, and 20005.
[0122] Optionally, the packet N1 may further include indication information, indicating a destination device of the packet N1, namely, the network device 105, after receiving the packet N1, to obtain information about a second forwarding path based on the information about the first forwarding path. The second forwarding path is a reverse path of the first forwarding path, in other words, the first forwarding path and the second forwarding path are co-routed.
[0123] A position of the indication information carried in the packet N1 is similar to the position of the indication information carried in the packet M1. Details are not described herein again.
[0124] S202: The network device 101 sends the packet N1 to a network device 105.
[0125] In this embodiment of this application, based on the SID list included in the packet N1, after being sent from the network device 101, the packet N1 passes through the network device 102, the network device 103, and the network device 104, and arrives at the network device 105.
[0126] S203: The network device 105 receives the packet N1, and obtains information about a second forwarding path based on the information about the first forwarding path carried in the packet N1.
[0127] In this embodiment of this application, the network device 105 may reverse a sequence of SIDs included in the SID list in the packet N1, to obtain the following SID list: 20005, 20004, 20003, 20003, and 20001. The SID list identifies a return path from the network device 105 to the network device 101, namely, the second forwarding path.
[0128] S204: The network device 105 generates a packet N2, where the packet N2 carries the information about the second forwarding path.
[0129] In this embodiment of this application, the packet N2 carries an SID list: 20005, 20004, 20003, 20003, and 20001, to guide forwarding of the packet N2.
[0130] S205: The network device 105 sends the packet N2 to the network device 101.
[0131] Based on the SID list carried in the packet N2, after being sent from the network device 105, the packet N2 successively passes through the network device 104, the network device 103, and the network device 102, and finally arrives at the network device 101.
[0132] In this embodiment of this application, because the forward packet N1 sent by the network device 101 to the network device 102 carries only information about the forward path, but does not carry information about the return path, after receiving the packet N1, the network device 105 obtains the information about the return path based on the information about the forward path carried in the packet N1, so that an amount of information carried in the forward packet N1 can be reduced while it can be ensured that the forward path and the return path are co-routed, and packet forwarding efficiency is improved.
[0133] In addition, similar to the embodiment shown in
[0134]
[0135] The packet sending method provided in this embodiment of this application includes the following steps.
[0136] S301: A second network device obtains a first packet.
[0137] In this embodiment of this application, the second network device may be, for example, the network device 101 in the embodiment shown in
[0138] Optionally, the first packet includes an identifier of the second network device, and the identifier of the second network device may be used as a part of information about a first forwarding path. The first forwarding path is a forwarding path from the second network device to a first network device. For a specific example, refer to the embodiment shown in
[0139] Optionally, the first packet may include indication information, and the indication information indicates the first network device to obtain information about a second forwarding path based on the information about the first forwarding path. The first network device may be the network device 105 in the embodiment shown in
[0140] It should be noted that, if the first packet is an SBFD packet, the indication information may be carried not only in an SRH of the SBFD packet, but also in another IPv6 extension header of the SBFD packet, for example, a hop-by-hop option header (hop-by-hop option header, HBH) or a destination address option header (destination option header, DOH). This is not limited in this embodiment of this application.
[0141] S302: The second network device sends the first packet to an intermediate network device.
[0142] In this embodiment of this application, the intermediate network device may be any one of the network device 102, the network device 103, or the network device 104 in the embodiment shown in
[0143] S303: The intermediate network device receives the first packet, and adds an identifier of the intermediate network device in the first packet to obtain a second packet.
[0144] In this embodiment of this application, the identifier of the intermediate network device may be used as a part of the information about the first forwarding path. Optionally, in an SR scenario, the information about the first forwarding path may further include an SID corresponding to an interface used by the intermediate network device to receive the first packet. This manner is applicable to a scenario with load sharing. For a related example, refer to the embodiment shown in
[0145] S304: The intermediate network device sends the second packet to the first network device.
[0146] In this embodiment of this application, if there are a plurality of intermediate network devices between the first network device and the second network device, each intermediate network device may perform steps S304 and S305. Therefore, a second packet sent by each intermediate network device carries different information about the first forwarding path.
[0147] S305: The first network device receives the second packet, and obtains information about a second forwarding path based on information about a first forwarding path in the second packet.
[0148] In this embodiment of this application, when the first network device is the network device 105 in the embodiment shown in
[0149] S306: The first network device sends a third packet to the second network device through the second forwarding path, where the third packet the carries the information about the second forwarding path.
[0150] In this embodiment of this application, when the first network device is the network device 105 in the embodiment shown in
[0151] The second packet carries only the information about the first forwarding path, and does not carry the information about the second forwarding path. Therefore, in comparison with a conventional technology, a packet length of a forward packet is shortened, packet transmission efficiency is improved, and a forward path and a return path are co-routed.
[0152] In addition, because there is no need to rely on a controller, this embodiment of this application is applicable to a scenario such as a cross-domain scenario, and can be applied in a wider scope compared with the conventional technology.
[0153] In addition, in this embodiment of this application, the intermediate network device may also include, in the packet, the SID corresponding to the interface for receiving the first packet as the information about the first forwarding path. Therefore, this can not only implement that the first forwarding path and the second forwarding path can share a node and a link, but also is especially applicable to a scenario with load sharing, while this cannot be implemented in the conventional technology.
[0154] In this embodiment of this application, the first packet and the second packet may further carry a timestamp, and the timestamp identifies a time point at which the second network device sends the first packet. After receiving the second packet, the first network device may obtain, through calculation, information such as a latency based on the timestamp carried in the second packet and a time point at which the second packet is received. When sending the third packet, the first network device may also add a timestamp in the third packet, so that the first network device obtains a packet forwarding latency through calculation based on the timestamp in the third packet and a time point at which the third packet is received.
[0155] Certainly, the first packet and the second packet may further include another type of network performance measurement information, and persons skilled in the art may design a type of network performance measurement information based on an actual situation. Details are not described in this application.
[0156]
[0157] The packet sending method provided in this embodiment of this application includes the following steps.
[0158] S401: A second network device obtains a first packet.
[0159] In this embodiment of this application, the second network device may be, for example, the network device 101 in the embodiment shown in
[0160] The first packet includes information about a first forwarding path, and the first forwarding path is a forwarding path from the second network device to a first network device. In an SRv6 scenario, the information about the first forwarding path is expressed as the SID list carried in the SRH in the embodiment shown in
[0161] Optionally, the first packet may further include indication information, and the indication information indicates a destination device of the first packet, namely, the first network device to obtain information about a second forwarding path based on the information about the first forwarding path. The second forwarding path is a reverse path of the first forwarding path. For a specific position of the indication information in the first packet, refer to the description of the embodiment shown in
[0162] S402: The second network device sends the first packet to an intermediate network device.
[0163] In this embodiment of this application, the intermediate network device may be any one of the network device 102, the network device 103, or the network device 104 in the embodiment shown in
[0164] S403: The intermediate network device receives the first packet.
[0165] S404: The intermediate network device sends the first packet to a first network device.
[0166] In this embodiment of this application, there may be one or more intermediate network devices between the second network device and the first network device. The intermediate network device sends the first packet to a next-hop network device based on the information about the first forwarding path in the first packet, until the first packet arrives at the first network device.
[0167] S405: The first network device receives the first packet, and obtains information about a second forwarding path based on information about a first forwarding path carried in the first packet.
[0168] In this embodiment of this application, if the information about the first forwarding path is an SID list, the first network device may reverse the SID list corresponding to the first forwarding path, to obtain an SID list corresponding to the second forwarding path. In other words, SIDs included in the SID list of the first forwarding path and SIDs included in the SID list of the second forwarding path are the same and are arranged in sequences reverse to each other.
[0169] If the information about the first forwarding path is a label stack, the first network device may reverse the label stack corresponding to the first forwarding path, to obtain a label stack corresponding to the second forwarding path. In other words, labels included in the label stack of the first forwarding path and labels included in the label stack of the second forwarding path are the same and are arranged in sequences reverse to each other.
[0170] Certainly, the information about the first forwarding path and the information about the second forwarding path may be further expressed in another form, and persons skilled in the art may design an expression based on a specific situation. Details are not described herein again.
[0171] S406: The first network device sends a second packet to the second network device by using the intermediate network device, where the second packet carries the information about the second forwarding path.
[0172] In this embodiment of this application, the second packet may be the packet N2 in the embodiment shown in
[0173] The first packet carries only the information about the first forwarding path, and does not carry the information about the second forwarding path. Therefore, in comparison with a conventional technology, a packet length of a forward packet is shortened, packet transmission efficiency is improved, and a forward path and a return path are co-routed.
[0174] In addition, because there is no need to rely on a controller, this embodiment of this application is applicable to a scenario such as a cross-domain scenario, and can be applied in a wider scope compared with the conventional technology.
[0175]
[0176] It should be noted that, in embodiments of this application, division into the units is an example, and is merely logical function division. During actual implementation, another division manner may be used. Functional units in embodiments of this application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit. For example, in the foregoing embodiment, the obtaining unit and the processing unit may be a same unit or different units. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software functional unit.
[0177]
[0178] It should be noted that, in embodiments of this application, division into the units is an example, and is merely logical function division. During actual implementation, another division manner may be used. Functional units in embodiments of this application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit. For example, in the foregoing embodiment, the obtaining unit and the processing unit may be a same unit or different units. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software functional unit.
[0179]
[0180] It should be noted that, in embodiments of this application, division into the units is an example, and is merely logical function division. During actual implementation, another division manner may be used. Functional units in embodiments of this application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit. For example, in the foregoing embodiment, the obtaining unit and the processing unit may be a same unit or different units. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software functional unit.
[0181]
[0182] The processor 1201 may be a general-purpose central processing unit (central processing unit, CPU), an application-specific integrated circuit (application-specific integrated circuit, ASIC), or one or more integrated circuits (integrated circuits, ICs) for controlling program execution of the solutions of this application. The processor may be configured to process a packet, to implement the packet sending method provided in embodiments of this application.
[0183] For example, when the first network device 900 in
[0184] The communication bus 1202 is configured to transmit information between the processor 1201, the network interface 1204, and the memory 1203.
[0185] The memory 1203 may be a read-only memory (read-only memory, ROM) or another type of static storage device that may store static information and instructions. The memory 1203 may alternatively be a random access memory (random access memory, RAM) or another type of dynamic storage device that may store information and instructions, or may be a compact disc read-only memory (compact disc read-only Memory, CD-ROM) or another optical disc storage, an optical disc storage (including a compact disc, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, and the like), a disk storage medium or another magnetic storage device, or any other medium that can be configured to carry or store expected program code in a form of instructions or a data structure and that can be accessed by a computer. However, the memory is not limited thereto. The memory 1203 may exist independently, and is connected to the processor 1201 through the communication bus 1202. The memory 1203 may be alternatively integrated with the processor 1201.
[0186] Optionally, the memory 1203 is configured to store program code or instructions for executing the solutions of this application, and the processor 1201 controls the execution. The processor 1201 is configured to execute the program code or the instructions stored in the memory 1203. The program code may include one or more software modules. Optionally, the processor 1201 may alternatively store the program code or the instructions for executing the solutions of this application. In this case, the processor 1201 does not need to read the program code or the instructions from the memory 1203.
[0187] The network interface 1204 may be an apparatus such as a transceiver, and is configured to communicate with another device or a communication network. The communication network may be an Ethernet, a radio access network (RAN), a wireless local area network (wireless local area networks, WLAN), or the like. In this embodiment of this application, the network interface 1204 may be configured to receive a packet sent by another node in a segment routing network, or send a packet to another node in the segment routing network. The network interface 1204 may be an Ethernet (Ethernet) interface, a fast Ethernet (fast Ethernet, FE) interface, a gigabit Ethernet (gigabit Ethernet, GE) interface, or the like.
[0188] During specific implementation, in an embodiment, the device 1200 may include a plurality of processors, for example, the processor 1201 and the processor 1205 shown in
[0189]
[0190] An embodiment of this application provides a network system. The system is configured to implement the packet sending method in the foregoing method embodiments. The system includes at least two of a first network device 1201, a second network device 1202, and an intermediate network device 1203. The first network device 1201 may implement functions of the first network device 900 in the embodiment shown in
[0191] An embodiment of this application further provides a chip system, including a processor. The processor is coupled to a memory. The memory is configured to store a program or instructions. When the program or the instructions are executed by the processor, the chip system is enabled to implement the method of the network device 101 to the network device 105 in the embodiment shown in
[0192] Optionally, there may be one or more processors in the chip system. The processor may be implemented by hardware, or may be implemented by software. When the processor is implemented by the hardware, the processor may be a logic circuit, an integrated circuit, or the like. When the processor is implemented by the software, the processor may be a general-purpose processor, and is implemented by reading software code stored in the memory.
[0193] Optionally, there may alternatively be one or more memories in the chip system. The memory may be integrated with the processor, or may be disposed separately from the processor. This is not limited in this application. For example, the memory may be a non-transitory processor, for example, a read-only memory ROM. The memory and the processor may be integrated into a same chip, or may be separately disposed on different chips. A type of the memory and a manner of disposing the memory and the processor are not specifically limited in this application.
[0194] For example, the chip system may be an FPGA, an ASIC, a system on chip (system on chip, SoC), a CPU, an NP, a digital signal processor (digital signal processor, DSP), a microcontroller unit (microcontroller unit, MCU), a programmable logic device (programmable logic device, PLD), or another integrated chip.
[0195] It should be understood that the steps in the foregoing method embodiments may be completed by using a hardware integrated logic circuit or instructions in a form of software in the processor. The steps in the methods disclosed with reference to embodiments of this application may be directly performed and completed by a hardware processor, or may be performed and completed by using a combination of hardware in the processor and a software module.
[0196] An embodiment of this application further provides a computer-readable storage medium, including instructions. When the instructions are run on a computer, the computer is enabled to perform the methods in the foregoing embodiments.
[0197] In the specification, claims, and accompanying drawings of this application, the terms “first”, “second”, “third”, “fourth”, and so on are intended to distinguish between similar objects but do not necessarily indicate a specific sequence or order. It should be understood that, the data termed in such a way is interchangeable in proper circumstances, so that embodiments described herein can be implemented in a sequence other than the sequence illustrated or described herein. In addition, the terms “include”, “have” and any other variants thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a list of steps or units is not necessarily limited to those steps or units that are expressly listed, but may include other steps or units that are not expressly listed or inherent to the process, method, product, or device.
[0198] In this application, “at least one item (piece)” means one or more, and “a plurality of” means two or more. “At least one of the following items (pieces)” or a similar expression thereof indicates any combination of these items, including a single item (piece) or any combination of a plurality of items (pieces). For example, at least one item (piece) of a, b, or c may represent: a, b, c, a and b, a and c, b and c, or a, b, and c, where a, b, and c may be singular or plural. In this application, it is considered that “A and/or B” includes only A, only B, and A and B.
[0199] It may be clearly understood by persons skilled in the art that, for the purpose of convenient and brief description, for detailed working processes of the foregoing system, apparatus, and unit, refer to corresponding processes in the foregoing method embodiments. Details are not described herein again.
[0200] In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus, and method may be implemented in another manner. For example, the described apparatus embodiments are merely examples. For example, division into the units is merely logical module division and may be other division during actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.
[0201] The units described as separate components may or may not be physically separate, and components displayed as units may or may not be physical units, to be specific, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be obtained based on actual requirements to achieve the objectives of the solutions of embodiments.
[0202] In addition, module units in embodiments of this application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software module unit.
[0203] When the integrated unit is implemented in the form of a software module unit and sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of this application essentially, or the part contributing to the conventional technology, or all or some of the technical solutions may be implemented in a form of a software product. The computer software product is stored in a storage medium and includes several instructions for instructing a computer device (which may be a personal computer, a server, a network device, or the like) to perform all or some of the steps of the method in embodiments of this application. The storage medium includes any medium that can store program code, such as a USB flash drive, a removable hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc.
[0204] Persons skilled in the art should be aware that in the foregoing one or more examples, functions described in this application may be implemented by hardware, software, firmware, or any combination thereof. When the functions are implemented by software, the foregoing functions may be stored in a computer-readable medium or transmitted as one or more instructions or code in a computer-readable medium. The computer-readable medium includes a computer storage medium and a communication medium, where the communication medium includes any medium that enables a computer program to be transmitted from one place to another. The storage medium may be any available medium that can be accessed by a general-purpose or a dedicated computer.
[0205] The objectives, technical solutions, and beneficial effects of this application are further described in detail in the foregoing specific implementations. It should be understood that the foregoing descriptions are merely specific implementations of this application.
[0206] In conclusion, the foregoing embodiments are merely intended for describing the technical solutions of this application, but not for limiting this application. Although this application is 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. However, the modifications and replacements do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of embodiments of this application.