CN111107182B - MAC address synchronization method, device, system, equipment and medium - Google Patents

MAC address synchronization method, device, system, equipment and medium Download PDF

Info

Publication number
CN111107182B
CN111107182B CN201911424826.XA CN201911424826A CN111107182B CN 111107182 B CN111107182 B CN 111107182B CN 201911424826 A CN201911424826 A CN 201911424826A CN 111107182 B CN111107182 B CN 111107182B
Authority
CN
China
Prior art keywords
mac address
synchronization
address information
event
synchronized
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911424826.XA
Other languages
Chinese (zh)
Other versions
CN111107182A (en
Inventor
尹楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Raisecom Technology Co Ltd
Original Assignee
Raisecom Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Raisecom Technology Co Ltd filed Critical Raisecom Technology Co Ltd
Priority to CN201911424826.XA priority Critical patent/CN111107182B/en
Publication of CN111107182A publication Critical patent/CN111107182A/en
Application granted granted Critical
Publication of CN111107182B publication Critical patent/CN111107182B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5053Lease time; Renewal aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The embodiment of the invention discloses a method, a device, a system, equipment and a medium for synchronizing MAC addresses, wherein the method comprises the following steps: periodically triggering a first synchronization event according to a preset first period, wherein the first synchronization event comprises: sending the first MAC address information to equipment to be synchronized so that the equipment to be synchronized performs first synchronization processing on the received first MAC address information; periodically triggering a second synchronization event according to a preset second period, wherein the second synchronization event comprises: and sending the second MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs second synchronization processing on the received second MAC address information. The scheme disclosed by the embodiment of the invention adopts a long-short period for synchronization, guarantees the synchronization effectiveness of the MAC address and effectively avoids the impact on the network caused by the untimely MAC synchronization.

Description

MAC address synchronization method, device, system, equipment and medium
Technical Field
The present invention relates to the field of network technologies, and in particular, to a method, an apparatus, a system, a device, and a medium for synchronizing MAC addresses.
Background
The switch is used as a common device in a communication network, and can provide an exclusive electric signal path for any two network nodes accessed to the switch based on a two-layer forwarding technology, so that message interaction between the two nodes is realized. Accordingly, the generally adopted two-layer forwarding principle is: extracting a Media Access Control (MAC) address of a source Media of a received message by a switch, inquiring an MAC forwarding table (also called an L2 table), and if a corresponding table entry is found, sending the received message to a port recorded in the table entry; if the search fails, the received message is broadcast and sent to all ports. The information of the MAC forwarding table is maintained by using a MAC address learning mechanism and an aging mechanism.
Switch stacking refers to the combination of more than one switch to work together to provide as many ports as possible in a limited space, with each switch in the combination of switches being referred to as a stack member. In the switch stacking technology, MAC addresses are often required to be synchronized between stack members, so that L2 tables on the stack members can be kept consistent, and the problem of message flooding caused by the L2 table being asynchronous is effectively solved, for example, a server may be burdened by receiving a large number of messages with target addresses other than the own message.
At present, the MAC address synchronization is usually implemented by encapsulating MAC addresses to be synchronized in a protocol message in batches and transmitting the MAC addresses to destination devices to be synchronized. Therefore, under the condition that a large number of MAC addresses need to be learned at the same time, it is important that whether a protocol packet bearing the synchronization work can accurately reach a destination device, and the realization of the method often depends on the buffer capacity of device switching, and for a part of devices with insufficient buffer capacity, a situation that a part of protocol packets are lost can occur at a high probability, so that the synchronization result is inaccurate, the flooding of the packet in the network is caused, and unnecessary pressure is caused to the bandwidth of the existing network.
Disclosure of Invention
The present invention provides a method, an apparatus, a system, a device and a medium for synchronizing MAC addresses, which are used to solve the technical problems in the background art.
In a first aspect, an embodiment of the present invention provides a MAC address synchronization method, where the method includes:
according to a preset first period, regularly triggering a first synchronization event, wherein the first synchronization event comprises: sending the first MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs first synchronization processing on the received first MAC address information;
according to a preset second period, triggering a second synchronous event periodically, wherein the second synchronous event comprises: sending the second MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs second synchronization processing on the received second MAC address information;
the second period is greater than the first period, the second period is greater than the maximum synchronization duration of the first synchronization event, the first MAC address information comprises newly learned MAC address information and aged MAC address information in the latest first period, and the second MAC address information comprises all locally learned MAC address information which is not aged.
In a possible implementation manner, in the method provided by the embodiment of the present invention, the method further includes: when the first synchronization event is triggered and a second synchronization event is carried out, stopping carrying out the second synchronization event;
when the first synchronization event is finished, if the MAC address information of the first synchronization processing failure exists during the operation of the first synchronization event, recording the current moment;
judging whether the time length between the current time and the trigger time of the next second synchronous event is greater than the preset aging time length of the MAC address information;
if yes, triggering a third synchronization event, and resetting timing of a second cycle, wherein the third synchronization event comprises: and resending the MAC address information of which the first synchronization processing fails when the first synchronization event runs to the equipment to be synchronized so as to enable the equipment to be synchronized to carry out third synchronization processing.
In a possible implementation manner, in the method provided in the embodiment of the present invention, sending the MAC address information to the device to be synchronized specifically includes: sending MAC address information to equipment to be synchronized by adopting at least one protocol message, wherein each protocol message carries a message serial number of the protocol message;
the method further comprises the following steps: if a response carrying the message serial number returned by the equipment to be synchronized is received, determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is successful, or else determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is failed.
In a possible implementation manner, in the method provided in the embodiment of the present invention, the protocol packet further carries a priority identifier, so that the device to be synchronized determines the type and the sequence of the synchronization processing on the protocol packet according to the priority identifier;
the priority identifiers of all protocol messages sent in the first synchronization event are the same, and the priority is the highest; the priority identifiers of all protocol messages sent in the second synchronous event are the same, and the priority identifiers are the same; the priority identifiers of the protocol messages sent in the third synchronous event are the same, and the priority is the lowest.
In a possible implementation manner, in the method provided in an embodiment of the present invention, the method further includes:
receiving and storing newly learned MAC address information and aged MAC address information reported by forwarding hardware in an interrupt mode;
receiving drifting MAC address information reported by forwarding hardware in an interrupt mode;
detecting whether a node of the drifted MAC address information exists in a preset MAC drift linked list, if not, inserting the drifted MAC address information into the MAC drift linked list as a node, and adding timing information to the node; if yes, updating the timing information of the node;
when a first synchronization event is triggered, searching target MAC address information timed to exceed a preset drift suppression duration in an MAC drift linked list based on timing information;
and informing the forwarding hardware to normally learn the MAC address in the target MAC address information, and clearing the node of the target MAC address information in the MAC drift chain table.
In a second aspect, an embodiment of the present invention provides a MAC address synchronization method, where the method includes:
receiving first MAC address information periodically sent by a synchronization source device according to a preset first period, and performing first synchronization processing on the first MAC address information;
and receiving second MAC address information periodically sent by the synchronization source equipment according to a preset second period, and performing second synchronization processing on the second MAC address information, wherein the first MAC address information comprises newly learned MAC address information and aged MAC address information in the latest first period of the synchronization source equipment, and the second MAC address information comprises all unaged MAC address information locally learned by the synchronization source equipment.
In a possible implementation manner, in a method provided by an embodiment of the present invention, the method includes:
transmitting a response identifying the MAC address information successfully processed in synchronization back to the synchronization source device, so that the synchronization source device determines the MAC address information failed in synchronization based on the response;
and receiving MAC address information which is retransmitted by the synchronization source device and fails in the first synchronization processing as third MAC address information, and performing third synchronization processing on the third MAC address information.
In a possible implementation manner, in the method provided in this embodiment of the present invention, receiving MAC address information sent by a synchronization source device includes: receiving MAC address information sent by a synchronization source device by adopting at least one protocol message, wherein each protocol message carries a self message serial number;
transmitting a response identifying the MAC address information with successful synchronization processing back to the synchronization source device, so that the synchronization source device determines the MAC address information with failed synchronization processing based on the response, comprising:
if all MAC address information in the protocol message is successfully synchronized, a response carrying the message serial number is transmitted back to the synchronization source device, so that the synchronization source device determines MAC address information failed in synchronization processing based on the message serial number in the response.
In a possible implementation manner, in the method provided in the embodiment of the present invention, the protocol message further carries a priority identifier;
receiving MAC address information sent by a synchronization source device by adopting at least one protocol message, and carrying out synchronization processing on the received MAC address information, wherein the method comprises the following steps:
receiving a protocol message carrying a priority identification and MAC address information;
if the priority identifier is the highest priority identifier, determining that the MAC address information in the protocol message is first MAC address information periodically sent by the synchronization source equipment according to a preset first period;
if the priority identifier is a suboptimal priority identifier, determining that the MAC address information in the protocol message is second MAC address information periodically sent by the synchronous source equipment according to a preset second period;
if the priority identifier is the lowest priority identifier, determining that the MAC address information in the protocol message is the MAC address information which is retransmitted by the synchronization source device and fails the first synchronization processing;
and performing corresponding first synchronous processing, second synchronous processing and third synchronous processing on the MAC address information in the protocol message according to the sequence from high priority to low priority.
In a possible implementation manner, in the method provided in this embodiment of the present invention, a response identifying the MAC address information that is successfully processed in synchronization is transmitted back to the synchronization source device, which specifically includes: and only aiming at the first synchronization processing, transmitting a response which identifies the MAC address information with successful synchronization processing back to the synchronization source equipment.
In a third aspect, an embodiment of the present invention provides an apparatus for synchronizing MAC addresses, where the apparatus includes:
the first trigger unit is used for regularly triggering a first synchronization event according to a preset first cycle, wherein the first synchronization event comprises: sending the first MAC address information to equipment to be synchronized so that the equipment to be synchronized performs first synchronization processing on the received first MAC address information;
a second triggering unit, configured to periodically trigger a second synchronization event according to a preset second period, where the second synchronization event includes: sending the second MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs second synchronization processing on the received second MAC address information;
the second period is greater than the first period, the second period is greater than the maximum synchronization duration of the first synchronization event, the first MAC address information comprises newly learned MAC address information and aged MAC address information in the latest first period, and the second MAC address information comprises all locally learned MAC address information which is not aged.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the apparatus further includes an event control unit and a third trigger unit;
the event control unit is used for stopping the second synchronous event when the second synchronous event is carried out when the first synchronous event is triggered;
the third trigger unit is used for:
when the first synchronization event is finished, if the MAC address information of the first synchronization processing failure exists during the operation of the first synchronization event, recording the current moment;
judging whether the time length between the current time and the trigger time of the next second synchronous event is greater than the preset aging time length of the MAC address information;
if yes, triggering a third synchronization event, and resetting the timing of the second cycle, where the third synchronization event includes: and resending the MAC address information of which the first synchronization processing fails when the first synchronization event runs to the equipment to be synchronized so as to enable the equipment to be synchronized to perform third synchronization processing.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the first trigger unit, the second trigger unit, and the third trigger unit are specifically configured to: sending the MAC address information to the device to be synchronized, specifically including: sending MAC address information to equipment to be synchronized by adopting at least one protocol message, wherein each protocol message carries a message serial number of the protocol message;
the device also comprises a synchronization result judging unit which is used for determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is successful if the response carrying the message serial number returned by the equipment to be synchronized is received, or else determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is failed.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the protocol packet further carries a priority identifier, so that the device to be synchronized determines a type and an order of synchronous processing on the protocol packet according to the priority identifier;
the priority identifiers of all protocol messages sent in the first synchronization event are the same, and the priority is the highest; the priority identifiers of all protocol messages sent in the second synchronous event are the same, and the priority identifiers are the second priority; the priority identifiers of the protocol messages sent in the third synchronous event are the same, and the priority is the lowest.
In a fourth aspect, an embodiment of the present invention provides an apparatus for synchronizing MAC addresses, where the apparatus includes:
a first receiving unit, configured to receive first MAC address information periodically sent by a synchronization source device according to a preset first period;
a second receiving unit, configured to receive second MAC address information periodically sent by the synchronization source device according to a preset second period, where the first MAC address information includes MAC address information newly learned by the synchronization source device in the latest first period and aged MAC address information, and the second MAC address information includes all unaged MAC address information locally learned by the synchronization source device;
and the processing unit is used for carrying out first synchronous processing on the first MAC address information and carrying out second synchronous processing on the second MAC address information.
In a possible implementation manner, in an apparatus provided in an embodiment of the present invention, the apparatus further includes:
a feedback unit, configured to feedback a response identifying that the synchronization processing is successful to the synchronization source device, so that the synchronization source device determines, based on the response, MAC address information for which the synchronization processing is failed;
a third receiving unit, configured to receive, as third MAC address information, MAC address information that is retransmitted by the synchronization source device and fails in the first synchronization process;
the processing unit is further configured to perform a third synchronization process on the third MAC address information.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the first receiving unit, the second receiving unit, and the third receiving unit are specifically configured to:
receiving MAC address information sent by a synchronization source device by adopting at least one protocol message, wherein each protocol message carries a self message serial number;
a pass-back unit, specifically configured to:
if all MAC address information in the protocol message is successfully synchronized, a response carrying the message serial number is transmitted back to the synchronization source device, so that the synchronization source device determines MAC address information failed in synchronization processing based on the message serial number in the response.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the protocol packet further carries a priority identifier;
the first receiving unit, the second receiving unit and the third receiving unit are specifically configured to:
receiving a protocol message carrying a priority identification and MAC address information;
if the priority identifier is the highest priority identifier, determining that the MAC address information in the protocol message is newly learned first MAC address information periodically sent by the synchronization source equipment according to a preset first period;
if the priority identifier is a suboptimal priority identifier, determining that the MAC address information in the protocol message is second MAC address information which is locally learned by the synchronous source equipment and is periodically sent by the synchronous source equipment according to a preset second period;
if the priority identifier is the lowest priority identifier, determining that the MAC address information in the protocol message is the MAC address information which is retransmitted by the synchronization source device and fails the first synchronization processing;
the processing unit is specifically configured to: and performing corresponding first synchronous processing, second synchronous processing and third synchronous processing on the MAC address information in the protocol message according to the sequence of the priority from high to low.
In a fifth aspect, an embodiment of the present invention provides a MAC address synchronization system, where the system includes:
a synchronization source apparatus comprising the MAC address synchronization device as described in the third aspect above;
a device to be synchronized, the device comprising a MAC address synchronization apparatus as described above in the fourth aspect.
In a sixth aspect, an embodiment of the present invention provides an electronic device, including: at least one processor, at least one memory, and computer program instructions stored in the memory, which when executed by the processor, implement a method as provided in the first or second aspect of an embodiment of the invention.
In a seventh aspect, embodiments of the present invention provide a computer-readable storage medium, on which computer program instructions are stored, which, when executed by a processor, implement a method as provided in the first or second aspect of embodiments of the present invention.
The MAC address synchronization method, device, system, equipment and medium provided by the invention have the following beneficial effects: by using the long-short period synchronization mode, the problem of MAC asynchronism among equipment caused by loss of MAC address information in the synchronous transmission process is solved, the phenomenon of message flooding when the MAC addresses are not synchronous is greatly reduced, and the pressure of network bandwidth is further relieved.
Drawings
Fig. 1 is a schematic flowchart of a MAC address synchronization method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a MAC address synchronization method according to a second embodiment of the present invention;
fig. 3 is a schematic flowchart of a MAC address synchronization method according to a third embodiment of the present invention;
fig. 4 is a schematic flowchart of a MAC address synchronization method according to a fourth embodiment of the present invention;
fig. 5 is a schematic flowchart of a MAC address synchronization method according to a fifth embodiment of the present invention;
fig. 6 is a schematic flowchart of a MAC address synchronization method according to a sixth embodiment of the present invention;
fig. 7 is a schematic structural diagram of a MAC address synchronization apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of another MAC address synchronization apparatus according to an embodiment of the present invention;
fig. 9 is a schematic diagram of a MAC address synchronization system according to a seventh embodiment of the present invention;
fig. 10 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Some of the words that appear in the text are explained below:
in the embodiment of the present invention, the term "and/or" describes an association relationship of an associated object, and indicates that three relationships may exist, for example, a and/or B, and may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The MAC address synchronization method, apparatus, system, device and medium provided by the present invention are described in more detail below with reference to the accompanying drawings and embodiments.
Example one
The present embodiment provides a method for synchronizing MAC addresses, where the method is applicable to a switch stacking scenario, and a synchronization source device and a device to be synchronized are two different stacking members, respectively. Of course, the method may also be applied to other scenarios with MAC address synchronization requirements, for example, a switching device with a main and standby dual processor chips is deployed, where the synchronization source device is the main processor chip and the device to be synchronized is the standby processor chip, and this embodiment is not particularly limited to this.
Referring to fig. 1, a MAC address synchronization method applied to a synchronization source device specifically includes:
step 101, periodically triggering a first synchronization event according to a preset first period, wherein the first synchronization event comprises: and sending the first MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs first synchronization processing on the received first MAC address information.
Step 102, according to a preset second period, periodically triggering a second synchronization event, where the second synchronization event includes: and sending the second MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs second synchronization processing on the received second MAC address information. It should be noted that, the above step 101 and step 102 are two parallel steps, there is no precedence order, the step numbers are only labels used to describe different steps for convenience of description, the first MAC address information includes newly learned MAC address information and aged MAC address information in the latest first period, and the second MAC address information includes all locally learned unaged MAC address information.
In this embodiment, the second period is not only greater than the first period, but also greater than the maximum synchronization duration of the first synchronization event. Preferably, the first period is greater than or equal to a maximum synchronization duration of the first synchronization event. Therefore, the first synchronization event is also called as a short-period synchronization event, and the first synchronization process is a short-period synchronization process; the second synchronization event is also referred to as a long-period synchronization event, and the second synchronization process is a long-period synchronization process. Wherein, the synchronization duration of the first synchronization event refers to: the length of time it takes from when the first synchronization event is triggered to when the first synchronization event ends. The end of the first synchronization event is marked when it is determined that the first synchronization process of the device to be synchronized is complete (e.g., an indication that the first synchronization process of the device to be synchronized is complete). The maximum synchronization duration of the first synchronization event may be determined empirically by those skilled in the art, or may be the maximum value of the synchronization duration when the first synchronization event is performed, which is counted according to the history information. In one example, the first period is 5 times the maximum value, and the second period is 15 minutes, for example, the first period is 3 minutes.
As a specific implementation manner, the MAC address synchronization method provided in this embodiment further includes: and learning the MAC address according to an MAC address learning mechanism in real time, and periodically aging the learned MAC address according to an aging mechanism. The learning mechanism and the aging mechanism may both adopt any existing MAC address learning and aging technology, and are not described herein again. Each piece of MAC address information sent to the equipment to be synchronized for synchronization processing comprises: an information body and a FLAG identifier. The information body contains MAC address and port number, the FLAG mark is an operation instruction corresponding to the source of the information body, if the source of the information body is the learned MAC address, the corresponding operation instruction is an adding instruction, and if the source of the information body is the aged MAC address, the corresponding operation instruction is a deleting instruction.
Specifically, in each first synchronization event, all MAC address information to be subjected to the first synchronization processing may be encapsulated by using a protocol packet, and the encapsulated protocol packet is sent to the device to be synchronized. If one protocol message is not encapsulated, the second protocol message can be adopted for continuous encapsulation, and the like is repeated until all the MAC address information is encapsulated. Similarly, in each second synchronization event, all MAC address information to be subjected to the second synchronization processing may also be encapsulated by using a protocol packet, and the encapsulated protocol packet is sent to the device to be synchronized. If one protocol message is not encapsulated, the second protocol message can be adopted for continuous encapsulation, and the like is repeated until all the MAC address information is encapsulated. The formats of the protocol messages used in the two synchronization events may be the same or different, which is not limited in the embodiments of the present invention. When the formats of the protocol messages adopted in the two synchronization events are the same, the protocol messages contain related fields marked with the types of the synchronization events (including the first synchronization event type and the second synchronization event type), so that the equipment to be synchronized can identify the type of the received MAC address information according to the identification fields, and further judge whether to perform the first synchronization processing or the second synchronization processing.
In the scheme provided by this embodiment, a mode of respectively synchronizing the long and short periods of the MAC address is adopted, the short period synchronization can effectively ensure that the MAC address can be synchronized to the required device at the first time, and the long period synchronization further ensures that the MAC address can still keep the synchronization reliability under the condition that part of MAC addresses are failed to be synchronized when the short period synchronization is performed as a compensatory measure, thereby effectively avoiding the impact on the network caused by the untimely MAC synchronization.
Example two
In order to implement MAC address synchronization more reliably and efficiently, the embodiment optimizes the long-short period synchronization scheme provided in the first embodiment, and further adds a retransmission event and a trigger condition of the retransmission event on the basis of the first embodiment.
Referring to fig. 2, the present embodiment provides a MAC address synchronization method, which is applied to a synchronization source device, and specifically includes steps 201 to 205.
Step 201, according to a preset first period, periodically triggering a first synchronization event, where the first synchronization event includes: and sending newly learned MAC address information and aged MAC address information in the latest first period to the equipment to be synchronized so that the equipment to be synchronized performs first synchronization processing on the received MAC address information.
Step 202, according to a preset second period, periodically triggering a second synchronization event, where the second synchronization event includes: and sending all the locally learned unaged MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs second synchronization processing on the received MAC address information.
Step 203, when the first synchronization event is triggered, if the second synchronization event is running, the second synchronization event is ended.
And step 204, when the first synchronization event is finished, if the MAC address information of the first synchronization processing failure exists during the operation of the first synchronization event, recording the current time.
In this step 204, when the first synchronization process of the MAC address information sent to the device to be synchronized in the first synchronization event is completed, the first synchronization event is ended.
As a specific embodiment 1, the method further includes: after triggering a first synchronization event, sending identification information which can enable the equipment to be synchronized to know whether all MAC address information in the first synchronization event is sent or not to the equipment to be synchronized; and when receiving an indication that the first synchronization processing sent by the equipment to be synchronized according to the identification information is finished, determining that the first synchronization event is finished. If the MAC address information is sent to the device to be synchronized in the form of a protocol packet in the first synchronization event, the identification information may be the total number of protocol packets required for encapsulating all MAC address information in the event, or the sequence number of each protocol packet required. The identification information may be carried in a first protocol packet sent in the first synchronization event and transmitted to the device to be synchronized, or may be sent to the device to be synchronized as a single message.
As another specific embodiment 2, after the first synchronization event is triggered, after the last piece of MAC address information is sent to the device to be synchronized, a preset processing duration is waited for, and the first synchronization event is ended. Wherein the preset processing time is at least longer than the following time: and the estimated first synchronization processing time length of the equipment to be synchronized to all MAC address information in the first synchronization event. The estimated value can be obtained empirically by those skilled in the art in connection with the delay condition of the information transmission path and the processing performance of the device to be synchronized.
In addition, for example, the method provided by the present embodiment may further include: recording MAC address information sent out in a first synchronization event; and receiving MAC address information which is returned by the equipment to be synchronized and successfully processed in the first synchronization. Correspondingly, in this step 204, the MAC address information of the first synchronization processing failure during the operation of the first synchronization event is determined by comparing the recorded result and the returned result.
Step 205, judging whether the difference value between the current time and the trigger time of the next second synchronization event is greater than the preset aging duration of the MAC address information; if yes, go to step 206; if not, the next trigger of the second synchronization event in step 202 is waited for.
In this step 205, the aging of the MAC address information is prior art, and the aging duration can be set by those skilled in the art according to experience, and is typically 5 minutes.
Step 206, triggering a third synchronization event, and restarting timing of a second period, where the third synchronization event includes: and resending the MAC address information of which the first synchronization processing fails when the first synchronization event runs to the equipment to be synchronized so as to enable the equipment to be synchronized to carry out third synchronization processing.
In the above steps 204 and 206, the aging duration and the short-period synchronization result are combined to trigger the retransmission mechanism and the long-period timing restart, so that the impact of a large amount of MAC address information interaction on the device CPU caused by frequent long-period synchronization is reduced on the basis of stabilizing the synchronization quality, and the MAC synchronization is more stable.
Similar to the above embodiment, step 201 and step 202 in this embodiment are executed in parallel, step 204 and step 206 and step 202 are also executed in parallel, there is no sequence, and the step numbers are used to describe different steps for convenience of description.
As a preferred embodiment, protocol messages with the same format are used in all types of synchronization events to send respective corresponding MAC address information to the device to be synchronized. Specifically, whether for a first synchronization event, a second synchronization event, or a third synchronization event, wherein the MAC address information is sent to the device to be synchronized, includes: and sending the MAC address information to the equipment to be synchronized by adopting at least one protocol message, wherein each protocol message carries the sequence number of the message. Correspondingly, the method provided by the embodiment further includes: if a response carrying the protocol message serial number returned by the equipment to be synchronized is received, the synchronization processing of the MAC address information in the protocol message of the serial number is determined to be successful, otherwise, the synchronization processing of the MAC address information in the protocol message of the serial number is determined to be failed.
Further, the protocol message also carries a priority identifier, so that the device to be synchronized determines a synchronization processing sequence of the received protocol message according to the priority identifier, and if the protocol message with multiple priorities needs to be processed synchronously at present, the protocol message with a higher priority is processed preferentially. Typically, the priority identifier is further used to identify a synchronization event type, so that the device to be synchronized determines a synchronization processing type of the received protocol packet according to the priority identifier. The method comprises the steps that priority identifiers in protocol messages sent in a first synchronization event are all identified as the first synchronization event, and MAC address information carried in the first synchronization event is to be subjected to first synchronization processing with the highest priority; the priority marks in the protocol messages sent in the second synchronous event are all marked as the second synchronous event, wherein the carried MAC address information is to be subjected to second synchronous processing with the second priority; and the priority identifiers in the protocol messages sent in the third synchronous event are all identified as the third synchronous event, wherein the carried MAC address information is to be subjected to third synchronous processing with the lowest priority. In the embodiment, priorities are set for three major synchronization events, so that short-period synchronization processing is guaranteed to be at the highest synchronization level, and reliability of real-time synchronization is guaranteed preferentially.
In the scheme provided by the embodiment, the MAC address information which is not successfully synchronized is retransmitted at a proper time, the mechanism makes up for the deficiency of a long-period synchronization mode, on one hand, the pressure on equipment caused by frequent occurrence of a long period is solved, and on the other hand, the flooding problem caused by synchronization after partial MAC is aged due to overlong long-period synchronization period is avoided.
EXAMPLE III
The embodiment is based on the first embodiment and the second embodiment, and supplements the learning, aging and drift suppression scheme of the MAC address. This embodiment provides a MAC address synchronization method, which can be executed by a CPU in a synchronization source device, and as shown in fig. 3, in addition to the above steps 101 and 102 and the above steps 201 and 206, the method further includes a MAC address information maintenance process, which is specifically as follows.
Step 301, receiving and storing newly learned MAC address information and aged MAC address information reported by the forwarding hardware of the device in an interrupt manner.
Step 302, receiving the drifting MAC address information reported by the forwarding hardware of the device in an interrupt manner.
In this step 301, if the synchronization source device is a switching device, the forwarding hardware of the device is a forwarding chip of the switching device, the forwarding chip performs learning, aging, and drift detection on the MAC address, and reports the MAC address to the CPU in a hardware interrupt manner. Each piece of MAC address information comprises an information body and a FLAG mark. The information body includes a MAC address and a port number, and optionally a Virtual Local Area Network (VLAN) identifier. If the information main body is newly learned MAC address information, the FLAG mark is an addition indication; if the information main body is aged MAC address information, the FLAG mark is a deletion instruction; if the information body is drifting MAC address information, the FLAG mark is a drifting indication.
Step 303, detecting whether a node of the drifting MAC address information exists in the MAC drifting chain table; if so, go to step 304; if not, step 305 is performed.
And step 304, updating the timer of the node.
And 305, inserting the drifting MAC address information into the MAC drifting linked list as a node, and adding a timer for the node.
And step 306, when the first synchronization event is triggered, searching target MAC address information of which the timer times out of the preset drift suppression duration in the MAC drift chain table.
In specific implementation, the drift suppression duration may be determined empirically by a person skilled in the art in combination with networking conditions, and typically the duration is 1 minute. The destination MAC address information is MAC address information that is confirmed to be valid after drift suppression.
And 307, informing the forwarding hardware of normally learning the MAC address in the target MAC address information.
After receiving the notification, if the forwarding hardware of the device learns the MAC address in the target MAC address information again, the forwarding hardware directly reports the learning result (for example, MAC address + new port + new VLAN) to the CPU in an interrupt manner, and if the MAC address information corresponding to the MAC address is stored before, the CPU directly replaces the learning result with the learning result.
And 308, clearing the nodes which are the target MAC address information in the MAC drift linked list.
In the technical scheme provided by this embodiment, by providing a drift suppression mechanism, a large amount of MAC drift reports can be well relieved of a huge burden on MAC synchronization, and meanwhile, MAC learning reporting under normal conditions is not hindered.
Example four
The embodiment provides a MAC address synchronization scheme, which is applicable to a switch stacking scenario, where a synchronization source device and a device to be synchronized are two different stacking members respectively. Of course, the method may also be applied to other scenarios with MAC address synchronization requirements, for example, a switching device with active and standby dual processor chips is deployed, where the synchronization source device is the main processor chip and the device to be synchronized is the standby processor chip, and this embodiment is not particularly limited to this.
Referring to fig. 4, the present embodiment provides a MAC address synchronization method, which is applied to a device to be synchronized, and the MAC address synchronization method provided in the first embodiment is executed in cooperation with the MAC address synchronization method, so that the MAC address maintenance condition of a synchronization source device can be synchronized to the device to be synchronized. Specifically, the method comprises the following steps:
step 401, receiving newly learned MAC address information and aged MAC address information periodically sent by the synchronization source device according to a preset first period as first MAC address information.
Step 402, performing a first synchronization process on the first MAC address information.
In specific implementation, the first synchronization process includes: according to the first MAC address information, a locally stored MAC address forwarding table is adaptively updated, and the specific updating process comprises the following steps:
if the FLAG mark in the first MAC address information is a deletion indication, searching whether a locally stored MAC address forwarding table has an entry corresponding to the MAC address in the MAC address information; if the corresponding table entry exists, deleting the table entry, and marking that the first synchronous processing of the MAC address information is successful when the deletion is successful; if the corresponding table entry does not exist, determining not to execute the table entry deleting operation, and successfully processing the first synchronization of the MAC address information.
If the FLAG mark in the first MAC address information is an adding indication, searching whether a locally stored MAC address forwarding table has an item corresponding to the MAC address in the MAC address information; if no corresponding table entry exists, adding a table entry, wherein the contents of the table entry are an MAC address, a port and a VLAN in the MAC address information, and when the addition is successful, marking that the first synchronous processing of the MAC address information is successful; and if the corresponding table entry exists, determining that the table entry adding operation is not executed, and successfully processing the first synchronization of the MAC address information.
Step 403, receiving all unaged MAC address information, which is periodically sent by the synchronization source device according to a preset second period, and is locally learned by the synchronization source device, as second MAC address information.
And step 404, performing second synchronization processing on the second MAC address information.
In specific implementation, the second synchronization process includes: and comparing all second MAC address information in the current second period sent by the synchronization source equipment when the second period arrives each time with a locally stored MAC address forwarding table, deleting redundant table entries in the forwarding table, and adding missing table entries. And the content of the missing table entry is an information body in the second MAC address information which does not exist in the forwarding table. For example, when the 1 st second period arrives, the synchronization source device triggers a second synchronization event, and sends 8 pieces of MAC address information to the device to be synchronized in the event, and the MAC address information compared with the MAC address forwarding table of the device to be synchronized is the 8 pieces of MAC address information.
In the scheme provided by this embodiment, a mode of respectively synchronizing long and short MAC address periods is adopted, short-period synchronization can effectively ensure that the MAC addresses can be synchronized to required devices at the first time, and long-period synchronization as a compensatory measure further ensures that the MAC addresses can still keep synchronized reliability under the condition that partial MAC address synchronization fails during short-period synchronization, thereby effectively avoiding the impact on the network caused by untimely MAC synchronization.
EXAMPLE five
Based on the fourth embodiment, the present embodiment further adds a backhaul of the synchronization processing result and a synchronization processing under a retransmission mechanism. Referring to fig. 5, the present embodiment provides a MAC address synchronization method, which is applied to a device to be synchronized, and the method is executed in cooperation with the MAC address method provided in the second embodiment, so that the MAC address maintenance condition of a synchronization source device can be efficiently and reliably synchronized to the device to be synchronized. Specifically, the method comprises the following steps:
step 501, receiving newly learned MAC address information and aged MAC address information periodically sent by a synchronization source device according to a preset first cycle as first MAC address information.
Step 502, performing a first synchronization process on the first MAC address information.
Step 503, receiving all unaged MAC address information, which is periodically sent by the synchronization source device according to a preset second period, and is locally learned by the synchronization source device, as second MAC address information.
And step 504, performing second synchronization processing on the second MAC address information.
Step 505, a response identifying the MAC address information with successful synchronization processing is transmitted back to the synchronization source device, so that the synchronization source device determines the MAC address information with failed synchronization processing based on the response.
Step 506, receiving the MAC address information of the first synchronization processing failure retransmitted by the synchronization source device, as a third MAC address information, and performing a third synchronization processing on the third MAC address information.
Wherein the third synchronization processing includes: according to the third MAC address information, adaptively updating a locally stored MAC address forwarding table, wherein the specific updating process comprises the following steps:
if the FLAG identifier in the third MAC address information is a deletion indication, searching whether a locally stored MAC address forwarding table has an entry corresponding to the MAC address in the MAC address information; if the corresponding table entry exists, deleting the table entry, and marking that the third synchronous processing of the MAC address information is successful when the deletion is successful; if the corresponding table entry does not exist, determining not to execute the table entry deleting operation, and successfully processing the third synchronization of the MAC address information;
if the FLAG identifier in the third MAC address information is the addition indication, searching whether a locally stored MAC address forwarding table has an entry corresponding to the MAC address in the MAC address information; if no corresponding table entry exists, adding a table entry, wherein the contents of the table entry are the MAC address, the port and the VLAN in the MAC address information, and marking that the third synchronization processing of the MAC address information is successful when the addition is successful; and if the corresponding table entry exists, determining not to execute the table entry adding operation, and successfully processing the third synchronization of the MAC address information.
As a preferred embodiment, the first MAC address information, the second MAC address information, or the third MAC address information is received by the device to be synchronized by being carried in protocol messages having the same format but different contents. Correspondingly, receiving the MAC address information sent by the synchronization source device specifically includes: and receiving MAC address information sent by the synchronization source equipment by adopting at least one protocol message, wherein each protocol message carries a message serial number of the protocol message.
Transmitting a response identifying the MAC address information with which the synchronization processing succeeded back to the synchronization source device, so that the synchronization source device determines the MAC address information with which the synchronization processing failed based on the response, including: if all the MAC address information in the protocol message is successfully synchronized, a response carrying the protocol message serial number is transmitted back to the synchronization source device, so that the synchronization source device determines the MAC address information failed in synchronization processing based on the protocol message serial number in the response. Typically, only for the first synchronization process, a response identifying the MAC address information with which the synchronization process was successful is transmitted back to the synchronization source device.
As a preferred embodiment, the protocol message also carries a priority identifier. Receiving MAC address information sent by a synchronization source device by adopting at least one protocol message, and carrying out synchronization processing on the received MAC address information, wherein the synchronization processing comprises the following steps:
receiving a protocol message carrying a priority identification and MAC address information;
if the priority identifier is the highest priority identifier, determining that the MAC address information in the protocol message is newly learned MAC address information and aged MAC address information which are periodically sent by the synchronization source equipment according to a preset first period;
if the priority identifier is a suboptimal priority identifier, determining that the MAC address information in the protocol message is all unaged MAC address information which is locally learned by the synchronous source equipment and is periodically sent by the synchronous source equipment according to a preset second period;
if the priority identifier is the lowest priority identifier, determining that the MAC address information in the protocol message is the MAC address information which is retransmitted by the synchronization source device and fails in the first synchronization processing;
and performing corresponding first, second or third synchronous processing on the MAC address information in the protocol message according to the sequence of the priority from high to low.
In the embodiment, the priority is set, so that the short-period synchronization processing is ensured to be at the highest level of synchronization, and the reliability of real-time synchronization is preferentially ensured.
EXAMPLE six
The present embodiment provides a preferred embodiment of a MAC address synchronization method according to the first to fifth embodiments. Referring to fig. 6, the method specifically includes the following steps 600-611.
Step 600, the synchronization source device sets a first period, a second period, an aging time length and a drift suppression time length of MAC address synchronization.
The MAC address information maintenance process (corresponding to step 601), the short-period MAC address synchronization process (corresponding to step 602-.
Step 601, the synchronization source device maintains the MAC address information in real time, where the information includes the MAC address, the port, and the VLAN. Specifically, the method comprises the following steps:
receiving newly learned MAC address information and aged MAC address information reported by forwarding hardware of the equipment in an interrupt mode, and storing the newly learned MAC address information and the aged MAC address information;
receiving drifting MAC address information reported by forwarding hardware of the equipment in an interrupt mode, and performing drifting inhibition on the MAC address information;
when the first synchronization event is triggered, the forwarding hardware is informed to normally learn the MAC address in the MAC address information confirmed to be effective through drift suppression.
Step 602, the synchronization source device periodically triggers a first synchronization event according to a first period. The first event includes:
the synchronization source equipment takes all newly learned and aged MAC address information in the latest first period as short-period MAC address information to be synchronized and sends the short-period MAC address information to the local protocol module;
the local protocol module of the synchronization source equipment encapsulates the received short-period MAC address information to be synchronized in at least one protocol message, sends the protocol message to the equipment to be synchronized, and simultaneously records the serial number of each protocol message and the MAC address information carried by the protocol message;
in this step 602, each protocol packet may carry 256 pieces of MAC address information at most, the carried priority identifier is the highest priority identifier, and a local chain table U1 is used to store the sequence number of each sent protocol packet and the carried MAC address information.
Step 603, the device to be synchronized decapsulates the received protocol packet, determines that the protocol packet is the highest priority packet, and performs the first synchronization processing on the MAC address information contained therein.
Step 604, the device to be synchronized returns a response carrying the sequence number of the protocol packet successfully processed by the first synchronization process to the synchronization source device.
Wherein, the successful first synchronous processing of the protocol message means that: the first synchronization process of all MAC address information contained in the protocol message is successful.
Step 605, the synchronization source device records the sequence number of the protocol packet in the received response.
Illustratively, in step 605, the local linked list U2 is used to store the protocol packet sequence number in each response.
Step 606, when the first synchronization event triggered each time ends, the synchronization source device determines the MAC address information of the first synchronization processing failure according to the recording result.
In this step 606, the synchronization source device compares the local linked list U1 and U2, and if the protocol packet serial number stored in the local linked list U1 cannot be found in the local linked list U2, it is determined that the first synchronization processing of the MAC address information in the protocol packet of the serial number stored in the local linked list U1 that cannot be found fails.
Step 607, if the result is not null, determining whether the difference between the current time and the next trigger time of the second synchronization event is greater than the preset aging duration of the MAC address information;
if yes, go to step 608, otherwise, do not execute any operation and wait for the triggering of the second synchronization event in the long-period MAC address synchronization process.
Step 608, triggering a third synchronization event, and restarting the timing of the second cycle, where the third event includes: and encapsulating the determined MAC address information failed in the first synchronization processing in at least one protocol message and retransmitting the protocol message to the equipment to be synchronized.
In this step 608, the priority identifier carried in the protocol packet sent out in the third synchronization event is the lowest priority identifier.
Step 609, the device to be synchronized decapsulates the received protocol packet, determines that the protocol packet is the lowest priority packet, and performs the third synchronization processing on the MAC address information included therein.
Step 610, the synchronization source device periodically triggers a second synchronization event according to a second period. The second synchronization event includes:
the synchronization source equipment takes all the locally learned unaged MAC address information as long-period MAC address information to be synchronized and sends the long-period MAC address information to the local protocol module;
and the local protocol module of the synchronization source equipment encapsulates the received MAC address information to be synchronized in a long period into at least one protocol message and sends the protocol message to the equipment to be synchronized.
In this step 610, each protocol packet may carry 256 pieces of MAC address information at most, and the carried priority identifier is a sub-priority identifier.
Step 611, the device to be synchronized decapsulates the received protocol packet, determines that the protocol packet is a sub-optimal priority packet, and performs a second synchronization process on the MAC address information contained therein.
It should be noted that, because the link delay between the synchronization source device and the device to be synchronized is not constant, and the storage capacity of the device to be synchronized is different depending on the device, the synchronization processing speed of each received protocol packet is also not constant, and the device to be synchronized is likely to store all types of protocol packets (for example, the device to be synchronized has not yet processed the protocol packet sent in the last second synchronization event, and has received the protocol packet sent in the next first synchronization event) and needs to process them at the same time, the synchronization processing priority (which may also be regarded as the priority of each type of synchronization event) of all types of protocol packets in this embodiment is defined, and when the device to be synchronized processes all protocol packets sent by the synchronization source device that has been received at present, the device to be synchronized has a higher priority and is processed preferentially.
In the technical scheme provided by this embodiment, a mode of adding a response and retransmission mechanism on the basis of short-period synchronization further ensures reliability that a protocol packet is lost in short-period synchronization and a CPU maintains synchronization of an MAC address under the condition of a large number of packet impacts.
As shown in fig. 7, based on the same inventive concept of the MAC address synchronization method, the present invention further provides a MAC address synchronization apparatus, including:
a first triggering unit 701, configured to trigger a first synchronization event periodically according to a preset first cycle, where the first synchronization event includes: sending the first MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs first synchronization processing on the received first MAC address information;
a second triggering unit 702, configured to periodically trigger a second synchronization event according to a preset second period, where the second synchronization event includes: sending the second MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs second synchronization processing on the received second MAC address information;
the second period is greater than the first period, the second period is greater than the maximum synchronization duration of the first synchronization event, the first MAC address information comprises newly learned MAC address information and aged MAC address information in the latest first period, and the second MAC address information comprises all locally learned MAC address information which is not aged.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the apparatus further includes an event control unit 704 and a third trigger unit 703;
an event control unit 704, configured to terminate performing the second synchronization event when the first synchronization event is triggered and the second synchronization event is being performed;
the third triggering unit 703 is configured to:
when the first synchronization event is finished, if the MAC address information of the first synchronization processing failure exists during the operation of the first synchronization event, recording the current moment;
judging whether the time length between the current time and the trigger time of the next second synchronous event is greater than the preset aging time length of the MAC address information;
if yes, triggering a third synchronization event, and resetting timing of a second cycle, wherein the third synchronization event comprises: and resending the MAC address information of which the first synchronization processing fails when the first synchronization event runs to the equipment to be synchronized so as to enable the equipment to be synchronized to carry out third synchronization processing.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the first trigger unit 701, the second trigger unit 702, and the third trigger unit 703 are specifically configured to: sending the MAC address information to the device to be synchronized, specifically including: sending MAC address information to equipment to be synchronized by adopting at least one protocol message, wherein each protocol message carries a message serial number of the protocol message;
the device also comprises a synchronization result judging unit which is used for determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is successful if the response carrying the message serial number returned by the equipment to be synchronized is received, or else determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is failed.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the protocol packet further carries a priority identifier, so that the device to be synchronized determines a type and an order of synchronous processing on the protocol packet according to the priority identifier;
the priority identifiers of all protocol messages sent in the first synchronization event are the same, and the priority is the highest; the priority identifiers of all protocol messages sent in the second synchronous event are the same, and the priority identifiers are the same; the priority identifiers of the protocol messages sent in the third synchronous event are the same, and the priority is the lowest.
As shown in fig. 8, based on the same inventive concept of the MAC address synchronization method, the present invention further provides a MAC address synchronization apparatus, including:
a first receiving unit 801, configured to receive first MAC address information periodically sent by a synchronization source device according to a preset first cycle;
a second receiving unit 802, configured to receive second MAC address information periodically sent by the synchronization source device according to a preset second period, where the first MAC address information includes MAC address information newly learned in a latest first period of the synchronization source device and aged MAC address information, and the second MAC address information includes all pieces of MAC address information that are locally learned by the synchronization source device and are not aged;
the processing unit 803 is configured to perform a first synchronization process on the first MAC address information, and perform a second synchronization process on the second MAC address information.
In a possible implementation manner, in an apparatus provided in an embodiment of the present invention, the apparatus further includes:
a feedback unit, configured to feedback a response identifying that the synchronization processing is successful to the synchronization source device, so that the synchronization source device determines, based on the response, MAC address information for which the synchronization processing is failed;
a third receiving unit, configured to receive, as third MAC address information, MAC address information that is retransmitted by the synchronization source device and fails to perform the first synchronization processing;
the processing unit 803 is further configured to perform a third synchronization process on the third MAC address information.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the first receiving unit 801, the second receiving unit 802, and the third receiving unit are specifically configured to:
receiving MAC address information sent by a synchronization source device by adopting at least one protocol message, wherein each protocol message carries a self message serial number;
a pass-back unit, specifically configured to:
if all MAC address information in the protocol message is successfully synchronized, a response carrying the message serial number is transmitted back to the synchronization source device, so that the synchronization source device determines MAC address information failed in synchronization processing based on the message serial number in the response.
In a possible implementation manner, in the apparatus provided in the embodiment of the present invention, the protocol packet further carries a priority identifier;
the first receiving unit 801, the second receiving unit 802, and the third receiving unit are specifically configured to:
receiving a protocol message carrying a priority identifier and MAC address information;
if the priority identifier is the highest priority identifier, determining that the MAC address information in the protocol message is newly learned first MAC address information periodically sent by the synchronization source equipment according to a preset first period;
if the priority identifier is the suboptimal priority identifier, determining that the MAC address information in the protocol message is second MAC address information which is locally learned by the synchronous source equipment and is periodically sent by the synchronous source equipment according to a preset second period;
if the priority identifier is the lowest priority identifier, determining that the MAC address information in the protocol message is the MAC address information which is retransmitted by the synchronization source device and fails in the first synchronization processing;
the processing unit 803 is specifically configured to: and performing corresponding first synchronous processing, second synchronous processing and third synchronous processing on the MAC address information in the protocol message according to the sequence of the priority from high to low.
As shown in fig. 9, the present invention further provides a MAC address synchronization system, which includes:
a sync source device 901 including a MAC address synchronizing apparatus as shown in fig. 7;
a device to be synchronized 902 comprising a MAC address synchronization apparatus as shown in fig. 8.
In addition, the MAC address synchronization method and apparatus of the embodiments of the present invention described in conjunction with fig. 1 to 9 may be implemented by an electronic device. Fig. 10 is a schematic diagram illustrating a hardware structure of an electronic device according to an embodiment of the present invention.
The electronic device may include a processor 1001 and a memory 1002 that stores computer program instructions.
Specifically, the processor 1001 may include a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or may be configured as one or more Integrated circuits implementing an embodiment of the present invention.
Memory 1002 may include mass storage for data or instructions. By way of example, and not limitation, memory 1002 may include a Hard Disk Drive (HDD), a floppy Disk Drive, flash memory, an optical Disk, a magneto-optical Disk, magnetic tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 1002 may include removable or non-removable (or fixed) media, where appropriate. The memory 1002 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 1002 is non-volatile solid-state memory. In certain embodiments, memory 1002 comprises Read Only Memory (ROM). Where appropriate, the ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), electrically rewritable ROM (EAROM), or flash memory or a combination of two or more of these.
The processor 1001 realizes any one of the MAC address synchronization methods in the above embodiments by reading and executing computer program instructions stored in the memory 1002.
In one example, the electronic device may also include a communication interface 1003 and a bus 1010. As shown in fig. 10, the processor 1001, the memory 1002, and the communication interface 1003 are connected to each other via a bus 1010 to complete communication therebetween.
The communication interface 1003 is mainly used for implementing communication between modules, apparatuses, units and/or devices in the embodiment of the present invention.
The bus 1010 includes hardware, software, or both to couple the components of the electronic device to one another. By way of example, and not limitation, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industrial Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an infiniband interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus or a combination of two or more of these. Bus 1010 may include one or more buses, where appropriate. Although specific buses have been described and shown in the embodiments of the invention, any suitable buses or interconnects are contemplated by the invention.
The electronic device may execute the MAC address synchronization method in the embodiments of the present invention based on the received packet, thereby implementing the MAC address synchronization method, apparatus, and system described in conjunction with fig. 1 to fig. 9.
In addition, in combination with the electronic device in the foregoing embodiment, the embodiment of the present invention may be implemented by providing a computer-readable storage medium. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the MAC address synchronization methods in the above embodiments.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (13)

1. A MAC address synchronization method, the method comprising:
periodically triggering a first synchronization event according to a preset first period, wherein the first synchronization event comprises: sending the first MAC address information to equipment to be synchronized so that the equipment to be synchronized performs first synchronization processing on the received first MAC address information;
periodically triggering a second synchronization event according to a preset second period, wherein the second synchronization event comprises: sending second MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs second synchronization processing on the received second MAC address information;
the second period is greater than the first period, the second period is greater than the maximum synchronization duration of a first synchronization event, the first MAC address information comprises newly learned MAC address information and aged MAC address information in the latest first period, and the second MAC address information comprises all locally learned MAC address information which is not aged;
when the first synchronization event is triggered and the second synchronization event is carried out, stopping carrying out the second synchronization event;
when the first synchronization event is finished, if the MAC address information of the first synchronization processing failure exists during the operation of the first synchronization event, recording the current moment;
judging whether the time length between the current time and the trigger time of the next second synchronous event is greater than the preset aging time length of the MAC address information;
if yes, triggering a third synchronization event, and resetting the timing of the second cycle, where the third synchronization event includes: and resending the MAC address information of which the first synchronization processing fails when the first synchronization event runs to the equipment to be synchronized, so that the equipment to be synchronized performs third synchronization processing.
2. The method according to claim 1, wherein sending the MAC address information to the device to be synchronized specifically comprises: sending MAC address information to the equipment to be synchronized by adopting at least one protocol message, wherein each protocol message carries a message serial number of the protocol message;
the method further comprises the following steps: if a response carrying the message serial number returned by the equipment to be synchronized is received, determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is successful, or else determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is failed.
3. The method according to claim 2, wherein the protocol message further carries a priority identifier, so that the device to be synchronized determines the type and sequence of the synchronous processing of the protocol message according to the priority identifier;
the priority identifiers of the protocol messages sent in the first synchronization event are the same, and the priority is the highest; the priority identifiers of all protocol messages sent in the second synchronous event are the same, and the priority identifiers are the same; and the priority identifiers of all protocol messages sent in the third synchronous event are the same, and the priority is the lowest.
4. The method of any one of claims 1-3, further comprising:
receiving and storing newly learned MAC address information and aged MAC address information reported by forwarding hardware in an interrupt mode;
receiving drifting MAC address information reported by forwarding hardware in an interrupt mode;
detecting whether a node of the drifted MAC address information exists in a preset MAC drift linked list, if not, inserting the drifted MAC address information into the MAC drift linked list as a node, and adding timing information to the node; if yes, updating the timing information of the node;
when the first synchronization event is triggered, searching target MAC address information timed to exceed a preset drift suppression duration in an MAC drift linked list based on timing information;
and informing forwarding hardware to normally learn the MAC address in the target MAC address information, and clearing the node of the target MAC address information in the MAC drift linked list.
5. A method for MAC address synchronization, the method comprising:
the method comprises the steps that a synchronization source device periodically triggers a first synchronization event which sends first MAC address information to a device to be synchronized according to a preset first period;
the method comprises the steps that a device to be synchronized receives first MAC address information periodically sent by a synchronization source device according to a preset first period, and first synchronization processing is carried out on the first MAC address information;
the synchronization source equipment periodically triggers a second synchronization event for sending second MAC address information to the equipment to be synchronized according to a preset second period; the method comprises the steps that a device to be synchronized receives second MAC address information periodically sent by a synchronization source device according to a preset second period, and second synchronization processing is carried out on the second MAC address information, wherein the first MAC address information comprises newly learned MAC address information and aged MAC address information in the latest first period of the synchronization source device, and the second MAC address information comprises all unaged MAC address information locally learned by the synchronization source device;
the equipment to be synchronized returns a response identifying MAC address information with successful synchronization processing to the synchronization source equipment, so that the synchronization source equipment determines the MAC address information with failed synchronization processing based on the response;
if the synchronization source equipment judges that the second synchronization event is carried out when the first synchronization event is triggered, the second synchronization event is terminated, and when the first synchronization event is ended, if the synchronization source equipment determines that the MAC address information of the first synchronization processing failure exists when the first synchronization event runs, the current moment is recorded;
the synchronization source equipment judges whether the time length between the current time and the trigger time of the next second synchronization event is greater than the preset aging time length of the MAC address information;
if so, the synchronization source equipment resends the MAC address information of the first synchronization processing failure when the first synchronization event runs to the equipment to be synchronized, and resets the timing of a second period;
and receiving MAC address information which is retransmitted by the synchronization source device and fails in first synchronization processing, wherein the MAC address information is used as third MAC address information, and performing third synchronization processing on the third MAC address information.
6. The method of claim 5, wherein receiving the MAC address information sent by the synchronization source device comprises: receiving MAC address information sent by a synchronization source device by adopting at least one protocol message, wherein each protocol message carries a self message serial number;
the transmitting a response identifying the MAC address information with which the synchronization processing is successful back to the synchronization source device, so that the synchronization source device determines the MAC address information with which the synchronization processing fails based on the response, includes:
if all MAC address information in the protocol message is successfully synchronized, a response carrying a message serial number is transmitted back to the synchronization source device, so that the synchronization source device determines MAC address information failed in synchronization processing based on the message serial number in the response.
7. The method of claim 6, wherein the protocol message further carries a priority identifier;
receiving MAC address information sent by the synchronization source device by adopting at least one protocol message, and carrying out synchronization processing on the received MAC address information, wherein the synchronization processing comprises the following steps:
receiving a protocol message carrying a priority identifier and MAC address information;
if the priority identifier is the highest priority identifier, determining that the MAC address information in the protocol message is first MAC address information periodically sent by the synchronization source device according to a preset first period;
if the priority identifier is a suboptimal priority identifier, determining that the MAC address information in the protocol message is second MAC address information periodically sent by the synchronous source equipment according to a preset second period;
if the priority identifier is the lowest priority identifier, determining that the MAC address information in the protocol message is the MAC address information which is retransmitted by the synchronization source device and fails in the first synchronization processing;
and performing corresponding first synchronous processing, second synchronous processing and third synchronous processing on the MAC address information in the protocol message according to the sequence of the priority from high to low.
8. The method according to any of claims 6-7, wherein the sending back a response to the synchronization source device identifying the MAC address information that the synchronization process was successful is specifically: and only aiming at the first synchronization processing, transmitting a response which identifies the MAC address information with successful synchronization processing back to the synchronization source equipment.
9. An apparatus for MAC address synchronization, the apparatus comprising:
the device comprises a first triggering unit, a second triggering unit and a third triggering unit, wherein the first triggering unit is used for triggering a first synchronization event periodically according to a preset first period, and the first synchronization event comprises: sending the first MAC address information to equipment to be synchronized so that the equipment to be synchronized performs first synchronization processing on the received first MAC address information;
a second triggering unit, configured to periodically trigger a second synchronization event according to a preset second period, where the second synchronization event includes: sending second MAC address information to the equipment to be synchronized so that the equipment to be synchronized performs second synchronization processing on the received second MAC address information;
the second period is greater than the first period, the second period is greater than the maximum synchronization duration of a first synchronization event, the first MAC address information comprises newly learned MAC address information and aged MAC address information in the latest first period, and the second MAC address information comprises all locally learned MAC address information which is not aged;
an event control unit, configured to terminate performing the second synchronization event if the second synchronization event is being performed when the first synchronization event is triggered;
the third trigger unit is used for:
when the first synchronization event is finished, if the MAC address information of the first synchronization processing failure exists during the operation of the first synchronization event, recording the current moment;
judging whether the time length between the current time and the trigger time of the next second synchronous event is greater than the preset aging time length of the MAC address information;
if yes, triggering a third synchronization event, and resetting timing of a second cycle, where the third synchronization event includes: and resending the MAC address information of which the first synchronization processing fails when the first synchronization event runs to the equipment to be synchronized so as to enable the equipment to be synchronized to carry out third synchronization processing.
10. The apparatus of claim 9, wherein the first trigger unit, the second trigger unit, and the third trigger unit are specifically configured to: sending the MAC address information to the device to be synchronized, which specifically includes: sending MAC address information to the equipment to be synchronized by adopting at least one protocol message, wherein each protocol message carries a message serial number of the protocol message;
the device also comprises a synchronization result judging unit which is used for determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is successful if the response carrying the message serial number returned by the equipment to be synchronized is received, or else determining that the synchronization processing of the MAC address information in the protocol message containing the message serial number is failed.
11. The apparatus according to claim 10, wherein the protocol packet further carries a priority identifier, so that the device to be synchronized determines the type and sequence of the synchronous processing of the protocol packet according to the priority identifier;
the priority identifiers of the protocol messages sent in the first synchronization event are the same, and the priority is the highest; the priority identifiers of all protocol messages sent in the second synchronous event are the same, and the priority identifiers are the same; and the priority identifiers of the protocol messages sent in the third synchronous event are the same, and the priority is the lowest.
12. An electronic device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory that, when executed by the processor, implement the method of any of claims 1-4 or 5-8.
13. A computer-readable storage medium having computer program instructions stored thereon which, when executed by a processor, implement the method of any one of claims 1-4 or 5-8.
CN201911424826.XA 2019-12-31 2019-12-31 MAC address synchronization method, device, system, equipment and medium Active CN111107182B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911424826.XA CN111107182B (en) 2019-12-31 2019-12-31 MAC address synchronization method, device, system, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911424826.XA CN111107182B (en) 2019-12-31 2019-12-31 MAC address synchronization method, device, system, equipment and medium

Publications (2)

Publication Number Publication Date
CN111107182A CN111107182A (en) 2020-05-05
CN111107182B true CN111107182B (en) 2022-09-20

Family

ID=70427197

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911424826.XA Active CN111107182B (en) 2019-12-31 2019-12-31 MAC address synchronization method, device, system, equipment and medium

Country Status (1)

Country Link
CN (1) CN111107182B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111865750B (en) * 2020-06-30 2022-04-05 北京瀚诺半导体科技有限公司 Message transmission method and system based on two-layer network
CN113242481B (en) * 2021-06-29 2022-04-19 烽火通信科技股份有限公司 MAC address synchronization method and device of OLT equipment
CN116094997A (en) * 2022-12-15 2023-05-09 瑞斯康达科技发展股份有限公司 MAC address synchronization method, equipment, storage medium and M-LAG

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414801A (en) * 2013-08-12 2013-11-27 杭州华三通信技术有限公司 Method and device for synchronizing medium access control addresses in stacking system
CN103929461A (en) * 2013-08-12 2014-07-16 杭州华三通信技术有限公司 MAC address information synchronization method and device in stacking system
CN104243630A (en) * 2014-09-29 2014-12-24 杭州华三通信技术有限公司 MAC (media access control) address learning method and MAC address learning device in VXLAN (virtual extensible local area network)
CN110019260A (en) * 2017-09-27 2019-07-16 北京国双科技有限公司 A kind of update method and relevant device of user data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9413691B2 (en) * 2013-01-11 2016-08-09 Brocade Communications Systems, Inc. MAC address synchronization in a fabric switch

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414801A (en) * 2013-08-12 2013-11-27 杭州华三通信技术有限公司 Method and device for synchronizing medium access control addresses in stacking system
CN103929461A (en) * 2013-08-12 2014-07-16 杭州华三通信技术有限公司 MAC address information synchronization method and device in stacking system
CN104243630A (en) * 2014-09-29 2014-12-24 杭州华三通信技术有限公司 MAC (media access control) address learning method and MAC address learning device in VXLAN (virtual extensible local area network)
CN110019260A (en) * 2017-09-27 2019-07-16 北京国双科技有限公司 A kind of update method and relevant device of user data

Also Published As

Publication number Publication date
CN111107182A (en) 2020-05-05

Similar Documents

Publication Publication Date Title
CN111107182B (en) MAC address synchronization method, device, system, equipment and medium
CN109936510B (en) Multi-path RDMA transport
JP5570560B2 (en) Method, switching device, and system for locating an Ethernet loop
US20090300209A1 (en) Method and system for path based network congestion management
US10182015B2 (en) Redundant transmission of data frames in communication networks having a ring topology
JP5883743B2 (en) Method for reducing communication interruption time in packet communication networks
KR20060064692A (en) Packet transmission method and packet transmission device
EP2978171B1 (en) Communication method, communication device, and communication program
CN106576108B (en) Communication method, equipment and system in communication system
US10505677B2 (en) Fast detection and retransmission of dropped last packet in a flow
US11924079B2 (en) Operations, administration and management information processing method and device
CN112332951B (en) Ethernet frame preemption method, device, equipment and storage medium
US20230163875A1 (en) Method and apparatus for packet wash in networks
CN113992654A (en) High-speed file transmission method, system, equipment and medium
CN114285765A (en) Link failure detection method, device and computer readable storage medium
CN116155826A (en) Message receiving and transmitting method, network equipment, system and storage medium
EP4398534A1 (en) Network monitoring method and apparatus, and computer storage medium
CN113541874A (en) Data transmission method and network equipment
US6453372B1 (en) Data communication system for and method of avoiding computer network transmissions of excessive length
CN114244785B (en) 5G data flow out-of-order processing method and device
CN112351049B (en) Data transmission method, device, equipment and storage medium
CN114401127A (en) Data packet transmission method, device and equipment based on zeroMQ
CN114584575A (en) Ship-shore communication method and system in ship management system
CN116185598A (en) Address processing method, address processing device, electronic equipment and readable storage medium
CN110336759B (en) RDMA (remote direct memory Access) -based protocol message forwarding method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant