MAC address synchronization method, MLAG system, electronic equipment and storage medium

In the MLAG system, after learning the MAC address information, the LPU card synchronizes within the first device, and the synchronization within the second device is achieved by the LPU card used for synchronization. This solves the problem of MAC address asynchrony between distributed switching devices and ensures the correctness of data forwarding and network stability.

CN119276781APending Publication Date: 2025-01-07MAIPU COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411386041.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In MLAG scenarios, the synchronization of MAC addresses between distributed switching devices can lead to traffic flooding that consumes unnecessary bandwidth and affects network stability.

Method used

In the MLAG system, after any LPU card learns the MAC address information, it synchronizes within the first device. The first LPU card used for synchronization then sends the information to the second LPU card used for synchronization in the second device, which is responsible for synchronizing the MAC address within the second device, thus ensuring the synchronization between the various LPU cards.

Benefits of technology

This ensures the synchronization of MAC addresses of distributed switching devices across LPU cards in MLAG scenarios, guaranteeing the correctness of data forwarding and the stability of the network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276781A_ABST
    Figure CN119276781A_ABST
Patent Text Reader

Abstract

The invention provides an MAC address synchronization method, an MLAG system, electronic equipment and a storage medium, and relates to the field of communication. In the MLAG system, a first device comprises at least one first LPU card, a second device comprises at least one second LPU card, a peer-to-peer link is established between the first device and the second device, and at least one downlink device accesses the MLAG system in a dual-homing or single-homing manner. In the invention, any one LPU card of the first equipment is synchronized in the first equipment after learning the first MAC address information, then the first LPU card for synchronization is synchronized to the second LPU card for synchronization in the second equipment, and the second LPU card for synchronization is responsible for realizing synchronization of the first MAC address information in the second equipment. And the MAC address synchronization of the distributed switching equipment in the MLAG scene is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and in particular to a MAC address synchronization method, an MLAG system, an electronic device and a storage medium. Background Art

[0002] MAC (Media Access Control Address) is a globally unique identifier for a device. In Layer 2 switching devices, MAC addresses are mainly used to guide the forwarding of known data. Therefore, ensuring the stability of MAC addresses is an essential basic function.

[0003] With the rapid development of data centers, the bandwidth of link aggregation of a single device can no longer meet the needs. Therefore, the current data center network adopts MLAG (Multi-chassis Link Aggregation Group) virtualization technology, which can improve the reliability of the link from the single-board level to the device level through link aggregation between multiple devices, thereby increasing the bandwidth and improving the reliability of the link.

[0004] In data center scenarios, MLAG technology is widely used to improve link reliability. When traffic is aggregated and forwarded across devices, the asynchrony of addresses between devices will affect the stability of the entire network and cause traffic flooding to occupy unnecessary bandwidth. In the MLAG scenario, the synchronization of MAC addresses between devices refers to the two switching devices aggregated based on MLAG technology. When a link aggregation group on one of the switching devices learns a MAC address, it needs to be synchronized to another switching device written in the same link aggregation group.

[0005] The current network devices are distributed, that is, distributed network devices can be plugged with multiple LPU (Line Processing Unit) cards responsible for message forwarding. Therefore, in the MLAG scenario using distributed switching devices for aggregation, how to achieve MAC address synchronization between two distributed switching devices is an issue that needs to be considered. Summary of the invention

[0006] The purpose of the present invention is to provide a MAC address synchronization method, an MLAG system, an electronic device and a storage medium to improve the problems existing in the prior art.

[0007] The embodiments of the present invention can be implemented as follows:

[0008] In a first aspect, the present invention provides a MAC address synchronization method, which is applied to a first device of an MLAG system, wherein the MLAG system further includes a second device that establishes a peer link with the first device; the first device includes at least one first LPU card, and the second device includes at least one second LPU card; at least one downstream device is dual-homed or single-homed connected to the MLAG system; the method includes:

