A MAC address synchronization method, device, storage medium and M-LAG

By using the MAC dictionary corresponding to VLAN ID for MAC address synchronization, the problem of MAC address synchronization in the M-LAG system is solved, the synchronization efficiency and success rate are improved, and the effectiveness of the M-LAG mechanism is ensured.

CN116094997BActive Publication Date: 2024-11-05RAISECOM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211626205.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-15
Publication Date
2024-11-05
Estimated Expiration
2042-12-15

AI Technical Summary

Technical Problem

In the M-LAG system, when MAC address synchronization is synchronized, due to the limit of the number of MAC addresses that can be carried in the synchronization message and the rate limit of the CPU packet queue, the synchronization is not real-time, which may lead to traffic flooding and network insecurity, affecting M- The effectiveness of the LAG mechanism.

Method used

Using the MAC dictionary corresponding to the VLAN ID as the basic data synchronization unit, the first device updates the MAC dictionary corresponding to the VLAN ID in the changed MAC address forwarding table entry and sends it to the second device, and the second device according to the received The MAC dictionary updates the local MAC address forwarding table to realize MAC address synchronization.

Benefits of technology

The amount of data of MAC address synchronization packets is reduced, the efficiency and success rate of MAC address update is improved, the effectiveness of the M-LAG mechanism is ensured, and network bandwidth waste and insecurity are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116094997B_ABST
    Figure CN116094997B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a MAC address synchronization method, electronic device and storage medium applied to M‑LAG, and an M‑LAG. The method comprises: when a non-address synchronization-triggered change occurs in a local media access control MAC address forwarding table, a first device updates a MAC dictionary corresponding to a virtual local area network identifier VLAN ID in a changed MAC address forwarding table item; the first device sends the updated MAC dictionary to a second device; the second device updates a local MAC dictionary corresponding to the same virtual local area network identifier VLAN ID according to the received MAC dictionary; the second device updates a local MAC address forwarding table according to the updated MAC dictionary. The MAC address synchronization scheme provided by the disclosed implementation overcomes the problems of high update success rate risk and network traffic waste caused by a large amount of data in a full update of MAC address forwarding table items in related implementable schemes, improves the MAC address update efficiency and success rate, and effectively ensures the effectiveness of the M‑LAG mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to, but is not limited to, the field of computer network technology, and in particular to a MAC address synchronization method applied to an M-LAG, an electronic device, a storage medium, and an M-LAG. Background Art

[0002] M-LAG (Multichassis Link Aggregation Group) is a mechanism for implementing cross-device link aggregation. Two switches are connected through a peer-link link and negotiate link aggregation with the host (or switch) in the same state to form a dual-active system, thereby improving link reliability from the single-board level to the device level. The peer-link link is a direct aggregation link between the two devices deploying M-LAG, which is used to exchange protocol messages and transmit part of the traffic to ensure the normal operation of M-LAG. Typically, M-LAG application networking is as follows: Figure 1 As shown in the figure, device A and device B are M-LAG member devices and are neighbors in the M-LAG system. Device A can be set as the master device and device B as the slave device. The Layer 2 aggregation interface on device A and the Layer 2 aggregation interface on device B belong to the same M-LAG group. Device A and device B each have only one peer-link port. The link between the peer-link interfaces is a peer-link link. M-LAG member devices exchange protocol messages and transmit data traffic through the peer-link link. An M-LAG system has only one peer-link link. Device A and device B detect neighbor status through the Keepalive link.

[0003] In a typical M-LAG application network, in order to be able to treat two member devices in an M-LAG group as one device, all M-LAG devices in the same M-LAG group are required to be configured with the same system MAC (Media Access Control Address) address forwarding table entry. After the M-LAG system starts working, the member devices at both ends of the peer-link link synchronize the MAC address forwarding table entries of the other end in real time. This synchronization process is also called MAC address synchronization, so that the failure of any member device will not affect the forwarding of traffic, and normal services can be guaranteed not to be interrupted. In the MAC address synchronization process, the synchronization message method is usually adopted. However, if the number of MAC addresses to be synchronized is large, not only the real-time synchronization is restricted by the number of MAC addresses that can be carried in the synchronization message, but also the switch CPU packet receiving and sending queue rate restricts the real-time synchronization. The synchronization of the MAC address may fail, which will lead to the flooding of traffic that should be forwarded according to the MAC address forwarding table entry, resulting in network bandwidth waste and network insecurity.

[0004] Therefore, continuously optimizing the MAC address synchronization solution and improving the efficiency and success rate of MAC address synchronization are important links in ensuring the effectiveness of the M-LAG mechanism. Summary of the invention

[0005] The disclosed embodiments provide a MAC address synchronization method, an electronic device, and a storage medium applied to M-LAG, as well as an M-LAG, which adopts a MAC dictionary corresponding to a VLAN ID as a basic unit for data synchronization, overcomes the problems of high update success rate risk and network traffic waste caused by a large amount of data in a full update of MAC address forwarding table items in related implementable solutions, reduces the amount of MAC address synchronization message data, improves the MAC address update efficiency and success rate, and effectively ensures the effectiveness of the M-LAG mechanism.

[0006] The present disclosure provides a MAC address synchronization method, which is applied to an inter-device link aggregation group M-LAG, including:

[0007] When a non-address synchronization-triggered change occurs in a local media access control MAC address forwarding table, the first device updates a MAC dictionary corresponding to a virtual local area network identifier VLAN ID in a changed MAC address forwarding table entry;

[0008] Sending the updated MAC dictionary to the second device;

[0009] Wherein, the first device and the second device constitute the M-LAG;

[0010] Each VLAN ID corresponds to a MAC dictionary, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table entry.

[0011] The embodiment of the present disclosure also provides a MAC address synchronization method, which is applied to an inter-device link aggregation group M-LAG, including:

[0012] The second device receives a media access control MAC dictionary from the first device;

[0013] Update the local MAC dictionary corresponding to the same virtual local area network identifier VLAN ID according to the received MAC dictionary;

[0014] Update the local MAC address forwarding table according to the updated MAC dictionary;

[0015] Wherein, the first device and the second device constitute the M-LAG;

[0016] Each MAC dictionary corresponds to a VLAN ID, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table item.

[0017] The embodiment of the present disclosure also provides an inter-device link aggregation group M-LAG, including:

[0018] a first device and a second device;

[0019] The first device is configured to update the MAC dictionary corresponding to the virtual local area network identifier VLAN ID in the changed MAC address forwarding table entry when a non-address synchronization-triggered change occurs in the local media access control MAC address forwarding table; and is also configured to send the updated MAC dictionary to the second device;

[0020] The second device is configured to update a local MAC dictionary according to the received MAC dictionary, and update a local MAC address forwarding table according to the locally updated MAC dictionary;

[0021] Wherein, each VLAN ID corresponds to a MAC dictionary, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table entry.

[0022] The present disclosure also provides an electronic device, including:

[0023] one or more processors;

[0024] a storage device for storing one or more programs,

[0025] When the one or more programs are executed by the one or more processors, the one or more processors implement the MAC address synchronization method as described in any embodiment of the present disclosure.

[0026] An embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the MAC address synchronization method as described in any embodiment of the present disclosure.

[0027] Other aspects will be apparent upon reading and understanding the drawings and detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0029] Figure 1 is a schematic diagram of an M-LAG system networking in an embodiment of the present invention;

[0030] Figure 2 This is a flow chart of a MAC address synchronization method provided by an embodiment of the present invention;

[0031] Figure 3 is a flow chart of another MAC address synchronization method provided by an embodiment of the present invention;

[0032] Figure 4 is a flow chart of another MAC address synchronization method provided by an embodiment of the present invention;

[0033] Figure 5 It is a schematic diagram of an M-LAG structure provided by an embodiment of the present invention.

[0034] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0036] It should be noted that in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0037] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0038] After the M-LAG system is configured, a MAC address forwarding table is established on each M-LAG member device, including one or more MAC address forwarding table entries. Usually, the MAC address forwarding table entry (also called MAC address table entry) is uniquely determined by three parameters: MAC address, port number, and VLAN ID (Virtual Local Area Network Identity); for the M-LAG system, the port numbers involved in the MAC address forwarding table include: the link aggregation (port-channel) port number based on the aggregation group port where the M-LAG member device is located, the port number of the non-M-LAG member port, and the port number of the peer-link port. Various types of port numbers can be identified based on relevant solutions in this field.

[0039] The present disclosure provides a MAC address synchronization method, which is applied to an inter-device link aggregation group M-LAG, such as Figure 2 As shown, including:

[0040] Step 210, when a change that is not triggered by address synchronization occurs in the local media access control MAC address forwarding table, the first device updates the MAC dictionary corresponding to the virtual local area network identifier VLAN ID in the changed MAC address forwarding table entry;

[0041] Step 220, sending the updated MAC dictionary to the second device;

[0042] Wherein, the first device and the second device constitute the M-LAG;

[0043] Each VLAN ID corresponds to a MAC dictionary, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table entry.

[0044] The second device updates the local MAC dictionary and the MAC address forwarding table according to the received MAC dictionary.

[0045] It can be understood that the MAC address forwarding table entries corresponding to the same VLAN ID are in the same MAC dictionary. Since the initial MAC address forwarding table entries of the two member devices as the master device and the slave device in the same M-LAG group are configured the same, the number of MAC dictionaries generated on the two devices and the content of each MAC dictionary are the same, where the number of MAC dictionaries is the same as the number of service VLAN IDs currently in use, the keys and values ​​in each MAC dictionary appear in pairs, and the number of key-value pairs is consistent with the number of MAC address forwarding table entries corresponding to the VLAN ID.

[0046] In some exemplary embodiments, step 210 is performed after periodically determining whether a change of non-address synchronization triggering occurs according to a preset time interval; or, step 210 is performed after determining whether a change of non-address synchronization triggering occurs when a preset synchronization indication event occurs. The time interval is flexibly set as needed and is not limited to a specific aspect. The preset synchronization indication event is flexibly set as needed and is not limited to a specific aspect.

[0047] In some exemplary embodiments, the changed MAC address forwarding table entries in step 210 are determined based on the last update time of each MAC address forwarding table entry and the last synchronization initiated time of the first device, that is, the MAC address forwarding table entries that are updated by non-address synchronization triggering after the last synchronization initiated time.

