Network switch and dual-host system link recovery method thereof
By comparing the source MAC address information of data packets in a network switch, ensuring that the network device is fully restored and then performing link switching, the packet loss problem caused by premature handover in the existing technology is solved, and the application requirements of low packet loss rate are achieved .
Patent Information
- Application Number
- CN202310890990.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-06-20
- Filing Date
- 2023-07-20
- Publication Date
- 2024-12-20
AI Technical Summary
The prior art misjudgment exists when judging whether the network device is fully restored to normal operation, resulting in premature link switching after the network switch receives the electrical link signal, resulting in data packet loss and the application requirements of low packet loss rate cannot be met. .
By receiving the first multiple data packets in the backup communication port, the first packet information is obtained, and after detecting the electrical signal of the main link, the main communication port is converted to the learning state to receive the second multiple data packets in the second multiple data packets to obtain the second packet information, and compare The information of the two is to determine whether the network device is fully restored, and to decide whether to perform link switching based on the comparison results.
Ensure that the network device is fully restored before link switching is performed to maximize and reduce packet loss rate and avoid data communication interruptions and losses caused by premature handover.
Smart Images

Figure CN119172227A_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a network device and a link recovery method, and in particular to a network device using a dual-host system and a link recovery method thereof. [Background technology]
[0002] As the industry's requirements for production capacity and cost increase, connecting production equipment to the Internet has become a trend. Through network connection, cross-machine data collection and analysis become possible, which improves the speed, flexibility, and efficiency of the process, while reducing costs and producing higher quality products. However, as the dependence on the Internet increases, how to ensure the reliability and stability of network connections has become one of the issues of concern to the industry.
[0003] In order to ensure stable communication of devices connected to the network, the prior art has provided a path backup mechanism such as dual-homing to avoid the risk of network disconnection caused by the failure of a single line or a single network device. The dual-homing mechanism is usually connected to different network adapters of the same device or two different devices that back up each other through two physical links from two different communication ports of a network switch. Under the dual-homing system, one of the communication ports of the network switch is used as the primary communication port, which is connected to the primary link and used to forward data packets, and the other communication port is used as a backup communication port to connect to the backup link and is in standby mode. When the primary link connected to the primary communication port fails (link-down), the backup link connected to the backup communication port must replace the primary link to forward data packets until the primary link is restored (link-up).
[0004] However, the previous technology generally determines whether the link is restored based on whether the physical layer (OSI L1) receives electrical signals, but cannot correctly determine whether the connected network device has fully recovered and operated normally. In this case, although the network switch has received the electrical signal of the link, the connected network device may not actually be able to start transmitting and receiving data. Therefore, when the network switch receives the electrical signal of the link and immediately switches the link, data packets will be lost, and the application requirement of low packet loss rate cannot be met. [Summary of the invention]
[0005] Therefore, the object of the present invention is to provide a network switch and method for operating a dual-host system, which can first ensure that the connected network device has fully recovered and then perform link switching, thereby maximally reducing the packet loss rate.
[0006] The embodiment of the present invention discloses a dual-host link recovery method for a network switch. The network switch is coupled to a first network device through a main link by a main communication port, and is coupled to a second network device through a backup communication port through a backup link. The link recovery method includes receiving a first plurality of data packets through the backup communication port to obtain a first packet information when the backup communication port is in a forwarding state; receiving a second plurality of data packets through the main communication port in response to detecting an electrical signal of the main link to obtain a second packet information; comparing the first packet information with the second packet information to obtain a comparison result; and performing link switching according to the comparison result.
[0007] The embodiment of the present invention further discloses a network switch, comprising a main communication port, a backup communication port, a processing unit and a storage unit. The main communication port is coupled to a first network device via a main link; the backup communication port is coupled to a second network device via a backup link. The processing unit is used to execute a program code; the storage unit is coupled to the processing unit and is used to store the program code to instruct the processing unit to execute a link recovery method for dual-host. The link recovery method includes receiving a first plurality of data packets through the backup communication port to obtain a first packet information when the backup communication port is in a forwarding state; receiving a second plurality of data packets through the main communication port in response to detecting an electrical signal of the main link to obtain a second packet information; comparing the first packet information with the second packet information to obtain a comparison result; and performing link switching according to the comparison result.
Brief Description of the Drawings
[0008] Figure 1 A schematic diagram of a network system. Figure 2 A schematic diagram of a network system performing redundancy. Figure 3 A schematic diagram of a network system switching links prematurely. Figure 4 The figure is a schematic diagram of a link recovery process according to an embodiment of the present invention. Figure 5 The present invention is a schematic diagram of a network system executing a link recovery process according to an embodiment of the present invention. Figure 6 The present invention is a schematic diagram of a network system executing a link recovery process according to an embodiment of the present invention. Figure 7 It is a schematic diagram of a network switch running a dual-homing redundancy mechanism for different network interface controllers of the same device according to an embodiment of the present invention. Figure 8 FIG. 1 is a schematic diagram of a backup device according to an embodiment of the present invention. [Specific implementation method]
[0009] Certain words are used in the specification and subsequent patent applications to refer to specific components. Those with ordinary knowledge in the field should understand that hardware manufacturers may use different terms to refer to the same component. This specification and subsequent patent applications do not use differences in names as a way to distinguish components, but use differences in the functions of components as the criteria for distinction. The term "including" mentioned throughout the specification and subsequent patent applications is an open term and should be interpreted as "including but not limited to". In addition, the term "coupling" includes any direct and indirect electrical connection means. Therefore, if the text describes a first device coupled to a second device, it means that the first device can be directly electrically connected to the second device, or indirectly electrically connected to the second device through other devices or connection means.
[0010] Please refer to Figure 1 , Figure 1 1 is a schematic diagram of a network system 1. The network system 1 includes a network switch 10 and two network devices 20_1 and 20_2, wherein the network devices 20_1 and 20_2 are mutually redundant devices, and the network switch 10 operates a dual-host redundant mechanism for them. Specifically, the network device 10 is connected to the network device 20_1 via a primary communication port P1 via a primary link L1, and is connected to the network device 20_2 via a backup communication port P2 via a backup link L2. Figure 1 As shown, in general, the network device 20_1 is used as a main operation device to send and receive data packets, and the network device 20_2 is used as a backup device of the network device 20_1 to stand by.
[0011] In specific practice, the states of the communication ports P1 and P2 can be divided into a blocking state and a forwarding state. Through the communication port in the forwarding state, the network switch 10 can send and receive packets of any type and thereby forward data packets. On the other hand, the communication port in the blocking state only receives control packets and discards other types of packets received. Figure 1 As shown, under normal circumstances, when the network device 20_1 and the main link L1 operate normally, the status of the main communication port P1 is the forwarding state (marked as F), and the status of the backup communication port P2 is the blocking state (marked as B). At this time, data packets can be transmitted via the path R1 for communication.
[0012] Please refer to Figure 2 , Figure 2A schematic diagram of backup for network system 1, which illustrates the situation when network device 20_1 fails. In this case, the status of the main communication port P1 of the network switch 10 will be changed to the blocking state, and the status of the backup communication port P2 will be changed to the forwarding state. In this case, network device 20_2 will backup network device 20_1, and the backup link L2 will replace the main link L1 to forward data packets. At this time, data packets can be transmitted via path R2 for communication. On the other hand, when network device 20_1 resumes operation, the main link L1 will be enabled again, returning to the state as shown in FIG. Figure 1 That is, the state of the main communication port P1 will be changed to the forwarding state again to resume forwarding of data packets, and the state of the backup communication port P2 will be changed to the blocking state again to continue to standby, thereby, the network system 1 can resume the normal operation mode.
[0013] Generally speaking, the prior art determines whether to re-enable the main link L1 to restore the normal operation mode based on whether the electrical signal of the main link L1 can be received from the communication port P1. However, in practice, this method cannot correctly determine whether the network device 20_1 has fully restored normal operation. Please refer to Figure 3 , Figure 3 FIG. 1 is a schematic diagram of the network system 1 switching the link when the network device 20_1 is not ready (has not yet fully recovered to normal operation). Figure 3 As shown, in the prior art, when the network switch 10 detects the electrical signal of the main link L1, the link switching will be performed immediately. At this time, the state of the main communication port P1 is changed to the forwarding state to forward the data packet, and the state of the backup communication port P2 is changed to the blocking state to continue to standby. However, it should be noted that at this point in time, the network device 20_1 is still not ready and therefore cannot process the data packet, and has not completed the work handover with the backup network device 20_2, resulting in network communication interruption. For example, downlink data may be sent to the network device 20_1 that is not yet ready via the path R4, through the main communication port P1 and the main link L1, and thus is not processed. On the other hand, the uplink data may still be sent to the backup communication port P2 in the blocked state via the path R3, through the backup link L2, and thus is directly discarded. In this case, the serious consequence of data packet loss during this period will result.
[0014] Therefore, in order to improve the defects of the prior art, the present invention proposes a link recovery method for dual-homing, which can detect the time when the network device 20_1 fully resumes operation, and accordingly perform link switching to restore the communication of the main link L1. The link recovery method can be summarized as a link recovery process 40, such as Figure 4 The link recovery process 40 includes the following steps:
[0015] Step 400: Start.
[0016] Step 402: When the standby communication port P2 is in a forwarding state, receive a first plurality of data packets through the standby communication port P2 to obtain a first packet information.
[0017] Step 404: Determine whether the electrical signal of the primary link L1 is detected. If yes, execute step 406; otherwise, execute step 402.
[0018] Step 406: Convert the primary communication port P1 to a learning state.
[0019] Step 408: Receive a second plurality of data packets through the primary communication port P1 to obtain a second packet of information.
[0020] Step 410: Compare the first packet information with the second packet information to obtain a comparison result.
[0021] Step 412: Determine whether to switch the path based on the comparison result. If yes, execute step 414; otherwise, execute step 408.
[0022] Step 414: Perform link switching.
[0023] Step 416: End.
[0024] In simple terms, when the network switch 10 forwards data on the backup link L2, it receives a first plurality of data packets through the backup communication port P2 to obtain a first packet information (step 402). When the network switch 10 detects the electrical signal of the main link L1, it needs to further determine whether the network device 20_1 connected to the main link L1 has fully recovered (step 404); if the electrical signal of the main link L1 is not received, it continues to obtain the first packet information. When the network switch 10 detects the electrical signal of the main link L1, the network switch 10 needs to first convert the state of the main communication port P1 to a learning state (step 406). In this state, the main communication port P1 does not forward data packets, but can receive data packets. Therefore, the network switch 10 can receive a second plurality of data packets from the network device 20_1 through the main communication port P1 to obtain a second packet information (step 408). The network switch 10 compares the second packet information with the first packet information (step 412), and decides whether to perform link switching (step 414) to resume data forwarding via the primary link L1 according to the comparison result. Accordingly, the network switch 10 can wait until the network device 20_1 fully resumes operation before performing link switching.
[0025] Specifically, in step 402, the operation of the network system 1 is as follows: Figure 5 As shown, the data packet is transmitted between the network switch 10 and the backup network device 20_2 via the backup communication port P2 and the backup link L2 through the path R2. In this case, the backup communication port P2 is in a forwarding state, and the network switch 10 can forward the first plurality of data packets DP1 received from the network device 20_1 through the backup communication port P2. According to the first plurality of data packets DP1, the network switch 10 can obtain and store the first packet information. The first packet information can include the source media access control (MAC) address of the first plurality of data packets DP1. Based on this, the network switch 10 can observe which MAC address devices the data packets forwarded by the network device 20_2 come from. The network switch 10 can set an aging time for the source MAC address of each packet, and only retain the information within the aging time to avoid a sudden increase in the data volume of the first packet information.
[0026] While obtaining the first packet information, in step 404, the network switch 10 continuously monitors the status of the main link L1. When the network switch 10 detects the electrical signal of the main link L1, in step 406, the main communication port P1 is switched to the learning state. Figure 6 , Figure 6 FIG. 1 is a schematic diagram showing that the network system 1 detects the electrical signal of the main link L1. Figure 6 As shown, in this state, although the electrical signal of the main link L1 has been detected, the network switch 10 still cannot obtain the operating status of the network device 20_1. Therefore, the status of the backup communication port P2 remains in the forwarding state, and the data packet is still transmitted via the path R2, while the main communication port P1 is turned into the learning state (marked as L). Compared with the blocking state, the main communication port P1 at this time can receive data packets and wait to receive data packets from the network device 20_1. When the network device 20_1 resumes operation and starts to send packets, the network switch 10 can receive packets from the network device 20_1 through the main communication port P1.
[0027] Please continue to refer to Figure 6In step 408, when the network device 20_1 starts to resume operation, it will automatically hand over the work with the backup network device 20_2 and start forwarding uplink data. At the same time, although the network switch 10 does not know the operating status of the network device 20_1, it can receive packets from the network device 20_1 through the main communication port P1. Based on this, the network switch 10 obtains the second plurality of data packets DP2 and obtains the second packet information from the second plurality of data packets DP2. The second packet information mainly includes the source MAC address of the second plurality of data packets DP2. Based on this, the network switch 10 can observe which MAC address devices the data packets forwarded by the network device 20_1 come from.
[0028] In step 410, the network switch 10 compares the second packet information obtained successively with the first packet information to obtain a comparison result. When the second packet information contains the same source MAC address as the first packet information (in other words, the data stream originally sent through link L2 has been sent through link L1 instead), the network switch 10 can determine that the network device 20_1 has fully resumed operation. In other words, the network device 20_1 has completed the work handover with the network device 20_2 and started to forward data. Based on this, the network switch 10 can determine whether a link switch is required based on the comparison result. On the contrary, when the second packet information does not contain the same source MAC address as the first packet information, it means that the network device 20_1 is not yet ready for operation. In this case, the link switch should be suspended and the process returns to step 408 to continue waiting for the reception of the second plurality of data packets DP2.
[0029] Finally, in step 414, the network switch 10 performs link switching. At this point, the network switch 10 has detected that the network device 20_1 has fully recovered by observing the source MAC address of the data packet, and therefore needs to recover to the normal state of data transmission through the primary communication port P1 and the link L1. In other words, the network switch 10 needs to change the state of the backup communication port P2 from forwarding to blocking, and change the state of the primary communication port from learning to forwarding, and the data packet is transmitted again via the path R1, that is, Figure 1 shown.
[0030] Accordingly, the network switch 10 detects whether the network device 20_1 has fully recovered by observing the source MAC address of the data packet, and immediately switches the path when the network device 20_1 has fully recovered. In this case, the network switch 10 does not need to send additional control packets to the network device 20_1 for confirmation, so the method of the embodiment of the present invention can be applied to various different brands of equipment. In addition, according to the detection method in the link recovery process 40, the network switch 10 does not need to set an additional delay time to wait for the network device 20_1 to fully recover, so it can greatly reduce the packet loss rate caused by the time difference when the equipment is restarted after a failure.
[0031] It should be noted that in the network system 1, the network devices 20_1 and 20_2 are mutually redundant devices, and the network switch 10 runs a dual-host redundant mechanism for them. However, the method of the embodiment of the present invention is not limited to a one-to-two device connection method. For example, the network device 10 can simultaneously run a dual-host redundant mechanism for multiple pairs of mutually redundant network devices. In addition, the method of the embodiment of the present invention does not interfere with the cooperation method between the network devices 20_1 and 20_2, and only detects based on the status of the link and the transmitted packets to achieve the dual-host redundant effect.
[0032] On the other hand, the network switch 10 can also run a dual-homing redundancy mechanism for different network interface controllers (NICs) of the same device. Figure 7 , Figure 7 FIG. 1 is a schematic diagram of a network switch 10 running a dual-homing redundancy mechanism for different network interface controllers of the same device. Figure 7 As shown, a network device 20_3 can be a large server, including two network interface controllers (not shown), which are connected to communication ports P5 and P6 respectively. The main port P1 of the network switch 10 is connected to the communication port P5 of the network device 20_3 through the main link L1, and the backup communication port P2 is connected to the communication port P6 through the backup link L2. Under normal circumstances, data packets are transmitted through the path R5. When the network interface controller corresponding to the communication port P5 fails or fails, the data packets are transmitted through the path R6 instead.
[0033] According to the link recovery process 40, when the network interface controller corresponding to the communication port P5 fails or fails, the network switch 10 receives a first plurality of data packets through the backup communication port P2 to obtain the first packet information (step 402). When the network interface controller corresponding to the communication port P5 may resume operation, the network switch 10 first detects the electrical signal of the main link L1 at the main communication port P1 (step 404), and converts the state of the main communication port P1 to the learning state (step 406). Then, the network switch 10 receives a second plurality of data packets through the main communication port P1 to obtain the second packet information (step 408). After comparing the first packet information with the second packet information (step 410), the network switch 10 can determine whether the network interface controller corresponding to the communication port P5 has fully resumed operation (step 412), and finally perform link switching accordingly (step 414).
[0034] For further information, please refer to Figure 8 , which is a schematic diagram of a device 8 according to an embodiment of the present invention. The device 8 can be used to implement the network switch 10 according to an embodiment of the present invention. Figure 8 As shown, the device 8 may include a processing unit 80 and a storage unit 82. The processing unit 80 may be a general-purpose processor, a microprocessor, an application-specific integrated circuit (ASIC), etc. or a combination thereof. The storage unit 82 is coupled to the processing unit 80 and may be any data storage device for storing a program code 820, and the program code 820 is read and executed by the processing unit 80. For example, the storage unit 82 may be a read-only memory (ROM), a flash memory, a random access memory (RAM), a hard disk, an optical data storage device, and a non-volatile storage unit, etc., but is not limited thereto. In addition, the device 8 further includes a plurality of communication ports (not shown in the figure), which are respectively used to connect different devices or different network interface controllers for dual-host support.
[0035] Device 8 is used to represent the necessary components required to implement the embodiment of the present invention, and those skilled in the art can make different modifications and adjustments accordingly, but are not limited to this. For example, when the network switch 10 is implemented by the device 8, the link recovery process 40 can be compiled into a program code 820 and stored in the storage unit 82, and the link recovery method is executed by the processing unit 80. In addition, the storage unit 82 is also used to store data required to run the link recovery method, such as the first packet information, the second packet information, etc., but is not limited to this.
[0036] In summary, the present invention provides a network switch and method for operating a dual-host system, which detects whether the connected network device has fully recovered by observing the source MAC address of the data packet. Accordingly, it can ensure that the connection switch is performed after the connected network device is ready, thereby maximizing the reduction of packet loss rate. The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should fall within the scope of the present invention.
Explanation of symbols
[0037] 1: Network system 10: Network switch 20_1,20_2,20_3: Network devices P1: Main communication port P2: Standby communication port P3~P5: Communication port L1: Main link L2: Backup Link R1~R6: Path DP1: first plurality of data packets DP2: Second plurality of data packets F: Forwarding status B: Blocked state L: Learning status 40: Process 400~416: Steps 8: Installation 80: Processing unit 82: Storage unit 820: Program code
Claims
1. A dual-host link recovery method for a network switch, wherein a primary communication port of the network switch is coupled to a first network device via a primary link, and a backup communication port of the network switch is coupled to a second network device via a backup link, the link recovery method comprising: When the standby communication port is in a forwarding state, receiving a first plurality of data packets through the standby communication port to obtain a first packet of information; In response to detecting the electrical signal of the primary link, receiving a second plurality of data packets through the primary communication port to obtain a second packet of information; comparing the first packet information with the second packet information to obtain a comparison result; and Link switching is performed according to the comparison result. 2 . The link recovery method as claimed in claim 1 , wherein the second network device performs backup for the first network device. 3 . The link recovery method as claimed in claim 1 , wherein the first network device and the second network device are the same device, and the main link and the backup link are coupled to different network interface controllers.
4. The link recovery method of claim 1, further comprising, in response to detecting the electrical signal of the primary link, switching the primary communication port to a learning state and receiving the second plurality of data packets through the primary communication port.
5. The link recovery method as claimed in claim 1, wherein the first packet information comprises source media access control addresses of the first plurality of data packets, and the second packet information comprises source media access control addresses of the second plurality of data packets.
6. The link recovery method as described in claim 5, wherein the step of performing link switching according to the comparison result includes performing link switching when the comparison result shows that a source media access control address in the second packet information is the same as a source media access control address in the first packet information.
7. The link recovery method as claimed in claim 1, wherein the step of performing link switching according to the comparison result converts a state of the primary communication port into a forwarding state, and converts a state of the backup communication port into a blocking state.
8. A network switch, comprising: a primary communication port coupled to a first network device via a primary link; a backup communication port coupled to a second network device via a backup link; a processing unit for executing a program code; as well as A storage unit, coupled to the processing unit, is used to store the program code to instruct the processing unit to execute a link recovery method for dual-host system, the link recovery method comprising: When the standby communication port is in a forwarding state, receiving a first plurality of data packets through the standby communication port to obtain a first packet of information; In response to detecting the electrical signal of the primary link, receiving a second plurality of data packets through the primary communication port to obtain a second packet of information; Comparing the first packet information with the second packet information to obtain a comparison result; as well as Link switching is performed according to the comparison result. 9 . The network switch as claimed in claim 8 , wherein the second network device performs backup for the first network device. 10 . The network switch as claimed in claim 8 , wherein the first network device and the second network device are the same device, and the primary link and the backup link are coupled to different network interface controllers.
11. The network switch of claim 8, wherein the link recovery method further comprises, in response to detecting the electrical signal of the primary link, converting the primary communication port to a learning state and receiving the second plurality of data packets through the primary communication port.
12. The network switch as claimed in claim 8, wherein in the link recovery method, the first packet information includes source media access control addresses of the first plurality of data packets, and the second packet information includes source media access control addresses of the second plurality of data packets.
13. The network switch as claimed in claim 12, wherein in the link recovery method, the step of performing link switching according to the comparison result includes performing link switching when the comparison result shows that a source media access control address in the second packet information is the same as a source media access control address in the first packet information.
14. The network switch as claimed in claim 8, wherein in the link recovery method, the step of performing link switching according to the comparison result converts a state of the main communication port into a forwarding state, and converts a state of the backup communication port into a blocking state.