[0009] When any first LPU card receives a message sent by the downstream device, it searches the MAC address table maintained by itself to see whether there is a matching entry based on the source MAC address of the message;

[0010] If the matching table entry does not exist, any of the first LPU cards acquires the first MAC address information, stores it in its own MAC address table, and synchronizes it to other first LPU cards, and then forwards the message;

[0011] The first LPU card for synchronization sends the first MAC address information to the second LPU card for synchronization in the second device, so that the second LPU card for synchronization updates the MAC address table maintained by itself based on the first MAC address information and synchronizes the first MAC address information to other second LPU cards.

[0012] Optionally, the method further includes: after each of the other first LPU cards stores the first MAC address information in a MAC address table maintained by itself, feeding back to any of the first LPU cards.

[0013] Optionally, the step of the first LPU card for synchronization sending the first MAC address information to the second LPU card for synchronization in the second device includes:

[0014] The first LPU card for synchronization encapsulates the first MAC address information based on the pairing transmission service protocol to obtain a synchronization message;

[0015] The first LPU card for synchronization transparently transmits the synchronization message to the second LPU card for synchronization through a peer-to-peer link.

[0016] Optionally, the method further includes:

[0017] The first LPU card for synchronization receives a first response message sent by the second LPU card for synchronization; the first response message is generated by the second LPU card for synchronization after receiving feedback from each other second LPU card on updating the MAC address table maintained by itself based on the first MAC address information;

[0018] The first LPU card used for synchronization sends a first response message to any of the first LPU cards.

[0019] Optionally, the method further includes:

[0020] When receiving the second MAC address information sent by the second LPU card for synchronization, the first LPU card for synchronization stores the second MAC address information in its own MAC address table and synchronizes it to other first LPU cards;

[0021] After each other first LPU card stores the second MAC address information in the MAC address table maintained by itself, it feeds back to the first LPU card used for synchronization;

[0022] After receiving feedback from each other first LPU card, the first LPU card used for synchronization sends a second response message to the second LPU card used for synchronization.

[0023] Optionally, before any of the first LPU cards receives a message sent by the downstream device, the method further includes:

[0024] When there is only one first LPU card whose port belongs to the member port of the peer link, determining that a first LPU card whose port belongs to the member port of the peer link is the first LPU card for synchronization;

[0025] When the first device is a master device and more than one port of the first LPU card is a member port of the peer link, the first LPU card for synchronization is determined in the following manner:

[0026] The first device selects an LPU card from all first LPU cards whose ports belong to member ports of the peer link according to a preset rule as the first LPU card for synchronization; the first LPU card for synchronization sends an election result message to the connected second LPU card through the peer link;

[0027] When the first device is a standby device and more than one port of the first LPU card is a member port of the peer link, the first LPU card for synchronization is determined in the following manner:

[0028] After multiple first LPU cards receive the election result message sent by the second LPU card selected for synchronization by the second device, the first device selects an LPU card as the first LPU card for synchronization from the multiple first LPU cards that receive the election result message according to preset rules.

[0029] Optionally, the first MAC address information includes a source MAC address of the message, a port identifier of a port receiving the message, a VLAN to which the port belongs, and an LPU card identifier of any first LPU card.

[0030] In a second aspect, the present invention provides an MLAG system, comprising two devices in communication connection, each device comprising a plurality of LPU cards, wherein there is an LPU card for synchronization among the plurality of LPU cards of each device, and at least one downstream device is dual-homed or single-homed to access the MLAG system, wherein when dual-homed is accessed, each of the downstream devices is connected to an LPU card of one device and an LPU card of another device, and when single-homed is accessed, each of the downstream devices is connected to an LPU card of any device;

[0031] A device uses the MAC address synchronization method described in the first aspect to achieve MAC address synchronization with another device.

[0032] In a third aspect, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory stores a software program, and when the electronic device is running, the processor executes the software program to implement the MAC address synchronization method described in the first aspect above.

[0033] In a fourth aspect, the present invention provides a computer storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the MAC address synchronization method described in the first aspect is implemented.