[0048] In some exemplary embodiments, after step 220, the method further includes:

[0049] Step 230: Update the last synchronization initiated time.

[0050] Alternatively, in some exemplary embodiments, the method further comprises:

[0051] Step 240: after receiving the synchronization success confirmation message from the second device, update the last synchronization initiation time.

[0052] In some exemplary embodiments, the number of the MAC dictionary is the same as the VLAN ID. According to the VLAN ID, the MAC dictionary with the corresponding number can be found.

[0053] In some exemplary embodiments, the MAC dictionary includes one or more MAC dictionaries, and each MAC dictionary corresponds to a VLAN ID.

[0054] In some exemplary embodiments, when a non-address synchronization-triggered change occurs to MAC address forwarding table entries of a plurality of different VLAN IDs in the local MAC address forwarding table, the MAC dictionaries updated in step 210 include a plurality of entries.

[0055] In some exemplary embodiments, the first device is a master device of the M-LAG, and the second device is a slave device of the M-LAG; or, the first device is a slave device of the M-LAG, and the second device is a master device of the M-LAG. It can be seen that the synchronization scheme provided in the embodiments of the present disclosure can be a master device synchronizing MAC address forwarding table entries to a slave device, or a slave device synchronizing MAC address forwarding table entries to a master device, and is not limited to a specific method.

[0056] In some exemplary embodiments, step 220 includes:

[0057] The updated MAC dictionary is encapsulated in an ICCP (Inter-Chassis Communication Protocol) message and sent to the second device through a peer-link link.

[0058] In some exemplary embodiments, the updated MAC dictionary is compressed and encapsulated in an ICCP message. The compression method can be implemented according to relevant schemes and is not limited to a specific method. The specific steps are not discussed in detail here.

[0059] In some exemplary embodiments, the updated MAC dictionary is encapsulated in a data bit field.

[0060] In some exemplary embodiments, the MAC dictionary does not include the table entry corresponding to the MAC address of the peer-link port in the local MAC address forwarding table. That is, on each M-LAG member device, a number of MAC dictionaries numbered with VLAN ID are generated based on the forwarding entry information corresponding to the MAC address of the non-peer-link port in the current MAC address forwarding table. It can be understood that the forwarding entry information corresponding to the MAC address of the peer-link port in the MAC address forwarding table is not included in any local MAC dictionary, because the MAC address of the peer-link port itself is synchronized from the other end. Therefore, there is no need to calculate the MAC dictionary and synchronize it to the other party to avoid forming a synchronization loop.

[0061] In some exemplary embodiments, the change in the local MAC address forwarding table in step 210 that is triggered by non-address synchronization can be determined by judging the triggering conditions that cause the change in the MAC address forwarding table: if the triggering condition is that a message indicating address synchronization is received through the peer-link port, it is considered to be triggered by address synchronization, otherwise it is considered to be triggered by non-address synchronization; the non-address synchronization trigger includes triggering through events such as self-learning and timed aging, and may also include table entry changes triggered by one or more other non-address synchronization events, and is not limited to a specific method.

[0062] In some exemplary embodiments, the key in the key-value pair is uniquely determined according to the MAC address using a first algorithm, and the MAC address is uniquely determined according to the key using a second algorithm.

[0063] It can be understood that the key in the key-value in the MAC dictionary is a unique value calculated based on the MAC address, and the MAC address can be deduced from the unique value. The corresponding first algorithm and second algorithm can be selected based on this goal, without limitation to specific aspects.

[0064] In some exemplary embodiments, the key is uniquely determined according to the MAC address using a first algorithm, including:

[0065] Get the hexadecimal number corresponding to the MAC address;

[0066] Convert the hexadecimal number into a decimal number, and determine that the decimal number is the key;

[0067] The MAC address is uniquely determined according to the key using a second algorithm, including:

[0068] Convert the decimal number of the key into a hexadecimal number;

[0069] The hexadecimal number is determined to be the hexadecimal number corresponding to the MAC address.

[0070] Since the MAC address is a hardware address, it is unique and is usually represented by 12 hexadecimal numbers, with colons separating every two hexadecimal numbers, such as 08:00:20:0A:8C:6D, which is a MAC address. In some implementations, the key can be calculated based on the MAC address by first removing the colons of the MAC address to obtain a unique hexadecimal number in the original digital sequence, and then converting the hexadecimal number into a decimal number, which is recorded as the "key".

[0071] For example, the MAC address 08:00:20:0A:8C:6D, first remove the colon to become: 0200A8C6D, and then convert the hexadecimal number into a decimal number: 8796630584429, which is the key calculated by the first algorithm.

[0072] In some exemplary embodiments, the value in the key-value pair is determined according to the port type and the port number;

[0073] The port types include: non-M-LAG member ports and M-LAG member ports.

[0074] In some exemplary embodiments, when the port type is a non-M-LAG member port, the value in the key-value pair is a first set prefix + a preset port number. When the port type is an M-LAG member port, the value in the key-value pair is a second set prefix + a port number; the port number is a port number in a MAC address forwarding table entry, which is a link aggregation (port-channel) port number corresponding to the port in the M-LAG group.

