Address adaptive switching method and device, active-active system, electronic equipment and storage medium
Through the address synchronization and switching mechanism between switches in the M-LAG environment, the problem of abnormal aging of MAC addresses caused by traffic path switching is solved, and network stability and reliability are improved.
Patent Information
- Application Number
- CN202410886767.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-07-03
AI Technical Summary
In the M-LAG environment, traffic path switching causes abnormal aging of MAC addresses, resulting in short-term multi-packet and packet loss problems, affecting network stability and reliability.
When the user equipment switches from the first switch to the second switch, the first switch receives the address synchronization message sent by the second switch, carries the dynamic address after the second switch is switched, and switches the dynamic address when the number of misses reaches the threshold value. It is a static address to avoid abnormal aging of the address.
It effectively avoids abnormal address aging caused by traffic path switching, solves the problems of short-term multi-packet and packet loss, and improves the stability and reliability of the network.
Smart Images

Figure CN118890338A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to an address adaptive switching method, device, active-active system, electronic device and storage medium. Background Art
[0002] Multi-chassis Link Aggregation Group (M-LAG) is a virtualization technology. Through M-LAG, two switches can achieve cross-device link aggregation with user devices to form an active-active system, thereby improving the reliability of the link from the single-board level to the device level. User devices are generally customer edge devices (CE), and the switches that form the active-active system are generally network edge devices (PE). The uplink traffic from the user device to the switch is load-shared to the two switches after the hash calculation of the link aggregation group (LAG) in the user device. The downlink traffic from the switch to the user device is forwarded to the user device through the M-LAG of the switch. Therefore, in order to ensure the normal operation of the active-active system, the relevant forwarding tables need to be synchronized between the two switches, and the synchronization of the media access control (MAC) address table is crucial. Accordingly, the MAC address table of the switch is divided into two parts: the address learned by the switch itself, and the address synchronized from another switch. The learned address is a dynamic address that can be aged. In order to prevent the synchronized address from being periodically aged, the usual practice is to write the synchronized address as a static address.
[0003] In the actual application of M-LAG, the uplink traffic from the user device to the switch changes dynamically. Certain changes (such as changes in message content, increase / decrease in the number of message entries, etc.) will trigger the LAG in the user device connected to the switch to re-hash the uplink traffic. Even if the MAC and virtual local area network (VLAN) of a certain uplink traffic have not changed, after the re-hash calculation, the traffic path of the uplink traffic from the user device to the current switch may also change. Although it is still sent to the same M-LAG, the device to which it is sent is switched from the current switch to another switch. This traffic path switching will cause abnormal aging of the address (MAC address), short-term multiple packets and packet loss problems, and thus lead to low network stability and reliability. Summary of the invention
[0004] The present invention provides an address adaptive switching method, device, active-active system, electronic device and storage medium, which are used to solve the defects in the prior art that traffic path switching may cause abnormal address aging, short-term multiple packets and packet loss problems, and further lead to low stability and reliability of the network. In this method, when a user device switches from a first switch to a second switch and sends a message to the second switch, that is, when traffic path switching occurs, the first switch receives a second address synchronization message sent by the second switch, and the second address synchronization message carries a second dynamic address obtained after the second switch switches the first static address. When the first miss number reaches a preset number threshold, it indicates that the first dynamic address is about to be abnormally aged. After determining the second static address corresponding to the second dynamic address, the first switch switches the first dynamic address to the second static address, so that the abnormal address aging caused by the traffic path switching can be effectively avoided, thereby solving the short-term multiple packets and packet loss problems caused by the abnormal address aging, and effectively improving the stability and reliability of the network.
[0005] In a first aspect, the present invention provides an address adaptive switching method, which is applied to a first switch, wherein the first switch is connected to a second switch and a user equipment respectively, and the method comprises the following steps.
[0006] Receive a message sent by the user equipment; generate a first address synchronization message according to the first dynamic address corresponding to the message, wherein the first address synchronization message carries the first dynamic address; synchronize the first address synchronization message to the second switch, wherein the first address synchronization message is used to instruct the second switch to determine a first static address corresponding to the first dynamic address.
[0007] When the user equipment switches from the first switch to the second switch and sends the message to the second switch, a second address synchronization message sent by the second switch is received, where the second address synchronization message carries a second dynamic address obtained after the second switch switches the first static address.
[0008] When the first miss count reaches a preset count threshold, a second static address corresponding to the second dynamic address is determined, and the first dynamic address is switched to the second static address, wherein the first miss count is the number of times the message misses the first switch.
[0009] In a second aspect, the present invention provides an address adaptive switching method, which is applied to a second switch, wherein the second switch is connected to a first switch and a user device respectively, and the first switch is connected to the user device, and the method comprises the following steps.
[0010] A first address synchronization message sent by the first switch is received, where the first address synchronization message is generated by the first switch according to a first dynamic address corresponding to the message after receiving the message sent by the user equipment, and the first address synchronization message carries the first dynamic address.
[0011] Determine a first static address corresponding to the first dynamic address; when the user equipment switches from the first switch to the second switch and sends the message to the second switch, receive the message sent by the user equipment; switch the first static address to a second dynamic address, and generate a second address synchronization message, where the second address synchronization message carries the second dynamic address; synchronize the second address synchronization message to the first switch, where the second address synchronization message is used to instruct the first switch to determine a second static address corresponding to the second dynamic address, and switch the first dynamic address to the second static address.
[0012] In a third aspect, the present invention further provides an address adaptive switching device, which is applied to a first switch, wherein the first switch is connected to a second switch and a user equipment respectively, and the device includes the following modules.
[0013] The first transceiver module is used to receive a message sent by the user equipment.
[0014] The first processing module is used to generate a first address synchronization message according to the first dynamic address corresponding to the message, where the first address synchronization message carries the first dynamic address.
[0015] The first transceiver module is further configured to synchronize the first address synchronization message to the second switch, where the first address synchronization message is used to instruct the second switch to determine a first static address corresponding to the first dynamic address; and, when the user equipment switches from the first switch to the second switch and sends the message to the second switch, receive a second address synchronization message sent by the second switch, where the second address synchronization message carries a second dynamic address obtained after the second switch switches the first static address.
[0016] The first processing module is further configured to determine a second static address corresponding to the second dynamic address and switch the first dynamic address to the second static address when the first miss number reaches a preset number threshold, wherein the first miss number is the number of times the message misses the first switch.
[0017] In a fourth aspect, the present invention further provides an address adaptive switching device, which is applied to a second switch, wherein the second switch is connected to a first switch and a user equipment respectively, and the first switch is connected to the user equipment, and the device includes the following modules.
[0018] The second transceiver module is configured to receive a first address synchronization message sent by the first switch, where the first address synchronization message is generated by the first switch according to a first dynamic address corresponding to the message after the first switch receives the message sent by the user equipment, and the first address synchronization message carries the first dynamic address.
[0019] The second processing module is used to determine a first static address corresponding to the first dynamic address.
[0020] The second transceiver module is further configured to receive the message sent by the user equipment when the user equipment switches from the first switch to the second switch and sends the message to the second switch.
[0021] The second processing module is further configured to switch the first static address to a second dynamic address and generate a second address synchronization message, wherein the second address synchronization message carries the second dynamic address.
[0022] The second transceiver module is further used to synchronize the second address synchronization message to the first switch, where the second address synchronization message is used to instruct the first switch to determine a second static address corresponding to the second dynamic address and switch the first dynamic address to the second static address.
[0023] In a fifth aspect, the present invention also provides an active-active system for address adaptive switching, comprising: a first switch and a second switch; the first switch implements the address adaptive switching method as described in any one of the first aspect; the second switch implements the address adaptive switching method as described in any one of the second aspect.
[0024] In a sixth aspect, the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the address adaptive switching method as described in the first aspect or the second aspect is implemented.
[0025] In a seventh aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the address adaptive switching method as described in the first aspect or the second aspect.
[0026] In an eighth aspect, the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the address adaptive switching method as described in the first aspect or the second aspect is implemented.
[0027] The present invention provides an address adaptive switching method, device, active-active system, electronic device and storage medium. In this method, when a user device switches from a first switch to a second switch and sends a message to the second switch, that is, when a traffic path switching occurs, the first switch receives a second address synchronization message sent by the second switch. The second address synchronization message carries a second dynamic address obtained after the second switch switches the first static address. When the first miss number reaches a preset number threshold, it indicates that the first dynamic address is about to be abnormally aged. After determining the second static address corresponding to the second dynamic address, the first switch switches the first dynamic address to the second static address. This can effectively avoid abnormal address aging caused by traffic path switching, thereby solving the short-term multiple packet and packet loss problems caused by abnormal address aging, and effectively improving the stability and reliability of the network. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 This is one of the flow charts of the address adaptive switching method provided by the present invention.
[0030] Figure 2 It is a schematic diagram of traffic path switching provided by the present invention.
[0031] Figure 3 It is a schematic diagram of the address table of the first switch and the second switch before the traffic path switching provided by the present invention.
[0032] Figure 4 It is a schematic diagram of the address table of the first switch and the second switch in the intermediate state of traffic path switching provided by the present invention.
[0033] Figure 5 It is a schematic diagram of the address table of the first switch and the second switch in the steady state of traffic path switching provided by the present invention.
[0034] Figure 6 This is the second flow chart of the address adaptive switching method provided by the present invention.
[0035] Figure 7This is one of the structural schematic diagrams of the address adaptive switching device provided by the present invention.
[0036] Figure 8 This is the second structural schematic diagram of the address adaptive switching device provided by the present invention.
[0037] Fig. 9 It is a structural schematic diagram of the active-active system with adaptive address switching provided by the present invention.
[0038] Fig.10 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] In order to better understand the embodiments of the present invention, the background technology is first described in detail.
[0041] In the actual application of M-LAG, the uplink traffic sent from the user device to the switch changes dynamically. Certain changes (such as changes in message content, increase / decrease in the number of message entries, etc.) will trigger the LAG connected to the switch in the user device to re-hash the uplink traffic. In this case, even if the MAC and VLAN of a certain uplink traffic have not changed, after the re-hash calculation, the traffic path of the uplink traffic from the user device to the current switch may change. Although it is still sent to the same M-LAG, the device to which it is sent is switched from the current switch to another switch.
[0042] This type of traffic path switching does not fall into the category of MAC address learning, aging, and drift. The MAC function of almost all switching chips will not notify the software of this type of traffic path switching. The corresponding static MAC address originally synchronized on the switch after the traffic path switching cannot be automatically updated to a dynamic MAC address. For the switch before the traffic path switching, the corresponding MAC address will be aged after the MAC aging time, and will be synchronized to the switch after the traffic path switching through relevant protocols (such as Inter-Chassis Control Protocol (ICCP), Multiprotocol Border Gateway Protocol (MP-BGP) or custom protocols). The switch after the traffic path switching deletes the corresponding MAC address after receiving the synchronization message.
[0043] Because the traffic is only switched but not interrupted, MAC aging should not occur. This aging is the abnormal aging of the MAC address, which will bring the following problems: the Layer 2 forwarding message with the aged MAC as the destination MAC will generate flooding, resulting in short-term multiple packet problems; switches generally have a default storm suppression configuration (unknown unicast\unknown multicast\broadcast rate limit). If the bandwidth of the flooded message reaches the storm suppression threshold, it will cause rate limit packet loss and short-term packet loss problems; it affects the related Address Resolution Protocol (ARP) table and Neighbor Discovery Protocol (NDP) table on the switch, resulting in the impact of the Layer 3 forwarding function, resulting in short-term packet loss or multiple packets.
[0044] In other words, this traffic path switching will cause abnormal aging of the address (MAC address), resulting in short-term multiple packets and packet loss problems, which will lead to low stability and reliability of the network.
[0045] To solve the above problems, an embodiment of the present invention provides an address adaptive switching method, device, active-active system, electronic device and storage medium. In the method, when a user device switches from a first switch to a second switch and sends a message to the second switch, that is, when a traffic path switching occurs, the first switch receives a second address synchronization message sent by the second switch, and the second address synchronization message carries a second dynamic address obtained after the second switch switches the first static address. When the first miss number reaches a preset number threshold, it indicates that the first dynamic address is about to be abnormally aged. After determining the second static address corresponding to the second dynamic address, the first switch switches the first dynamic address to the second static address. This can effectively avoid abnormal address aging caused by traffic path switching, thereby solving the short-term multiple packet and packet loss problems caused by abnormal address aging, and effectively improving the stability and reliability of the network.
[0046] It should be noted that the execution subject involved in the embodiment of the present invention may be the first switch, the second switch, the address adaptive switching device, or an electronic device. Optionally, the electronic device may include: a computer and a mobile terminal.
[0047] It should be noted that the first switch involved in the embodiment of the present invention can be understood as a switch before the traffic path is switched, and the second switch can be understood as a switch after the traffic path is switched.
[0048] It should be noted that the first switch is connected to the second switch and the user equipment respectively, and the second switch is connected to the user equipment.
[0049] Optionally, the first switch and the second switch may be connected via a peer link.
[0050] The embodiment of the present invention is further described below by taking the first switch and the second switch as examples.
[0051] Figure 1 is one of the flow charts of the address adaptive switching method provided by the present invention, such as Figure 1 As shown, the method includes the following steps 101 to 108.
[0052] 101. A first switch receives a message sent by a user equipment.
[0053] The first switch is a network edge device (PE). The first switch can be understood as a switch before the traffic path is switched, that is, the traffic path of the user device sending the message has not been affected by certain changes (such as: message content changes, increase / decrease in the number of message entries, etc.), and the traffic path switching has not occurred at this time.
[0054] User equipment is a type of user edge equipment (CE).
[0055] It should be noted that the first switch and the second switch share one M-LAG, and the user equipment actually sends a message to the M-LAG.
[0056] 102. The first switch generates a first address synchronization message according to the first dynamic address corresponding to the message.
[0057] The first address synchronization message carries the first dynamic address.
[0058] The first dynamic address refers to the address of the message learned by the first switch. It should be noted that the first dynamic address is an aging dynamic address.
[0059] After the user equipment sends a message to the first switch, the first switch may generate a first address synchronization message according to the learned address of the message, that is, the first dynamic address, where the first address synchronization message carries the first dynamic address, and the first address synchronization message is used to instruct the second switch to determine the first static address corresponding to the first dynamic address.
[0060] In some embodiments, the first dynamic address is a first dynamic MAC address.
[0061] Optionally, the first static address involved in the embodiment of the present invention may be a first static MAC address; the second dynamic address may be a second dynamic MAC address; and the second static address may be a second static MAC address.
[0062] In some embodiments, the first switch includes a first software table and a first switching chip. The first switch generates a first address synchronization message according to the first dynamic address corresponding to the message, which may include: the first switch periodically reads the first address table of the first switching chip according to the first software table, and determines the current source address hit information corresponding to the message for the current first reading cycle, and the current first reading cycle is less than the aging time of the first dynamic address; the first switch reads the first dynamic address from the first address table when the current source address hit information indicates that the message hits the first switching chip; the first switch generates a first address synchronization message according to the first dynamic address through a preset protocol.
[0063] Among them, the source address hit (SRC_HIT) means that the message whose source MAC address is the MAC address of M-LAG enters (ie hits) the switching chip of the switch.
[0064] The source address hit information is used to indicate whether the message hits the switching chip of the switch.
[0065] Aging time refers to the normal aging time of MAC addresses. Aging time is a parameter that affects the learning process of switches. In switches, each port has the function of automatically learning addresses. The switch will record the source address (source MAC address) and corresponding port number of the frame received by the port, and store this information in the address table (MAC address table) of the switching chip. Aging time starts from the time an address record is added to the address table.
[0066] It should be noted that address aging is an important mechanism used in switches to manage MAC address tables. The normal aging of dynamic addresses automatically deletes outdated or no longer used MAC address entries by setting an aging time, thereby ensuring the accuracy and validity of the MAC address table.
[0067] The first address table refers to the MAC address table of the first switching chip.
[0068] Exemplarily, the aging time of the first dynamic address may be set to 600 seconds (s), and the first read cycle may be set to 100 s.
[0069] Optionally, the first switch may start a built-in timer to implement periodic reading of the first address table.
[0070] Optionally, the preset protocol may include: Inter-device Control Protocol (ICCP) and Multi-Protocol Border Gateway Protocol (MP-BGP), etc. The preset protocol may also be user-defined.
[0071] In the process of generating the first address synchronization message, the first switch can periodically read the first address table of the first switching chip according to the first software table, and determine the current source address hit information corresponding to the message sent by the user equipment for the current first reading cycle; then, the first switch reads the first dynamic address from the first address table when the current source address hit information indicates that the message hits the first switching chip, that is, the first switch has learned the address of the message at this time; then, the first switch generates a first address synchronization message according to the first dynamic address through a preset protocol, so as to subsequently instruct the second switch to determine the first static address corresponding to the first dynamic address.
[0072] In some embodiments, the first switch further includes an inter-device link aggregation group (M-LAG), and the first software table is used to store address information of the inter-device link aggregation group.
[0073] Optionally, the address information may include: a MAC address of the M-LAG and related status information.
[0074] It can be understood that, since the MAC address of M-LAG is stored in the first software table, when the current source address hit information indicates that the message hits the first switching chip, it means that the source MAC address of the message is the MAC address of M-LAG at this time, and the message has entered the first switching chip of the first switch, that is, the first switch has learned the address of the message at this time, and the first switch can read the first dynamic address from the first address table of the first switching chip.
[0075] 103. The first switch synchronizes the first address synchronization message to the second switch.
[0076] The second switch receives the first address synchronization message sent by the first switch.
[0077] The first address synchronization message is used to instruct the second switch to determine the first static address corresponding to the first dynamic address.
[0078] The second switch is a network-side edge device (PE). The second switch can be understood as a switch after the traffic path is switched.
[0079] The first switch can synchronize the first address synchronization message to the second switch via a peer link through a preset protocol.
[0080] Likewise, the second switch may receive the first address synchronization message sent by the first switch via the peer link through a preset protocol.
[0081] 104. The second switch determines a first static address corresponding to the first dynamic address.
[0082] Optionally, the second switch includes a second switching chip.
[0083] It should be noted that at this time, the traffic path switching has not occurred, and the message has not entered the second switch, that is, the message has not hit the second switching chip of the second switch, and the source address hit (SRC_HIT) state is a miss state.
[0084] The second switch writes the synchronized first dynamic address into the second switching chip, and writes the first dynamic address as a static source address miss address, namely, a first static address, so as to avoid timing aging of the synchronized first dynamic address.
[0085] For example, Figure 2 It is a schematic diagram of traffic path switching provided by the present invention. Figure 2In the figure, PE1 represents the first switch; PE2 represents the second switch; LAG1 represents an M-LAG shared by the first switch and the second switch; CE represents user equipment; peerlink represents a peer link; SMAC (Source Media Access Control) represents the source media access control address, that is, the source MAC address; VLAN ID (Virtual Local Area Network Identity Document) represents the virtual local area network identification number. Figure 2 It can be seen that the user equipment CE sends the message P with the source MAC address of MAC A and the VLAN ID of VLAN A to LAG1. Before the traffic path is switched, the user equipment CE sends the message P to LAG1 of the first switch PE1. After the traffic path is switched, the user equipment CE starts to send the message P to LAG1 of the second switch PE2.
[0086] Combination Figure 2 , exemplary, Figure 3 Schematic diagram of the address table of the first switch and the second switch before the traffic path switching provided by the present invention. Figure 3 It can be seen that before the traffic path is switched, the address state of the first switch PE1 is dynamic, and the source address hit (SRC_HIT) state is a hit state, indicating that the message P has entered the first switching chip of the first switch PE1 at this time, that is, the first switch PE1 has learned the address MAC A of the message P at this time, and the first switch PE1 can read the first dynamic address from the first address table; the address state of the second switch PE2 is static, and the source address hit (SRC_HIT) state is a miss state, indicating that the message P has not entered the second switch PE2 at this time, that is, the message P has not hit the second switching chip of the second switch PE2.
[0087] 105. When the user equipment is switched from the first switch to the second switch and sends a message to the second switch, the second switch receives a message sent by the user equipment.
[0088] Combination Figure 2 When the user equipment switches from the first switch to the second switch and starts to send messages to the second switch, the second switch starts to receive the messages sent by the user equipment.
[0089] 106. The second switch switches the first static address to a second dynamic address, and generates a second address synchronization message.
[0090] The second address synchronization message carries the second dynamic address.
[0091] Optionally, the second switch includes a second software table. After the second switch switches the first static address to the second dynamic address, the second software table may also be updated simultaneously.
[0092] After the second switch starts to receive the message sent by the user equipment, the source address hit (SRC_HIT) state will change from the no hit state to the hit state. At this time, the second switch writes the first static address as the dynamic address, that is, switches the first static address to the second dynamic address. The second switch uses the second dynamic address as the newly learned address, and generates a second address synchronization message according to the second dynamic address through a preset protocol. The second address synchronization message is used to instruct the first switch to determine the second static address corresponding to the second dynamic address, and switch the first dynamic address to the second static address.
[0093] Combination Figure 2 , exemplary, Figure 4 Schematic diagram of the address table of the first switch and the second switch in the intermediate state of the traffic path switching provided by the present invention. The intermediate state of the traffic path switching indicates that the user equipment switches from the first switch to the second switch and starts to send messages to the second switch. Figure 4 It can be seen that Figure 3 compared to, Figure 4 The source address hit (SRC_HIT) state of the second switch PE2 is a hit state, indicating that the message P has entered the second switching chip of the second switch PE2, and the address state of the second switch PE2 is dynamic, indicating that the second switch PE2 has switched the first static address to the second dynamic address.
[0094] In some embodiments, the second switch includes a second software table and a second switching chip, and the second switch switches the first static address to the second dynamic address, which may include: the second switch periodically reads the second address table of the second switching chip according to the second software table, and determines the current source address hit information corresponding to the message for the current second reading cycle, and the current second reading cycle is less than the aging time of the second dynamic address; the second switch switches the first static address to the second dynamic address when the current source address hit information indicates that the message hits the second switching chip.
[0095] The second software table is used to store the address information of the M-LAG.
[0096] The second address table refers to the MAC address table of the second switching chip.
[0097] Exemplarily, the aging time of the second dynamic address may be set to 600 seconds, and the second read cycle may be set to 100 seconds.
[0098] It should be noted that the aging time of the second dynamic address may be the same as or different from the aging time of the first dynamic address; the second read cycle may be the same as or different from the first read cycle, which is not specifically limited here.
[0099] Optionally, the second switch may start a built-in timer to implement periodic reading of the second address table.
[0100] Since the MAC address of M-LAG is stored in the second software table, the second switch can periodically read the second address table of the second switching chip according to the second software table, and determine the current source address hit information corresponding to the message sent by the user equipment for the current second reading cycle; then, when the current source address hit information indicates that the message hits the second switching chip, the second switch indicates that the source MAC address of the message is the MAC address of M-LAG at this time, and the message has entered the second switching chip of the second switch. At this time, the second switch switches the first static address to the second dynamic address, and the second switch uses the second dynamic address as the newly learned address.
[0101] In some embodiments, the method may further include: when the current source address hit information of the second switch indicates that the message does not hit the second switching chip, S1, the second switch reads the second address table according to the second software table in the next second reading cycle to obtain new source address hit information corresponding to the message; S2, when the new source address hit information indicates that the message does not hit the second switching chip, the second switch repeats the above step S1 until the new source address hit information finally obtained indicates that the message hits the second switching chip, and the first static address is switched to the second dynamic address.
[0102] When the current source address hit information indicates that the message does not hit the second switching chip, it means that the message sent by the user device has not yet entered the second switching chip of the second switch. In the next second reading cycle, the second switch will read the second address table again according to the second software table to determine the new source address hit information corresponding to the message, that is, the second switch will again determine whether the message enters the second switching chip; when the new source address hit information indicates that the message does not hit the second switching chip, it means that the message has not yet entered the second switching chip. The second switch will continue to read the second address table according to the second software table in the new next second reading cycle until the new source address hit information finally obtained indicates that the message hits the second switching chip. At this time, the second switch switches the first static address to the second dynamic address, and subsequently synchronizes the second address synchronization message carrying the second dynamic address to the first switch.
[0103] 107. The second switch synchronizes the second address synchronization message to the first switch.
[0104] When the user equipment is switched from the first switch to the second switch and sends a message to the second switch, the first switch receives the second address synchronization message sent by the second switch.
[0105] The second address synchronization message carries a second dynamic address obtained by the second switch after switching the first static address.
[0106] The second address synchronization message is used to instruct the first switch to determine a second static address corresponding to the second dynamic address, and to switch the first dynamic address to the second static address.
[0107] The second switch can synchronize the second address synchronization message to the first switch via the peer link through a preset protocol.
[0108] It should be noted that at this time, the traffic path switching has occurred, and the second switch has switched the first static address to the second dynamic address. The second switch synchronizes the second address synchronization message carrying the second dynamic address to the first switch. The first switch can receive the second address synchronization message through the peer link through a preset protocol.
[0109] 108. When the first miss number reaches a preset number threshold, the first switch determines a second static address corresponding to the second dynamic address and switches the first dynamic address to the second static address. The first miss number is the number of times the message misses the first switch.
[0110] It should be noted that the first miss number is the number of times the message misses the first switching chip of the first switch.
[0111] Optionally, the preset number threshold may be set by the first switch before leaving the factory, or may be user-defined, which is not specifically limited here.
[0112] When the first switch reaches a preset number of times when the first miss number reaches a preset number of times, it indicates that the first dynamic address is about to age abnormally (in fact, abnormal aging has not yet occurred), and the first switch writes the synchronized second dynamic address into the first switching chip, writes the second dynamic address as a static source address miss address, that is, a second static address, and switches the first dynamic address to the second static address before the first dynamic address ages abnormally.
[0113] Combination Figure 2 , exemplary, Figure 5Schematic diagram of the address table of the first switch and the second switch in the steady state of the traffic path switching provided by the present invention. The steady state of the traffic path switching means that the user equipment no longer sends messages to the first switch, but sends messages to the second switch, and the traffic path switching has been completed. Figure 5 It can be seen that Figure 4 compared to, Figure 5 The source address hit (SRC_HIT) state of the first switch PE1 is a miss state, indicating that the message P no longer enters the first switching chip of the first switch PE1, and the address state of the first switch PE1 is static, indicating that the first switch PE1 has switched the first dynamic address to the second static address.
[0114] During the whole process, when the user equipment switches from the first switch to the second switch and sends a message to the second switch, that is, when the traffic path switching occurs, the first switch receives the second address synchronization message sent by the second switch, and the second address synchronization message carries the second dynamic address (the first address switching) obtained after the second switch switches the first static address. The purpose of the first address switching is that when the traffic path switching occurs, the MAC address state in the second switch may change, and the second dynamic address obtained after the switching can adapt to this change more flexibly; when the first miss number reaches the preset number threshold, it means that the first dynamic address is about to be abnormally aged. After determining the second static address corresponding to the second dynamic address, the first switch switches the first dynamic address to the second static address (the second address switching). The purpose of the second address switching is that the second static address obtained after the switching is more stable and will not be affected by the normal aging mechanism of the dynamic address and be mistakenly deleted, thereby avoiding abnormal aging. In this way, through two address switching, the abnormal aging of the address caused by the traffic path switching can be effectively avoided, thereby solving the short-term multiple packets and packet loss problems caused by the abnormal aging of the address, and effectively improving the stability and reliability of the network.
[0115] In some embodiments, the first switch determines the first number of misses, which may include: when the current source address hit information indicates that the message has not hit the first switch chip, the first switch counts the first number of misses.
[0116] Optionally, when the current source address hit information indicates that the message hits the first switching chip, the first switch clears the current source address hit information in the first address table and clears the first miss count to zero.
[0117] During the periodic reading of the first address table, starting from the first first reading cycle, if it is determined for the first time that the current source address hit information indicates that the message has not hit the first switching chip, then the number of times the message has not hit the first switching chip, ie, the first number of misses, is counted.
[0118] In some embodiments, the method may also include one of the following implementations.
[0119] Implementation method 1: When the first miss number does not reach the preset number threshold, the first switch reads the first address table according to the first software table in the next first reading cycle to obtain new source address hit information corresponding to the message; when the new source address hit information indicates that the message does not hit the first switching chip, the first switch adds 1 to the first miss number.
[0120] If the first miss count does not reach the preset count threshold, it means that the first dynamic address will not age abnormally at this time, and the first switch will continue to read the first address table according to the first software table in the next first read cycle to obtain new source address hit information corresponding to the message, that is, the first switch will continue to determine whether the message enters the first switching chip of the first switch: if the new source address hit information indicates that the message does not hit the first switching chip, it means that the message still has not entered the first switching chip at this time, and the first switch will add 1 to the first miss count. In other words, in the process of periodically reading the first address table, starting from the first first read cycle, the first miss count is accumulated until the first miss count finally obtained reaches the preset count threshold.
[0121] Implementation method 2: When the first miss number does not reach the preset number threshold, the first switch reads the first address table according to the first software table in the next first reading cycle to obtain new source address hit information corresponding to the message; when the new source address hit information indicates that the message hits the first switching chip, the first switch clears the new source address hit information in the first address table and clears the first miss number to zero.
[0122] If the first number of misses does not reach the preset number threshold, it means that the first dynamic address will not age abnormally at this time, and the first switch will continue to read the first address table according to the first software table in the next first reading cycle to obtain new source address hit information corresponding to the message. That is to say, the first switch will continue to determine whether the message enters the first switching chip of the first switch: if the new source address hit information indicates that the message hits the first switching chip, it means that the message has entered the first switching chip of the first switch. At this time, the first switch will clear the new source address hit information in the first address table and clear the first number of misses to zero.
[0123] In some embodiments, the method may further include: the first switch clears the first dynamic address in the first address table and generates a first address clearing message when the first switch does not receive the second address synchronization message sent by the second switch, wherein the first address clearing message is used to instruct the second switch to clear the first static address; and the first switch sends the first address clearing message to the second switch.
[0124] It should be noted that the method proposed in the embodiment of the present invention will not affect the normal aging of the dynamic address.
[0125] When the first dynamic address of the first switch ages normally, if the first switch does not receive the second address synchronization message sent by the second switch, it means that the traffic path switching has not occurred at this time, and the first switch will clear the first dynamic address in the first address table and generate a first address clearing message; then, the first switch can send the first address clearing message to the second switch through the peer link through a preset protocol, and the first address clearing message is used to instruct the second switch to clear the first static address in the second address table.
[0126] Optionally, after the traffic path switching occurs, the second switch receives a message sent by the user equipment, and then the second switch switches the first static address to the second dynamic address. If the second switch does not receive the first address synchronization message sent by the first switch, it means that the traffic path switching does not occur again at this time, and the user equipment does not send the message to the first switch. When the second dynamic address of the second switch ages normally, the second switch clears the second dynamic address in the second address table and generates a second address clearing message; then, the second switch can send the second address clearing message to the first switch through the peer link through a preset protocol, and the second address clearing message is used to instruct the first switch to clear the second static address in the first address table.
[0127] In an embodiment of the present invention, a first switch receives a message sent by a user device; the first switch generates a first address synchronization message according to a first dynamic address corresponding to the message; the first switch synchronizes the first address synchronization message to a second switch; the second switch receives the first address synchronization message sent by the first switch; the second switch determines a first static address corresponding to the first dynamic address; the second switch receives a message sent by the user device when the user device switches from the first switch to the second switch and sends a message to the second switch; the second switch switches the first static address to a second dynamic address and generates a second address synchronization message; the second switch synchronizes the second address synchronization message to the first switch; the first switch receives the second address synchronization message sent by the second switch when the user device switches from the first switch to the second switch and sends a message to the second switch; the first switch determines a second static address corresponding to the second dynamic address when the first miss number reaches a preset number threshold, and switches the first dynamic address to the second static address, and the first miss number is the number of times the message misses the first switch. In the method, when the user equipment switches from the first switch to the second switch and sends a message to the second switch, that is, when the traffic path switching occurs, the first switch receives the second address synchronization message sent by the second switch, the second address synchronization message carries the second dynamic address (the first address switching) obtained after the second switch switches the first static address. When the first miss number reaches a preset number threshold, it indicates that the first dynamic address is about to be abnormally aged. After determining the second static address corresponding to the second dynamic address, the first switch switches the first dynamic address to the second static address (the second address switching). Through the two address switching, the abnormal address aging caused by the traffic path switching can be effectively avoided, thereby solving the short-term multiple packets and packet loss problems caused by the abnormal address aging, and effectively improving the stability and reliability of the network.
[0128] The embodiments of the present invention are further described below with reference to the following examples.
[0129] For example, Figure 6 This is a second flow chart of the address adaptive switching method provided by the present invention, such as Figure 6As shown, the second switch can start the built-in timer to implement periodic reading of the second address table. For the current second reading cycle, the second switch determines the current source address hit information corresponding to the message. When the current source address hit information indicates that the message hits the second switching chip, that is, at this time, the source address hit (SRC_HIT) state of the second switch is a hit state, the second switch switches the first static address to the second dynamic address and generates a second address synchronization message; when the current source address hit information indicates that the message does not hit the second switching chip, S1, the second switch reads the second address table according to the second software table in the next second reading cycle to obtain new source address hit information corresponding to the message; S2, when the new source address hit information indicates that the message does not hit the second switching chip, the second switch repeats the above step S1 until the new source address hit information finally obtained indicates that the message hits the second switching chip, and the second switch switches the first static address to the second dynamic address.
[0130] The first switch can also start a built-in timer to periodically read the first address table. For the current first reading cycle, the first switch determines the current source address hit information corresponding to the message. When the current source address hit information indicates that the message does not hit the first switching chip, the first switch counts the first miss number; when the first miss number reaches a preset number threshold (such as 4), the first switch determines that the first dynamic address is about to be abnormally aged; when the first miss number does not reach the preset number threshold, the first switch reads the first address table according to the first software table in the next first reading cycle to obtain new source address hit information corresponding to the message, and then determines whether the message hits the first switching chip according to the new source address hit information: when the new source address hit information indicates that the message does not hit the first switching chip, the first switch adds 1 to the first miss number; when the new source address hit information indicates that the message hits the first switching chip, the first switch clears the new source address hit information in the first address table and clears the first miss number to zero. When the current source address hit information indicates that the message hits the first switch chip, the first switch clears the current source address hit information in the first address table and clears the first miss count to zero.
[0131] The address adaptive switching device provided by the present invention is described below. The address adaptive switching device described below and the address adaptive switching method described above can be referred to each other.
[0132] Figure 7 1 is a schematic diagram of the structure of the address adaptive switching device provided by the present invention, which is applied to a first switch, and the first switch is connected to a second switch and a user device respectively, such as Figure 7As shown, the device includes a first transceiver module 701 and a first processing module 702 as follows.
[0133] The first transceiver module 701 is configured to receive a message sent by the user equipment.
[0134] The first processing module 702 is configured to generate a first address synchronization message according to the first dynamic address corresponding to the message, where the first address synchronization message carries the first dynamic address.
[0135] The first transceiver module 701 is further configured to synchronize the first address synchronization message to the second switch, where the first address synchronization message is used to instruct the second switch to determine the first static address corresponding to the first dynamic address; and when the user equipment switches from the first switch to the second switch and sends the message to the second switch, receive the second address synchronization message sent by the second switch, where the second address synchronization message carries the second dynamic address obtained after the second switch switches the first static address.
[0136] The first processing module 702 is further configured to determine a second static address corresponding to the second dynamic address and switch the first dynamic address to the second static address when the first miss count reaches a preset count threshold, wherein the first miss count is the number of times the message misses the first switch.
[0137] Figure 8 2 is a schematic diagram of the structure of the address adaptive switching device provided by the present invention, which is applied to a second switch, the second switch is connected to the first switch and the user equipment respectively, and the first switch is connected to the user equipment, such as Figure 8 As shown, the device includes the following second transceiver module 801 and second processing module 802.
[0138] The second transceiver module 801 is used to receive a first address synchronization message sent by the first switch, where the first address synchronization message is generated by the first switch according to a first dynamic address corresponding to the message after receiving the message sent by the user equipment, and the first address synchronization message carries the first dynamic address.
[0139] The second processing module 802 is configured to determine a first static address corresponding to the first dynamic address.
[0140] The second transceiver module 801 is further configured to receive the message sent by the user equipment when the user equipment switches from the first switch to the second switch and sends the message to the second switch.
[0141] The second processing module 802 is further configured to switch the first static address to a second dynamic address and generate a second address synchronization message, wherein the second address synchronization message carries the second dynamic address.
[0142] The second transceiver module 801 is further used to synchronize the second address synchronization message to the first switch, where the second address synchronization message is used to instruct the first switch to determine the second static address corresponding to the second dynamic address and switch the first dynamic address to the second static address.
[0143] Fig. 9 Schematic diagram of the structure of the active-active system of address adaptive switching provided by the present invention, such as Fig. 9 As shown, the active-active system of address adaptive switching may include: a first switch 901 and a second switch 902; the first switch 901 implements Figure 1 The second switch 902 implements the address adaptive switching method on the first switch side; Figure 1 The invention discloses an address adaptive switching method on the second switch side.
[0144] Fig.10 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Fig.10 As shown, the electronic device may include: a processor 1010, a communications interface 1020, a memory 1030 and a communication bus 1040, wherein the processor 1010, the communications interface 1020, and the memory 1030 communicate with each other through the communication bus 1040. The processor 1010 may call the logic instructions in the memory 1030 to execute the address adaptive switching method, which is applied to the first switch, and the first switch is respectively connected to the second switch and the user equipment. Alternatively, the address adaptive switching method is executed and applied to the second switch, and the second switch is respectively connected to the first switch and the user equipment, and the first switch is connected to the user equipment.
[0145] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0146] On the other hand, the present invention also provides a computer program product, the computer program product includes a computer program, the computer program can be stored in a non-transitory computer readable storage medium, when the computer program is executed by a processor, the computer can execute Figure 1 The method for adaptively switching addresses on the first switch side is applied to the first switch, which is connected to the second switch and the user equipment respectively. Or, to perform Figure 1 The address adaptive switching method on the second switch side is applied to the second switch, the second switch is connected to the first switch and the user equipment respectively, and the first switch is connected to the user equipment.
[0147] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is executed by a processor to perform Figure 1 The method for adaptively switching addresses on the first switch side is applied to the first switch, which is connected to the second switch and the user equipment respectively. Or, to perform Figure 1 The address adaptive switching method on the second switch side is applied to the second switch, the second switch is connected to the first switch and the user equipment respectively, and the first switch is connected to the user equipment.
[0148] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0150] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An address adaptive switching method, characterized in that: Applied to a first switch, the first switch being connected to a second switch and a user equipment respectively, the method comprising: receiving a message sent by the user equipment; generating a first address synchronization message based on the first dynamic address corresponding to the message, wherein the first address synchronization message carries the first dynamic address; synchronizing the first address synchronization message to the second switch, wherein the first address synchronization message is used to instruct the second switch to determine a first static address corresponding to the first dynamic address; When the user equipment switches from the first switch to the second switch and sends the message to the second switch, receiving a second address synchronization message sent by the second switch, where the second address synchronization message carries a second dynamic address obtained by the second switch after switching the first static address; When the first miss count reaches a preset threshold, a second static address corresponding to the second dynamic address is determined, and the first dynamic address is switched to the second static address. The first miss count is the number of times the message misses the first switch.
2. The address adaptive switching method according to claim 1, wherein: The first switch includes a first software table and a first switching chip, and generating a first address synchronization message according to the first dynamic address corresponding to the message includes: Periodically reading the first address table of the first switching chip according to the first software table, and determining current source address hit information corresponding to the message for a current first reading cycle, where the current first reading cycle is less than an aging time of the first dynamic address; When the current source address hit information indicates that the message hits the first switching chip, reading the first dynamic address from the first address table; Generate the first address synchronization message according to the first dynamic address through a preset protocol.
3. The address adaptive switching method according to claim 2, wherein: Determining the first number of misses includes: When the current source address hit information indicates that the message has not hit the first switching chip, the first miss count is counted.
4. The address adaptive switching method according to claim 3, characterized in that: The method further comprises: When the first miss count does not reach the preset count threshold, reading the first address table according to the first software table in the next first read cycle to obtain new source address hit information corresponding to the message; When the new source address hit information indicates that the message has not hit the first switching chip, the first miss count is incremented by 1.
5. The address adaptive switching method according to claim 3, wherein: The method further comprises: When the first miss count does not reach the preset count threshold, reading the first address table according to the first software table in the next first read cycle to obtain new source address hit information corresponding to the message; When the new source address hit information indicates that the message hits the first switching chip, the new source address hit information in the first address table is cleared, and the first miss count is cleared to zero.
6. The address adaptive switching method according to any one of claims 3 to 5, characterized in that: The method further comprises: In the case where the second address synchronization message sent by the second switch is not received, clearing the first dynamic address in the first address table and generating a first address clearing message, where the first address clearing message is used to instruct the second switch to clear the first static address; Send the first address clearing message to the second switch.
7. The address adaptive switching method according to any one of claims 1 to 5, characterized in that: The first dynamic address is a first dynamic MAC address.
8. The address adaptive switching method according to any one of claims 2 to 5, characterized in that: The first switch further includes an inter-device link aggregation group, and the first software table is used to store address information of the inter-device link aggregation group.
9. An address adaptive switching method, characterized in that: Applied to a second switch, the second switch being connected to a first switch and a user equipment respectively, and the first switch being connected to the user equipment, the method comprising: receiving a first address synchronization message sent by the first switch, where the first address synchronization message is generated by the first switch according to a first dynamic address corresponding to a message sent by the user equipment after the first switch receives the message, and the first address synchronization message carries the first dynamic address; Determine a first static address corresponding to the first dynamic address; when the user equipment switches from the first switch to the second switch and sends the message to the second switch, receive the message sent by the user equipment; switch the first static address to a second dynamic address, and generate a second address synchronization message, where the second address synchronization message carries the second dynamic address; synchronize the second address synchronization message to the first switch, where the second address synchronization message is used to instruct the first switch to determine a second static address corresponding to the second dynamic address and switch the first dynamic address to the second static address.
10. The address adaptive switching method according to claim 9, wherein: The second switch includes a second software table and a second switching chip, and switching the first static address to a second dynamic address includes: Periodically reading the second address table of the second switching chip according to the second software table, and determining current source address hit information corresponding to the message for a current second reading cycle, where the current second reading cycle is less than an aging time of the second dynamic address; When the current source address hit information indicates that the message hits the second switching chip, the first static address is switched to the second dynamic address.
11. The address adaptive switching method according to claim 10, characterized in that: The method further comprises: When the current source address hit information indicates that the message does not hit the second switching chip, S1, in a next second read cycle, read the second address table according to the second software table to obtain new source address hit information corresponding to the message; S2. When the new source address hit information indicates that the message does not hit the second switching chip, repeat step S1 until the new source address hit information finally obtained indicates that the message hits the second switching chip, and switch the first static address to the second dynamic address.
12. An address adaptive switching device, characterized in that: Applied to a first switch, the first switch is connected to a second switch and a user equipment respectively, and the apparatus includes: A first transceiver module, configured to receive a message sent by the user equipment; A first processing module, configured to generate a first address synchronization message according to the first dynamic address corresponding to the message, where the first address synchronization message carries the first dynamic address; The first transceiver module is further configured to synchronize the first address synchronization message to the second switch, the first address synchronization message being used to instruct the second switch to determine a first static address corresponding to the first dynamic address; and, when the user equipment switches from the first switch to the second switch and sends the message to the second switch, receive a second address synchronization message sent by the second switch, the second address synchronization message carrying a second dynamic address obtained by the second switch after switching the first static address. The first processing module is further configured to determine a second static address corresponding to the second dynamic address and switch the first dynamic address to the second static address when the first miss count reaches a preset threshold, wherein the first miss count is the number of times the message misses the first switch.
13. An address adaptive switching device, characterized in that: Applied to a second switch, the second switch is connected to a first switch and a user equipment respectively, and the first switch is connected to the user equipment, the apparatus includes: a second transceiver module, configured to receive a first address synchronization message sent by the first switch, where the first address synchronization message is generated by the first switch after receiving a message sent by the user equipment according to a first dynamic address corresponding to the message, and the first address synchronization message carries the first dynamic address; a second processing module, configured to determine a first static address corresponding to the first dynamic address; The second transceiver module is further configured to receive the message sent by the user equipment when the user equipment switches from the first switch to the second switch and sends the message to the second switch; The second processing module is further configured to switch the first static address to a second dynamic address and generate a second address synchronization message, where the second address synchronization message carries the second dynamic address; The second transceiver module is further configured to synchronize the second address synchronization message to the first switch, where the second address synchronization message is configured to instruct the first switch to determine a second static address corresponding to the second dynamic address and switch the first dynamic address to the second static address.
14. An active-active system with adaptive address switching, characterized in that: include: A first switch and a second switch; the first switch implements the address adaptive switching method according to any one of claims 1 to 8; the second switch implements the address adaptive switching method according to any one of claims 9 to 11.
15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the address adaptive switching method according to any one of claims 1 to 8 is implemented, or the address adaptive switching method according to any one of claims 9 to 11 is implemented.
16. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the address adaptive switching method according to any one of claims 1 to 8 is implemented, or the address adaptive switching method according to any one of claims 9 to 11 is implemented.
Citation Information
Patent Citations
Address synchronization method, switch, cross-device link aggregation system and storage medium
CN115706724A
Satellite-borne dual-redundancy TTE network MAC address table configuration and maintenance method
CN116886646A
Method of dynamically learning address on MAC layer
CN1809032A