[0034] Compared with the prior art, the embodiment of the present invention provides a MAC address synchronization method, an MLAG system, an electronic device and a storage medium. In the MLAG system, the first device includes at least one first LPU card, the second device includes at least one second LPU card, and a peer link is established between the two devices, and at least one downstream device is dual-homed or single-homed to the MLAG system. When any first LPU card receives a message sent by a downstream device, it searches the MAC address table maintained by itself for a matching entry based on the source MAC address of the message. If there is no matching entry, it obtains the first MAC address information to store it in its own MAC address table and synchronizes it to other first LPU cards, and then forwards the message; the first LPU card used for synchronization sends the first MAC address information to the second LPU card used for synchronization in the second device, so that the second LPU card used for synchronization stores the first MAC address information in the MAC address table maintained by itself and synchronizes the first MAC address information to other second LPU cards. In the present invention, any LPU card of the first device first synchronizes within the first device after learning the first MAC address information, and then the first LPU card used for synchronization synchronizes to the second LPU card used for synchronization, and the second LPU card used for synchronization is responsible for realizing the synchronization of the first MAC address information within the second device, thereby ensuring the MAC address synchronization of the distributed switching device in the MLAG scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0036] Figure 1 The figure is a schematic diagram of MLAG networking.

[0037] Figure 2 A schematic diagram of an application scenario provided by an embodiment of the present invention.

[0038] Figure 3 One of the flow charts of a MAC address synchronization method provided by an embodiment of the present invention.

[0039] Figure 4 The present invention provides a second flowchart of a MAC address synchronization method according to an embodiment of the present invention.

[0040] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0042] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. 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.

[0043] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0044] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0045] See also Figure 1 , Figure 1 The figure is a schematic diagram of MLAG networking. Figure 1 When MLAG is used for networking, different ports on different devices are grouped into an aggregation group to achieve the same function as a common LAG (Link Aggregation Group). For downstream devices, the upstream device is considered to be one device. In addition, a peer-link is configured between the two upstream devices, so that the two upstream devices can synchronize protocol packets to achieve the purpose of active-active forwarding.

[0046] Among them, Eth-Trunk (link aggregation technology) is a technology that bundles multiple physical Ethernet interfaces into one logical interface, mainly used to increase network bandwidth, enhance network reliability, and achieve load balancing. This technology bundles multiple independent physical interfaces together to form a logical interface with higher bandwidth, thereby improving the overall performance and availability of the network.

[0047] Next in Figure 1 Based on this, the application scenarios of the present invention are introduced.

[0048] In the present invention, the MLAG system includes a first device and a second device belonging to a distributed switching device, the first device includes a plurality of first LPU cards, the second device includes a plurality of second LPU cards, and a peer-link is established between the two devices, and the peer-link is used for data synchronization between the first device and the second device. If a downstream device (switch or access host) needs dual-homing access to the MLAG system, it is necessary to simultaneously connect an LPU card of the first device and an LPU card of the second device; if a downstream device (switch or access host) needs single-homing access to the MLAG system, it is necessary to select an LPU card of the first device or an LPU card of the second device.

[0049] Among them, any LPU card of the first device SwitchA can be physically connected to any LPU card of the second device SwitchB, the first device SwitchA can add each port physically connected to the LPU card of the second device to the first aggregation group, and the second device SwitchB can add each port physically connected to the LPU card of the first device to the second aggregation group, so that multiple physical links between the first device SwitchA and the second device SwitchB can be logically aggregated and regarded as a peer link, and all member ports of the first aggregation group are logically regarded as aggregated link ports L1 of the peer link, and all member ports of the second aggregation group are logically regarded as aggregated link ports L2 of the peer link.

[0050] For example, in Figure 1 Based on Figure 2 , Figure 2 In the example, the first device SwitchA and the second device SwitchB each include four LPU cards, and a downlink device is connected to the first LPU card A3 and the second LPU card B3 to implement dual-homing access to the MLAG system.