[0075] It can be understood that when the port type in the MAC address forwarding table entry is a non-M-LAG member port, the corresponding value in the key-value pair is the same. For non-M-LAG member ports, the actual physical port number cannot be inferred based on the value in the key-value pair. That is, when the MAC address of the non-M-LAG member port on the first device is synchronized to the second device, it is bound to the peer-link port of the second device. Therefore, there is no need to infer the actual physical port number through the value in the key-value pair.

[0076] In some exemplary embodiments, the first set prefix and the second set prefix may be the same or different. The preset port number is a port number outside the range of physical port numbers actually available on the first device or the second device in the M-LAG group.

[0077] For example, the first setting prefix is ​​1, the preset port number is 00, then when the port type is a non-M-LAG member port, the value in the key-value pair is 100; the second setting prefix is ​​1, and the link aggregation (port-channel) port number corresponding to the port in the M-LAG group is 01, then the value in the key-value pair of the port is 101.

[0078] In some exemplary embodiments, when the port type is a non-M-LAG member port, the value in the key-value pair is a first preset value. When the port type is an M-LAG member port, the value in the key-value pair is a second set prefix + a port number; the port number is a port number in a MAC address forwarding table entry, which is a link aggregation (port-channel) port number corresponding to the port in the M-LAG group.

[0079] In some exemplary embodiments, the first preset value is different from the second set prefix+the port number available for link aggregation in the M-LAG group.

[0080] It can be seen that the port type corresponding to the key-value pair can be identified based on the value in the key-value pair and the preset first set prefix and the second set prefix, or based on the value in the key-value pair and the preset first preset value and the second set prefix, and the link aggregation (port-channel) port number corresponding to the key-value pair in the M-LAG group can be determined when the port type is an M-LAG member port.

[0081] In some exemplary embodiments, when the MAC address in the MAC address forwarding table entry is empty, the key in the key-value pair is the first preset key. For example, the first preset key is 0, that is, the key uniquely determined according to the first algorithm for the MAC address forwarding table entry with an empty MAC address is 0. It can be understood that the specific value of the first preset key is different from the key in the key-value pair determined according to the embodiment of the present disclosure for the non-empty MAC address, and is not limited to the case of the example of the present disclosure.

[0082] In some exemplary embodiments, when the port number in the MAC address forwarding table entry is empty, the value in the key-value pair is a second preset value. For example, the second preset value is 0, that is, the corresponding determined value of the MAC address forwarding table entry with an empty port number is 0. It can be understood that the specific value of the second preset value is different from the value in the key-value pair determined by the non-empty port number according to the embodiment of the present disclosure, and is not limited to the case of the example of the present disclosure.

[0083] For example, the MAC dictionary with VLAN ID N in the MAC address forwarding table entry in the first device is numbered N, recorded as dict_N, and includes n key-value (key: value) pairs, and its data structure is as follows:

[0084] dict_N={key(1-N):value(1-N),key(2-N):value(2-N),…,key(nN):value(nN)}

[0085] dict_N: MAC dictionary numbered N. The value of N is the same as the VLAN ID. Since the actual service VLAN ID ranges from 1 to 4094, the value range of N can also be 1 to 4094.

[0086] key(nN): "key" in the MAC dictionary, obtained by calculating the MAC address in the MAC address forwarding table item n corresponding to VLAN ID N according to the first algorithm, and 0 represents that the MAC address of the current MAC address forwarding table item is empty; at this time, the MAC address forwarding table item corresponding to the VLANID refers to: after sorting the entire MAC address forwarding table with the VLAN ID as the index, the nth item in the MAC address forwarding table item corresponding to the VLAN ID number.

[0087] value(nN): "value" in the MAC dictionary. When it is determined that the port of the MAC address forwarding table entry n corresponding to VLAN ID N is a non-M-LAG member port, the value is set to the first set prefix + 00 (for example: when the first set prefix = 1, value(nN) = 100); when it is determined that the port of the MAC address forwarding table entry n corresponding to VLAN ID N is an M-LAG member port, the value is set to the second set prefix + the link aggregation (port-channel) port number corresponding to the port in the M-LAG group (for example: when the second set prefix = 1 and the link aggregation (port-channel) port number is 01, value(nN) = 101); 0 represents that the port number of the current MAC address table entry is empty.

[0088] It can be seen that the MAC address forwarding table entries corresponding to the same VLAN ID number are in one MAC dictionary. Since the initial MAC address forwarding table entry configurations of the two member devices as the master device and the slave device in the same M-LAG group are the same, the number of MAC dictionaries generated on the two devices and the content of each MAC dictionary are the same. The number of MAC dictionaries is the same as the number of service VLAN IDs currently in use, and the dictionary number is the same as the VLAN ID number. The key and value in each MAC dictionary appear in pairs and are consistent with the number of MAC address forwarding table entries corresponding to the VLAN ID.

[0089] The embodiment of the present disclosure also provides a MAC address synchronization method, which is applied to an inter-device link aggregation group M-LAG, such as Figure 3 As shown, including:

[0090] Step 310, the second device receives a media access control MAC dictionary from the first device;

[0091] Step 320, updating the local MAC dictionary corresponding to the same virtual local area network identifier VLAN ID according to the received MAC dictionary;

