Disclosure of Invention
The embodiment of the invention provides a message forwarding method and device based on a data center, which are used for solving the problem of three-layer loops in the prior art.
According to an embodiment of the present invention, a method for forwarding a packet based on a data center is provided, which is applied to a core switch included in the data center, and includes:
determining a first shared risk link group to which a receiving interface of a message belongs, wherein the first shared risk link group comprises each interface connected between a switch connected with the receiving interface and the core switch;
searching a first route forwarding table item corresponding to a destination Internet Protocol (IP) address of the message in a route forwarding table;
if the first route forwarding table entry is found in the route forwarding table, finding a first set equal-cost multi-path group corresponding to the first shared risk link group in the first route forwarding table entry;
if the first set equal cost multi-path group is found in the first route forwarding table entry, forwarding the message according to the first set equal cost multi-path group; if the first set equal cost multi-path group is not found in the route forwarding table entry, forwarding the message according to a first original equal cost multi-path group in the first route forwarding table entry; the interfaces included in the first set equal cost multi-path group are interfaces except the interfaces belonging to the first shared risk link group in the interfaces included in the first original equal cost multi-path group.
Optionally, the method further includes:
setting interfaces connected with the switches with the same networking role in all the interfaces of the core switch as a load sharing interface group;
and setting the interfaces connected with the same switch in all the interfaces of the core switch as a shared risk link group.
Optionally, the method further includes:
after learning a second route forwarding table entry, determining whether each interface included in a second original equivalent multipath group in the second route forwarding table entry belongs to the same load sharing interface group;
if it is determined that each interface included in the second original equal-cost multi-path group belongs to the same load sharing interface group, determining a shared risk link risk group to which each interface included in the second original equal-cost multi-path group belongs;
and adding a set equal cost multi-path group corresponding to each determined shared risk link group in the second route forwarding table entry, wherein an interface included in each added set equal cost multi-path group is an interface except for an interface included in the corresponding shared risk link group in the interfaces included in the second original equal cost multi-path group.
Optionally, the method further includes:
and if the first route forwarding table entry is not found in the route forwarding table, discarding the message.
According to an embodiment of the present invention, there is also provided a data center-based packet forwarding apparatus, applied to a core switch included in the data center, including:
a first determining module, configured to determine a first shared risk link group to which a receiving interface of a packet belongs, where the first shared risk link group includes each interface connected between a switch connected to the receiving interface and the core switch;
the first searching module is used for searching a first route forwarding table item corresponding to the destination IP address of the message in a route forwarding table;
a second searching module, configured to search a first set equal-cost multipath group corresponding to the first shared risk link group in the first route forwarding table entry if the first route forwarding table entry is found in the route forwarding table;
a forwarding module, configured to forward the packet according to the first set equal cost multipath group if the first set equal cost multipath group is found in the first route forwarding entry; if the first set equal cost multi-path group is not found in the route forwarding table entry, forwarding the message according to a first original equal cost multi-path group in the first route forwarding table entry; the interfaces included in the first set equal cost multi-path group are interfaces except the interfaces belonging to the first shared risk link group in the interfaces included in the first original equal cost multi-path group.
Optionally, the system further comprises a setting module, configured to:
setting interfaces connected with the switches with the same networking role in all the interfaces of the core switch as a load sharing interface group;
and setting the interfaces connected with the same switch in all the interfaces of the core switch as a shared risk link group.
Optionally, the apparatus further includes a second determining module, configured to:
after learning a second route forwarding table entry, determining whether each interface included in a second original equivalent multipath group in the second route forwarding table entry belongs to the same load sharing interface group;
if it is determined that each interface included in the second original equal-cost multi-path group belongs to the same load sharing interface group, determining a shared risk link risk group to which each interface included in the second original equal-cost multi-path group belongs;
and adding a set equal cost multi-path group corresponding to each determined shared risk link group in the second route forwarding table entry, wherein an interface included in each added set equal cost multi-path group is an interface except for an interface included in the corresponding shared risk link group in the interfaces included in the second original equal cost multi-path group.
Optionally, the system further comprises a discarding module, configured to:
and if the first route forwarding table entry is not found in the route forwarding table, discarding the message.
According to the embodiment of the invention, the electronic equipment comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing the above method steps when executing the program stored in the memory.
According to an embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein a computer program, which when executed by a processor, performs the above-mentioned method steps.
The invention has the following beneficial effects:
the embodiment of the invention provides a message forwarding method and a device based on a data center, wherein a first shared risk link group to which a receiving interface of a message belongs is determined, and the first shared risk link group comprises each interface connected between a switch connected with the receiving interface and a core switch; searching a first route forwarding table item corresponding to a destination Internet Protocol (IP) address of the message in a route forwarding table; if the first route forwarding table entry is found in the route forwarding table, finding a first set equal-cost multi-path group corresponding to the first shared risk link group in the first route forwarding table entry; if the first set equal cost multi-path group is found in the first route forwarding table entry, forwarding the message according to the first set equal cost multi-path group; if the first set equal cost multi-path group is not found in the route forwarding table entry, forwarding the message according to a first original equal cost multi-path group in the first route forwarding table entry; the interfaces included in the first set equal cost multi-path group are interfaces except the interfaces belonging to the first shared risk link group in the interfaces included in the first original equal cost multi-path group. In the scheme, after receiving a message, a core switch searches for a first set equal cost multi-path group corresponding to a first shared risk link group to which a receiving interface of the message belongs in a first route forwarding table entry, if the first set equal cost multi-path group is found, the message is forwarded through the first set equal cost multi-path group, and because an interface included in the first set equal cost multi-path group is an interface except an interface included in a first original equal cost multi-path group, and the interface of the first shared risk link group is connected with the same device, the message is not forwarded through an interface included in the first shared risk link group to which the receiving interface of the message belongs, and the message is also ensured not to be forwarded to a switch which sends the message; if the first set equal cost multi-path group is not found, it is indicated that the interface included in the first original equal cost multi-path group does not include the interface included in the first shared risk link group, the message can be forwarded according to the first original equal cost multi-path group in the first route forwarding table entry, and thus it can be ensured that the message is not forwarded to the switch sending the message.
Detailed Description
To solve the problem of three-layer loops in the prior art, an embodiment of the present invention provides a packet forwarding method based on a data center, which is applied to a core switch included in the data center, and a flow of the method is shown in fig. 2, and the method includes the following steps:
s21: and determining a first shared risk link group to which a receiving interface of the message belongs.
The first shared risk link group includes interfaces connected between the switch receiving the interface connection and the core switch, that is, the interfaces connected to the same switch may be set as a shared risk link group.
S22: searching a first route forwarding table entry corresponding to a destination Internet Protocol (IP) address of the message in the route forwarding table, and if the first route forwarding table entry is found in the route forwarding table, executing S23; if the first route forwarding table entry is not found in the route forwarding table, S26 is executed.
S23: searching a first set equal cost multipath group corresponding to the first shared risk link group in the first route forwarding table entry, and if the first set equal cost multipath group is searched in the first route forwarding table entry, executing S24; if the first set equal cost multi-path group is not found in the route forwarding entry, S25 is executed.
If the first route forwarding entry is found in the route forwarding table, the packet may be processed according to the first route forwarding entry, specifically, a set equal cost multi-path group corresponding to the first shared risk link group may be found in the first route forwarding entry, and the set equal cost multi-path group may be defined as a first set equal cost multi-path group.
S24: and forwarding the message according to the first set equal cost multipath group.
S25: and forwarding the message according to the first original equivalent multipath group in the first route forwarding table entry.
The interfaces included in the first set equal-cost multipath group are interfaces except the interfaces belonging to the first shared risk link group in the interfaces included in the first original equal-cost multipath group.
S26: and discarding the message.
If the destination IP address of the message is not found in the route forwarding table, the message cannot be forwarded, and the message can be directly discarded.
In the scheme, after receiving a message, a core switch searches for a first set equal cost multi-path group corresponding to a first shared risk link group to which a receiving interface of the message belongs in a first route forwarding table entry, if the first set equal cost multi-path group is found, the message is forwarded through the first set equal cost multi-path group, and because an interface included in the first set equal cost multi-path group is an interface except an interface included in a first original equal cost multi-path group, and the interface of the first shared risk link group is connected with the same device, the message is not forwarded through an interface included in the first shared risk link group to which the receiving interface of the message belongs, and the message is also ensured not to be forwarded to a switch which sends the message; if the first set equal cost multi-path group is not found, it is indicated that the interface included in the first original equal cost multi-path group does not include the interface included in the first shared risk link group, the message can be forwarded according to the first original equal cost multi-path group in the first route forwarding table entry, and thus it can be ensured that the message is not forwarded to the switch sending the message.
Optionally, the method further includes:
setting interfaces connected with the switches with the same networking role in all interfaces of the core switch as a load sharing interface group;
and setting the interface connected with the same switch in all the interfaces of the core switch as a shared risk link group.
As shown in fig. 1, for the core switch 1 and the core switch 2, the interface connected to the metro network switch may be set as one load sharing group, and the aggregation switch 1 and the aggregation switch 2 are both aggregation switches in the networking role of the data center, so that the interface connected to the aggregation switch 1 and the aggregation switch 2 may be set as another load sharing group, and then the interface connected to the aggregation switch 1 may be set as one shared risk link group, and the interface connected to the aggregation switch 2 may be set as another shared risk link group.
Correspondingly, the method further comprises the following steps:
after learning the second route forwarding table entry, determining whether each interface included in the second original equivalent multi-path group in the second route forwarding table entry belongs to the same load sharing interface group;
if it is determined that each interface included in the second original equal cost multi-path group belongs to the same load sharing interface group, determining a shared risk link risk group to which each interface included in the second original equal cost multi-path group belongs;
and adding a set equal-cost multi-path group corresponding to each determined shared risk link group in a second route forwarding table entry, wherein an interface included in each added set equal-cost multi-path group is an interface except for an interface included in the corresponding shared risk link group in the interfaces included in the second original equal-cost multi-path group.
The core switch may continuously learn a routing forwarding entry, where the routing forwarding entry may be defined as a second routing forwarding entry, an equal cost multi-path group included in the second routing forwarding entry may be defined as a second original equal cost multi-path group, and it may be determined whether each interface included in the second original equal cost multi-path group belongs to the same load sharing interface group, and if it is determined that each interface included in the second original equal cost multi-path group belongs to the same load sharing interface group, a three-layer loop may be generated, it is necessary to further determine a shared risk link risk group to which each interface included in the second original equal cost multi-path group belongs, and then add a set equal cost group corresponding to each determined shared risk link group in the second routing forwarding entry, where an interface included in each set equal cost multi-path group is an interface included in the second original equal cost multi-path group, excluding an interface included in the corresponding shared risk link group Thus, it can be ensured that the received message is not forwarded to the switch that sent the message.
It should be noted that the second route forwarding table entry may be the same as or different from the first route forwarding table entry.
The following description will be given by taking the core switch 1 shown in fig. 1 as an example, assuming that interfaces of the core switch 1 and the aggregation switch 1 are Gi0/0 and Gi0/1, next hop addresses are 10.1.0.1 and 10.1.1.1, interfaces of the core switch 1 and the aggregation switch 2 are Gi0/2 and Gi0/3, next hop addresses are 10.1.2.1 and 10.1.3.1, interfaces of the core switch 1 and the metro network switch are Gi0/4 and Gi0/5, and next hop addresses are 10.1.4.1 and 10.1.5.1, Gi0/0, Gi0/1, Gi0/2 and Gi0/3 can be configured as a load sharing interface group 1, Gi 38/4 and Gi0/5 can be configured as a load sharing interface group 2, Gi0/0 and Gi0/1 can be configured as a load sharing interface group 2, Gi0/1 and Gi0/2 can be configured as a load sharing link group 2/2, Gi0/3 is configured as shared risk link group 2, and Gi0/4, Gi0/5 are configured as shared risk link group 3.
If the routing table entry 100.1.1.1/32 from the access switch 1 is learned, its next hop and egress interface are <10.1.0.1, Gi0/0>, <10.1.1.1, Gi0/1>, <10.1.2.1, Gi0/2>, <10.1.3.1, Gi0/3>, respectively. All the outgoing interfaces of the route 100.1.1.1/32 are in the load sharing interface group 1, where the outgoing interfaces Gi0/0, Gi0/1, Gi0/2, and Gi0/3 belong to different shared risk link groups, and therefore it is necessary to set corresponding set equal-cost multipath groups for each shared risk link group, which are:
A) using { <10.1.0.1, Gi0/0>, <10.1.1.1, Gi0/1>, <10.1.2.1, Gi0/2>, <10.1.3.1, Gi0/3> } as the default original equal cost multipath set, and marking with EP-0.
B) The set of forwarding paths excluding the shared risk link group 1 { <10.1.2.1, Gi0/2>, <10.1.3.1, Gi0/3> } is taken as a set equal cost multipath group, denoted by EP-1.
C) The set of forwarding paths excluding the shared risk link group 2 { <10.1.0.1, Gi0/0>, <10.1.1, Gi0/1> } is used as a set equal cost multi-path group, and is marked with EP-2.
Routing table entries 100.1.1.1/32 may be associated with EP-0, EP-1, and EP-2.
The message of the external access switch 1 downlink server 100.1.1.1 reaches the core switch 1 through the metropolitan area network switch; the core switch 1 receives the message from Gi0/4 or Gi0/5 between the core switch and the metropolitan area network switch, determines the shared risk link group 3 to which the receiving interface of the message belongs, then searches a routing forwarding table according to the destination IP address 100.1.1.1 of the message, finds a routing table item with a prefix of 100.1.1.1/32, and then searches a set equivalent multi-path group corresponding to the shared risk link group 3 in the routing table item 100.1.1.1/32, and does not find the set equivalent multi-path group, and at this time, the message can be forwarded to the aggregation switch 1 or the aggregation switch 2 based on the original equivalent multi-path group EP-0; if the link between the aggregation switch 1 and the access switch 1 and the link between the aggregation switch 1 and the access switch 2 are in failure, the message accessing 100.1.1.1 server is retransmitted to the core switch 1 and the core switch 2 at the aggregation switch 1 according to the default route; the core switch 1 receives the message from the interface Gi0/0 or Gi0/1 between the core switch 1 and the aggregation switch 1, determines the shared risk link group 1 to which the receiving interface of the message belongs, searches a routing forwarding table according to the destination IP address 100.1.1.1 of the message, finds a routing table item with a prefix of 100.1.1.1/32, searches a set equivalent multi-path group corresponding to the shared risk link group 1 in the routing table item 100.1.1.1/32, finds EP-1, and forwards the message to the aggregation switch 2 according to EP-1 (the forwarding path of EP-1 does not reach the aggregation switch 1); the convergence switch 2 receives the message forwarded by the core switch 1 and forwards the message to the access switch 1. Thereby avoiding the creation of a three-layer loop.
Based on the same inventive concept, an embodiment of the present invention provides a data center-based message forwarding apparatus, which is applied to a core switch included in a data center, and a structure of the apparatus is shown in fig. 3, where the apparatus includes:
a first determiningmodule 31, configured to determine a first shared risk link group to which a receiving interface of a packet belongs, where the first shared risk link group includes interfaces connected between a switch and a core switch that are connected to the receiving interface;
afirst searching module 32, configured to search, in a route forwarding table, a first route forwarding table entry corresponding to a destination IP address of a packet;
asecond searching module 33, configured to search a first set equal-cost multipath group corresponding to the first shared risk link group in the first route forwarding table entry if the first route forwarding table entry is found in the route forwarding table;
aforwarding module 34, configured to forward the packet according to the first set equal cost multipath group if the first set equal cost multipath group is found in the first route forwarding entry; if the first set equal cost multi-path group is not found in the route forwarding table entry, forwarding the message according to a first original equal cost multi-path group in the first route forwarding table entry; the interfaces included in the first set equal-cost multipath group are interfaces except the interfaces belonging to the first shared risk link group in the interfaces included in the first original equal-cost multipath group.
In the scheme, after receiving a message, a core switch searches for a first set equal cost multi-path group corresponding to a first shared risk link group to which a receiving interface of the message belongs in a first route forwarding table entry, if the first set equal cost multi-path group is found, the message is forwarded through the first set equal cost multi-path group, and because an interface included in the first set equal cost multi-path group is an interface except an interface included in a first original equal cost multi-path group, and the interface of the first shared risk link group is connected with the same device, the message is not forwarded through an interface included in the first shared risk link group to which the receiving interface of the message belongs, and the message is also ensured not to be forwarded to a switch which sends the message; if the first set equal cost multi-path group is not found, it is indicated that the interface included in the first original equal cost multi-path group does not include the interface included in the first shared risk link group, the message can be forwarded according to the first original equal cost multi-path group in the first route forwarding table entry, and thus it can be ensured that the message is not forwarded to the switch sending the message.
Optionally, the apparatus further includes a setting module, configured to:
setting interfaces connected with the switches with the same networking role in all interfaces of the core switch as a load sharing interface group;
and setting the interface connected with the same switch in all the interfaces of the core switch as a shared risk link group.
Optionally, the apparatus further includes a second determining module, configured to:
after learning a second route forwarding table entry, determining whether each interface included in a second original equivalent multi-path group in the second route forwarding table entry belongs to the same load sharing interface group;
if it is determined that each interface included in the second original equal-cost multi-path group belongs to the same load sharing interface group, determining a shared risk link risk group to which each interface included in the second original equal-cost multi-path group belongs;
and adding the set equal cost multipath group corresponding to each determined shared risk link group in a second route forwarding table entry, wherein the added interfaces included in each set equal cost multipath group are the interfaces except the interfaces included in the corresponding shared risk link group in the interfaces included in the second original equal cost multipath group.
Optionally, the apparatus further includes a discarding module, configured to:
and if the first route forwarding table entry is not found in the route forwarding table, discarding the message.
The embodiment of the present application further provides an electronic device, please refer to fig. 4, which includes aprocessor 410, acommunication interface 420, amemory 430, and acommunication bus 440, where theprocessor 410, thecommunication interface 420, and thememory 430 complete communication with each other through thecommunication bus 440.
Amemory 430 for storing computer programs;
theprocessor 410 is configured to implement the message forwarding method based on the data center according to any of the embodiments described above when executing the program stored in thememory 430.
Thecommunication interface 420 is used for communication between the above-described electronic device and other devices.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In the scheme, after receiving a message, a core switch searches for a first set equal cost multi-path group corresponding to a first shared risk link group to which a receiving interface of the message belongs in a first route forwarding table entry, if the first set equal cost multi-path group is found, the message is forwarded through the first set equal cost multi-path group, and because an interface included in the first set equal cost multi-path group is an interface except an interface included in a first original equal cost multi-path group, and the interface of the first shared risk link group is connected with the same device, the message is not forwarded through an interface included in the first shared risk link group to which the receiving interface of the message belongs, and the message is also ensured not to be forwarded to a switch which sends the message; if the first set equal cost multi-path group is not found, it is indicated that the interface included in the first original equal cost multi-path group does not include the interface included in the first shared risk link group, the message can be forwarded according to the first original equal cost multi-path group in the first route forwarding table entry, and thus it can be ensured that the message is not forwarded to the switch sending the message.
Accordingly, an embodiment of the present application further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer is caused to execute any of the data center-based message forwarding methods described in the foregoing embodiments.
In the scheme, after receiving a message, a core switch searches for a first set equal cost multi-path group corresponding to a first shared risk link group to which a receiving interface of the message belongs in a first route forwarding table entry, if the first set equal cost multi-path group is found, the message is forwarded through the first set equal cost multi-path group, and because an interface included in the first set equal cost multi-path group is an interface except an interface included in a first original equal cost multi-path group, and the interface of the first shared risk link group is connected with the same device, the message is not forwarded through an interface included in the first shared risk link group to which the receiving interface of the message belongs, and the message is also ensured not to be forwarded to a switch which sends the message; if the first set equal cost multi-path group is not found, it is indicated that the interface included in the first original equal cost multi-path group does not include the interface included in the first shared risk link group, the message can be forwarded according to the first original equal cost multi-path group in the first route forwarding table entry, and thus it can be ensured that the message is not forwarded to the switch sending the message.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While alternative embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following appended claims be interpreted as including alternative embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass these modifications and variations.