[0051] Figure 2In the example, there are four physical links (physical links 1 to 4) between the first device SwitchA and the second device SwitchB. The first device SwitchA adds ports a1-a4 physically connected to the LPU card of the second device to the aggregation group 1 of the peer link divided on the device, and the second device SwitchB adds ports b1-b4 physically connected to the LPU card of the first device to the aggregation group 2 of the peer link divided on the device. In this way, the four physical links between the first device SwitchA and the second device SwitchB can be logically aggregated and regarded as a peer link. For the first device SwitchA, the member ports of the aggregated link port L1 include ports a1-a4; for the second device SwitchB, the member ports of the aggregated link port L2 include ports b1-b4.

[0052] Figure 2 The figure is only an example. The embodiment of the present invention does not limit the number of LPU cards in each device in the MLAG system, the LPU cards and ports physically connected between two devices, the number of connected downstream devices, and the access method of the downstream devices.

[0053] Please refer to Figure 3 , Figure 3 A flow chart of a MAC address synchronization method provided in an embodiment of the present invention is provided. The method is applied to a first device of an MLAG system. The MLAG system also includes a second device that establishes a peer link with the first device. The first device includes at least one first LPU card, and the second device includes at least one second LPU card. At least one downlink device is dual-homed or single-homed to the MLAG system. The MAC address synchronization method includes the following steps:

[0054] S101. When any first LPU card receives a message sent by a downstream device, it searches the MAC address table maintained by itself for a matching entry based on the source MAC address of the message.

[0055] It can be understood that each LPU card of the first device and the second device independently maintains a MAC address table. An entry in the MAC address table includes at least a MAC address, a port, a port identifier, a VLAN, an LPU card identifier, etc., and is used to guide data forwarding.

[0056] In this embodiment, the first LPU card that receives the message from the downstream device searches the MAC address table maintained by itself for a matching entry based on the source MAC address of the message. If so, the following step S102 is continued to be executed; if not, the following step S103 is continued to be executed.

[0057] S102: If a matching entry exists, the first LPU card that receives the message directly forwards the message based on the matching entry.

[0058] S103: If there is no matching entry, the first LPU card that receives the message obtains the first MAC address information, stores it in its own MAC address table, synchronizes it to other first LPU cards, and then forwards the message.

[0059] In this embodiment, the first MAC address information obtained by the first LPU card that receives the message may include the source MAC address of the message, the port identifier of the port that receives the message, the VLAN to which the port belongs, and the LPU card identifier of the first LPU card that receives the message. The first LPU card that receives the message can directly write these four items into the MAC address table maintained by itself, thereby completing MAC address learning. Then, after synchronizing the first MAC address information to each other first LPU card, the received message can be forwarded normally.

[0060] S105. The first LPU card for synchronization sends the first MAC address information to the second LPU card for synchronization in the second device, so that the second LPU card for synchronization updates the MAC address table maintained by itself based on the first MAC address information and synchronizes the first MAC address information to other second LPU cards.

[0061] In this embodiment, there is a first LPU card selected for synchronization among all LPU cards of the first device, and similarly, there is a second LPU card selected for synchronization among all LPU cards of the second device. After receiving the first MAC address information, the second LPU card for synchronization will update the MAC address table maintained by itself and synchronize the first MAC address information to other second LPU cards, so that the first MAC address information learned by any first LPU card can be synchronized to each second LPU card of the second device.

[0062] In the MAC address synchronization method provided by the embodiment of the present invention, any LPU card of the first device first synchronizes inside the first device after learning the first MAC address information, and then the first LPU card used for synchronization synchronizes to the second LPU card used for synchronization, and the second LPU card used for synchronization is responsible for realizing the synchronization of the first MAC address information inside the second device, thereby ensuring the synchronization of the MAC address information between the various LPU cards inside the first device and the second device in the MLAG scenario including the distributed switching device, so as to ensure correct data forwarding.

[0063] Next, from the perspective of the first device, a method for determining the first LPU card used for synchronization is introduced, which is divided into the following three cases.

