Disclosure of Invention
In order to realize loop detection and positioning of a two-layer network, the invention provides a loop detection and positioning method of the two-layer network, which is used for periodically sending a private loop detection message, carrying out loop judgment and blocking flow according to sending port information and SMAC in the private loop detection message, supporting positioning loop points and blocking loops on multi-chip forwarding equipment, and reducing forwarding pressure of the detection message to the whole network.
In order to achieve the above purpose, the present invention adopts the following technical scheme.
In the embodiment of the invention, a two-layer network loop detection positioning method is provided, which comprises the following steps:
s1, periodically sending a private loop detection message, wherein the private message carries sending port information;
s2, after receiving the private loop detection message, the equipment carries out loop judgment and determines a block port blocking flow according to SMAC and sending port information in the private message;
s3, in the BFC period, if the block port does not receive the loop detection message, the port state is set to be a forward forwarding state;
s4, in the RLC period, waiting until the RLT timer is finished, prompting user loop release of a block port, wherein the block port is a looping point, and prompting the user to loop-free of a non-block port.
Further, the private message is newly added with a TPID type, transmission port information and total transmission times TFT.
Further, the sending port information includes a port type, a port logic id, and a chip id.
Further, after receiving the private loop detection message, the device determines whether the SMAC is equal to the Local MAC and whether the chip id to which the transmitting port belongs is equal to the receiving port chip id, and if yes, the device considers the SMAC as a loop.
Further, if the device determines that the loop is not established, the TFT field is added with 1, if yes, the device is discarded, and if no, the device continues to forward.
Further, if the device determines that the device is a loop, the device further determines the block port according to the states of the transmitting port and the receiving port.
Further, the newly accessed link results in a loop, and its port is naturally a block port as a looping point.
Further, if any non-block port receives the detection message sent by the chip in the RLC period, the RLT needs to be re-clocked; otherwise, when the timer is finished, namely the whole loop detection is finished, the user loop is released, a block port is used as a looping point, and a non-block port prompts the user to have no loop.
In the embodiment of the invention, a computer device is also provided, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the access method of the special terminal when executing the computer program.
In an embodiment of the present invention, a computer-readable storage medium is also presented, in which a computer program for executing the access method of a specific terminal is stored.
The invention has the beneficial effects that the two-layer network loop detection positioning method is provided for solving the problems existing in the existing communication system, not only supports positioning loop points and blocking loops on the multi-chip forwarding equipment, but also reduces the forwarding pressure of the detection message on the whole network.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention will be described in further detail with reference to the accompanying drawings. The following examples are only used to more clearly illustrate the system method and technical scheme of the present invention, and should not be used to limit the scope of the present application.
According to the embodiment of the invention, a two-layer network loop detection positioning method is provided, and a private loop detection message is periodically sent, and a loop judgment and blocking flow is carried out according to the sending port information and the SMAC in the private loop detection message, so that the loop point positioning and the loop blocking on the multi-chip forwarding equipment are supported, and the forwarding pressure of the detection message to the whole network can be reduced.
The principles and spirit of the present invention are explained in detail below with reference to several representative embodiments thereof.
Fig. 1 is a schematic process flow diagram of a two-layer network loop detection positioning method. As shown in fig. 1, the method comprises the steps of:
s1, periodically sending a private loop detection message, wherein the private message carries sending port information;
further, the private message is newly added with a TPID type, transmission port information and total transmission times TFT.
Further, the sending port information includes a port type, a port logic id, and a chip id.
S2, after receiving the private loop detection message, the equipment carries out loop judgment and determines a block port blocking flow according to SMAC and sending port information in the private message;
further, after receiving the private loop detection message, the device determines whether the SMAC is equal to the Local MAC and whether the chip id to which the transmitting port belongs is equal to the receiving port chip id, and if yes, the device considers the SMAC as a loop.
Further, if the device determines that the loop is not established, the TFT field is added with 1, if yes, the device is discarded, and if no, the device continues to forward.
Further, if the device determines that the device is a loop, the device further determines the block port according to the states of the transmitting port and the receiving port.
Further, the newly accessed link causes a loop, and the port of the newly accessed link is naturally a block port as a looping point.
S3, in the BFC period, if the block port does not receive the loop detection message, the port state is set to be a forward forwarding state;
s4, in the RLC period, waiting until the RLT timer is finished, prompting user loop release of a block port, wherein the block port is a looping point, and prompting the user to loop-free of a non-block port.
In the preferred embodiment, if any non-block port receives the detection message sent by the chip in the RLC period, the RLT needs to be re-clocked; otherwise, when the timer is finished, namely the whole loop detection is finished, the user loop is released, a block port is used as a looping point, and a non-block port prompts the user to have no loop.
It should be noted that although the operations of the method of the present invention are described in a particular order in the above embodiments and the accompanying drawings, this does not require or imply that the operations must be performed in the particular order or that all of the illustrated operations be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform.
For a clearer explanation of the above-mentioned two-layer network loop detection positioning method, a specific embodiment is described below, however, it should be noted that this embodiment is only for better explaining the present invention, and is not meant to limit the present invention unduly.
Embodiment one:
a two-layer network loop detection positioning method comprises the following specific implementation steps:
step one: sending private loop detection message
After the loop detection function is started, forwarding equipment such as a switch and the like needs to wait for different times at random according to the priority, then a sending timer of the private detection message is started, the timer sequentially constructs the private loop detection message from all link up ports of the equipment every N periods, and the message is sent to the hardware to be forwarded to the network.
The format of the PRIVATE detection message designed by the method is shown in fig. 2, the message format carrying Vlan tag is shown in fig. 3, wherein the PRIVATE loop detection message is determined by a TPID (tag protocol ID) field, the PRIVATE_ATTRIBUTE field comprises a chip ID (tx_mod_id) to which a transmission port belongs, a transmission port type (tx_port_type), a transmission port ID (tx_port_id) and total forwarding times (tft), the transmission port type can determine whether the transmission message needs to carry Vlan tag, the chip ID to which the port belongs can distinguish multi-chip scenes, and the total forwarding times field is used for reducing the repeated forwarding times of the message.
In this embodiment, the private detection message needs to carry dmac=0xffffff, smac=the MAC of the device, tpid=0x9119, and information such as port type, port logical id, chip id, TFT, etc. of the sending port is carried in the privateate_attribute field, so that detection is convenient, and if the sending port is of the trunk port type, the sending detection message needs to carry allowed Vlan (Virtual Local Area Network ) information.
Step two: detecting loops and determining loop-forming point blocking flow
The process judges whether a loop exists in the network topology, and can identify a typical loop of the network: the TX-RX fiber self-loop, the down-hanging network loop, the self-network loop and the like, and can block the port to break the loop, the flow is shown in fig. 4, and the specific flow is described as follows:
1. when the port receives the loop detection message, the port sends the loop detection message, and parameter information carried by the loop detection message is analyzed: SMAC, transmission PORT id (tx_port), transmission PORT type, chip id to which the transmission PORT belongs, TFT (total number of transmissions); the SMAC and the chip id can determine whether the message is sent by the chip on the device, and the TFT is used for determining whether the message is discarded.
2. Judging whether the SMAC is equal to Local MAC (MAC address of the equipment) and whether the chip id of the sending port is equal to the chip id of the receiving port, namely whether the sending port is a message sent by the same chip on the equipment, if not, adding 1 to a TFT field, judging whether the MFT (maximum sending times) is exceeded, if so, discarding, otherwise, continuing forwarding;
3. if yes, i.e. a loop exists, further judging whether the tx_port (transmitting PORT) is equal to the rx_port (receiving PORT), i.e. whether the same PORT is transceived, if yes, giving a prompt: may be a TX-RX fiber loop or an drop network loop;
4. if the PORTs are not the same PORT, judging whether RX_PORT is block, if the receiving PORT is block and receives a message again, continuing the block, and restarting a recovery flow, namely resetting a recovery Forwarding counter BFT (Back to Forwarding Timer, recovery Forwarding timer) of the block PORT;
5. if the RX_PORT is not blocked, but the TX_PORT is blocked, namely after the sending PORT is blocked preferentially, the receiving PORT does not need to be blocked, and the processing is not performed;
6. otherwise, the sending port and the receiving port are not blocked, and the receiving port is required to be set as a block, so that a recovery forwarding flow is started.
Step three: restoring forwarding flow
In the loop detection and blocking process, in step 6, a block port restoration forwarding process is triggered, and the specific process is shown in fig. 5, and is described in detail as follows:
1. the BFT timer of the block port is firstly set to zero;
2. if the block port does not receive the loop detection message in the BFC (Back to Forwarding Cycle, restoring Forwarding period and sending period M times), setting the port state as Forwarding state;
3. otherwise, the BFT recime is still in a blocking state, and whether the message is received or not is continuously detected.
Step four: loop breaking flow
Clearing an RLT (Remove to Loop Timer, loop release timer) at initial time, and if any non-block port in the RLC (Remove to Loop Cycle, loop release period, transmission period multiple of L) period receives a detection message sent by the chip, then the RLT needs to be re-timed; otherwise, when the RLT timer is ended, namely the whole loop detection is ended, the user loop is released by the prompt of a block port, the block port is a looping point, the user is not loop by the prompt of a non-block port, and the flow is shown in figure 6.
RLT is started when the whole detection flow is started; step three affects the RLT value, because the port forward or block status affects whether the chip can receive the message sent by itself, and further affects whether the RLT clears or continues to time.
In the specific implementation, step 1-3 can only determine that a loop exists in the network originally, a block port can be regarded as a loop forming point, but when a link is newly added to the network topology, the link is regarded as the loop forming point, and the existing detection technology is less concerned about the condition that the loop is newly added, so that the port can be extended by a random value from link down to link up according to the characteristic of the newly added link, BFC (Back to Forwarding Cycle, forwarding period recovery, sending period multiple) is realized, and if the newly accessed link leads to the loop, the port is always slower than the ports on other links in recovery and Forwarding, and the port is naturally a block port to be used as the loop forming point.
The invention has the beneficial effects that aiming at the problems existing in the existing communication system, the invention provides a two-layer network loop detection positioning method, which periodically transmits a private loop detection message, carries out loop judgment and blocking flow according to the transmission port information and SMAC in the private loop detection message, not only supports positioning loop points and blocking loops on multi-chip forwarding equipment, but also reduces the forwarding pressure of the detection message to the whole network.
The applicant has described in detail the embodiments of the present invention with reference to the accompanying drawings of the specification, the above embodiments are only preferred embodiments of the present invention, and the detailed description is only for helping the reader to better understand the spirit of the present invention, but not limiting the scope of the present invention, but any improvements or modifications based on the spirit of the present invention should fall within the scope of the present invention.