[0092] Step 330, updating the local MAC address forwarding table according to the updated MAC dictionary;

[0093] Wherein, the first device and the second device constitute the M-LAG;

[0094] Each MAC dictionary corresponds to a VLAN ID, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table entry.

[0095] It can be understood that one MAC dictionary corresponds to one VLAN ID, which is received from the first device.

[0096] In some exemplary embodiments, the MAC dictionary includes one or more MAC dictionaries, and each MAC dictionary corresponds to a VLAN ID.

[0097] In some exemplary embodiments, after step 330, the method further includes:

[0098] Step 340: Send a synchronization success confirmation message to the first device.

[0099] In some exemplary embodiments, step 320 includes:

[0100] For each MAC dictionary, update the local MAC dictionary of the corresponding VLAN ID respectively.

[0101] In some exemplary embodiments, for each MAC dictionary, respectively updating the local MAC dictionary corresponding to the VLAN ID includes:

[0102] Obtain the local MAC dictionary with the same VLAN ID corresponding to the received MAC dictionary;

[0103] If the local MAC dictionary is empty or does not exist, the received MAC dictionary is saved as the local MAC dictionary corresponding to the VLAN ID;

[0104] When the local MAC dictionary is not empty, the local MAC dictionary is updated according to the received MAC dictionary.

[0105] In some exemplary embodiments, updating the local MAC dictionary according to the received MAC dictionary in step 320 includes:

[0106] Step 321-1: for each key-value pair included in the received MAC dictionary, perform the following steps respectively:

[0107] If the key of the key-value pair does not exist in the local MAC dictionary, add the key-value pair to the local MAC dictionary;

[0108] Step 322-1: for each key-value pair included in the local MAC dictionary, perform the following steps respectively:

[0109] If the key of the key-value pair does not exist in the received MAC dictionary and the local MAC dictionary is synchronized for the first time, the key-value pair in the local MAC dictionary is not updated;

[0110] If the key of the key-value pair does not exist in the received MAC dictionary and the local MAC dictionary is not synchronized for the first time, then delete the key-value pair in the local MAC dictionary;

[0111] If the key-value pair exists in the received MAC dictionary, the key-value pair in the local MAC dictionary is not updated;

[0112] If the key of the key-value pair exists in the received MAC dictionary, but the value of the key-value pair is different from the value corresponding to the same key in the received MAC dictionary, the key-value pair in the local MAC dictionary is not updated.

[0113] In some exemplary embodiments, step 322-1 further includes:

[0114] When the key of the key-value pair exists in the received MAC dictionary, but the value of the key-value pair is different from the value corresponding to the same key in the received MAC dictionary, MAC address drift alarm information is generated.

[0115] In some exemplary embodiments, the MAC address drift alarm information is TRAP alarm information.

[0116] In some exemplary embodiments, updating the local MAC dictionary according to the received MAC dictionary in step 320 includes:

[0117] Step 321-2: for each key-value pair included in the received MAC dictionary, if it is determined that any key-value pair does not exist in the local MAC dictionary, the local MAC dictionary is deleted and the received MAC dictionary is saved as an updated local MAC dictionary.

[0118] In some exemplary embodiments, updating the local MAC dictionary according to the received MAC dictionary in step 320 includes:

[0119] Step 321-1: for each key-value pair included in the received MAC dictionary, perform the following steps respectively:

[0120] If the key of the key-value pair does not exist in the local MAC dictionary, add the key-value pair to the local MAC dictionary;

[0121] Step 322-2: If the key of any key-value pair of the local MAC dictionary does not exist in the received MAC dictionary and the local MAC dictionary is not synchronized for the first time, the local MAC dictionary is deleted and the received MAC dictionary is saved as the updated local MAC dictionary.

[0122] In some exemplary embodiments, whether the local MAC dictionary is synchronized for the first time can be determined based on the synchronization counter set in the local MAC dictionary. The synchronization counter is initially 0, indicating that synchronization has not been performed. At this time, the synchronization performed by the MAC dictionary received is not the first synchronization. Each MAC dictionary corresponds to the first synchronization counter. After the MAC dictionary with the same VLAN ID is synchronized, its synchronization counter is incremented by one.

[0123] Optionally, whether each local MAC dictionary is synchronized for the first time may be determined in other ways, which are not limited to the ways in the examples of the present disclosure.

[0124] In some exemplary embodiments, step 330 includes:

[0125] Step 331, determining the local MAC dictionary that has been deleted in this local MAC dictionary update, and updating the MAC address forwarding table entry in the local MAC address forwarding table corresponding to the VLAN ID of the deleted local MAC dictionary according to the deleted local MAC dictionary;

[0126] Step 332: Update the corresponding MAC address forwarding table entry in the local MAC address forwarding table according to the updated VLAN ID and key-value pair of the local MAC dictionary.

[0127] In some exemplary embodiments, updating the MAC address forwarding table entry in the local MAC address forwarding table corresponding to the VLAN ID of the deleted local MAC dictionary in step 331 includes:

[0128] Delete the MAC address forwarding table entry whose VLAN ID is the VLAN ID of the deleted local MAC dictionary and whose port number is the peer-link port number;