[0064] Case 1: When there is only one first LPU card on the first device whose port is a member port of the aggregated link port L1 at one end of the peer link, find out the first LPU card whose port is a member port of the aggregated link port L1 at one end of the peer link, and determine that the first LPU card is the first LPU card used for synchronization.

[0065] Case 2: When the first device is a master device and more than one first LPU card has a port that is a member port of the aggregated link port L1 at one end of the peer link, the first LPU card for synchronization is determined in the following manner: the first device selects an LPU card as the first LPU card for synchronization from all first LPU cards whose ports are member ports of the peer link according to a preset rule. After the first LPU card for synchronization is selected, the first LPU card for synchronization will immediately send an election result message (the election result message may include the LPU card identifier of the second LPU card for synchronization) to the connected second LPU card through the peer link, so that the second device determines the second LPU card for synchronization based on the election result message.

[0066] Case three: When the first device is a backup device and ports of more than one first LPU card are member ports of the aggregated link port L1 at one end of the peer link, the first LPU card used for synchronization is determined in the following manner: after multiple first LPU cards receive an election result message sent by a second LPU card selected by the second device for synchronization, the first device selects an LPU card as the first LPU card used for synchronization from the multiple first LPU cards that receive the election result message according to preset rules.

[0067] Optionally, the preset rule for sampling during election may be: random selection, or selecting the LPU card with the largest / smallest LPU card identifier, or selecting the LPU card with the least number of internal switching chips, etc., which is not limited in the embodiment of the present invention.

[0068] It should be noted that the process in which the second device determines the second LPU card for synchronization is similar to the above three cases, and will not be described in detail here.

[0069] Next, the detailed process of any first LPU card in the first device initiating the synchronization process is introduced.

[0070] Optionally, inside the first device, the first LPU card that receives the message can synchronize the first MAC address information to each other first LPU card by multicast. That is, all LPU cards of the first device are in the same first multicast group, and the first LPU card that receives the message encapsulates the first MAC address information into a first multicast message, and then sends the first multicast message to the first multicast group, so that each other first LPU card can receive the first multicast message and parse the first MAC address information therefrom to perform MAC address learning. Therefore, please refer to Figure 4 After the above step S103, the MAC address synchronization method further includes the following steps:

[0071] S104: After each other first LPU card stores the first MAC address information in a MAC address table maintained by itself, it feeds back to the first LPU card that receives the message.

[0072] In this embodiment, after receiving the first multicast message and parsing the first MAC address information therefrom, each other first LPU card will first write the content in the first MAC address information into the MAC address table maintained by itself, and then provide feedback to the first LPU card that received the message to inform the first LPU card that received the message that the synchronous learning of the MAC address has been completed.

[0073] Optionally, therefore, the sub-steps of the above step S105 may include:

[0074] S1051. The first LPU card for synchronization encapsulates the first MAC address information based on a Peering Transport Service (PTS) protocol to obtain a synchronization message.

[0075] S1052: The first LPU card used for synchronization transparently transmits the synchronization message to the second LPU card used for synchronization through the peer link.

[0076] In this embodiment, after receiving the transparently transmitted synchronization message, the second LPU card used for synchronization can parse the message to obtain the first MAC address information.

[0077] In the process of the second LPU card for synchronization updating the MAC address table maintained by itself based on the parsed first MAC address information, since the port identifier in the parsed first MAC address information belongs to the first device, the second LPU card for synchronization can first find a port corresponding to it from all ports of the second device based on the port identifier in the first MAC address information, and then write the found port, the MAC address in the first MAC address information, the port identifier, the VLAN and the LPU card identifier into a blank table entry in the MAC address table maintained by itself.

[0078] All LPU cards of the second device may be in the same second multicast group, and the second LPU card used for synchronization may synchronize the first MAC address information to other second LPU cards by multicasting. That is, the second LPU card used for synchronization may encapsulate the first MAC address information into a second multicast message, and then send the second multicast message to the second multicast group, so that each other second LPU card may receive the second multicast message and parse the first MAC address information therefrom to perform MAC address learning.

