This application relates to the field of communications technologies, and in particular, to a packet forwarding method and device, and a computer-readable storage medium.
A bit index explicit replication (BIER) technology is a multicast technology. In the BIER technology, a BIER forwarding router identifier (BFR-id) is configured for each edge node device on a network. Configuration information of the edge node device is flooded on the network through interior gateway protocol (IGP) flooding, so that each node on the network can determine a device that is identified by each BFR-id. In addition, each node on the network establishes a forwarding table based on information flooded by a control plane over IGP, and each node may forward a BIER packet on a forwarding plane by using the forwarding table.
Embodiments of this application provide a packet forwarding method and device, and a computer-readable storage medium, to resolve a problem in a related technology. Technical solutions are as follows.
According to one aspect, a packet forwarding method is provided. The method is used to forward a BIER packet, and the method includes: A destination node device starts a timer when the destination node device determines that a network topology changes; before the timer expires, the destination node device forwards the BIER packet by using an old forwarding table and establishes a new forwarding table, where the old forwarding table is a forwarding table used by the destination node device before the network topology changes, the new forwarding table is a forwarding table established by the destination node device based on the changed network topology, and the timer indicates that establishment of the new forwarding table is completed before the timer expires; and after the timer expires, the destination node device switches the old forwarding table to the new forwarding table, and forwards the BIER packet according to the new forwarding table.
When the network topology changes, the destination node device forwards the BIER packet by using the old forwarding table and establishes the new forwarding table before the timer expires, switches the old forwarding table to the new forwarding table after the timer expires, and forwards the BIER packet by using the new forwarding table. This avoids or reduces a packet loss and excess packets.
In an example embodiment, when the destination node device determines that the network topology changes, the method further includes: The destination node device determines, according to the old forwarding table, whether a loop exists on a packet forwarding path after the network topology changes; and before starting the timer, the destination node device determines, according to the old forwarding table, that no loop exists on the packet forwarding path after the network topology changes.
The timer is started only when it is determined, according to the old forwarding table, that no loop exists on the packet forwarding path after the network topology changes. This avoids link congestion caused by timing of the timer when the loop exists.
In an example embodiment, when the destination node device determines that the network topology changes, the method further includes: The destination node device determines, according to the old forwarding table, whether a loop exists on a packet forwarding path after the network topology changes; and when determining, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the destination node device does not start the timer, and establishes the new forwarding table; and after establishment of the new forwarding table is completed, the destination node device switches the old forwarding table to the new forwarding table, and forwards the BIER packet according to the new forwarding table.
When it is determined, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the timer is not started and the new forwarding table is directly established. After establishment of the new forwarding table is completed, the old forwarding table is switched to the new forwarding table. The BIER packet is forwarded according to the new forwarding table to avoid link congestion.
In an example embodiment, when the destination node device determines that the network topology changes, the method further includes: The destination node device determines, according to the old forwarding table, whether a loop exists on a packet forwarding path after the network topology changes; and when determining, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the destination node device does not start the timer, updates the old forwarding table based on the changed network topology, and forwards the BIER packet according to the updated forwarding table.
When it is determined, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the timer is not started and the old forwarding table is directly updated. The BIER packet is forwarded according to the updated forwarding table to avoid link congestion.
In an example embodiment, the packet forwarding path includes a first path and a second path that is calculated based on the changed network topology. The first path is a path from the destination node device to each neighbor of the destination node device in the old forwarding table. The second path uses each neighbor of the destination node device in the old forwarding table as a start point, and uses an edge node device indicated by a forwarding bit mask of each neighbor of the destination node device as an end point. Existence of the loop means that the second path travels through the destination node device.
In an example embodiment, that the destination node device determines, according to the old forwarding table, whether a loop exists on a packet forwarding path after the network topology changes includes: For any neighbor of the destination node device in the old forwarding table, the destination node device determines whether a path, indicated by a forwarding bit mask of the any neighbor, of each edge node device in the changed network topology travels through the destination node device; and when a path of any edge node device in the changed network topology travels through the destination node device, determines that the loop exists on the packet forwarding path after the network topology changes; or when the path of each edge node device in the changed network topology does not travel through the destination node device, determines that no loop exists on the packet forwarding path after the network topology changes.
In an example embodiment, that the destination node device determines, according to the old forwarding table, whether a loop exists on a packet forwarding path after the network topology changes includes: The destination node device establishes a shortest path tree in the changed network topology by using each neighbor of the destination node device in the old forwarding table as a root; traverses identifiers of edge node devices that arrive on the shortest path tree through the destination node device, to obtain a bit string; performs an AND operation on the bit string and the forwarding bit mask of the neighbor of the destination node device; and when a result is 0, determines that no loop exists on the packet forwarding path after the network topology changes; or when a result is not 0, determines that the loop exists on the packet forwarding path after the network topology changes.
In an example embodiment, before the timer expires, that the destination node device forwards the BIER packet by using an old forwarding table and establishes a new forwarding table includes: Before the timer expires, the destination node device forwards the BIER packet by using old multiple load balancing entries, and establishes new multiple load balancing entries based on a quantity of load balancing paths; and after the timer expires, that the destination node device switches the old forwarding table to the new forwarding table, and forwards the BIER packet according to the new forwarding table includes: After the timer expires, the destination node device switches a forwarding table of the multiple load balancing entries to the new multiple load balancing entries, and forwards the BIER packet according to the new multiple load balancing entries.
An embodiment of this application further provides a packet forwarding node device. The packet forwarding node device is configured to forward a BIER packet, and the packet forwarding node device includes: a starting module, configured to start a timer when it is determined that a network topology changes; a forwarding module, configured to: before the timer expires, forward the BIER packet by using an old forwarding table, where the old forwarding table is a forwarding table used by the packet forwarding node device before the network topology changes; and an establishment module, configured to: before the timer expires, establish a new forwarding table, where the new forwarding table is a forwarding table established by the packet forwarding node device based on the changed network topology, and the timer indicates that establishment of the new forwarding table is completed before the timer expires; the forwarding module is further configured to: after the timer expires, switch the old forwarding table to the new forwarding table, and forward the BIER packet according to the new forwarding table.
In an example embodiment, the packet forwarding node device further includes: a determining module, configured to determine, according to the old forwarding table, whether a loop exists on a packet forwarding path after the network topology changes; and before the starting module starts the timer, the determining module determines, according to the old forwarding table, that no loop exists on the packet forwarding path after the network topology changes.
In an example embodiment, the packet forwarding node device further includes: a determining module, configured to determine, according to the old forwarding table, whether a loop exists on a packet forwarding path after the network topology changes; and when it is determined, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the starting module does not start the timer, and the establishment module establishes the new forwarding table; and after establishment of the new forwarding table is completed, the forwarding module switches the old forwarding table to the new forwarding table, and forwards the BIER packet according to the new forwarding table.
In an example embodiment, the packet forwarding node device further includes: a determining module, configured to determine, according to the old forwarding table, whether a loop exists on a packet forwarding path after the network topology changes; and when it is determined, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the starting module does not start the timer, and the forwarding module is configured to update the old forwarding table based on the changed network topology, and forward the BIER packet according to the updated forwarding table.
In an example embodiment, the packet forwarding path includes a first path and a second path that is calculated based on the changed network topology. The first path is a path from the destination node device to each neighbor of the destination node device in the old forwarding table. The second path uses each neighbor of the destination node device in the old forwarding table as a start point, and uses an edge node device indicated by a forwarding bit mask of each neighbor of the destination node device as an end point. Existence of the loop means that the second path travels through the destination node device.
In an example embodiment, the determining module is configured to: for any neighbor of the destination node device in the old forwarding table, determine whether a path, indicated by a forwarding bit mask of the any neighbor, of each edge node device in the changed network topology travels through the destination node device; and when a path of any edge node device in the changed network topology travels through the destination node device, determine that the loop exists on the packet forwarding path after the network topology changes; or when the path of each edge node device in the changed network topology does not travel through the destination node device, determine that no loop exists on the packet forwarding path after the network topology changes.
In an example embodiment, the determining module is configured to: establish a shortest path tree in the changed network topology by using each neighbor of the destination node device in the old forwarding table as a root; traverse identifiers of edge node devices that arrive on the shortest path tree through the destination node device, to obtain a bit string; perform an AND operation on the bit string and the forwarding bit mask of the neighbor of the destination node device; and when the result is 0, determine that no loop exists on the packet forwarding path after the network topology changes; or when the result is not 0, determine that the loop exists on the packet forwarding path after the network topology changes.
In an example embodiment, the forwarding module is configured to: before the timer expires, forward the BIER packet by using old multiple load balancing entries; the establishment module is configured to establish new multiple load balancing entries based on a quantity of load balancing paths; and the forwarding module is configured to: after the timer expires, switch a forwarding table of the multiple load balancing entries to the new multiple load balancing entries, and forward the BIER packet according to the new multiple load balancing entries.
A packet forwarding node device is further provided. The packet forwarding node device includes a memory and a processor. The memory stores at least one instruction, and the processor loads and executes the at least one instruction to implement any one of the foregoing packet forwarding methods.
A computer-readable storage medium is further provided. The storage medium stores at least one instruction, and a processor loads and executes the instruction to implement any one of the foregoing packet forwarding methods.
Another communications apparatus is provided. The apparatus includes a transceiver, a memory, and a processor. The transceiver, the memory, and the processor communicate with each other through an internal connection channel. The memory is configured to store instructions. The processor is configured to execute the instructions stored in the memory, to control the transceiver to receive a signal, and control the transceiver to send a signal. In addition, when the processor executes the instructions stored in the memory, the processor is enabled to perform the method in the first aspect or any one of possible implementations of the first aspect.
In an example embodiment, there are one or more processors, and there are one or more memories.
In an example embodiment, the memory may be integrated with the processor, or the memory and the processor are disposed separately.
In a specific implementation process, the memory may be a non-transitory memory, such as a read-only memory (ROM). The memory and the processor may be integrated into one chip, or may be disposed in different chips. A type of the memory and a manner in which the memory and the processor are disposed are not limited in this embodiment of this application.
A computer program (product) is provided. The computer program (product) includes computer program code. When the computer program code is run on a computer, the computer is enabled to perform the methods in the foregoing aspects.
A chip is provided. The chip includes a processor, configured to invoke and run instructions stored in a memory, so that a communications device on which the chip is installed performs the methods in the foregoing aspects.
Another chip is provided, including an input interface, an output interface, a processor, and a memory. The input interface, the output interface, the processor, and the memory are connected to each other through an internal connection channel. The processor is configured to execute code in the memory. When the code is executed, the processor is configured to perform the methods in the foregoing aspects.
Terms used in implementations of this application are merely intended to explain specific embodiments of this application, and are not intended to limit this application.
A BIER technology is a multicast technology. In the BIER technology, a BFR-id is configured for each edge node device on a network, for example, the BFR-id is a value ranging from 1 to 256. Configuration information of each edge node on the network is flooded on the network through IGP flooding. The information flooded along with IGP is referred to as BIER information. After flooding, each node on the network can determine a device that is identified by each BFR-id.
In addition, each node on the network establishes a forwarding table based on information flooded by a control plane over IGP, and each node may forward a BIER packet on a forwarding plane by using the forwarding table. The BIER packet includes a BIER encapsulated multicast data packet. For a BIER encapsulation format, refer to descriptions of a BIER header format in a request for comment (RFC) 8296. The BIER header format is a key to implementing BIER on the forwarding plane (chip). As shown in
Each bit in the BitString field is used to identify a BIER forwarding egress router (BIER forwarding egress router, BFER). For example, a least significant (rightmost) bit of the BitString is used to identify that a next-hop node is a node whose BFR-id is 1. The second bit to the right of the BitString is used to identify a node whose BFR-id is 2. Forwarding by the forwarding plane is based on a forwarding entry. The forwarding entry determines, based on a BitString in a BIER packet, to which next hop or which next hops the BIER packet is to be sent. If a plurality of bits correspond to a same next hop, only one BIER packet is sent to the next hop.
For example, nodes in
Neighbor (Nbr)=B, and forwarding bit mask (FBM)=0111.
Each bit in the FBM indicates one edge node device. If there are a large number of edge node devices, the edge node devices may be divided into different sets. For a plurality of sets, the FBM includes bit strings of the plurality of sets. For example, there are 512 edge node devices in the network topology. The 512 edge node devices are divided into two sets: a set 0 and a set 1. One set uses a 256-bit bit string. In this case, an FBM of a neighbor may include two 256-bit bit strings: a bit string corresponding to the set 0 and a bit string corresponding to the set 1.
For the neighbor entry of the edge node device A, when the first bit, the second bit, and third bit to the right of the BitString in the BIER packet are 1, the edge node device A sends the BIER packet to the neighboring node B. When the fourth bit to the right of the BitString in the BIER packet is 1 (for example, a BIER packet sent from the node B to the node A), the entry indicates to send the BIER packet to the node A. In
For the node B, neighbors of the node B include the edge node device A, the node C, and the edge node device E. Next hops of BFER nodes whose BFR-id is ½ are both the node C, a BFER node whose BFR-id is 3 is the edge node device E, and a BFER node whose BFR-id is 4 is the edge node device A. A neighbor entry of the node B is established as follows:
Nbr=C, FBM=0011
Nbr=E, FBM=0100
Nbr=A, FBM=1000
For the node C, neighboring nodes of the node C include the node B, the edge node device E, the edge node device F, and the edge node device D. A BFER node whose BFR-id is 1 is the edge node device D, a BFER node whose BFR-id is 2 is the edge node device F, and a BFER node whose BFR-id is 3 is the edge node device E, and a next hop of a BFER node whose BFR-id is 4 is the node B. A neighbor entry of the node C is established as follows:
Nbr=D, FBM=0001
Nbr=F, FBM=0010
Nbr=E, FBM=0100
Nbr=B, FBM=1000
For the edge node device D, neighboring nodes of the edge node device D include the node C. A next hop of a BFER node whose BFR-id is 2/3/4 is the node C. A neighbor entry of the edge node device D is established as follows:
Nbr=C, FBM=1110
For the edge node device E, neighboring nodes of the edge node device E include the node B and the node C. A next hop of a BFER node whose BFR-id is ½ is the node C, and a next hop of a BFER node whose BFR-id is 4 is the node B. A neighbor entry of the edge node device E is established as follows:
Nbr=B, FBM=1000
Nbr=C, FBM=0011
For the edge node device F, neighboring nodes of the edge node device F include the node C. A next hop of a BFER node whose BFR-id is 1/3/4 is the node C. A neighbor entry of the edge node device F is established as follows:
Nbr=C, FBM=1101
On the network shown in
After receiving a multicast internet protocol (IP) packet, the node A encapsulates the BIER header. For example, in
However, in the foregoing process of establishing the forwarding table and forwarding the BIER packet according to the forwarding table, if a link is added to the network and the network topology changes, a packet loss or excess packets occurs or occur in the process of the BIER packet forwarding. For example, a link between a node 1 and a node 3 is added in the network topology shown in
{(Nbr=Node 1(Self), FBM=0001),
(Nbr=Node 2, FBM=0110)}
In a final state after the link between the node 1 and the node 3 is added, the BIER forwarding table of the node 1 is as follows:
{(Nbr=Node 1(Self), FBM=0001),
(Nbr=Node 2, FBM=0010),
(Nbr=Node 3, FBM=0100)}
Because a path of the node 3 switches from the original Nbr=Node 2 to Nbr=Node 3, FBM fields of Nbr=Node2 and Nbr=Node 3 entries need to be updated. Updating the two entries is not an atomic operation and the two entries are sequentially updated. For example, in a process of reaching the final state, the FBM field of the Nbr=Node2 entry may be first updated to 0010, and then the Nbr=Node3 entry is added. In this case, a packet sent to the node 3 may be lost before the Nbr=Node 3 entry is added. Alternatively, in the process of reaching the final state, the Nbr=Node 3 entry may be first added, and then the FBM field of the Nbr=Node2 entry may be updated to 0010. In this case, a packet sent to the node 3 may be repeated.
For the packet loss or excess packets occurring when the link is added to the network topology in
Step 501: When a destination node device determines that a network topology changes, the destination node device starts a timer.
A network topology change includes a case in which a new link is added. The case in which a new link is added is not limited in this embodiment of this application. For example, the added link may be a link that is previously disconnected due to a fault and then recovered. Also refer to the network topology shown in
In addition to the foregoing case in which the link is added because the link fault is rectified, there is a case in which a new link is added after a router is added to the network. The network topology shown in
In this embodiment of this application, BIER MBB may be enabled for a node on a network. In other words, the destination node device in this method may be any node that is in the changed network topology after the link is added and for which BIER MBB is configured. For example, the destination node device uses a BIER protocol, and has a BIER forwarding capability and a forwarding capability of specific BIER encapsulation types, for example, MPLS encapsulation, ethernet (Ethernet) encapsulation, or internet protocol version 6 (IPv6) encapsulation. A specific encapsulation type for BIER forwarding is not limited in this embodiment of this application. In addition, the destination node device in this embodiment of this application may be a router or a switch.
In the method provided in this embodiment of this application, a network administrator enables BIER MBB for the destination node device, so that the destination node device has a BIER MBB function. In addition, the timer indicates that establishment of a new forwarding table is completed before the timer expires. For example, in addition to enabling BIER MBB for the destination node device, the network administrator may further configure timing duration of the timer. The timing duration of the timer may be configured based on a capability of the destination node device, for example, based on a central processing unit (CPU) load of the destination node device, or may be configured based on experience. A same timing duration or different timing durations of timers may be configured for different destination node devices. This is not limited in this embodiment of this application, provided that it can be ensured that establishment of the new forwarding table is completed.
Step 502: Before the timer expires, the destination node device forwards a BIER packet by using an old forwarding table and establishes the new forwarding table.
The old forwarding table is a forwarding table used by the destination node device before the network topology changes. The new forwarding table is a forwarding table established by the destination node device based on the changed network topology. After the network topology changes, if the destination node device receives the BIER packet before the timer expires, the destination node device forwards the BIER packet by using the old forwarding table, and establishes the new forwarding table.
It should be noted that, when the network topology changes, the new forwarding table may be established before or after the timer is started, or the new forwarding table may be established when the timer is started. Because the timer indicates that establishment of the new forwarding table is completed before the timer expires, if the new forwarding table is established before the timer is started, the timing duration of the timer is less than establishment duration of the new forwarding table. If the new forwarding table is established after the timer is started, the timing duration of the timer is greater than the establishment duration of the new forwarding table. If the new forwarding table is established when the timer is started, the timing duration of the timer may be equal to the establishment duration of the new forwarding table. The establishment duration of the new forwarding table is a length of time between a moment at which the new forwarding table starts to be established and a moment at which establishment of the new forwarding table is completed.
Because the link is added, the BIER packet sent by the destination node device to the destination node according to the original forwarding path may be sent back to the destination node device. In other words, if the BIER packet is forwarded according to the old forwarding table, a loop may exist on the packet forwarding path. As a result, link congestion or the like may occur. Therefore, whether a loop exists on the packet forwarding path needs to be determined before forwarding the BIER packet according to the old forwarding table. In an example embodiment, when the network topology changes, the method further includes: determining, based on the old forwarding table, whether a loop exists on the packet forwarding path after the network topology changes. In this embodiment, before the timer is started, the destination node device determines, according to the old forwarding table, that no loop exists on the packet forwarding path after the network topology changes. Then, before the timer expires, the destination node device forwards the BIER packet by using the old forwarding table and establishes the new forwarding table. When it is determined that no loop exists on the packet forwarding path after the network topology changes, before the timer expires, the old forwarding table is used to forward the BIER packet and the new forwarding table is established. This avoids link congestion caused by the loop that exists when the old forwarding table is used to forward the BIER packet.
A manner of determining, based on the old forwarding table, whether the loop exists on the packet forwarding path after the network topology changes includes but is not limited to the following two manners:
Manner 1: For any neighbor of the destination node device in the old forwarding table, the destination node device determines whether a path, indicated by a forwarding bit mask of the any neighbor, of each edge node device in the changed network topology travels through the destination node device. When a path of any edge node device in the changed network topology travels through the destination node device, the destination node device determines that the loop exists on the packet forwarding path after the network topology changes. When the path of each edge node device in the changed network topology does not travel through the destination node device, the destination node device determines that no loop exists on the packet forwarding path after the network topology changes.
The packet forwarding path includes a first path and a second path that is calculated based on the changed network topology. The first path is a path from the destination node device to each neighbor of the destination node device in the old forwarding table. The second path uses each neighbor of the destination node device in the old forwarding table as a start point, and uses an edge node device indicated by a forwarding bit mask of each neighbor of the destination node device as an end point. Existence of the loop means that the second path travels through the destination node device.
The node 1 in the network topology shown in
After the BIFT forwarding table is added, the new forwarding table may be set to be used for the forwarding path after a specific period of time. Because in a system, for example, the router, it takes time to complete a process of delivering the forwarding table, and the delivery process may be an asynchronous process. In other words, a delivery program does not check whether delivery is completed. For example, timing duration of the timer is 500 ms. When the timer expires, the new forwarding table is set for the forwarding path. After the timing duration of the timer is configured, timing of the timer may be started when the network topology change is detected.
For example, the current forwarding table BIFT 1 of the nodes is as follows:
{(Nbr=Node1(Self), FBM=0001),
(Nbr=Node 2, FBM=0110)}
For a BFER node indicated by an FBM field of each Nbr node (excluding the node 1) of the node 1, the node 1 determines whether the packet forwarding path in the changed network topology travels through the node 1, in other words, from the neighbor to the node 1.
For example, determining may be performed according to a formula Distance(2_X)<Distance(2_1)+Distance(1_X) or D(2_X)<D(2_1)+D(1_X), where D(X_Y) indicates a path cost from a node X to a node Y.
Because a neighboring node of the node 1 is the node 2, FBM<0110> of Nbr<Node2> indicates the node 2 and the node 3, respectively. Determining is performed according to the foregoing formula as follows:
D(2_2)<D(2_1)+D(1_2)
D(2_3)<D(2_1)+D(1_3)
If links shown in
Manner 2: The destination node device establishes a shortest path tree in the changed network topology by using each neighbor of the destination node device in the old forwarding table as a root; traverses identifiers of edge node devices from the destination node device to edge node devices of the shortest path tree, to obtain a bit string; performs an AND operation on the bit string and the forwarding bit mask of the neighbor; and when a result is 0, determines that no loop exists on the packet forwarding path after the network topology changes; or when a result is not 0, determines that the loop exists on the packet forwarding path after the network topology changes.
For example, the SPT tree is established in the changed network topology by using each neighbor (for example, 2) of the node 1 in the old forwarding table of the node 1 as a root. BFR-ids of nodes from the node 1 to nodes of the SPT tree are traversed, to form a BitString (BitStringx). Then, the AND operation is performed on the BitString and the FBM (FBMx) of the neighbor, that is, (BSx AND FBMx). If the result is not 0, the loop exists.
For the network topology shown in
Step 503: After the timer expires, the destination node device switches the old forwarding table to the new forwarding table, and forwards the BIER packet according to the new forwarding table.
After the timer expires, the old forwarding table is switched to the new forwarding table, and the BIER packet is forwarded according to the new forwarding table. An atomic operation or a single-entry operation may be used in this process.
The network topology shown in
(1) The node 1 forwards the BIER packet according to the old forwarding table, in other words, according to an old forwarding path 1->2->3. The node 3 receives only the BitString (0100) in the BIER packet according to the operations of the node devices in the foregoing packet forwarding process. Regardless of whether the node 3 forwards the BIER packet according to the old forwarding path or the new forwarding path, a result of forwarding the BIER packet is not affected. In other words, no packet loss occurs in the BIER packet received by the node 3 from the node 1.
(2) The node 1 forwards the BIER packet according to the new forwarding table, in other words, according to a new forwarding path 1->2 or 3. The node 3 receives also only the BitString (moo) in the BIER packet. Regardless of whether the node 3 forwards the BIER packet according to the old forwarding path or the new forwarding path, a result of forwarding the BIER packet is not affected. In other words, no packet loss occurs in the BIER packet received by the node 3 from the node 1.
According to the method provided in this embodiment of this application, the timer is started when the network topology changes. Before the timer expires, the BIER packet is forwarded by using the old forwarding table and the new forwarding table is established. After the timer expires, the old forwarding table is switched to the new forwarding table. The new forwarding table is used to forward the BIER packet. This avoids or reduces a packet loss and excess packets. In addition, the timer is started only when it is determined, according to the old forwarding table, that no loop exists on the packet forwarding path after the network topology changes. This avoids link congestion caused when the loop exists, improves reliability of packet forwarding, and further reduces a probability of a packet loss or excess packets.
It should be noted that, the foregoing description is provided only for a case in which the destination node device determines, according to the old forwarding table, that no loop exists on the packet forwarding path after the network topology changes. If the loop exists, the method provided in this embodiment of this application includes but is not limited to the following two processing manners:
Processing manner 1: When the network topology changes, the method further includes: when determining, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the destination node device does not start the timer, and establishes the new forwarding table. After establishment of the new forwarding table is completed, the destination node device switches the old forwarding table to the new forwarding table, and forwards the BIER packet according to the new forwarding table.
In this manner, the foregoing manner of determining, according to the old forwarding table, whether the loop exists on the packet forwarding path after the network topology changes is used. When it is determined, according to the old forwarding table, that the loop exists on the path forwarding path after the network topology changes, the timer is not started, and the new forwarding table is directly established. After establishment of the new forwarding table is completed, the old forwarding table is switched to the new forwarding table, and the BIER packet is forwarded according to the new forwarding table.
Processing manner 2: When the network topology changes, the method further includes: when determining, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the destination node device does not start the timer. The destination node device updates the old forwarding table based on the changed network topology, and forwards the BIER packet according to the updated forwarding table.
In this manner, the foregoing manner of determining, according to the old forwarding table, whether the loop exists on the packet forwarding path after the network topology changes is used. When it is determined, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the timer is not started, and the new forwarding table is not established. Instead, the old forwarding table is updated based on the changed network topology, and the packet is forwarded according to the updated forwarding table.
In the foregoing processing manner 1 and processing manner 2, the packet forwarding path includes the first path and the second path that is calculated based on the changed network topology. The first path is a path from the destination node device to each neighbor of the destination node device in the old forwarding table. The second path uses each neighbor of the destination node device in the old forwarding table as a start point, and uses an edge node device indicated by a forwarding bit mask of each neighbor of the destination node device as an end point. Existence of the loop means that the second path travels through the destination node device.
Because the loop causes link congestion or the like, when it is determined that the loop exists, the timer is not started, to avoid or reduce link congestion.
For ease of understanding the method provided in this embodiment of this application, the following describes by using several different scenarios other than the scenario shown in
Scenario 1: Four devices are deployed on a network.
(1) A Link is Added Between the Node 1 and the Node 2.
As shown in
Determining manner 1: All destination nodes and neighboring nodes of the BIER packet whose FBM is <1110> received by the neighboring node 3 do not include the node 1.
Determining manner 2: A new SPT tree is calculated for the neighboring node 3, where nodes corresponding to the FBM satisfy a formula D(3_X)<D(3_1)+D(1_X).
For example, traffic is received from the node 1 and sent to the node 2, 3, or 4. Convergence on the node 2 does not affect a packet forwarding result, because convergence on the node 2 affects only BFER=1. When the BIER packet reaches the node 2, the BitString in the BIER packet does not include BFER=1.
(2) A Link is Added Between the Node 2 and the Node 4.
As shown in
Determining manner 1: All destination nodes and neighboring nodes of the BIER packet whose FBM is <1101> received by the neighboring node 1 do not include the node 2.
Determining manner 2: A new SPT tree is calculated for the neighboring node 1, where nodes corresponding to the FBM <1101> satisfy a formula D(1_X)<D(1_2)+D(2_X).
For example, traffic is received from the node 2 and sent to the node 1, 3, or 4. Convergence on the node 3 does not affect a packet forwarding result, because convergence on the node 3 affects only BFER=2. When the packet reaches the node 3, the BitString in the packet does not include BFER=2. Similarly, convergence on the node 4 does not affect a packet forwarding result, because convergence on the node 4 affects only BFER=2. When the packet reaches the node 4, the BitString in the packet does not include BFER=2.
For example, traffic is received from the node 4 and sent to the node 1, 2, or 3. Because a packet whose FBM is <0010> and that is sent to the node 3 is sent back, the node 4 determines, according to the old forwarding table and in the following determining manners, that the loop exists on the packet forwarding path after the network topology changes, and therefore does not delay convergence.
Determining manner 1: All destination nodes and neighboring nodes of the BIER packet whose FBM is <0111> received by the neighboring node 3, a packet whose BFR-id is 2 is sent to the node 4. Therefore, a condition that none of the destination nodes and neighboring nodes of the BIER packet whose FBM is <0111> received by the neighboring node 3 do not include the node 4 is not satisfied.
Determining manner 2: A new SPT tree is calculated for the neighboring node 3, and BFR-id=2 does not satisfy a formula D(3_2)<D(3_4)+D(4_2).
It should be noted that convergence of the BIER packet whose FBM is <0111> cannot be delayed, but convergence of the BIER packet whose FBM is <0101> in traffic is not affected. Only the BIER packet with BFR-id=2 is affected.
(3) A Link is Added Between the Node 3 and the Node 4.
As shown in
Determining manner 1: All destination nodes and neighboring nodes of the BIER packet whose FBM is <1011> received by the neighboring node 1, a packet whose BFR-id is 4 is sent to the node 3. Therefore, a condition that none of the destination nodes and neighboring nodes of the BIER packet whose FBM is <1011> f received by the neighboring node 1 do not include the node 3 is not satisfied.
Determining manner 2: A new SPT tree is calculated for the neighboring node 1, and BFR-id=4 does not satisfy a formula D(1_4)<D(1_3)+D(3_4).
For example, traffic is received from the node 3. The node 3 determines, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, and therefore does not start the timer. After establishment of the new forwarding table is completed, the node 3 immediately switches back to the new forwarding table or updates the old forwarding table. In this case, the MBB configured in this embodiment of this application is invalid.
Scenario 2: Six devices are deployed on a network.
(1) A Link is Added Between the Node 1 and the Node 2.
As shown in
Determining manner 1: All destination nodes and neighboring nodes of the BIER packet whose FBM is <111101> received by the neighboring node 4 do not include the node 2.
Determining manner 2: A new SPT tree is calculated for the neighboring node 1, where nodes corresponding to the FBM <111101> satisfy a formula D(4_X)<D(4_2)+D(2_X).
Convergence on the node 1 does not affect a packet forwarding result if BFER=2. For example, traffic is received from the node 2. When a packet (BitString=111101) is sent to the node 1, 3, 4, 5, or 6, no packet is lost.
(2) A Link is Added Between the Node 2 and the Node 4.
As shown in
Determining manner 1: All destination nodes and neighboring nodes of the BIER packet whose FBM is <111101> received by the neighboring node 1 do not include the node 2.
Determining manner 2: A new SPT tree is calculated for the neighboring node 1, where nodes corresponding to the FBM <111101> satisfy a formula D(1_X)<D(1_2)+D(2_X).
Convergence on the node 4 does not affect a packet forwarding result if BFER=2. Because the node whose BFER=2 includes the node 4, the node 4 determines, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes.
For example, traffic is received from the node 2. Convergence on the node 4 affects only BFER=2. When the BIER packet reaches the node 4, the BitString in the BIER packet does not include BFER=2. According to the method provided in this embodiment of this application, no packet is lost.
(3) A Link is Added Between the Node 3 and the Node 4.
As shown in
For processing of the node 2, the original neighboring node 1 takes over 1 or 3, and the neighboring node 4 takes over 2, 4, 6, or 5. All destination nodes and neighboring nodes of the BIER packet whose FBM is <000101> received by the neighboring node 1 do not include the node 2. All destination nodes and neighboring nodes of the BIER packet whose FBM is <111000> received by the neighboring node 4 do not include the node 2. Therefore, no loop exists on the packet forwarding path after the network topology changes, and convergence can be delayed.
For processing of the node 3, two neighboring nodes are changed to three neighboring nodes. Because the node whose BFER=4 includes the node 3, the loop exists on the packet forwarding path. However, a convergence process of the node 3 does not affect the BIER packet sent from the node 2 to the node 3.
For processing of the node 4, two neighboring nodes are changed to three neighboring nodes. Because the node whose BFER=3 includes the node 4, the loop exists on the packet forwarding path. However, a convergence process of the node 4 does not affect the BIER packet sent from node 2 to node 4.
(4) A Link is Added Between the Node 4 and the Node 6.
As shown in
For processing of the node 2, the original neighboring node 1 takes over 1 and the neighboring node 4 takes over 3, 4, 5, or 6. All destination nodes and neighboring nodes of the BIER packet whose FBM is <000001> received by the neighboring node 1 do not include the node 2. All destination nodes and neighboring nodes of the BIER packet whose FBM is <111101> received by the neighboring node 4 do not include the node 2. Therefore, no loop exists on the packet forwarding path (the FBMs of the two neighboring nodes remain unchanged), and convergence can be delayed.
For processing of the node 4, two neighboring nodes are changed to three neighboring nodes. No loop exists on the packet forwarding path, and convergence can be delayed.
For processing of the node 6, one neighboring node is changed to two neighboring nodes. Because BFER=4, the loop exists and convergence is not delayed. However, a convergence process does not affect the BIER packet sent from the node 2 to the node 6.
In an example in which traffic is received from the node 1, forwarding paths include 1->2, 1->3->4 or 5, and 5->6. When the link between the node 4 and the node 6 is added:
For processing of the node 1, the original neighboring node 2 takes over 2 and the neighboring node 3 takes over 3, 4, 5, or 6. The FBMs of the two neighboring nodes remain unchanged, no loop exists on the packet forwarding path, and convergence can be delayed.
In the foregoing process, no packet loss exists in the entire traffic sent from the node 1 to the node 2, 3, 4, 5, or 6.
(5) A Link is Added Between the Node 5 and the Node 6.
As shown in
For processing of the node 5, one neighboring node is changed to two neighboring nodes. Because BFER=6, the loop exists on the packet forwarding path and convergence is not delayed.
For processing of the node 6, one neighboring node is changed to two neighboring nodes. Because BFER=5, the loop exists on the packet forwarding path and convergence is not delayed. However, a convergence process does not affect the packet and no packet is lost.
For processing of the node 2, the original neighboring node 1 takes over 1 and the neighboring node 4 takes over 3, 4, 5, or 6. All destination nodes and neighboring nodes of the BIER packet whose FBM is <000001> received by the neighboring node 1 do not include the node 2. All destination nodes and neighboring nodes of the BIER packet whose FBM is <111101> received by the neighboring node 4 do not include the node 2. Therefore, the FBMs of the two neighboring nodes remain unchanged, no loop exists on the packet forwarding path, and convergence can be delayed.
In the foregoing process, no packet is lost when the link is added.
Moreover, in addition to the foregoing several scenarios, the method provided in this embodiment is also applicable to a load balancing scenario. In the load balancing scenario, before the timer expires, that the destination node device forwards a BIER packet by using an old forwarding table and establishes the new forwarding table includes: Before the timer expires, the destination node device forwards the BIER packet by using old multiple load balancing entries, and establishes new multiple load balancing entries based on a quantity of load balancing paths.
Correspondingly, after the timer expires, that the destination node device switches the old forwarding table to the new forwarding table, and forwards the BIER packet according to the new forwarding table includes: After the timer expires, the destination node device switches a forwarding table of the multiple load balancing entries to the new multiple load balancing entries, and forwards the packet according to the new multiple load balancing entries.
In the foregoing case of multiple forwarding entries, principles of the packet forwarding process are the same as those of the method procedure shown in
Scenario 3: Load balancing links are deployed on a network.
In this embodiment, load balancing (RFC 8279) that is performed on a plurality of entries using the BIER is configured for the node 1. Four load balancing entries are configured. In other words, a quantity of paths for load balancing is 4. A load balancing table is as follows, where an entry of a neighbor being a node itself is omitted.
BIFT 1: {(Nbr=R, FBM=1111 0010)}
BIFT 2: {(Nbr=G, FBM=1111 0010)}
BIFT 3: {(Nbr=P, FBM=1111 0010)}
BIFT 4: {(Nbr=R, FBM=1111 0010)}
For example, there are currently 400 multicast flows, and there are 100 multicast flows in each BIFT table. 200 multicast flows travel through the neighbor R, 100 multicast flows travel through the neighbor G, and 100 multicast flows travel through the neighbor P. After a link is added, the foregoing entries may be changed as follows:
BIFT 1: {(Nbr=B, FBM=1111 0010)}
BIFT 2: {(Nbr=R, FBM=1111 0010)}
BIFT 3: {(Nbr=G, FBM=1111 0010)}
BIFT 4: {(Nbr=P, FBM=1111 0010)}
It can be learned that each BIFT table is changed. Nbr=R is changed to Nbr=B in a BIFT 1. Nbr=G is changed to Nbr=R in a BIFT 2. Nbr=P is changed to Nbr=G in a BIFT 3. Nbr=R is changed to Nbr=P in a BIFT 4.
In this case, adding a link may cause a packet loss or excess packets. For example, if the BIFT table is directly updated after a link fault occurs, for the BIFT 1, an Nbr=R entry may be first deleted and an Nbr=B entry is added. In this case, a flow is interrupted. If an Nbr=B entry is first added and an Nbr=R entry is added, there are excess packets. For the first problem, for example, in a case of forwarding of the BIFT 1, a new entry in a BIFT 1′ is first established. After a specific period of time, in other words, after the timer expires, a forwarding entry is changed to the entry in the BIFT 1′, so that no packet is lost.
To resolve the foregoing problem, in the method provided in this embodiment of this application, BIER MBB is enabled for each node, and timing duration of the timer is configured. As shown in
For a current entry in the BIFT 1, none of the destination nodes and neighboring nodes of the BIER packet whose FBM is <11110010> received by the neighboring node R includes the node 1. For a current entry in the BIFT 2, none of the destination nodes and neighboring nodes of the BIER packet whose FBM is <11110010> received by the neighboring node G includes the node 1. For a current entry in the BIFT 3, none of the destination nodes and neighboring nodes of the BIER packet whose FBM is <11110010> received by the neighboring node P includes the node 1. For a current entry in the BIFT 4, none of the destination nodes and neighboring nodes of the BIER packet whose FBM is <11110010> received by the neighboring node R includes the node 1.
If all the foregoing conditions are satisfied, it indicates that the four original load balancing entries can continue to be forwarded on an original path. Therefore, the timer can be started.
For example, before the timer expires, new multiple load balancing entries are generated. For example, initially the following multiple table load balancing index is used, namely, a multiple BIER forwarding table index (multiple BIFT index, MBI), for example, an MBI 1.
Multiple table load balancing index: MBI1={BIFT 1, BIFT 2, BIFT 3, BIFT4}
A BIER forwarding table is as follows:
BIFT 1: {(Nbr=R, FBM=1111 0010)}
BIFT 2: {(Nbr=G, FBM=1111 0010)}
BIFT 3: {(Nbr=P, FBM=1111 0010)}
BIFT 4: {(Nbr=R, FBM=1111 0110)}
A multiple table load balancing index table and a corresponding forwarding table are added during timing of the timer.
MBI2={BIFT 21, BIFT 22, BIFT 23, BIFT24}
BIFT 21: {(Nbr=B, FBM=1111 0010)}
BIFT 22: {(Nbr=R, FBM=1111 0010)}
BIFT 23: {(Nbr=G, FBM=1111 0010)}
BIFT 24: {(Nbr=P, FBM=1111 0010)}
After the timer expires, the forwarding table is changed to: multiple table load balancing index=MBI 2.
In this method, whether the loop exists on the packet forwarding path in the BIFTs 1, 2, 3, and 4 after the network topology changes needs to be determined. If no loop exists, the new multiple load balancing entries are used.
In conclusion, according to the method provided in this embodiment of this application, when the link is added, the BIER packet is forwarded by using the old multiple load balancing entries before the timer expires, and the new multiple load balancing entries are established based on the quantity of load balancing paths. After the timer expires, the old multiple load balancing entries are switched to the new multiple load balancing entries, and the BIER packet is forwarded by using the new multiple load balancing entries. This avoids or reduces a packet loss and excess packets.
An embodiment of this application provides a packet forwarding node device. The packet forwarding node device is configured to forward a BIER packet. Refer to
The forwarding module 902 is further configured to: after the timer expires, switch the old forwarding table to the new forwarding table, and forward the BIER packet according to the new forwarding table.
In an example embodiment, in
Before the starting module 901 starts the timer, the determining module 904 determines, according to the old forwarding table, that no loop exists on the packet forwarding path after the network topology changes.
In an example embodiment, in
When it is determined, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the starting module 901 does not start a timer, and the establishment module 903 establishes the new forwarding table. After after establishment of the new forwarding table is completed, the forwarding module 902 switches the old forwarding table to the new forwarding table, and forwards the BIER packet according to the new forwarding table.
In an example embodiment, in
When it is determined, according to the old forwarding table, that the loop exists on the packet forwarding path after the network topology changes, the starting module 901 does not start the timer, and the forwarding module 902 is configured to update the old forwarding table based on the changed network topology, and forward the BIER packet according to the updated forwarding table.
In an example embodiment, the packet forwarding path includes a first path and a second path that is calculated based on the changed network topology. The first path is a path from the destination node device to each neighbor of the destination node device in the old forwarding table. The second path uses each neighbor of the destination node device in the old forwarding table as a start point, and uses an edge node device indicated by a forwarding bit mask of each neighbor of the destination node device as an end point. Existence of the loop means that the second path travels through the destination node device.
In an example embodiment, the determining module 904 is configured to: for any neighbor of the destination node device in the old forwarding table, determine whether a path, indicated by a forwarding bit mask of the any neighbor, of each edge node device in the changed network topology travels through the destination node device; and when a path of any edge node device in the changed network topology travels through the destination node device, determine that the loop exists on the packet forwarding path after the network topology changes; or when the path of each edge node device in the changed network topology does not travel through the destination node device, determine that no loop exists on the packet forwarding path after the network topology changes.
In an example embodiment, the determining module 904 is configured to: establish a shortest path tree in the changed network topology by using each neighbor of the destination node device in the old forwarding table as a root; traverse identifiers of edge node devices that arrive on the shortest path tree through the destination node device, to obtain a bit string; perform an AND operation on the bit string and the forwarding bit mask of the neighbor of the destination node device; and when the result is 0, determine that no loop exists on the packet forwarding path after the network topology changes; or when the result is not 0, determine that the loop exists on the packet forwarding path after the network topology changes.
In an example embodiment, the forwarding module 902 is configured to: before the timer expires, forward the BIER packet by using old multiple load balancing entries.
The establishment module 903 is configured to establish new multiple load balancing entries based on a quantity of load balancing paths.
The forwarding module 902 is configured to: after the timer expires, switch a forwarding table of the multiple load balancing entries to the new multiple load balancing entries, and forward the BIER packet according to the new multiple load balancing entries.
It should be understood that, when the apparatuses provided in
As shown in
The interface 1103 may specifically include a transmitter and a receiver, configured to send and receive information between the packet forwarding node device and another node device in the foregoing embodiment. For example, the interface 1103 is configured to support to receive a BIER packet sent by a neighboring node device. The processor 1101 is configured to perform processing that is performed by the packet forwarding node device in the foregoing embodiment. For example, the processor 1101 is configured to start a timer when it is determined that a network topology changes; before the timer expires, forward the BIER packet by using an old forwarding table and establishing a new forwarding table, where the old forwarding table is a forwarding table used by the packet forwarding node device 1100 before the network topology changes, the new forwarding table is a forwarding table established by the destination node device based on the changed network topology, and the timer indicates that establishment of the new forwarding table is completed before the timer expires; and after the timer expires, switch the old forwarding table to the new forwarding table, and forward the BIER packet according to the new forwarding table. The processor 1101 and/or are/is used in another process of the technology described in this specification. For example, the processor 1101 is configured to support steps 501 to 503 in
It may be understood that
It should be understood that the processor may be a central processing unit (CPU); or may be another general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or another programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, or the like. The general-purpose processor may be a microprocessor, any conventional processor, or the like. It should be noted that the processor may be a processor that supports an advanced reduced instruction set computing machine (ARM) architecture.
Further, in an optional embodiment, the foregoing memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. The memory may further include a non-volatile random access memory. For example, the memory may further store information about a device type.
The memory may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. The nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), used as an external cache. For example but not limitation, many forms of RAMs are available. For example, a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchlink dynamic random access memory (SLDRAM), and a direct rambus random access memory (DR RAM).
A computer-readable storage medium is further provided. The storage medium stores at least one instruction, and a processor loads and executes the at least one instruction to implement any one of the foregoing packet forwarding methods.
This application provides a computer program. When the computer program is executed by a computer, the processor or the computer may perform corresponding steps and/or procedures in the foregoing method embodiments.
All or some of the foregoing embodiments may be implemented by using software, hardware, firmware, or any combination thereof. When the embodiments are implemented by using software, all or some of the embodiments may be implemented in a form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or some of the procedure or functions according to this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or another programmable apparatus. The computer instructions may be stored in the computer-readable storage medium or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible by the computer, or a data storage device, such as a server or a data center, integrating one or more usable media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, a solid-state drive Solid State Disk), or the like.
The foregoing descriptions are merely the embodiments of this application, but are not intended to limit this application. Any modification, equivalent replacement, or improvement made without departing from the spirit and principle of this application should fall within the protection scope of this application.
Number | Date | Country | Kind |
---|---|---|---|
201910606586.9 | Jul 2019 | CN | national |
This application is a continuation of International Application No. PCT/CN2020/090726, filed on May 17, 2020, which claims priority to Chinese Patent Application No. 201910606586.9, filed on Jul. 5, 2019. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2020/090726 | May 2020 | US |
Child | 17646963 | US |