Disclosure of Invention
Accordingly, an objective of the present invention is to provide a method and apparatus for detecting a loop based on VSI in a DRNI network, so as to improve the above-mentioned problems.
The embodiment of the invention provides a loop detection method based on VSI in a DRNI network, which comprises the following steps:
enabling a loop detection function on each Leaf node in the first DRNI network; the loop detection function is used for triggering the loop detection message to be sent to the CPU; the common IP of the first DRNI networking and the common IP of the second DRNI networking establish a first tunnel, and the first DRNI networking is connected with each device through a DR interface; the AC interfaces and tunnels in the first DRNI networking and the second DRNI networking are all bound in the same VSI;
constructing a loop detection message at each Leaf node in the first DRNI networking; the loop detection message is broadcast and sent on the own VSI and can be sent out on the first tunnel and each AC interface;
judging whether the SMAC is received within a preset time as a loop detection message of the equipment;
if the loop detection message is received from other panel ports except the internal control link port, both the two-layer unicast message and the broadcast message based on the VSI are discarded, and the loop is released.
Preferably, the loop detects the encapsulation format of the ethernet header of the message, and includes the following fields:
DMAC: the destination MAC address of the message uses a multicast MAC address 010F-E200-8570; when the device enables the loop detection function, redirecting the message of the destination address to a CPU for processing, and broadcasting an original message in a VSI (virtual switch interface) receiving the message;
SMAC: the source MAC address of the message adopts the bridge MAC of the equipment for sending the message;
TPID: the VLAN label type is 0x8100;
VLAN: the specific value of the VLAN label, the specific content comprises priority and VLAN ID;
type: a protocol type;
data: the data is in TLV format; the Data includes the following: chassis ID TLV, slot ID TLV, VSI TLV, VLAN TLV, port ID TLV, and End of TLV.
Preferably, the loop removal comprises:
confirming a virtual interface of a loop in the VSI, and releasing the loop; the virtual interface includes an AC interface or a tunnel.
Preferably, confirming a looped virtual interface within the VSI; the virtual interface comprises an AC interface or tunnel, comprising:
transmitting a detection message based on a virtual interface on each Leaf node of the first DRNI networking, wherein the virtual interface is related to VSI;
when the equipment receives a detection message from a virtual interface, checking whether the SMAC, the Chassis ID and the Slot ID in the detection message are the information of the equipment;
if not, adding the virtual interface information of the received loop detection message into the detection message and sending the detection message out of the IPP ports among the Leaf nodes, so as to forward the detection message to other equipment of the first DRNI networking;
if yes, indicating that the association exists between the virtual interface recorded in the DATA of the loop detection message and the virtual interface of the received detection message, namely forming a loop; setting a BLOCK for the corresponding virtual interface according to a preset loop detection BLOCK priority;
after detection is completed, the ACL which is discarded by both the two-layer unicast message and the broadcast message which are matched with the VSI is deleted, and the VSI loop is released.
Preferably, the loop detection Block priority is sequentially from high to low:
the self-sent message is received from self, and the virtual interface prioritizes BLOCK;
the tunnel sent out by the AC interface can be received, meanwhile, the AC interface sent out by the tunnel can also be received, and the priority AC interface sets a BLOCK;
the second AC interface sent by the first AC interface receives the BLOCK with small port; the tunnel is sent out and received from another tunnel, and the BLOCK is set based on VSI with small tunnel index;
the unidirectional energy is received, and the BLOCK is set for the transmitted virtual interface.
Preferably, the method further comprises:
when the state of the associated virtual interface changes, starting a detection flow of the related Block virtual interface; if the first tunnel fails or the first tunnel is unbound with the VSI, a detection message based on the virtual interface is immediately sent from the second AC interface, and if the detection message is not scheduled to be received, the state of the second AC interface is set to Forward.
The embodiment of the invention also provides a loop detection device based on VSI in the DRNI network, which comprises:
a loop detection enabling unit, configured to enable a loop detection function on each Leaf node in the first DRNI network; the loop detection function is used for triggering the loop detection message to be sent to the CPU; the common IP of the first DRNI networking and the common IP of the second DRNI networking establish a first tunnel, and the first DRNI networking is connected with each device through a DR interface; the AC interfaces and tunnels in the first DRNI networking and the second DRNI networking are all bound in the same VSI;
the detection message construction unit is used for constructing loop detection messages at all Leaf nodes in the first DRNI networking; the loop detection message is broadcast and sent on the own VSI and can be sent out on the first tunnel and each AC interface;
the judging unit is used for judging whether the SMAC is received in a preset time to be a loop detection message of the equipment;
and the releasing unit is used for discarding the two-layer unicast message and the broadcast message based on the VSI and releasing the loop if the loop detection message is received from other panel ports except the internal control link port.
Preferably, the loop detects the encapsulation format of the ethernet header of the message, and includes the following fields:
DMAC: the destination MAC address of the message uses a multicast MAC address 010F-E200-8570; when the device enables the loop detection function, redirecting the message of the destination address to a CPU for processing, and broadcasting an original message in a VSI (virtual switch interface) receiving the message;
SMAC: the source MAC address of the message adopts the bridge MAC of the equipment for sending the message;
TPID: the VLAN label type is 0x8100;
VLAN: the specific value of the VLAN label, the specific content comprises priority and VLAN ID;
type: a protocol type;
data: the data is in TLV format; the Data includes the following: chassis ID TLV, slot ID TLV, VSI TLV, VLAN TLV, port ID TLV, and End of TLV.
Preferably, the releasing unit is specifically configured to: confirming a virtual interface of a loop in the VSI, and releasing the loop; the virtual interface includes an AC interface or a tunnel.
Preferably, the releasing unit is specifically configured to:
transmitting a detection message based on a virtual interface on each Leaf node of the first DRNI networking, wherein the virtual interface is related to VSI;
when the equipment receives a detection message from a virtual interface, checking whether the SMAC, the Chassis ID and the Slot ID in the detection message are the information of the equipment;
if not, adding the virtual interface information of the received loop detection message into the detection message and sending the detection message out of the IPP ports among the Leaf nodes, so as to forward the detection message to other equipment of the first DRNI networking;
if yes, indicating that the association exists between the virtual interface recorded in the DATA of the loop detection message and the virtual interface of the received detection message, namely forming a loop; setting a BLOCK for the corresponding virtual interface according to a preset loop detection BLOCK priority;
after detection is completed, the ACL which is discarded by both the two-layer unicast message and the broadcast message which are matched with the VSI is deleted, and the VSI loop is released.
Preferably, the loop detection Block priority is sequentially from high to low:
the self-sent message is received from self, and the virtual interface prioritizes BLOCK;
the tunnel sent out by the AC interface can be received, meanwhile, the AC interface sent out by the tunnel can also be received, and the priority AC interface sets a BLOCK;
the second AC interface sent by the first AC interface receives the BLOCK with small port; the tunnel is sent out and received from another tunnel, and the BLOCK is set based on VSI with small tunnel index;
the unidirectional energy is received, and the BLOCK is set for the transmitted virtual interface.
In summary, the present embodiment can check whether a loop exists in the DRNI network, and release the loop through the BLOCK-related interface. And when the DRNI environment changes, the DRNI environment responds quickly, and the relevant interface state is updated to ensure the normal forwarding of the traffic.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
For a better understanding of the technical solution of the present invention, the following detailed description of the embodiments of the present invention refers to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The invention is described in further detail below with reference to the attached drawings and detailed description:
referring to fig. 2 and fig. 3 together, a first embodiment of the present invention provides a VSI-based loop detection method in a DRNI network, which includes:
s101, enabling a loop detection function on each Leaf node in a first DRNI networking; the loop detection function is used for triggering the loop detection message to be sent to the CPU; the common IP of the first DRNI networking and the common IP of the second DRNI networking establish a first tunnel, and the first DRNI networking is connected with each device through a DR interface; the AC interfaces and tunnels in the first DRNI network and the second DRNI network are both bound in the same VSI.
In this embodiment, taking fig. 3 as an example, a DRNI network includes a first DRNI network 10 and a second DRNI network 20, the first DRNI network 10 includes a first Leaf node 11 and a second Leaf node 12, the second DRNI network 20 includes a third Leaf node 21 and a second Leaf node 22, a first tunnel is established by a common IP of the first DRNI network 10 and a common IP of the second DRNI network 20, and the DRNI is connected to each device (i.e., the first device 31, the second device 32, the third device 33, and the fourth device 34 in fig. 3) through a DR interface (Distributed Relay interface, a distributed aggregation interface); each AC interface and the first tunnel in the DRNI network are bound in the same VSI (the Vxlan ID associated with the VSI is the same). And all Leaf nodes in the networking are communicated through the Spine three layers.
Of course, it should be noted that, in other embodiments of the present invention, the number of DRNI networks and the number of Leaf nodes in one DRNI network may be set according to actual needs, and the present invention is not limited specifically.
S102, constructing a loop detection message at each Leaf node in a first DRNI networking; the loop detection message is broadcast and sent on the own VSI and can be sent out on the first tunnel and each AC interface;
s103, judging whether the SMAC is a loop detection message of the equipment or not in a preset time.
If not, it is indicated that no loop is formed.
And S104, if the loop detection message is received from other panel ports except the internal control link port, discarding the two-layer unicast message and the broadcast message based on the VSI, and removing the loop.
In this embodiment, in order to detect whether there is a loop in the network, the loop detection function is first enabled on the first Leaf node 11 and the second Leaf node 12 in the first DRNI network 10. This operation will issue an acl that causes the loop detection message to be sent to the CPU, specifically by matching the Ethernet type with the DMAC.
Then, a loop detection message is constructed on the first Leaf node 11 and the second Leaf node 12.
As shown in fig. 4, the encapsulation format of the ethernet header of the loop detection packet, where each field is explained as follows:
DMAC: the destination MAC address of the message uses the multicast MAC address 010F-E200-8570. When the device enables the loop detection function, the message of the destination address is redirected to the CPU for processing, and the original message is broadcasted in the VSI receiving the message.
SMAC: the source MAC address of the message adopts the bridge MAC of the device sending the message.
TPID: the VLAN tag type may take a value of 0x8100.
VLAN: the specific value of the VLAN tag is the priority, VLAN ID, etc.
Type: the protocol type is 0x8570, and the value can be adjusted according to actual conditions.
Data: the data is in TLV format, and the content is shown in FIG. 5.
Wherein, the format of the TLV, i.e., type+length+value, type represents the type of TLV, length is the length of TLV in bytes, and value is the value of the TLV. Where the End Of TLV is mandatory, it must contain parts, in addition to which 1 to several optional other TLVs may be contained before the End Of the TLV. The TLV format is shown in fig. 6.
The TYPE definition of TLV is shown in table 1 below:
TABLE 1
The TLV for manager is the part that DATA must contain. The End Of TLV format is shown in fig. 7.
In this embodiment, after the loop detection message is constructed, the loop detection message is broadcast and sent on the VSI of the local network, and the loop detection message is sent out on the first tunnel, the first AC interface 41 and the second AC interface 42. If no loop detection message is received by the SMAC within a predetermined time (e.g., 1 second) that is the device, then no loop is considered. If a loop detection message (SMAC is the bridge MAC of the first Leaf node 11 or the second Leaf node 12) is received from a panel Port other than the PP (Intra-Port), the next ACL discards both the two-layer unicast message and the broadcast message based on the VSI, and releases the loop. Wherein, the loop is released by the following modes:
firstly, confirming virtual interfaces forming a ring in a VSI, and sending detection messages based on the virtual interfaces on virtual interfaces related to the VSI on all Leaf nodes of a first DRNI networking;
then, when the equipment receives a detection message from the virtual interface, checking whether the SMAC, the Chassis ID and the Slot ID in the detection message are information of the equipment;
if not, adding the virtual interface information of the received loop detection message into the detection message and sending the detection message out of the IPP ports among the Leaf nodes, so as to forward the detection message to other equipment of the first DRNI networking;
if yes, indicating that the association exists between the virtual interface recorded in the DATA of the loop detection message and the virtual interface of the received detection message, namely forming a loop; and setting the corresponding virtual interface to BLOCK according to the preset loop detection BLOCK priority.
As shown in fig. 8, when the probe packet sent out by the second AC interface 42 is received from the first tunnel and the probe packet sent out by the first tunnel is received from the second AC interface 42, the second AC interface 42 is set to be a Block, and the virtual interface associated with the second AC interface 42 is recorded as the first tunnel.
The loop detection Block priority is sequentially from high to low:
the self-sent message is received from self, and the virtual interface prioritizes BLOCK;
the tunnel sent out by the AC interface can be received, meanwhile, the AC interface sent out by the tunnel can also be received, and the priority AC interface sets a BLOCK;
the second AC interface sent by the first AC interface receives the BLOCK with small port; the tunnel is sent out and received from another tunnel, and the BLOCK is set based on VSI with small tunnel index;
the unidirectional energy is received, and the BLOCK is set for the transmitted virtual interface.
After detection is completed, the ACL which is discarded by both the two-layer unicast message and the broadcast message which are matched with the VSI is deleted, and the VSI loop is released, so that the traffic can be forwarded normally.
In this embodiment, when the state of the associated virtual interface changes, the detection flow of the associated Block virtual interface is immediately started. If the first tunnel fails or the first tunnel is unbound with the VSI, a detection message based on the virtual interface is immediately sent from the second AC interface, and if the message is not received within 1 second, the state of the second AC interface is set to Forward.
In summary, the present embodiment can check whether a loop exists in the DRNI network, and release the loop through the BLOCK-related interface. And when the DRNI environment changes, the DRNI environment responds quickly, and the relevant interface state is updated to ensure the normal forwarding of the traffic.
Referring to fig. 9, the second embodiment of the present invention further provides a VSI-based loop detection apparatus in a DRNI network, which includes:
a loop detection enabling unit 210, configured to enable a loop detection function on each Leaf node in the first DRNI network; the loop detection function is used for triggering the loop detection message to be sent to the CPU; the common IP of the first DRNI networking and the common IP of the second DRNI networking establish a first tunnel, and the first DRNI networking is connected with each device through a DR interface; the AC interfaces and tunnels in the first DRNI networking and the second DRNI networking are all bound in the same VSI;
a detection message construction unit 220, configured to construct a loop detection message at each Leaf node in the first DRNI network; the loop detection message is broadcast and sent on the own VSI and can be sent out on the first tunnel and each AC interface;
a judging unit 230, configured to judge whether the SMAC is received as a loop detection message of the device within a preset time;
and the releasing unit 240 is configured to discard both the two-layer unicast message and the broadcast message based on the VSI and release the loop if the loop detection message is received from the other panel ports except the internal control link port.
Preferably, the loop detects the encapsulation format of the ethernet header of the message, and includes the following fields:
DMAC: the destination MAC address of the message uses a multicast MAC address 010F-E200-8570; when the device enables the loop detection function, redirecting the message of the destination address to a CPU for processing, and broadcasting an original message in a VSI (virtual switch interface) receiving the message;
SMAC: the source MAC address of the message adopts the bridge MAC of the equipment for sending the message;
TPID: the VLAN label type is 0x8100;
VLAN: the specific value of the VLAN label, the specific content comprises priority and VLAN ID;
type: a protocol type;
data: the data is in TLV format; the Data includes the following: chassis ID TLV, slot ID TLV, VSI TLV, VLAN TLV, port ID TLV, and End of TLV.
Preferably, the releasing unit is used for confirming a looped virtual interface in the VSI and releasing the loop; the virtual interface includes an AC interface or a tunnel.
Preferably, the releasing unit is specifically configured to:
transmitting a detection message based on a virtual interface on each Leaf node of the first DRNI networking, wherein the virtual interface is related to VSI;
when the equipment receives a detection message from a virtual interface, checking whether the SMAC, the Chassis ID and the Slot ID in the detection message are the information of the equipment;
if not, adding the virtual interface information of the received loop detection message into the detection message and sending the detection message out of the IPP ports among the Leaf nodes, so as to forward the detection message to other equipment of the first DRNI networking;
if yes, indicating that the association exists between the virtual interface recorded in the DATA of the loop detection message and the virtual interface of the received detection message, namely forming a loop; setting a BLOCK for the corresponding virtual interface according to a preset loop detection BLOCK priority;
after detection is completed, the ACL which is discarded by both the two-layer unicast message and the broadcast message which are matched with the VSI is deleted, and the VSI loop is released.
Preferably, the loop detection Block priority is sequentially from high to low:
the self-sent message is received from self, and the virtual interface prioritizes BLOCK;
the tunnel sent out by the AC interface can be received, meanwhile, the AC interface sent out by the tunnel can also be received, and the priority AC interface sets a BLOCK;
the second AC interface sent by the first AC interface receives the BLOCK with small port; the tunnel is sent out and received from another tunnel, and the BLOCK is set based on VSI with small tunnel index;
the unidirectional energy is received, and the BLOCK is set for the transmitted virtual interface.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus and method embodiments described above are merely illustrative, for example, flow diagrams and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present invention may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, or other various media capable of storing program codes. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.