[0079] Similarly, all the second LPU cards in the second device need to inform the first LPU card that finally receives the message after completing the first MAC address information. Figure 4 , after the above S105, the address synchronization method may further include the following steps S106, S108: that is, S106, the first LPU card used for synchronization receives the first response message sent by the second LPU card used for synchronization;

[0080] The first response message is generated by the second LPU card for synchronization after receiving feedback from each other second LPU card on updating the MAC address table maintained by itself based on the first MAC address information;

[0081] S107: The first LPU card used for synchronization sends a first response message to the first LPU card that receives the message.

[0082] That is, after each other second LPU card updates the MAC address table maintained by itself based on the first MAC address information, it provides feedback to the second LPU card used for synchronization; and after receiving the feedback from each other second LPU card, the second LPU card used for synchronization sends a first response message to the first LPU card used for synchronization to inform the first LPU card used for synchronization that all LPU cards of the second device have completed the synchronous learning of the MAC address. The first LPU card used for synchronization sends the first response message to the first LPU card that received the message, so that the first LPU card that received the message knows clearly that all LPU cards of the second device have completed the synchronous learning of the MAC address.

[0083] Among them, the process of each other second LPU card updating the MAC address table maintained by itself based on the received first MAC address information is: first, based on the port identifier in the first MAC address information, a port corresponding to it is found from all ports of the second device, and then the found port, the MAC address in the first MAC address information, the port identifier, the VLAN and the LPU card identifier are written into a blank table entry of the MAC address table maintained by itself.

[0084] It should be noted that the above content describes that when any first LPU card receives a message from a connected downstream device, when it is confirmed that there is no matching table entry matching the source MAC address of the message in the MAC address table maintained by itself, a MAC address synchronization process is initiated, wherein the LPU card that receives the message can be the first LPU card used for synchronization, or it can be other first LPU cards.

[0085] Similarly, the synchronization process can be initiated by any second LPU card of the second device. After initiation, the synchronization process involved on the second device is similar to the principle described in the above content, which will not be repeated here. When any second LPU card of the second device initiates the MAC address synchronization process, the MAC address synchronization method can also include the following steps S201 to S203:

[0086] S201, when receiving the second MAC address information sent by the second LPU card used for synchronization, the first LPU card used for synchronization stores the second MAC address information into its own MAC address table and synchronizes it to other first LPU cards;

[0087] S202: After each other first LPU card stores the second MAC address information in the MAC address table maintained by itself, it provides feedback to the first LPU card used for synchronization;

[0088] S203: After receiving feedback from each other first LPU card, the first LPU card used for synchronization sends a second response message to the second LPU card used for synchronization.

[0089] In this embodiment, the second MAC address information is initially learned by the second LPU card that initiates the synchronization process. The second MAC address information may include: the source MAC address recorded by the second LPU card that initiates the synchronization process, the port identifier of the packet receiving port, the VLAN to which the packet receiving port belongs, and the LPU card identifier of the second LPU card that initiates the synchronization process.

[0090] Because the port identifier in the second MAC address information belongs to the second device, the process of the first LPU card used for synchronization and each other first LPU card performing MAC address learning based on the second MAC address information can be: first, based on the port identifier in the second MAC address information, a port corresponding to it is found from all ports of the first device, and then the port of the found port, the MAC address in the second MAC address information, the port identifier, the VLAN and the LPU card identifier are written into a blank table entry of the MAC address table maintained by itself.

[0091] The above steps S104, S202, and S203 all belong to the feedback between boards in the device after the MAC address synchronization is completed. The feedback between boards is in unicast mode. After the synchronized MAC address information is added with the identification information of the LPU card, the address information is sent to the LPU card that needs to receive feedback (the LPU card that actively learns the address and the LPU card that synchronizes the address information); and the first response message and the second response message mentioned above both belong to the feedback between devices after the MAC address synchronization is completed. The first and second only represent the description of distinction. It should be noted that the execution order of each step in the above method embodiment is not limited to the order shown in the accompanying drawings and the size of the step numbers. The execution order of each step shall be based on the actual application situation.

[0092] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0093] In the present invention, after learning the first MAC address information, any LPU card of the first device is first synchronized inside the first device, and then sent by the first LPU card for synchronization to the second LPU card for synchronization in the second device. The second LPU card for synchronization is responsible for realizing the synchronization of the first MAC address information inside the second device, thereby ensuring the synchronization of the MAC address in the MLAG scenario where the distributed switching device is located between the various LPU cards inside the first device and the second device, so as to ensure correct data forwarding.

[0094] An embodiment of the present invention also provides an MLAG system, which includes two devices in communication connection, each device includes multiple LPU cards, and there is an LPU card for synchronization among the multiple LPU cards of each device. At least one downstream device is dual-homed or single-homed to the MLAG system. When dual-homed, each downstream device is connected to an LPU card of one device and an LPU card of another device. When single-homed, each downstream device is connected to an LPU card of any device. The MAC address synchronization method introduced above by one device realizes MAC address synchronization with another device.

[0095] See also Figure 5 , Figure 5 The electronic device 300 is a structural diagram of an electronic device provided by an embodiment of the present invention. The electronic device 300 may be a distributed switching device, which includes a processor 310 , a memory 320 and a bus 330 , and the processor 310 is connected to the memory 320 via the bus 330 .

[0096] The memory 320 may be used to store software programs, for example, software programs corresponding to the MAC address synchronization device 200 provided in the embodiment of the present invention. The processor 310 executes various functional applications and data processing to implement the MAC address synchronization method provided in the embodiment of the present invention by running the software programs stored in the memory 320.

[0097] Among them, the memory 320 can be but is not limited to: RAM (Random Access Memory), ROM (Read Only Memory), FLASH (Flash Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.

[0098] The processor 310 may be an integrated circuit chip with signal processing capability. The processor 310 may be a general-purpose processor, including: CPU (Central Processing Unit), NP (Network Processor), etc.; it may also be: DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0099] Understandably, Figure 5 The structure shown is for illustration only. The electronic device 300 may also include Figure 5 More or fewer components as shown, or with Figure 5 Different configurations shown. Figure 5 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0100] The embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the MAC address synchronization method disclosed in the above embodiment is implemented. The computer-readable storage medium can be, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a PROM, an EPROM, an EEPROM, a FLASH disk, or an optical disk.

[0101] In summary, the embodiments of the present invention provide a MAC address synchronization method, an MLAG system, an electronic device, and a storage medium. In the MLAG system, the first device includes at least one first LPU card, the second device includes at least one second LPU card, and a peer link is established between the two devices, and at least one downstream device is dual-homed or single-homed to the MLAG system. When any first LPU card receives a message sent by a downstream device, it searches the MAC address table maintained by itself for a matching entry based on the source MAC address of the message. If there is no matching entry, it obtains the first MAC address information to store it in its own MAC address table and synchronizes it to other first LPU cards, and then forwards the message; the first LPU card used for synchronization sends the first MAC address information to the second LPU card used for synchronization in the second device, so that the second LPU card used for synchronization stores the first MAC address information in the MAC address table maintained by itself and synchronizes the first MAC address information to other second LPU cards. In the present invention, any LPU card of the first device first synchronizes within the first device after learning the first MAC address information, and then the first LPU card used for synchronization synchronizes to the second LPU card used for synchronization, and the second LPU card used for synchronization is responsible for realizing the synchronization of the first MAC address information within the second device, thereby ensuring the MAC address synchronization of the distributed switching device in the MLAG scenario.

