Address adaptive switching method, device, active-active system, electronic device, and storage medium
By carrying dynamic addresses in address synchronization messages between switches for switching, the problem of abnormal MAC address aging caused by traffic path switching in M-LAG is solved, improving network stability and reliability.
Patent Information
- Application Number
- CN202410886767.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-07-03
AI Technical Summary
In a multi-device link aggregation group (M-LAG), traffic path switching causes abnormal MAC address aging, leading to short-term multiple packets and packet loss, affecting network stability and reliability.
When the traffic path is switched, the switches carry dynamic addresses through address synchronization messages to ensure timely updates of static addresses and avoid abnormal aging, including address switching when the number of misses reaches a threshold.
It effectively avoids abnormal address aging caused by traffic path switching, solves the problems of short-term multiple packets and packet loss, and improves the stability and reliability of the network.
Smart Images

Figure CN118890338B_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 that enables two switches to aggregate links with user devices across multiple devices, forming an active-active system. This improves link reliability from the board level to the device level. User devices are typically customer edge devices (CE), while the switches that form the active-active system are typically provider edge devices (PE). Uplink traffic from the user device to the switch is load-balanced across the two switches after hashing is performed by the link aggregation group (LAG) within the user device. Downlink traffic from the switch to the user device is forwarded to the user device via the M-LAG within the switch. Therefore, to ensure the proper functioning of the active-active system, the relevant forwarding tables must be synchronized between the two switches, and synchronization of the Media Access Control (MAC) address table is crucial. A switch's MAC address table consists of two parts: addresses learned by the switch itself and addresses synchronized from another switch. The learned address is a dynamic address that can age. To prevent the synchronized address from aging out periodically, the common practice is to write the synchronized address as a static address.
[0003] In actual M-LAG applications, uplink traffic from user devices to switches changes dynamically. Certain changes (such as changes in packet content or increases or decreases in the number of packet entries) trigger the LAG in the user device connected to the switch to re-hash the uplink traffic. Therefore, even if the MAC address or virtual local area network (VLAN) of a particular uplink traffic flow remains unchanged, the re-hashing process can cause the traffic path from the user device to the current switch to change. Although the traffic still flows through the same M-LAG, the destination device switches from the current switch to another. This traffic path change can cause abnormal MAC address aging, resulting in temporary packet loss and packet loss, which in turn reduces 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 will cause abnormal address aging, short-term multiple packets and packet loss problems, and thus lead to low network stability and reliability. According to 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 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 number of first misses 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 packets and packet loss problems caused by 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 by the second switch after switching the first static address.
[0008] 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.
[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 equipment respectively, and the first switch is connected to the user equipment. The method includes the following steps.
[0010] A first address synchronization message sent by the first switch is received. 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. 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 configured to receive a message sent by the user equipment.
[0014] The first processing module 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.
[0015] 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.
[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 count reaches a preset threshold, wherein the first miss count 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. 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 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.
[0019] The second processing module is configured 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, where the second address synchronization message carries the second dynamic address.
[0022] 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.
[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 aspects; the second switch implements the address adaptive switching method as described in any one of the second aspects.
[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, which, when executed by a processor, implements the address adaptive switching method as described in the first aspect or the second aspect.
[0027] The present invention provides an address adaptive switching method, device, active-active system, electronic device and storage medium. According to 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. The second address synchronization message carries a second dynamic address obtained after the second switch switches the first static address. When the number of first misses 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, a brief introduction is given below to 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 any 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 This is a schematic diagram of the address tables of the first switch and the second switch before traffic path switching provided by the present invention.
[0032] Figure 4 It is a schematic diagram of the address tables 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 tables 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 diagrams of the address adaptive switching device provided by the present invention.
[0036] Figure 8 This is the second structural diagram of the address adaptive switching device provided by the present invention.
[0037] Figure 9 It is a structural diagram of the active-active system with adaptive address switching provided by the present invention.
[0038] Figure 10 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0039] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall 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 actual M-LAG applications, the upstream traffic from user devices to switches changes dynamically. Certain changes (such as changes in packet content or increases or decreases in the number of packet entries) trigger the LAG in the user device connected to the switch to re-hash the upstream traffic. Therefore, even if the MAC address or VLAN ID of a particular upstream traffic message remains unchanged, the re-hashing may change the traffic path from the user device to the current switch. Although the traffic remains sent to the same M-LAG, the destination device is switched from the current switch to another.
[0042] This type of traffic path switching does not fall within the scope 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 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 traffic is only switched rather than interrupted, MAC aging should not occur. However, this aging is abnormal aging of the MAC address and will cause the following problems: Layer 2 forwarding messages with the aged MAC as the destination MAC will generate flooding, resulting in short-term multiple packet problems; switches generally have default storm suppression configurations (unknown unicast, unknown multicast, and broadcast rate limits). If the bandwidth of the flooded messages reaches the storm suppression threshold, it will cause rate-limited packet loss, resulting in short-term packet loss problems; it will affect the related Address Resolution Protocol (ARP) table and Neighbor Discovery Protocol (NDP) table on the switch, resulting in affected Layer 3 forwarding functions and short-term packet loss or multiple packets.
[0044] In other words, this traffic path switching will cause abnormal aging of addresses (MAC addresses), resulting in short-term multiple packets and packet loss problems, which will lead to low network stability and reliability.
[0045] To solve the above problems, embodiments of the present invention provide 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 by the second switch after switching the first static address. When the number of first misses reaches a preset 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 can be the first switch, the second switch, the address adaptive switching device, or an electronic device. Optionally, the electronic device can 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 This 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). It can be understood as the switch before the traffic path is switched. In other words, the traffic path along which the user device sends packets has not yet been affected by certain changes (such as changes in packet content or an increase or decrease in the number of packet entries). Therefore, the traffic path switch has not yet occurred.
[0054] User equipment is a user-side edge device (CE).
[0055] It should be noted that the first switch and the second switch share one M-LAG, and the user equipment actually sends packets 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 based on the learned address of the message, that is, the first dynamic address. The first address synchronization message carries the first dynamic address. 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 based on 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 based on the first dynamic address through a preset protocol.
[0063] A source address hit (SRC_HIT) indicates that a packet with a source MAC address of M-LAG has entered (i.e., hit) 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] The aging time refers to the normal aging time of a MAC address. It is a parameter that affects the switch's learning process. Each port on a switch automatically learns addresses. The switch records the source address (source MAC address) and corresponding port number of frames received on the port and stores this information in the address table (MAC address table) on the switching chip. The aging time begins when an address record is added to the address table.
[0066] It should be noted that address aging is an important mechanism used by switches to manage the MAC address table. The normal aging of dynamic addresses automatically deletes outdated or unused 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 seconds.
[0069] Optionally, the first switch may start a built-in timer to implement periodic reading of the first address table.
[0070] Optionally, the preset protocols may include Inter-Chip Control Protocol (ICCP) and Multi-Protocol Border Gateway Protocol (MP-BGP), etc. The preset protocols 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, when the current source address hit information indicates that the message hits the first switching chip, the first switch reads the first dynamic address from the first address table, that is, at this time, the first switch has learned the address of the message; 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 edge device (PE). The second switch can be understood as the switch after the traffic path is switched.
[0079] The first switch may synchronize the first address synchronization message to the second switch via a peer link using a preset protocol.
[0080] Likewise, the second switch may receive the first address synchronization message sent by the first switch via the peer link using 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 yet 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, ie, a first static address, to avoid timed 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 and second switches; CE represents user equipment; peerlink represents a peer link; SMAC (Source Media Access Control) represents the source media access control address, i.e., the source MAC address; VLAN ID (Virtual Local Area Network Identity Document) represents the virtual local area network identification number. Figure 2 As can be seen in the figure, the user equipment CE sends the packet P with the source MAC address being MAC A and the VLAN ID being VLAN A to LAG1. Before the traffic path switching, the user equipment CE sends the packet P to LAG1 of the first switch PE1. After the traffic path switching, the user equipment CE starts to send the packet P to LAG1 of the second switch PE2.
[0086] Combine 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 As can be seen from the figure, before the traffic path switching, the address status of the first switch PE1 is dynamic, and the source address hit (SRC_HIT) status is hit, indicating that the packet P has entered the first switching chip of the first switch PE1. In other words, the first switch PE1 has learned the address MAC A of the packet P and can read the first dynamic address from the first address table. The address status of the second switch PE2 is static, and the source address hit (SRC_HIT) status is miss, indicating that the packet P has not yet entered the second switch PE2, that is, the packet 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] Combine Figure 2 When the user equipment switches from the first switch to the second switch and starts sending messages to the second switch, the second switch starts receiving 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, it may also update the second software table simultaneously.
[0092] After the second switch starts receiving packets sent by the user equipment, the source address hit (SRC_HIT) state changes from a no-hit state to a hit state. At this time, the second switch writes the first static address as a dynamic address, that is, switches the first static address to a second dynamic address. The second switch uses the second dynamic address as a newly learned address and generates a second address synchronization message based on 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] Combine Figure 2 , exemplary, Figure 4 The figure is a 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 shown as hit state, indicating that the packet P has entered the second switching chip of the second switch PE2. 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 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 the 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 the M-LAG, 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 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 using 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 count reaches a preset 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 count is the number of times the packet misses the first switch.
[0110] It should be noted that the first miss count 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, and is not specifically limited here.
[0112] When the first switch experiences a first miss count reaching a preset threshold, it indicates that the first dynamic address is about to age abnormally (in fact, abnormal aging has not yet occurred). 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, i.e., a second static address, and switches the first dynamic address to the second static address before abnormal aging occurs to the first dynamic address.
[0113] Combine 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 shown as a miss state, indicating that the packet P no longer enters the first switching chip of the first switch PE1. 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] Throughout the entire process, when a user device switches from a first switch to a second switch and sends a message to the second switch, i.e., when a traffic path switch occurs, the first switch receives a second address synchronization message from the second switch. The second address synchronization message carries a second dynamic address obtained by the second switch after switching the first static address (a first address switch). The purpose of the first address switch is to more flexibly adapt to changes in the MAC address state in the second switch during the traffic path switch. When the number of first misses reaches a preset threshold, indicating that the first dynamic address is about to abnormally age, the first switch determines the second static address corresponding to the second dynamic address and switches the first dynamic address to the second static address (a second address switch). The purpose of the second address switch is to make the second static address obtained after the switch more stable and prevent it from being erroneously deleted due to the normal aging mechanism of dynamic addresses, thereby avoiding abnormal aging. In this way, the two address switches can effectively prevent abnormal address aging caused by traffic path switching, thereby resolving the short-term multiple packet and packet loss problems caused by abnormal address aging, and effectively improving network stability and reliability.
[0115] In some embodiments, the first switch determining the first miss number may include: when the current source address hit information indicates that the packet has not hit the first switching chip, the first switch counting the first miss number.
[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 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, i.e., the first number of misses, is counted.
[0118] In some embodiments, the method may further include one of the following implementations.
[0119] Implementation method 1: When the first miss count does not reach a preset threshold, the first switch reads 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 switch increments the first miss count by 1.
[0120] If the first miss count does not reach the preset threshold, it indicates that the first dynamic address will not age abnormally at this time. 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. In other words, the first switch will continue to determine whether the message has entered the first switching chip of the first switch. If the new source address hit information indicates that the message has not hit the first switching chip, it means that the message has not entered the first switching chip at this time, and the first switch will increase the first miss count by 1. In other words, during the periodic reading of the first address table, starting from the first first read cycle, the first miss count is accumulated until the final first miss count reaches the preset threshold.
[0121] Implementation method 2: When the first miss count does not reach the preset threshold, the first switch reads 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 first switch clears the new source address hit information in the first address table and resets the first miss count to zero.
[0122] If the first miss count does not reach the preset 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, 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 reset the first miss count to zero.
[0123] In some embodiments, the method may further include: when the first switch does not receive the second address synchronization message sent by the second switch, clearing the first dynamic address in the first address table and generating a first address clearing message, the first address clearing message being used to instruct the second switch to clear the first static address; and the first switch sending 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. 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 via the peer link through a preset protocol. 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 has not occurred again at this time, and the user equipment has not sent the message to the first switch. When the second dynamic address of the second switch ages normally, the second switch will clear the second dynamic address in the second address table and generate a second address clearing message; then, the second switch can send the second address clearing message to the first switch via 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 based on 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; when the number of first misses reaches a preset 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, where the first miss number is the number of times the message misses the first switch. 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 switch 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 (a first address switch) obtained by the second switch after switching the first static address. When the number of first misses reaches a preset 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 (a second address switch). The two address switches can effectively avoid abnormal address aging caused by the traffic path switch, thereby solving the short-term multiple packet and packet loss problems caused by abnormal address aging, and effectively improving network stability and reliability.
[0128] The embodiments of the present invention are further described below with reference to the following examples.
[0129] For example, Figure 6 This is the second flow chart of the address adaptive switching method provided by the present invention, such as Figure 6As shown, the second switch can start a built-in timer to periodically read 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, the source address hit (SRC_HIT) state of the second switch is the 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 may also start a built-in timer to periodically read the first address table. For the current first reading cycle, the first switch determines current source address hit information corresponding to the message. If the current source address hit information indicates that the message has not hit the first switching chip, the first switch counts a first miss count. If the first miss count reaches a preset threshold (e.g., 4), the first switch determines that the first dynamic address is about to undergo abnormal aging. If the first miss count does not reach the preset 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 has hit the first switching chip based on the new source address hit information. If the new source address hit information indicates that the message has not hit the first switching chip, the first switch increments the first miss count by 1. If the new source address hit information indicates that the message has hit the first switching chip, the first switch clears the new source address hit information in the first address table and resets the first miss count 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 following describes the address adaptive switching device provided by the present invention. The address adaptive switching device described below and the address adaptive switching method described above can be referred to in correspondence with each other.
[0132] Figure 7 This is one of the structural diagrams 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, such as Figure 7As shown, the device includes the following first transceiver module 701 and a first processing module 702.
[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 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 by the second switch after switching 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 threshold, wherein the first miss count is the number of times the message misses the first switch.
[0137] Figure 8 This is a second structural diagram of the address adaptive switching device provided by the present invention, which is applied to the second switch. The second switch is connected to the first switch and the user equipment respectively. The first switch is connected to the user equipment. 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 configured to receive a first address synchronization message sent by the first switch. 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. 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, where the second address synchronization message carries the second dynamic address.
[0142] The second transceiver module 801 is further configured to synchronize the second address synchronization message to the first switch. 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.
[0143] Figure 9 Schematic diagram of the structure of the active-active system with adaptive address switching provided by the present invention. Figure 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 provides an address adaptive switching method on the second switch side.
[0144] Figure 10 Schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 10 As shown, the electronic device may include: a processor 1010, a communications interface 1020, a memory 1030, and a communication bus 1040. The processor 1010, the communications interface 1020, and the memory 1030 communicate with each other via the communication bus 1040. The processor 1010 may invoke logic instructions in the memory 1030 to execute an address adaptive handover method applied to a first switch, where the first switch is connected to a second switch and a user device. Alternatively, the address adaptive handover method may be executed on a second switch, where the second switch is connected to the first switch and a user device, where the first switch is connected to the user device.
[0145] Furthermore, the logic instructions in the aforementioned memory 1030 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[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 on a non-transitory computer readable storage medium, when the computer program is executed by a processor, the computer can perform Figure 1 The method for adaptive address switching on the first switch side is applied to the first switch, which is connected to the second switch and the user equipment respectively. Alternatively, 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 adaptive address switching on the first switch side is applied to the first switch, which is connected to the second switch and the user equipment respectively. Alternatively, 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. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0149] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions 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 various 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
Method of dynamically learning address on MAC layer
CN1809032A