[0129] Delete the MAC address forwarding entry in the local MAC address forwarding table whose VLAN ID is the VLAN ID of the deleted local MAC dictionary and whose port number is the link aggregation port number of the aggregation group port where the M-LAG member device is located.

[0130] It can be understood that if after updating the local MAC dictionary, there is no MAC dictionary with the same number as the VLANID number activated in the local MAC address forwarding table, it indicates that the local MAC dictionary has been deleted during this MAC dictionary update, that is, the local MAC dictionary corresponding to the VLAN ID has been deleted during this MAC dictionary update. Then the MAC address forwarding table entry corresponding to the peer-link port number corresponding to the VLAN ID is deleted, and the MAC address forwarding table entry corresponding to the link aggregation port number of the aggregation group port where the M-LAG member device corresponding to the VLAN ID is located is also deleted, that is, for this VLAN ID, only the MAC address forwarding table entry corresponding to the port number of the non-M-LAG member port maintained locally is left.

[0131] In some exemplary embodiments, step 332 includes:

[0132] Delete the MAC address forwarding table entry whose VLAN ID is the VLAN ID of the updated local MAC dictionary and whose port number is the peer-link port number;

[0133] Delete the MAC address forwarding table entry whose VLAN ID is the VLAN ID of the updated local MAC dictionary and whose port number is the link aggregation port number of the aggregation group port where the M-LAG member device is located;

[0134] At least one MAC address forwarding table entry is determined based on the VLAN ID and the key-value pairs included in the local MAC dictionary and added to the local MAC address forwarding table.

[0135] In some exemplary embodiments, the peer-link port number is a preconfigured port number.

[0136] In some exemplary embodiments, for each key-value pair included in the MAC dictionary, the following steps are performed to determine a MAC address forwarding table entry:

[0137] Uniquely determine the MAC address using a second algorithm based on the key included in the key-value;

[0138] Determine the port number according to the value included in the key-value;

[0139] The MAC address forwarding entry is determined according to the determined MAC address, port number and VLAN ID of the MAC dictionary.

[0140] Wherein, the port number is determined according to the value included in the key-value, including:

[0141] In a case where the value included in the key-value is a first set prefix+preset port number or a first preset value, determining that the port number is a peer-link port number;

[0142] When the value included in the key-value is the second set prefix+the non-preset port number, determining the port number to be the non-preset port number;

[0143] It can be understood that when the value included in the key-value is the first set prefix + preset port number or the first preset value, the port number of the original MAC address forwarding table item corresponding to the key-value pair is determined to be a non-M-LAG member port, and the port number of the MAC address forwarding table item is set to the peer-link port number; the MAC address forwarding table item (VLAN ID, MAC address, peer-link port number) thus determined will be added to the local MAC address forwarding table of the second device.

[0144] It should be noted that when the second device forwards the service message according to the local MAC address forwarding table, when the port number in the found MAC address forwarding table item is the peer-link port number, the service message is forwarded to the opposite device of the M-LAG through the peer-link port. The opposite device searches the local MAC address forwarding table to obtain the correct port number and continues to send it, which does not affect the forwarding of the service data.

[0145] In a case where the value included in the key-value pair is the second set prefix+non-preset port number, the port number of the original MAC address forwarding table entry corresponding to the key-value pair is determined to be the M-LAG member port, which is the corresponding link aggregation (port-channel) port number in the M-LAG group. At this time, the port number of the MAC address forwarding table entry is set to the corresponding link aggregation (port-channel) port number in the M-LAG group; the MAC address forwarding table entry (VLAN ID, MAC address, corresponding link aggregation (port-channel) port number in the M-LAG group) thus determined will be added to the local MAC address forwarding table of the second device.

[0146] It can be understood that first, based on the key-value pairs included in the updated local MAC dictionary, the corresponding MAC address and port number are reversely determined, and then combined with the LVAN ID corresponding to the MAC dictionary, a MAC address forwarding table entry can be determined, and the MAC address forwarding table entry is added to the local MAC address forwarding table of the second device.

[0147] In some exemplary embodiments, the VLAN ID is determined based on the MAC dictionary number;

[0148] In some exemplary embodiments, the MAC address is determined based on the key key (nN) and the inverse algorithm of a preset algorithm that can obtain a unique value; typically: extract the key key (nN) in the updated dictionary, convert the decimal number into a hexadecimal number, separate every two hexadecimal numbers with a colon, and the result is the MAC address in the table entry; corresponding to the example of converting the MAC address into a "key", the received key is the decimal number 8796630584429, which is converted into a hexadecimal number: 0800200A8C6D, and the "08:00:20:0A:8C:6D" obtained by separating every two hexadecimal numbers with colons is the MAC address corresponding to the key calculated.

[0149] In some exemplary embodiments, determining the port number according to the “value” corresponding to the “key” includes:

[0150] If the "value" corresponding to the "key" is the first set prefix + 00, it indicates that the port is a non-M-LAG member port, and the port number is determined to be a peer-link port number. For example, the peer-link port number is FFF, or a value that does not conflict with other available port numbers.

[0151] If the "value" corresponding to the "key" is: the second set prefix + non-00, it indicates that the port is an M-LAG member port, and the port number is determined to be the "non-00". Here, "non-00" is a general term. According to the actual "value", the second set prefix is ​​removed to obtain a non-00 value, that is, the link aggregation (port-channel) port number corresponding to the port in the M-LAG group. For example, if the value is "101", where the second prefix is ​​1, the port number is determined to be "01".