[0102] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A MAC address synchronization method, characterized in that: A first device applied to an MLAG system, the MLAG system further comprising a second device establishing a peer link with the first device; the first device comprising at least one first LPU card, the second device comprising at least one second LPU card; at least one downlink device dual-homing or single-homing access to the MLAG system; the method comprising: When any first LPU card receives a message sent by the downstream device, it searches the MAC address table maintained by itself to see whether there is a matching entry based on the source MAC address of the message; If the matching table entry does not exist, any of the first LPU cards acquires the first MAC address information, stores it in its own MAC address table, and synchronizes it to other first LPU cards, and then forwards the message; The first LPU card for synchronization sends the first MAC address information to the second LPU card for synchronization in the second device, so that the second LPU card for synchronization updates the MAC address table maintained by itself based on the first MAC address information and synchronizes the first MAC address information to other second LPU cards.

2. The method according to claim 1, characterized in that: The method further comprises: After each of the other first LPU cards stores the first MAC address information in a MAC address table maintained by itself, it feeds back to any of the first LPU cards.

3. The method according to claim 1, characterized in that The step of the first LPU card for synchronization sending the first MAC address information to the second LPU card for synchronization in the second device includes: The first LPU card for synchronization encapsulates the first MAC address information based on the pairing transmission service protocol to obtain a synchronization message; The first LPU card for synchronization transparently transmits the synchronization message to the second LPU card for synchronization through a peer-to-peer link.

4. The method according to claim 1, characterized in that: The method further comprises: The first LPU card for synchronization receives a first response message sent by the second LPU card for synchronization; the first response message is generated by the second LPU card for synchronization after receiving feedback from each other second LPU card on updating the MAC address table maintained by itself based on the first MAC address information; The first LPU card used for synchronization sends a first response message to any of the first LPU cards.

5. The method according to claim 1, characterized in that: The method further comprises: When receiving the second MAC address information sent by the second LPU card for synchronization, the first LPU card for synchronization stores the second MAC address information in its own MAC address table and synchronizes it to other first LPU cards; After each other first LPU card stores the second MAC address information in the MAC address table maintained by itself, it feeds back to the first LPU card used for synchronization; After receiving feedback from each other first LPU card, the first LPU card used for synchronization sends a second response message to the second LPU card used for synchronization.

6. The method according to claim 1, characterized in that Before any of the first LPU cards receives a message sent by the downstream device, the method further includes: When there is only one first LPU card whose port belongs to the member port of the peer link, determining that a first LPU card whose port belongs to the member port of the peer link is the first LPU card for synchronization; When the first device is a master device and more than one port of the first LPU card is a member port of the peer link, the first LPU card for synchronization is determined in the following manner: The first device selects an LPU card from all first LPU cards whose ports belong to member ports of the peer link according to a preset rule as the first LPU card for synchronization; the first LPU card for synchronization sends an election result message to the connected second LPU card through the peer link; When the first device is a standby device and more than one port of the first LPU card is a member port of the peer link, the first LPU card for synchronization is determined in the following manner: After multiple first LPU cards receive the election result message sent by the second LPU card selected for synchronization by the second device, the first device selects an LPU card as the first LPU card for synchronization from the multiple first LPU cards that receive the election result message according to preset rules.

7. The method according to any one of claims 1 to 6, characterized in that: The first MAC address information includes a source MAC address of the message, a port identifier of a port receiving the message, a VLAN to which the port belongs, and an LPU card identifier of any first LPU card.

8. An MLAG system, characterized in that: Two devices in communication connection are included, each device includes a plurality of LPU cards, among the plurality of LPU cards of each device there is an LPU card for synchronization, at least one downstream device is dual-homed or single-homed connected to the MLAG system, when dual-homed, each downstream device is connected to an LPU card of one device and an LPU card of another device, when single-homed, each downstream device is connected to an LPU card of any device; A device uses the MAC address synchronization method described in any one of claims 1 to 7 to achieve MAC address synchronization with another device.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a software program, and when the electronic device is running, the processor executes the software program to implement the MAC address synchronization method according to any one of claims 1 to 7.

10. A computer storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the MAC address synchronization method according to any one of claims 1 to 7 is implemented.