CN111107182A - MAC address synchronization method, device, system, equipment and medium - Google Patents
MAC address synchronization method, device, system, equipment and medium Download PDFInfo
- Publication number
- CN111107182A CN111107182A CN201911424826.XA CN201911424826A CN111107182A CN 111107182 A CN111107182 A CN 111107182A CN 201911424826 A CN201911424826 A CN 201911424826A CN 111107182 A CN111107182 A CN 111107182A
- Authority
- CN
- China
- Prior art keywords
- mac address
- address information
- synchronization
- event
- processing
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5053—Lease time; Renewal aspects
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2101/00—Indexing scheme associated with group H04L61/00
- H04L2101/60—Types of network addresses
- H04L2101/618—Details of network addresses
- H04L2101/622—Layer-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
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, the synchronization processing of the MAC address information in the protocol message containing the message serial number is determined to be successful, otherwise, the synchronization processing of the MAC address information in the protocol message containing the message serial number is determined to be 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, an embodiment of the present invention provides a method, including:
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;
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 a method provided in an 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 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 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 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.
In a possible implementation manner, in the method provided in the embodiment of the present invention, the sending back, to the synchronization source device, a response identifying the MAC address information that the synchronization processing is successful 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 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, 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 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, 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 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 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 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 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 in the fourth aspect above.
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, the MAC address synchronization device, the MAC address synchronization system, the MAC address synchronization equipment and the MAC address synchronization medium have the following beneficial effects that: by utilizing a long-short period synchronization mode, the problem of MAC asynchronism among devices caused by loss of MAC address information in a synchronous transmission process is solved, the phenomenon of message flooding when the MAC addresses are not synchronous is greatly reduced, and further the pressure of network bandwidth is 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:
the term "and/or" in the embodiments of the present invention describes an association relationship of associated objects, and indicates that three relationships may exist, for example, a and/or B 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 embodiment provides a MAC address synchronization method, 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 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:
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 the maximum value, and the second period is 5 times the first period, for example, the first period is 3 minutes, and the second period is 15 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.
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, 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.
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.
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 embodiments, step 201 and step 202 in the present embodiment are executed in parallel, step 204 and step 202 are also executed in parallel, there is no precedence order, 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 kinds 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.
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 identification. 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; and if the information body is the drifting MAC address information, the FLAG mark is a drifting indication.
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 those skilled in the art in combination with networking conditions, and typically the duration value 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 step 308, removing the nodes which are the target MAC address information in the MAC drift chain table.
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:
In specific implementation, the first synchronization process includes: according to the first MAC address information, adaptively updating a locally stored MAC address forwarding table, wherein 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 marking that the first synchronous 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 first synchronization of the MAC address information.
And step 404, performing second synchronization processing on the second MAC address information.
In specific implementation, the second synchronization processing 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 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 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:
And step 504, performing second synchronization processing on the second 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 an MAC address, a port and a 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 carried in a protocol message having the same format and different contents and received by the device to be synchronized. 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 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, 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 that 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.
The MAC address information maintenance process (corresponding to step 601), the short-period MAC address synchronization process (corresponding to step 602-.
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.
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.
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.
Illustratively, in step 605, the local linked list U2 is used to store the protocol packet sequence number in each response.
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.
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.
In this step 608, the priority identifier carried in the protocol packet sent out in the third synchronization event is the lowest priority identifier.
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 long-period MAC address information to be synchronized in 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-optimal priority identifier.
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 from device to device, the synchronous processing speed of each received protocol packet is also not constant, and the device to be synchronized is likely to have all types of protocol packets (for example, the device to be synchronized has not processed the protocol packet sent in the last second synchronization event, and has received the protocol packet sent in the next first synchronization event) to be processed at the same time.
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 periodically trigger a first synchronization event 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, when the first synchronization event is triggered, perform a second synchronization event, and terminate performing the second synchronization event;
the third trigger 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 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;
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 in the first synchronization process;
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 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 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 also 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.
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 Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hypertransport (HT) interconnect, an Industry 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 9.
In addition, in combination with the electronic device in the above embodiments, the embodiments 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 (21)
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 longer than the first period, and the second period is longer than the maximum synchronization duration of a first synchronization event, 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.
2. The method of claim 1, wherein the method further comprises: 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 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 that the equipment to be synchronized performs third synchronization processing.
3. The method according to claim 2, 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.
4. The method according to claim 3, 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 the protocol messages sent in the third synchronous event are the same, and the priority is the lowest.
5. The method of any one of claims 1-4, 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.
6. A MAC address synchronization method, the method comprising:
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.
7. The method of claim 6, wherein the method comprises:
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;
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.
8. The method of claim 7, 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.
9. The method of claim 8, 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 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 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.
10. The method according to any of claims 7 to 9, wherein the sending back, to the synchronization source device, a response 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.
11. 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 longer than the first period, and the second period is longer than the maximum synchronization duration of a first synchronization event, 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.
12. The apparatus of claim 11, wherein the apparatus further comprises 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 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 that the equipment to be synchronized performs third synchronization processing.
13. The apparatus of claim 12, 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, specifically including: 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.
14. The apparatus according to claim 13, 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.
15. An apparatus for MAC address synchronization, the apparatus comprising:
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 and aged MAC address information in a latest first period of the synchronization source device, 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.
16. The apparatus of claim 15, wherein the apparatus further comprises:
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.
17. The apparatus of claim 16, wherein 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;
the backhaul unit is specifically configured to:
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.
18. The apparatus of claim 17, wherein the protocol message 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 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 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 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.
19. A MAC address synchronization system, the system comprising:
a sync source device comprising the MAC address synchronization apparatus of any of claims 11-14;
device to be synchronized comprising a MAC address synchronization apparatus according to any of claims 15 to 18.
20. 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-5 or 6-10.
21. 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-5 or 6-10.
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 true CN111107182A (en) | 2020-05-05 |
CN111107182B 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) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111865750A (en) * | 2020-06-30 | 2020-10-30 | 北京瀚诺半导体科技有限公司 | Message transmission method and system based on two-layer network |
WO2023273864A1 (en) * | 2021-06-29 | 2023-01-05 | 烽火通信科技股份有限公司 | Mac address synchronization method and apparatus for olt device |
CN116094997A (en) * | 2022-12-15 | 2023-05-09 | 瑞斯康达科技发展股份有限公司 | MAC address synchronization method, equipment, storage medium and M-LAG |
Citations (5)
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 |
US20140198801A1 (en) * | 2013-01-11 | 2014-07-17 | Brocade Communications Systems, Inc. | Mac address synchronization in a fabric switch |
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 |
-
2019
- 2019-12-31 CN CN201911424826.XA patent/CN111107182B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140198801A1 (en) * | 2013-01-11 | 2014-07-17 | Brocade Communications Systems, Inc. | Mac address synchronization in a fabric switch |
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 |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111865750A (en) * | 2020-06-30 | 2020-10-30 | 北京瀚诺半导体科技有限公司 | Message transmission method and system based on two-layer network |
CN111865750B (en) * | 2020-06-30 | 2022-04-05 | 北京瀚诺半导体科技有限公司 | Message transmission method and system based on two-layer network |
WO2023273864A1 (en) * | 2021-06-29 | 2023-01-05 | 烽火通信科技股份有限公司 | Mac address synchronization method and apparatus for olt device |
CN116094997A (en) * | 2022-12-15 | 2023-05-09 | 瑞斯康达科技发展股份有限公司 | MAC address synchronization method, equipment, storage medium and M-LAG |
Also Published As
Publication number | Publication date |
---|---|
CN111107182B (en) | 2022-09-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111107182B (en) | MAC address synchronization method, device, system, equipment and medium | |
CN109936510B (en) | Multi-path RDMA transport | |
US10182015B2 (en) | Redundant transmission of data frames in communication networks having a ring topology | |
CN108964943B (en) | Method and device for realizing IOAM packaging | |
JP5883743B2 (en) | Method for reducing communication interruption time in packet communication networks | |
US20090300209A1 (en) | Method and system for path based network congestion management | |
KR20060064692A (en) | Packet transmission method and packet transmission device | |
CN106576108B (en) | Communication method, equipment and system in communication system | |
US11924079B2 (en) | Operations, administration and management information processing method and device | |
CN112332951B (en) | Ethernet frame preemption method, device, equipment and storage medium | |
CN113992654A (en) | High-speed file transmission method, system, equipment and medium | |
CN108259358B (en) | Route publishing method and device | |
CN114285765A (en) | Link failure detection method, device and computer readable storage medium | |
CN103338158A (en) | GOOSE message transmission delay jitter suppression method | |
CN102404152B (en) | Method and equipment for identifying response messages | |
CN113037740A (en) | GOOSE message sender restart frame judging method | |
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 | |
CN108768721B (en) | Primary and standby VNF switching technology based on temporary packet storage | |
CN114244785B (en) | 5G data flow out-of-order processing method and device | |
CN116185598A (en) | Address processing method, address processing device, electronic equipment and readable 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 | |
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 |