[0152] It should be noted that: if the "value" corresponding to the "key" is the first set prefix + 00, it indicates that the port is a non-M-LAG member port, and the port number is determined to be the peer-link port number, that is, the port number is recorded here as: the port number of the peer-link port. This is because according to the "value" in the MAC dictionary is "the first set prefix + 00", it is impossible to actually restore the actual physical port number of the MAC address forwarding table item before synchronization, so the peer-link port number is used here as a substitute. In the subsequent business message forwarding process, the local end receives the data flow that needs to reach the other end, and forwards it from the peer-link port to the other end by searching the MAC address forwarding table and according to the tag of the peer-link port number. Then, the correct port can be found to continue forwarding by searching the MAC address forwarding table item locally on the other end, and the forwarding of business data is not affected.

[0153] It can be understood that the specific process by which the second device determines the MAC address and port number based on the key-value pairs of the MAC dictionary corresponds to the process by which the first device determines the MAC dictionary key-value pairs based on the MAC address and port number in the MAC address forwarding table item. More details are not given here one by one.

[0154] According to the scheme recorded in the embodiment of the present disclosure, in the MAC address forwarding table on the second device, the MAC address forwarding table entry corresponding to the non-L-MAG member port is not actually updated or deleted based on the key-value pair of the first set prefix + preset port number or the first preset value in the received MAC dictionary.

[0155] In some exemplary embodiments, the second device is a master device of the M-LAG, and the first device is a slave device of the M-LAG; or, the first device is a master device of the M-LAG, and the second device is a slave device of the M-LAG.

[0156] It can be seen that the MAC address forwarding tables of the first device and the second device as the master / clusters of the member devices in the M-LAG system have been synchronized. During the entire synchronization process, the MAC dictionary carries the required information of all MAC address forwarding table items under a VLAN ID as a whole. There is no longer a limit on the MAC address table item data that can be updated each time, and the implementation method is simple and reliable.

[0157] The embodiment of the present disclosure also provides a MAC address synchronization method, which is applied to an inter-device link aggregation group M-LAG, such as Figure 4 As shown, including:

[0158] Step 410, when a change that is not triggered by address synchronization occurs in a local media access control MAC address forwarding table, the first device updates a MAC dictionary corresponding to the virtual local area network identifier VLAN ID in the changed MAC address forwarding table entry;

[0159] Step 420, the first device sends the updated MAC dictionary to the second device;

[0160] Step 430, the second device updates the local MAC dictionary corresponding to the same virtual local area network identifier VLAN ID according to the received MAC dictionary;

[0161] Step 440, the second device updates the local MAC address forwarding table according to the updated MAC dictionary;

[0162] Wherein, the first device and the second device constitute the M-LAG;

[0163] Each VLAN ID corresponds to a MAC dictionary, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table entry.

[0164] The embodiment of the present disclosure also provides a cross-device link aggregation group M-LAG, such as Figure 5 As shown, including:

[0165] A first device 510 and a second device 520;

[0166] The first device 510 is configured to update the MAC dictionary corresponding to the virtual local area network identifier VLAN ID in the changed MAC address forwarding table entry when a non-address synchronization-triggered change occurs in the local media access control MAC address forwarding table; and is also configured to send the updated MAC dictionary to the second device 520;

[0167] The second device 520 is configured to update a local MAC dictionary according to the received MAC dictionary, and update a local MAC address forwarding table according to the locally updated MAC dictionary;

[0168] Wherein, each VLAN ID corresponds to a MAC dictionary, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table entry.

[0169] In some exemplary embodiments, the second device is a master device of the M-LAG, and the first device is a slave device of the M-LAG; or, the first device is a master device of the M-LAG, and the second device is a slave device of the M-LAG.

[0170] The present disclosure also provides an electronic device, including:

[0171] one or more processors;

[0172] a storage device for storing one or more programs,

[0173] When the one or more programs are executed by the one or more processors, the one or more processors implement the MAC address synchronization method as described in any embodiment of the present disclosure.

[0174] In some exemplary embodiments, the electronic device is a switch; or other network communication devices, without limitation to specific aspects.

[0175] An embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the MAC address synchronization method as described in any embodiment of the present disclosure is implemented.

[0176] According to the MAC address synchronization method provided by the embodiment of the present disclosure, through one or more MAC dictionaries each carrying the required information of all MAC address forwarding table entries under the same VLAN ID, MAC address synchronization can be performed only based on the MAC dictionary that has changed due to a local non-address synchronization trigger, thereby reducing the amount of synchronized data and reducing the bandwidth pressure between the M-LAG master-standby devices; at the same time, various complex constraints on the number of MAC address forwarding table entries that can be synchronized at a time in other solutions adopted to overcome the large amount of data to be synchronized are avoided. Synchronization based on MAC dictionaries is simple and easy to implement, can significantly improve the synchronization success rate, and ensure the performance of the M-LAG solution.

[0177] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0178] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A MAC address synchronization method, applied to an inter-device link aggregation group M-LAG, characterized in that: include: When a non-address synchronization-triggered change occurs in a local media access control MAC address forwarding table, the first device updates a MAC dictionary corresponding to a virtual local area network identifier VLAN ID in a changed MAC address forwarding table entry; Sending the updated MAC dictionary to the second device; Wherein, the first device and the second device constitute the M-LAG; Each VLAN ID corresponds to a MAC dictionary, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table entry.

2. The MAC address synchronization method according to claim 1, characterized in that: The sending the updated MAC dictionary to the second device includes: The updated MAC dictionary is encapsulated in an Inter-Chassis Information Synchronization Protocol (ICCP) message, and sent to the second device via a peer-link link.

3. The MAC address synchronization method according to claim 1, wherein: The key in the key-value pair is uniquely determined by using a first algorithm according to the MAC address, and the MAC address is uniquely determined by using a second algorithm according to the key in the key-value pair.

4. The MAC address synchronization method according to claim 3, characterized in that: The key is uniquely determined according to the MAC address using a first algorithm, including: Get the hexadecimal number corresponding to the MAC address; Convert the hexadecimal number into a decimal number, and determine that the decimal number is the key; The MAC address is uniquely determined according to the key in the key-value pair using a second algorithm, including: Convert the decimal number of the key into a hexadecimal number; The hexadecimal number is determined to be the hexadecimal number corresponding to the MAC address.

5. The MAC address synchronization method according to any one of claims 1 to 4, characterized in that: The value in the key-value pair is determined according to the port type and the port number; The port types include: non-M-LAG member ports and M-LAG member ports.

6. The MAC address synchronization method according to any one of claims 1 to 4, characterized in that: The MAC dictionary does not include an entry corresponding to the MAC address of the peer-link port in the local MAC address forwarding table.

7. A MAC address synchronization method, applied to an inter-device link aggregation group M-LAG, characterized in that: include: The second device receives a media access control MAC dictionary from the first device; wherein the MAC dictionary is obtained by the first device updating the MAC dictionary corresponding to the virtual local area network identifier VLAN ID in the changed MAC address forwarding table entry when a non-address synchronization-triggered change occurs in the local media access control MAC address forwarding table; Update the local MAC dictionary corresponding to the same virtual local area network identifier VLAN ID according to the received MAC dictionary; Update the local MAC address forwarding table according to the updated MAC dictionary; Wherein, the first device and the second device constitute the M-LAG; Each MAC dictionary corresponds to a VLAN ID, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table item.

8. The MAC address synchronization method according to claim 7, characterized in that: The updating of the local MAC address forwarding table according to the updated MAC dictionary includes: Determine the local MAC dictionary that has been deleted in this local MAC dictionary update, and update the MAC address forwarding table entry in the local MAC address forwarding table corresponding to the VLAN ID of the deleted local MAC dictionary according to the deleted local MAC dictionary; According to the updated VLAN ID and the included key-value pairs of the local MAC dictionary, the corresponding MAC address forwarding table entry in the local MAC address forwarding table is updated.

9. The MAC address synchronization method according to claim 8, characterized in that: The updating of the deleted local MAC dictionary corresponding to the MAC address forwarding table entry in the local MAC address forwarding table includes: Delete the MAC address forwarding table entry whose VLAN ID is the VLAN ID of the deleted local MAC dictionary and whose port number is the peer-link port number; Delete the MAC address forwarding entry in the local MAC address forwarding table whose VLAN ID is the VLAN ID of the deleted local MAC dictionary and whose port number is the link aggregation port number of the aggregation group port where the M-LAG member device is located.

10. The MAC address synchronization method according to claim 8 or 9, characterized in that: The updating of the MAC address forwarding table entry corresponding to the local MAC address forwarding table according to the updated VLAN ID and the included key-value pair of the local MAC dictionary includes: Delete the MAC address forwarding table entry whose VLAN ID is the VLAN ID of the updated local MAC dictionary and whose port number is the peer-link port number; Delete the MAC address forwarding table entry whose VLAN ID is the VLAN ID of the updated local MAC dictionary and whose port number is the link aggregation port number of the aggregation group port where the M-LAG member device is located; At least one MAC address forwarding table entry is determined according to the VLAN ID and the key-value pairs included in the local MAC dictionary, and is added to the local MAC address forwarding table.

11. An inter-device link aggregation group M-LAG, characterized in that: include: a first device and a second device; The first device is configured to update the MAC dictionary corresponding to the virtual local area network identifier VLAN ID in the changed MAC address forwarding table entry when a non-address synchronization triggered change occurs in the local media access control MAC address forwarding table; is further configured to send the updated MAC dictionary to the second device; The second device is configured to update a local MAC dictionary according to the received MAC dictionary, and update a local MAC address forwarding table according to the locally updated MAC dictionary; Wherein, each VLAN ID corresponds to a MAC dictionary, and the MAC dictionary includes at least one key-value pair; the key-value pair is determined according to the MAC address and the port number in the MAC address forwarding table entry.

12. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the MAC address synchronization method as described in any one of claims 1-6, or the MAC address synchronization method as described in any one of claims 7-10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the MAC address synchronization method as described in any one of claims 1 to 6 is implemented, or the MAC address synchronization method as described in any one of claims 7 to 10 is implemented.