CN109842694B - Method for synchronizing MAC addresses, network equipment and computer readable storage medium - Google Patents

Method for synchronizing MAC addresses, network equipment and computer readable storage medium Download PDF

Info

Publication number
CN109842694B
CN109842694B CN201910221668.1A CN201910221668A CN109842694B CN 109842694 B CN109842694 B CN 109842694B CN 201910221668 A CN201910221668 A CN 201910221668A CN 109842694 B CN109842694 B CN 109842694B
Authority
CN
China
Prior art keywords
mac address
hit
configuration parameters
mac
state information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910221668.1A
Other languages
Chinese (zh)
Other versions
CN109842694A (en
Inventor
王丽芳
黄李伟
余华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Information Technologies Co Ltd
Original Assignee
New H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to CN201910221668.1A priority Critical patent/CN109842694B/en
Publication of CN109842694A publication Critical patent/CN109842694A/en
Application granted granted Critical
Publication of CN109842694B publication Critical patent/CN109842694B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Small-Scale Networks (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the application provides a method for synchronizing MAC addresses, network equipment and a computer readable storage medium, and relates to the technical field of communication. The method is applied to a master device in an M-LAG, the M-LAG further comprising a slave device, the method comprising: receiving a negotiation request message sent by the standby equipment, wherein the negotiation request message carries the current configuration parameters of the standby equipment, determining the configuration parameters after negotiation according to the received configuration parameters, the local configuration parameters and the preset configuration parameter negotiation rules, storing the configuration parameters after negotiation, and sending a negotiation response message to the standby equipment, wherein the negotiation response message carries the configuration parameters after negotiation, so that the main equipment and the standby equipment perform MAC address synchronization processing according to the configuration parameters after negotiation. By adopting the method and the device, the consistency of the configuration information can be ensured, and the success rate of synchronizing the MAC addresses is improved.

Description

Method for synchronizing MAC addresses, network equipment and computer readable storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method, a network device, and a computer-readable storage medium for synchronizing MAC addresses.
Background
An inter-device Link Aggregation Group (M-LAG for short) is a mechanism for implementing inter-device Link Aggregation, and in the M-LAG, a technician performs inter-device Link Aggregation on two devices, thereby improving the Link reliability from a single board level to a device level. One of the devices serves as a master device, and the other serves as a slave device. The master device and the standby device are connected through an aggregation interface (which may be called an aggregation interface 1).
In a network employing M-LAG, network devices may be interconnected through their preconfigured aggregation interface (which may be referred to as aggregation interface 2) and aggregation interface 2 in an M-LAG environment. The master device and the slave device in the M-LAG may perform secure Media Access Control (MAC) learning through an interface added to the aggregation interface 2, and perform secure MAC synchronization through the M-LAG system.
In practical applications, for two devices (i.e., a master device and a slave device) included in an M-LAG, a technician needs to manually configure configuration information of secure MACs of the two devices, and ensure that the configuration information of the two devices is completely consistent. The configuration information includes a maximum MAC number of the aggregation interface, a global maximum security MAC number, and the like. When the configuration information is inconsistent, a failure of the secure MAC synchronization may result. For example, if the maximum MAC number of the configured master device at the aggregation interface 2 is 100 and the maximum MAC number of the configured slave device at the aggregation interface 2 is 200, 200 slave devices will synchronize the security MACs with the master device, and the maximum MAC number of the master device at the aggregation interface 2 is 100, and 100 security MACs will fail to synchronize.
Disclosure of Invention
In view of this, the present application provides a method, a network device, and a computer-readable storage medium for synchronizing MAC addresses, so as to ensure consistency of configuration information and improve success rate of synchronizing MAC addresses. The specific technical scheme is as follows:
in a first aspect, a method for synchronizing MAC addresses is provided, where the method is applied to a master device in an M-LAG, and the M-LAG further includes a slave device, and the method includes:
receiving a negotiation request message sent by the standby equipment, wherein the negotiation request message carries the current configuration parameters of the standby equipment;
determining the negotiated configuration parameters according to the received configuration parameters, the local configuration parameters and the preset configuration parameter negotiation rules;
and storing the negotiated configuration parameters, and sending a negotiation response message to the standby device, where the negotiation response message carries the negotiated configuration parameters, so that the main device and the standby device perform MAC address synchronization according to the negotiated configuration parameters.
Optionally, the configuration parameters include a global maximum MAC number, a maximum MAC number of each aggregation group, and an aging policy of each aggregation group;
the determining the negotiated configuration parameters according to the received configuration parameters, the local configuration parameters and the preset configuration parameter negotiation rules includes:
determining a first minimum value in the received global maximum MAC number and the local global maximum MAC number, and taking the first minimum value as the negotiated global maximum MAC number;
for each aggregation group, determining a second minimum value in the received maximum MAC number of the aggregation group and the locally preset maximum MAC number of the aggregation group, and taking the second minimum value as the negotiated maximum MAC number of the aggregation group;
and aiming at each aggregation group, taking the aging strategy of the aggregation group stored in the equipment as the negotiated aging strategy.
Optionally, the method further includes:
aiming at a first MAC address with a locally stored aging type of no-flow aging, detecting hit state information of the first MAC address when a sampling period of the first MAC address is reached, and receiving a first state notification message sent by the standby equipment, wherein the first state notification message carries the hit state information of the first MAC address detected by the standby equipment, and the hit state information indicates whether the current flow contains the first MAC address;
determining a hit result of the first MAC address according to the detected hit state information and the received hit state information;
sending a first state response message carrying a hit result of the first MAC address to the standby equipment, and updating the continuous miss times of the first MAC address according to the hit result;
and deleting the first MAC address when the continuous miss times reach a preset threshold value.
Optionally, the determining a hit result of the first MAC address according to the detected hit state information and the received hit state information includes:
if the hit state information indicating that the current flow contains the first MAC address does not exist in the detected hit state information and the received hit state information, determining that a hit result is not hit;
and if the hit state information indicating that the current flow contains the first MAC address exists in the detected hit state information and the received hit state information, determining that the hit result is hit.
Optionally, the updating the number of consecutive misses of the first MAC address according to the hit result includes:
adding 1 to the number of consecutive misses of the first MAC address when the hit result is a miss;
and when the hit result is hit, setting the number of continuous misses of the first MAC address to zero.
Optionally, the method further includes:
receiving an updating instruction of a second MAC address input by a user, wherein the updating instruction comprises updating state information of the MAC address, and the updating state information is an adding state or a deleting state;
and updating the second MAC address according to the updating instruction, and sending a second state notification message to the standby equipment, wherein the second state notification message carries the second MAC address and the updating state information.
Optionally, the method further includes:
when the synchronous MAC address of the standby equipment is received, the MAC address is stored in a preset temporary MAC address table;
and when the flow containing the third MAC address in the temporary MAC address table is detected, the third MAC address is issued to the driver.
In a second aspect, a method for synchronizing MAC addresses is provided, where the method is applied to a standby device in an M-LAG, and the M-LAG further includes a primary device, and the method includes:
sending a negotiation request message to the main device, wherein the negotiation request message carries the current configuration parameters of the standby device, so that the main device determines the configuration parameters after negotiation according to the received configuration parameters, the configuration parameters of the main device and the preset configuration parameter negotiation rules;
receiving a negotiation response message sent by a main device, wherein the negotiation response message carries the configuration parameters after negotiation;
and carrying out MAC address synchronization processing according to the negotiated configuration parameters.
Optionally, the configuration parameters include a global maximum MAC number, a maximum MAC number of each aggregation group, and an aging policy of each aggregation group.
Optionally, the method further includes:
aiming at a first MAC address with a locally stored aging type of no-flow aging, detecting hit state information of the first MAC address when a sampling period of the first MAC address is reached, wherein the hit state information indicates whether the current flow contains the first MAC address;
sending a first state notification message to the master device, wherein the first state notification message carries hit state information of the first MAC address;
receiving a first state response message sent by the master device, wherein the first state response message carries a hit result of the first MAC address;
updating the continuous miss times of the first MAC address according to the hit result;
and deleting the first MAC address when the continuous miss times reach a preset threshold value.
Optionally, the updating the number of consecutive misses of the first MAC address according to the hit result includes:
adding 1 to the number of consecutive misses of the first MAC address when the hit result is a miss;
and when the hit result is hit, setting the number of continuous misses of the first MAC address to zero.
Optionally, the method further includes:
receiving a second state notification message sent by the master device, wherein the second state notification message carries a second MAC address and update state information, and the update state information is an addition state or a deletion state;
and updating the second MAC address according to the updating state information of the second MAC address.
Optionally, the method further includes:
when the MAC address synchronized by the master equipment is received, storing the MAC address into a preset temporary MAC address table;
and when the flow containing the fourth MAC address in the temporary MAC address table is detected, the fourth MAC address is issued to the driver.
In a third aspect, an apparatus for synchronizing MAC addresses is provided, where the apparatus is applied to a master device in an M-LAG, and the M-LAG further includes a slave device, and the apparatus includes:
a first receiving module, configured to receive a negotiation request message sent by the standby device, where the negotiation request message carries a current configuration parameter of the standby device;
the first determining module is used for determining the negotiated configuration parameters according to the received configuration parameters, the local configuration parameters and the preset configuration parameter negotiation rules;
a first sending module, configured to store the negotiated configuration parameters, and send a negotiation response message to the standby device, where the negotiation response message carries the negotiated configuration parameters, so that the main device and the standby device perform MAC address synchronization according to the negotiated configuration parameters.
Optionally, the configuration parameters include a global maximum MAC number, a maximum MAC number of each aggregation group, and an aging policy of each aggregation group;
the first determining module is specifically configured to:
determining a first minimum value in the received global maximum MAC number and the local global maximum MAC number, and taking the first minimum value as the negotiated global maximum MAC number;
for each aggregation group, determining a second minimum value in the received maximum MAC number of the aggregation group and the locally preset maximum MAC number of the aggregation group, and taking the second minimum value as the negotiated maximum MAC number of the aggregation group;
and aiming at each aggregation group, taking the aging strategy of the aggregation group stored in the equipment as the negotiated aging strategy.
Optionally, the apparatus further comprises:
a second receiving module, configured to detect, for a locally stored first MAC address whose aging type is non-traffic aging, hit status information of the first MAC address when a sampling period of the first MAC address is reached, and receive a first status notification message sent by the standby device, where the first status notification message carries the hit status information of the first MAC address detected by the standby device, and the hit status information indicates whether a current traffic includes the first MAC address;
a second determining module, configured to determine a hit result of the first MAC address according to the detected hit status information and the received hit status information;
the updating module is used for sending a first state response message carrying a hit result of the first MAC address to the standby equipment and updating the continuous miss times of the first MAC address according to the hit result;
and the deleting module is used for deleting the first MAC address when the continuous miss times reach a preset threshold value.
Optionally, the second determining module is specifically configured to:
if the hit state information indicating that the current flow contains the first MAC address does not exist in the detected hit state information and the received hit state information, determining that a hit result is not hit;
and if the hit state information indicating that the current flow contains the first MAC address exists in the detected hit state information and the received hit state information, determining that the hit result is hit.
Optionally, the update module is specifically configured to:
adding 1 to the number of consecutive misses of the first MAC address when the hit result is a miss;
and when the hit result is hit, setting the number of continuous misses of the first MAC address to zero.
Optionally, the apparatus further comprises:
the third receiving module is used for receiving an updating instruction of a second MAC address input by a user, wherein the updating instruction comprises updating state information of the MAC address, and the updating state information is an adding state or a deleting state;
and the second sending module is configured to update the second MAC address according to the update instruction, and send a second status notification message to the standby device, where the second status notification message carries the second MAC address and update status information.
Optionally, the apparatus further comprises:
the storage module is used for storing the MAC address into a preset temporary MAC address table when the synchronous MAC address of the standby equipment is received;
and the issuing module is used for issuing the third MAC address to the driver when detecting the flow containing the third MAC address in the temporary MAC address table.
In a fourth aspect, an apparatus for synchronizing MAC addresses is provided, the apparatus being applied to a standby device in an M-LAG, the M-LAG further including a master device, the apparatus including:
a first sending module, configured to send a negotiation request message to the primary device, where the negotiation request message carries a current configuration parameter of the standby device, so that the primary device determines a negotiated configuration parameter according to the received configuration parameter, the configuration parameter of the primary device, and a preset configuration parameter negotiation rule;
a first receiving module, configured to receive a negotiation response message sent by a master device, where the negotiation response message carries the negotiated configuration parameters;
and the synchronization module is used for carrying out MAC address synchronization processing according to the negotiated configuration parameters.
Optionally, the configuration parameters include a global maximum MAC number, a maximum MAC number of each aggregation group, and an aging policy of each aggregation group.
Optionally, the apparatus further comprises:
the detection module is used for detecting hit state information of a first MAC address when a sampling period of the first MAC address is reached, wherein the locally stored first MAC address is aged without flow, and the hit state information indicates whether the current flow contains the first MAC address;
a second sending module, configured to send a first status notification packet to the master device, where the first status notification packet carries hit status information of the first MAC address;
a second receiving module, configured to receive a first status response packet sent by the master device, where the first status response packet carries a hit result of the first MAC address;
the first updating module is used for updating the continuous miss times of the first MAC address according to the hit result;
and the deleting module is used for deleting the first MAC address when the continuous miss times reach a preset threshold value.
Optionally, the first updating module is specifically configured to:
adding 1 to the number of consecutive misses of the first MAC address when the hit result is a miss;
and when the hit result is hit, setting the number of continuous misses of the first MAC address to zero.
Optionally, the apparatus further comprises:
a third receiving module, configured to receive a second status notification message sent by the master device, where the second status notification message carries a second MAC address and update status information, and the update status information is an add status or a delete status;
and the second updating module is used for updating the second MAC address according to the updating state information of the second MAC address.
Optionally, the apparatus further comprises:
the storage module is used for storing the MAC address into a preset temporary MAC address table when the MAC address synchronized by the master equipment is received;
and the issuing module is used for issuing the fourth MAC address to the driver when the flow containing the fourth MAC address in the temporary MAC address table is detected.
In a fifth aspect, a network device is provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of the first or second aspects when executing a program stored in the memory.
A sixth aspect provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method steps of any one of the first or second aspects.
In a seventh aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method steps of any of the first or second aspects described above.
Therefore, by applying the method for synchronizing MAC addresses, the network device, and the computer-readable storage medium provided in the embodiments of the present application, the master device receives a negotiation request message sent by the standby device. The negotiation request message carries the current configuration parameters of the standby device. And then, the main equipment determines the negotiated configuration parameters according to the received configuration parameters, the local configuration parameters and the preset configuration parameter negotiation rules. And then, the main equipment stores the configuration parameters after negotiation and sends a negotiation response message to the standby equipment. The negotiation response message carries the negotiated configuration parameters, so that the main device and the standby device perform MAC address synchronization according to the negotiated configuration parameters. Therefore, the main equipment and the standby equipment can ensure the consistency of the configuration information, and the success rate of synchronizing the MAC addresses is improved.
Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is an architecture diagram of a network system according to an embodiment of the present application;
fig. 2 is a flowchart of a method for synchronizing MAC addresses according to an embodiment of the present disclosure;
fig. 3 is a flowchart of a method for synchronizing MAC addresses according to an embodiment of the present disclosure;
fig. 4 is a flowchart of a method for MAC address non-traffic aging according to an embodiment of the present application;
fig. 5 is a flowchart of a method for MAC address non-traffic aging according to an embodiment of the present application;
fig. 6 is a flowchart of a method for statically updating a MAC address according to an embodiment of the present disclosure;
fig. 7 is a flowchart of a method for statically updating a MAC address according to an embodiment of the present disclosure;
fig. 8 is a flowchart of a method for synchronizing MAC addresses according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of an apparatus for synchronizing MAC addresses according to an embodiment of the present disclosure;
fig. 10 is a schematic structural diagram of an apparatus for synchronizing MAC addresses according to an embodiment of the present disclosure;
fig. 11 is a schematic structural diagram of a network device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and 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 application.
The embodiment of the application provides a method for synchronizing MAC addresses, which may be applied to a network device supporting an M-LAG technology in a network system, where the MAC addresses synchronized by the network device may be MAC addresses that pass security authentication (i.e., secure MAC addresses). The network device may be a router, a switch, etc. A technician may aggregate interfaces on multiple network devices across device links via M-LAG techniques to improve link reliability. Meanwhile, a technician can set one of the network devices as a master device and set the other network devices as standby devices.
Fig. 1 is an architecture diagram of a network system according to an embodiment of the present application. As shown in fig. 1, the network system includes a first network device, a second network device, a third network device, and a fourth network device. Wherein the first network device and the second network device may constitute an M-LAG. The technician creates an aggregation group 1, an aggregation group 2, and an aggregation group 3 in the first network device and the second network device, respectively, creates an aggregation group 2 in the third network device, and creates an aggregation group 3 in the fourth network device. Then, the technician adds the first interface and the second interface of the first network device, and the third interface and the fourth interface of the second network device to the aggregation group 1, adds the fifth interface of the first network device and the seventh interface of the second network device to the aggregation group 2, adds the sixth interface of the first network device and the eighth interface of the second network device to the aggregation group 3, adds the ninth interface and the tenth interface of the third network device to the aggregation group 2, and adds the eleventh interface and the twelfth interface of the fourth network device to the aggregation group 3. The technician also configures configuration information of the first network device and the second network device, respectively, such as, for example, a maximum MAC number of each aggregation group and an aging policy of each aggregation group.
A method for synchronizing MAC addresses provided in the embodiments of the present application will be described in detail below with reference to specific embodiments, and for convenience of understanding, a specific processing procedure of the standby device is first described. As shown in fig. 2, the specific steps are as follows.
Step 201, sending a negotiation request message to the master device.
The negotiation request message carries the current configuration parameters of the standby device, so that the main device determines the negotiated configuration parameters according to the received configuration parameters, the configuration parameters of the main device and the preset configuration parameter negotiation rules. The configuration parameters may include a global maximum MAC number, a maximum MAC number of the aggregation group, an aging policy, and the like.
In implementation, when a technician enables a secure MAC synchronization function in an aggregation interface of a certain aggregation group of the standby device or modifies a configuration parameter corresponding to the aggregation group, the standby device may actively send a negotiation request message to the main device, and the main device may receive the negotiation request message. The negotiation request message carries current configuration parameters of the standby equipment, the configuration parameters comprise global configuration parameters and current configuration parameters of the aggregation groups, and if a plurality of aggregation groups exist in the standby equipment, the negotiation request message can carry the current configuration parameters of the aggregation groups. Optionally, for a case where multiple standby devices exist, after the multiple standby devices are online and the secure MAC synchronization function is enabled, the master device may receive multiple negotiation request messages.
The main device may determine the negotiated configuration parameters according to the received configuration parameters, the configuration parameters in the main device, and the preset configuration parameter negotiation rules. The specific processing procedure for determining the negotiated configuration parameters by the master device will be described in detail later, and details thereof are not described here.
Optionally, the configuration parameters carried in the negotiation request packet may include current configuration parameters of multiple aggregation groups. After receiving the negotiation request message, the master device may determine, for each aggregation group, the negotiated configuration parameters of the aggregation group according to the received configuration parameters of the aggregation group, the configuration parameters of the aggregation group in the master device, and a preset configuration parameter negotiation rule. In the embodiment of the present application, the configuration parameters carried in the negotiation request message include configuration parameters of an aggregation group as an example, and other situations are similar to the above.
Optionally, the configuration parameters may include a global maximum MAC number, a maximum MAC number of the aggregation group, and an aging policy.
In an implementation, the aging policies may include globally supported aging types (such as no aging type, absolute time aging type, no traffic aging type, etc.), aggregation group supported aging types, and aggregation group used aging types. The aging policy also includes an aging duration for the aggregation group if the aging type used by the aggregation group is an absolute duration aging type. If the aging type used by the aggregation group is a no-traffic aging type, the aging strategy further comprises an aging time of the aggregation group and a sampling period of the aggregation group.
In a possible implementation manner, the negotiation request packet may include a packet type (MSG) field, a packet length (MSGlength) field, a packet sequence number (MSGnum) field, a global maximum secure MAC number (total max secure-MAC count) field, a globally supported aging type (aging-type support) field, an aggregation group identity (group identity) field, an aging type (aging-type) field used by an aggregation group, an aging time (aging-value) field of the aggregation group, and a sampling period (aging-interval) field of the aggregation group. In addition, the negotiation request message may further include other fields (such as a device identification field), which is not limited in this embodiment. As shown in table one, an example of a negotiation request message provided in the embodiment of the present application is provided.
Watch 1
Figure BDA0002003815470000121
Step 202, receiving a negotiation response message sent by the master device.
And the negotiation response message carries the negotiated configuration parameters.
In implementation, the primary device may send a negotiation response message of the configuration parameters to the standby device after determining the negotiated configuration parameters according to the received configuration parameters, the configuration parameters of the primary device, and the preset configuration parameter negotiation rules. And the negotiation response message carries the negotiated configuration parameters. After receiving the negotiation response message, the standby device may parse the negotiation response message to obtain the negotiated configuration parameters carried in the negotiation response message.
Step 203, performing MAC address synchronization processing according to the negotiated configuration parameters.
In implementation, after obtaining the negotiated configuration parameters carried in the negotiation response message, the standby device may modify the local configuration parameters into the negotiated configuration parameters, so as to perform MAC address synchronization processing and MAC address aging processing according to the negotiated configuration parameters. In this way, the configuration parameters in the standby device and the main device can be kept consistent, thereby preventing various problems caused by inconsistent configuration parameters in the MAC address synchronization processing process.
Optionally, when the primary device detects that the configuration parameter of the primary device changes, the primary device may also send a notification message to the standby device, where the notification message is used to instruct the standby device to perform negotiation processing of the configuration parameter. After receiving the notification message, the standby device may execute step 201 to send a negotiation request message to the primary device,
the embodiment of the application also provides a method for synchronizing the MAC address, which is applied to the main equipment. As shown in fig. 3, the specific steps are as follows.
Step 301, receiving a negotiation request message sent by the standby device.
The negotiation request message carries the current configuration parameters of the standby device.
In implementation, when a technician enables a secure MAC synchronization function in an aggregation interface of a certain aggregation group of the standby device, or modifies a configuration parameter corresponding to the aggregation group, the standby device may send a negotiation request message to the main device, or the standby device may send a negotiation request message to the main device after receiving a notification message sent by the main device. Wherein, the negotiation request message carries the current configuration parameters of the standby device. Wherein the configuration parameters include a global configuration parameter and the configuration parameters of the aggregation group. After receiving the negotiation request message, the master device may parse the negotiation request message to obtain the current configuration parameters of the standby device carried in the negotiation request message.
Step 302, determining the negotiated configuration parameters according to the received configuration parameters, the local configuration parameters and the preset configuration parameter negotiation rules.
In implementation, the master device may store a configuration parameter negotiation rule in advance, and the configuration parameter negotiation rule may be set by a technician according to experience. After the master device obtains the current configuration parameters of the standby device carried in the negotiation request message, the master device may determine the negotiated configuration parameters according to the configuration parameters of the standby device, the locally preset configuration parameters, and the preset configuration parameter negotiation rules.
Optionally, for a case that the configuration parameters include the global maximum MAC number, the maximum MAC number of each aggregation group, and the aging policy of each aggregation group, the specific processing procedure of the master device for determining the negotiated configuration parameters is as follows: determining a first minimum value in the received global maximum MAC number and the local global maximum MAC number, and taking the first minimum value as the negotiated global maximum MAC number; for each aggregation group, determining a second minimum value in the received maximum MAC number of the aggregation group and the locally preset maximum MAC number of the aggregation group, and taking the second minimum value as the negotiated maximum MAC number of the aggregation group; and aiming at each aggregation group, taking the aging strategy of the aggregation group stored in the equipment as the negotiated aging strategy.
The parameters of the aging policy may include globally supported aging types (such as no aging type, absolute time aging type, no traffic aging type, etc.), aggregation group supported aging types, and aggregation group used aging types. If the aging type used by the aggregation group is an absolute time duration aging type, the parameters of the aging policy further include an aging time duration of the aggregation group. If the aging type used by the aggregation group is a no-traffic aging type, the parameters of the aging strategy further comprise the aging time of the aggregation group and the sampling period of the aggregation group.
In implementation, after the main device obtains the current configuration parameters and the local configuration parameters of the standby device, for the global maximum MAC number, the main device may determine a first minimum value in the global maximum MAC number and a locally preset global maximum MAC number of the standby device, and use the first minimum value as the negotiated global maximum MAC number. For example, if the global maximum MAC number of the slave device is 10000 and the global maximum MAC number configured in the master device is 9500, the negotiated global maximum MAC number is 9500.
For each aggregation group, the master device may determine the second minimum value from the maximum MAC number of the aggregation group of the standby device and the maximum MAC number of the aggregation group configured in the present device. Then, the second minimum value is used as the negotiated maximum MAC number of the aggregation group. For example, if the maximum MAC number of the aggregation group 2 of the standby device is 2000, and the maximum MAC number of the aggregation group 2 configured in the master device is 3000, the negotiated maximum MAC number of the aggregation group 2 is 2000.
For each aggregation group, the master device may use the aging policy of the aggregation group stored in the device as the negotiated aging policy of the aggregation group. For example, for the aggregation group 2, the configured aging type in the standby equipment is no-flow aging, the aging time is 10 minutes, and the sampling period is 1 minute; if the aging type configured in the master device is an absolute time aging type and the aging time is 20 minutes, the negotiated aging type of the aggregation group 2 is the absolute time aging type and the negotiated aging time is 20 minutes.
Optionally, the master device may further store priorities of the aging types in advance. Wherein the priority of each aging type can be set by a technician empirically. For example, the priority of the non-aging type is 1, the priority of the absolute time aging type is 2, the priority of the no-traffic aging type is 3, and the larger the value of the priority is, the higher the priority is. For each aggregation group, the master device may select an aging type with the highest priority from the aging types of the aggregation group supported by both the master device and the standby device, as the aging type of the aggregation group after negotiation, and use the aging time and the sampling period of the aggregation group stored in the present device as the aging time and the sampling period of the aggregation group after negotiation.
For example, for aggregation group 2, the aging types supported by the master device are a no-aging type, an absolute time aging type, and a no-traffic aging type, the aging type currently used by the master device is a no-traffic aging type, the aging time is 10 minutes, and the sampling period is 2 minutes. The aging types supported by the standby equipment are an absolute time aging type and a no-flow aging type, the aging type currently used by the main equipment is the no-flow aging type, the aging time is 20 minutes, and the sampling period is 1 minute. For the aggregation group 2, of the aging types (i.e., the absolute time aging type and the no-traffic aging type) supported by both the master device and the standby device, the aging type with the highest priority is the no-traffic aging type, that is, the aging type of the negotiated aggregation group 2 is the no-traffic aging type, the aging time is 10 minutes, and the sampling period is 2 minutes.
Step 303, storing the negotiated configuration parameters, and sending a negotiation response message of the configuration parameters to the standby device.
And the negotiation response message carries the negotiated configuration parameters.
In implementation, after the main device determines the negotiated configuration parameters, the negotiated configuration parameters may be stored in the storage device, and a negotiation response packet carrying the negotiated configuration parameters is sent to the standby device, so that the main device and the standby device may perform MAC address synchronization processing and MAC address aging processing according to the negotiated configuration parameters. The message format of the negotiation response message may be the same as or different from the message format of the negotiation request message, and the embodiments of the present application are not limited. Based on the above processing, the configuration parameters of the master device and the standby device can be kept consistent, thereby preventing problems caused by inconsistent configuration parameters during the MAC address synchronization processing.
Optionally, if the master device does not receive the negotiation request packet sent by the standby device through the aggregation interface of a certain aggregation group, the master device may determine that the aggregation interface of the aggregation group of the standby device does not enable the secure MAC synchronization function. Accordingly, after determining the negotiated configuration parameters, the master device does not need to send a negotiation response message carrying the negotiated configuration parameters to the standby device.
Based on the method for synchronizing the MAC address provided by the embodiment, the embodiment of the application also provides a method for aging the MAC address without flow, and the method can be applied to standby equipment. As shown in fig. 4, the specific steps are as follows.
Step 401, for a first MAC address whose aging type is no-traffic aging, when a sampling period of the first MAC address is reached, hit state information of the first MAC address is detected.
The hit state information indicates whether the current traffic contains the first MAC address.
In implementation, for a first MAC address whose aging type is a no-traffic aging type, the standby device may periodically detect whether the current traffic includes the first MAC address according to a sampling period corresponding to the no-traffic aging type, so as to obtain hit state information of the first MAC address. And if the current flow contains the first MAC address, determining that the hit state information of the first MAC address is a hit state. And if the current flow does not contain the first MAC address, determining that the hit state information of the first MAC address is in a miss state.
Step 402, a first status notification message is sent to the master device.
The first state notification message carries hit state information of the first MAC address.
In implementation, after obtaining the hit state information of the first MAC address, the standby device may generate a state advertisement message (i.e., a first state advertisement message) including the first MAC address and the hit state information, and then the standby device may send the first state advertisement message to the main device.
In a feasible implementation manner, the first state advertisement packet may include a packet type (MSG type) field, a packet length (MSG length) field, a security MAC (secure MAC) field, a group identity (group identity) field, a security MAC (secure MAC) Virtual Local Area Network (VLAN) identity field, a priority (priority) field, and a security MAC state (secure MAC state) field. Wherein the secure MAC state field includes a miss state, a hit state, an add state, and a delete state. In addition, the first status notification message may further include other fields (such as a device identification field, etc.), which is not limited in this embodiment of the present application. As shown in table two, an example of a status notification message provided in the embodiment of the present application is provided.
Watch two
Figure BDA0002003815470000161
Figure BDA0002003815470000171
The states added and deleted in the secure MAC VLAN id field, the priority field, and the secure MAC state field are used for MAC address static update and MAC address synchronization, and the specific process will be described in detail later.
Step 403, receiving a first status response message sent by the master device.
The first status response message carries a hit result of the first MAC address.
In implementation, the master device may also obtain the hit status information of the first MAC address, and after receiving a first status notification message that carries the hit status information of the first MAC address and is sent by each of the standby devices, determine a hit result of the first MAC address according to each of the hit status information corresponding to the first MAC address. Then, the master device may send a first status response packet carrying a hit result of the first MAC address to the standby device. The main device determines a specific processing procedure of the hit result of the first MAC address according to each hit state information, and details will be described later.
After receiving the first status response message sent by the master device, the standby device may analyze the first status response message to obtain a hit result of the first MAC address carried in the first status response message.
In step 404, the number of consecutive misses of the first MAC address is updated according to the hit result.
In an implementation, a counter for recording the number of consecutive misses of the first MAC address may be started in the standby device. After the standby device obtains the hit result of the first MAC address carried in the first state response packet, the number of consecutive misses of the first MAC address may be updated according to the hit result.
Optionally, the processing procedure of the standby device updating the number of consecutive misses of the first MAC address according to the hit result is as follows: when the hit result is miss, adding 1 to the current continuous miss times of the first MAC address; when the hit result is a hit, the number of consecutive misses of the first MAC address is set to zero.
In implementation, if the hit result of the first MAC address is a miss, it indicates that the traffic of the master device and the standby device does not include the first MAC address, and the standby device may add 1 to the current number of consecutive misses of the first MAC address. If the hit result of the first MAC address is a hit, it indicates that the traffic of at least one of the master device and the standby device includes the first MAC address, and the standby device may set the current consecutive number of times of the first MAC address miss to zero.
And step 405, deleting the first MAC address when the number of continuous misses reaches a preset threshold.
In implementation, a preset threshold corresponding to the number of consecutive misses of the first MAC address may be stored in advance in the standby device, and the threshold may be set by a technician or may be a ratio of an aging time corresponding to the first MAC address to a sampling period.
For example, if the aging time corresponding to the first MAC address is 10 minutes and the sampling period is 1 minute, the preset threshold value is (10/1) ═ 10. When the number of consecutive misses of the first MAC address reaches 10 times, the standby device determines that the first MAC address needs to be aged, and the standby device may delete the first MAC address.
Thus, based on the above processing procedure, no-flow aging of the secure MAC can be achieved.
The embodiment of the application also provides a method for MAC address non-flow aging, which is applied to the main equipment. As shown in fig. 5, the specific steps are as follows.
Step 501, for a first MAC address with an aging type of no-traffic aging, when a sampling period of the first MAC address is reached, detecting hit state information of the first MAC address, and receiving a first state notification message sent by a standby device.
The first status notification message carries hit status information of the first MAC address detected by the standby device, where the hit status information indicates whether the current traffic includes the first MAC address.
In implementation, for a first MAC address whose aging type is a no-traffic aging type, the master device may periodically detect whether the current traffic includes the first MAC address according to a sampling period corresponding to the no-traffic aging type, so as to obtain hit state information of the first MAC address. And if the current flow contains the first MAC address, determining that the hit state information of the first MAC address is a hit state. And if the current flow does not contain the first MAC address, determining that the hit state information of the first MAC address is in a miss state.
Meanwhile, the main device can also receive a first state notification message sent by the standby device. After receiving the first state notification message, the master device may analyze the first state notification message to obtain hit state information of the first MAC address detected by the standby device.
Step 502, determining a hit result of the first MAC address according to the detected hit status information and the received hit status information.
In implementation, after the master device detects the hit status information of the first MAC address and receives the hit status information of the first MAC address sent by each slave device, it may further determine whether there is a traffic hit of a certain device on the first MAC address.
Optionally, the specific processing procedure of the master device determining the hit result of the first MAC address is as follows: and if the hit state information which indicates that the current flow contains the first MAC address does not exist in the detected hit state information and the received hit state information, determining that the hit result is not hit. And if the hit state information indicating that the current flow contains the first MAC address exists in the detected hit state information and the received hit state information, determining that the hit result is hit.
In implementation, if there is no hit status information indicating that the current traffic includes the first MAC address (i.e., all the hit status information is in a miss status), in the detected hit status information and the received hit status information, it is determined that the hit result of the first MAC address is a miss. If there is hit state information indicating that the current traffic contains the first MAC address in the detected hit state information and the received hit state information (i.e., there is at least one hit state information as a hit state in all the hit state information), it is determined that the hit result of the first MAC address is a hit.
Step 503, sending a first status response packet carrying the hit result of the first MAC address to the standby device, and updating the number of consecutive misses of the first MAC address according to the hit result.
In implementation, after determining the hit result of the first MAC address, the master device may send a first status response packet carrying the hit result of the first MAC address to the standby device. The message format of the first status response message may be the same as the message format of the first status notification message.
Meanwhile, the master device may update the number of consecutive misses of the first MAC address according to a hit result of the first MAC address.
Optionally, the specific process of the master device updating the number of consecutive misses of the first MAC address according to the hit result of the first MAC address includes: and when the hit result is a miss, adding 1 to the current continuous miss times of the first MAC address. When the hit result is a hit, the number of consecutive misses of the first MAC address is set to zero.
In implementation, if the hit result of the first MAC address is a miss, it indicates that the master device determines that the traffic of the master device and the traffic of the standby device do not include the first MAC address, and the master device may add 1 to the current number of consecutive misses of the first MAC address. If the hit result of the first MAC address is a hit, it indicates that the master device determines that the traffic of at least one of the master device and the standby device includes the first MAC address, and the master device may set the current consecutive number of times of the first MAC address miss to zero.
And step 504, deleting the first MAC address when the number of continuous misses reaches a preset threshold value.
In implementation, a preset threshold corresponding to the number of consecutive misses of the first MAC address may be stored in the master device in advance, and the threshold may be set by a technician according to experience, or may be a ratio of an aging time corresponding to the first MAC address to a sampling period.
For example, if the aging time corresponding to the first MAC address is 10 minutes and the sampling period is 1 minute, the preset threshold value is (10/1) ═ 10. When the number of consecutive misses of the first MAC address reaches 10 times, the master determines that the first MAC address needs to be aged, and the master may delete the first MAC address.
Thus, based on the above processing procedure, no-flow aging of the secure MAC can be achieved.
The embodiment of the application also provides a method for statically updating the MAC address, which is applied to the main equipment. As shown in fig. 6, the specific steps are as follows.
Step 601, receiving an update instruction of the second MAC address input by the user.
In an implementation, the user may statically add or delete a secure MAC address (i.e., a second MAC address) directly in an aggregation interface of a certain aggregation group of the master device. Accordingly, the master device may receive an update instruction of the second MAC address input by the user. The updating instruction comprises updating state information of the MAC address, and the updating state information is an adding state or a deleting state.
Step 602, update the second MAC address according to the update instruction, and send a second status notification packet to the standby device.
And the second state notification message carries a second MAC address and update state information.
In implementation, after receiving an update instruction of the second MAC address input by the user, the master device may perform update processing on the second MAC address according to update state information in the update instruction. For example, when the update status information is in the add status, the master device may locally store the second MAC address, and when the update status information is in the delete status, the master device may search the locally stored MAC address for the second MAC address and then delete the second MAC address. In addition, the master device may further generate a second status notification message including the second MAC address and the updated status information, and then send the second status notification message to the standby device. The message format of the second state notification message is the same as the message format of the first state notification message.
Optionally, when the user directly adds or deletes the second MAC address in the aggregation interface of a certain aggregation group of a certain standby device, the standby device may send a third status notification packet carrying the update status information of the second MAC address to the main device. After receiving the third status notification message sent by the standby device, the master device may update the update status information in the third status notification message to update the second MAC address, and may also send the third status notification message to other standby devices. And the third status notification message carries the second MAC address and the updated status information.
In this way, devices in the M-LAG may also achieve automatic synchronization when a user manually adds or deletes MAC addresses.
The embodiment of the application also provides a method for statically updating the MAC address, and the method is applied to standby equipment. As shown in fig. 7, the specific steps are as follows.
Step 701, receiving a second status notification message sent by the master device.
The second status notification message carries a second MAC address and update status information, and the update status information is an add status or a delete status.
In implementation, the standby device receives the second status notification message sent by the main device. The second status notification message carries a second MAC address and update status information, and the update status information is an add status or a delete status. After receiving the second state notification message sent by the master device, the standby device may analyze the second state notification message to obtain a second MAC address and updated state information carried in the second state notification message.
Step 702, update the second MAC address according to the update status information of the second MAC address.
In implementation, after the standby device obtains the second MAC address and the updated state information carried in the second state notification packet, the standby device may update the second MAC address according to the updated state information.
In this way, devices in the M-LAG may also achieve automatic synchronization when a user manually adds or deletes MAC addresses.
The embodiment of the application also provides another MAC address synchronization method, which is applied to the main equipment or the standby equipment. In the embodiment of the present application, the MAC address synchronized by the master device is taken as an example for explanation, and as shown in fig. 8, the specific steps are as follows.
Step 801, when receiving a synchronous MAC address of the standby device, storing the MAC address in a preset temporary MAC address table.
In implementation, the master device may store a temporary MAC address table in advance. The temporary MAC address table may be a software table including a secure MAC (secure MAC) field, an interface index (interface index) field, a priority (priority) field, a secure MAC (secure MAC) VLAN identification field, an aging-type (aging-type) field used by a secure MAC, an aging-time (aging-value) field of a secure MAC, a sampling-period (aging-interval) field of a secure MAC, a number of consecutive times of miss (unhitnum) field, and a status (state) field. Wherein, the status field may indicate an undelivered status, a delivery successful status, and a delivery failed status. As shown in table three, an example of a temporary MAC address table provided in the embodiment of the present application is shown.
Watch III
Figure BDA0002003815470000221
Figure BDA0002003815470000231
When the master device receives the synchronous MAC address of the standby device, the MAC address may be stored in the temporary MAC address table, and the state corresponding to the MAC address is set to be undelivered.
Step 802, when detecting a traffic containing a third MAC address in the temporary MAC address table, issuing the third MAC address to the driver.
In an implementation, when the master device detects traffic containing a third MAC address in the temporary MAC address table, the third MAC address may be issued to the driver. If the delivery is successful, the status field corresponding to the third MAC address is set to 1 (i.e., the delivery is successful), and if the delivery is failed, the status field corresponding to the third MAC address is set to 2 (i.e., the delivery is failed).
Optionally, when multiple MAC addresses are issued to the driver at the same time, the master device may issue the MAC address with the higher priority to the driver preferentially according to the priority of the MAC address. In addition, when the master device synchronizes the MAC address in the temporary MAC table to the standby device, the MAC address with a higher priority may be preferentially synchronized to the standby device according to the priority of the MAC address.
In the embodiment of the present application, the processing procedure when the standby device receives the MAC address synchronized with the master device is similar to that described above, and details are not repeated in the embodiment of the present application.
Based on the above processing procedure, the device establishes a temporary MAC address table (i.e. a software table), sets the priority of the MAC addresses, and after receiving the synchronized MAC addresses, the device stores the MAC addresses in the software table, and then preferentially sends a part of the MAC addresses to the driver according to the above procedure, so that the important MAC addresses can be preferentially synchronized, and normal forwarding of network traffic is ensured. Moreover, based on the above process, even if the MAC address to be synchronized exceeds the threshold set in the driver (for example, the maximum MAC number of the global or the maximum MAC number of the aggregation group), the MAC address can be stored in the software table without being lost, and waits for the next delivery of the driver, thereby improving the success rate of MAC address synchronization.
Based on the same technical concept, as shown in fig. 9, an embodiment of the present application further provides an apparatus for synchronizing MAC addresses, where the apparatus is applied to a master device in an M-LAG, and the M-LAG further includes a slave device, and the apparatus includes:
a first receiving module 910, configured to receive a negotiation request message sent by a standby device, where the negotiation request message carries current configuration parameters of the standby device;
a first determining module 920, configured to determine a negotiated configuration parameter according to the received configuration parameter, a local configuration parameter, and a preset configuration parameter negotiation rule;
the first sending module 930 is configured to store the negotiated configuration parameters, and send a negotiation response message to the standby device, where the negotiation response message carries the negotiated configuration parameters, so that the master device and the standby device perform MAC address synchronization according to the negotiated configuration parameters.
Optionally, the configuration parameters include a global maximum MAC number, a maximum MAC number of each aggregation group, and an aging policy of each aggregation group;
the first determining module 920 is specifically configured to:
determining a first minimum value in the received global maximum MAC number and the local global maximum MAC number, and taking the first minimum value as the negotiated global maximum MAC number;
for each aggregation group, determining a second minimum value in the received maximum MAC number of the aggregation group and the locally preset maximum MAC number of the aggregation group, and taking the second minimum value as the negotiated maximum MAC number of the aggregation group;
and aiming at each aggregation group, taking the aging strategy of the aggregation group stored in the equipment as the negotiated aging strategy.
Optionally, the apparatus further comprises:
the second receiving module is used for detecting the hit state information of the first MAC address when the sampling period of the first MAC address is reached, and receiving a first state notification message sent by the standby equipment, wherein the first state notification message carries the hit state information of the first MAC address detected by the standby equipment, and the hit state information indicates whether the current flow contains the first MAC address or not;
the second determining module is used for determining a hit result of the first MAC address according to the detected hit state information and the received hit state information;
the updating module is used for sending a first state response message carrying a hit result of the first MAC address to the standby equipment and updating the continuous miss times of the first MAC address according to the hit result;
and the deleting module is used for deleting the first MAC address when the continuous miss times reach a preset threshold value.
Optionally, the second determining module is specifically configured to:
if the hit state information indicating that the current flow contains the first MAC address does not exist in the detected hit state information and the received hit state information, determining that the hit result is not hit;
and if the hit state information indicating that the current flow contains the first MAC address exists in the detected hit state information and the received hit state information, determining that the hit result is hit.
Optionally, the update module is specifically configured to:
adding 1 to the number of consecutive misses of the first MAC address when the hit result is a miss;
when the hit result is a hit, the number of consecutive misses of the first MAC address is set to zero.
Optionally, the apparatus further comprises:
the third receiving module is used for receiving an updating instruction of the second MAC address input by a user, wherein the updating instruction comprises updating state information of the MAC address, and the updating state information is an adding state or a deleting state;
and the second sending module is used for updating the second MAC address according to the updating instruction and sending a second state notification message to the standby equipment, wherein the second state notification message carries the second MAC address and the updating state information.
Optionally, the apparatus further comprises:
the storage module is used for storing the MAC address into a preset temporary MAC address table when the MAC address synchronized by the standby equipment is received;
and the issuing module is used for issuing the third MAC address to the driver when detecting the flow containing the third MAC address in the temporary MAC address table.
Based on the same technical concept, as shown in fig. 10, an embodiment of the present application further provides an apparatus for synchronizing MAC addresses, where the apparatus is applied to a standby device in an M-LAG, and the M-LAG further includes a primary device, and the apparatus includes:
a first sending module 1010, configured to send a negotiation request message to a primary device, where the negotiation request message carries current configuration parameters of a standby device, so that the primary device determines negotiated configuration parameters according to the received configuration parameters, the configuration parameters of the primary device, and a preset configuration parameter negotiation rule;
a first receiving module 1020, configured to receive a negotiation response message sent by a master device, where the negotiation response message carries a negotiated configuration parameter;
and a synchronization module 1030, configured to perform MAC address synchronization according to the negotiated configuration parameters.
Optionally, the configuration parameters include a global maximum MAC number, a maximum MAC number of each aggregation group, and an aging policy of each aggregation group.
Optionally, the apparatus further comprises:
the detection module is used for detecting hit state information of the first MAC address when the sampling period of the first MAC address is reached aiming at the locally stored first MAC address with the aging type of no-flow aging, wherein the hit state information indicates whether the current flow contains the first MAC address;
the second sending module is used for sending a first state notification message to the main equipment, wherein the first state notification message carries hit state information of the first MAC address;
the second receiving module is used for receiving a first state response message sent by the main device, wherein the first state response message carries a hit result of the first MAC address;
the first updating module is used for updating the continuous miss times of the first MAC address according to the hit result;
and the deleting module is used for deleting the first MAC address when the continuous miss times reach a preset threshold value.
Optionally, the first updating module is specifically configured to:
adding 1 to the number of consecutive misses of the first MAC address when the hit result is a miss;
when the hit result is a hit, the number of consecutive misses of the first MAC address is set to zero.
Optionally, the apparatus further comprises:
a third receiving module, configured to receive a second status notification message sent by the master device, where the second status notification message carries a second MAC address and update status information, and the update status information is an add status or a delete status;
and the second updating module is used for updating the second MAC address according to the updating state information of the second MAC address.
Optionally, the apparatus further comprises:
the storage module is used for storing the MAC address into a preset temporary MAC address table when the MAC address synchronized by the master equipment is received;
and the issuing module is used for issuing the fourth MAC address to the driver when the flow containing the fourth MAC address in the temporary MAC address table is detected.
According to the device for synchronizing the MAC addresses, the main equipment receives a negotiation request message sent by the standby equipment. The negotiation request message carries the current configuration parameters of the standby device. And then, the main equipment determines the negotiated configuration parameters according to the received configuration parameters, the local configuration parameters and the preset configuration parameter negotiation rules. And then, the main equipment stores the configuration parameters after negotiation and sends a negotiation response message to the standby equipment. The negotiation response message carries the negotiated configuration parameters, so that the main device and the standby device perform MAC address synchronization according to the negotiated configuration parameters. Therefore, the main equipment and the standby equipment can ensure the consistency of the configuration information and improve the success rate of synchronizing the MAC addresses.
The embodiment of the present application further provides a network device, as shown in fig. 11, including a processor 1101, a communication interface 1102, a memory 1103, and a communication bus 1104, where the processor 1101, the communication interface 1102, and the memory 1103 complete mutual communication through the communication bus 1104,
a memory 1103 for storing a computer program;
the processor 1101 is configured to implement a method for synchronizing MAC addresses executed by the host device or a method for synchronizing MAC addresses executed by the standby device when executing a program stored in the memory 1103.
The communication bus mentioned in the network device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the network device and other devices.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, or discrete hardware components.
Based on the same technical concept, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the above method steps for synchronizing MAC addresses.
Based on the same technical concept, embodiments of the present application further provide a computer program product containing instructions, which when run on a computer, causes the computer to execute any one of the above methods for synchronizing MAC addresses.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (14)

1. A method for synchronizing MAC addresses, the method being applied to a master device in a cross-device link aggregation group (M-LAG), the M-LAG further comprising a slave device, the method comprising:
receiving a negotiation request message sent by the standby equipment, wherein the negotiation request message carries the current configuration parameters of the standby equipment; the configuration parameters comprise a global maximum MAC number, a maximum MAC number of each aggregation group and an aging strategy of each aggregation group;
determining the negotiated configuration parameters according to the received configuration parameters, the local configuration parameters and the preset configuration parameter negotiation rules;
and storing the negotiated configuration parameters and sending a negotiation response message to the standby device, wherein the negotiation response message carries the negotiated configuration parameters, so that the main device and the standby device perform Media Access Control (MAC) address synchronization processing according to the negotiated configuration parameters.
2. The method of claim 1, wherein determining the negotiated configuration parameters according to the received configuration parameters, the local configuration parameters, and a preset configuration parameter negotiation rule comprises:
determining a first minimum value in the received global maximum MAC number and the local global maximum MAC number, and taking the first minimum value as the negotiated global maximum MAC number;
for each aggregation group, determining a second minimum value in the received maximum MAC number of the aggregation group and the locally preset maximum MAC number of the aggregation group, and taking the second minimum value as the negotiated maximum MAC number of the aggregation group;
and aiming at each aggregation group, taking the aging strategy of the aggregation group stored in the equipment as the negotiated aging strategy.
3. The method of claim 1, further comprising:
aiming at a first MAC address with a locally stored aging type of no-flow aging, detecting hit state information of the first MAC address when a sampling period of the first MAC address is reached, and receiving a first state notification message sent by the standby equipment, wherein the first state notification message carries the hit state information of the first MAC address detected by the standby equipment, and the hit state information indicates whether the current flow contains the first MAC address;
determining a hit result of the first MAC address according to the detected hit state information and the received hit state information;
sending a first state response message carrying a hit result of the first MAC address to the standby equipment, and updating the continuous miss times of the first MAC address according to the hit result;
and deleting the first MAC address when the continuous miss times reach a preset threshold value.
4. The method of claim 3, wherein determining the hit for the first MAC address based on the detected hit status information and the received hit status information comprises:
if the hit state information indicating that the current flow contains the first MAC address does not exist in the detected hit state information and the received hit state information, determining that a hit result is not hit;
and if the hit state information indicating that the current flow contains the first MAC address exists in the detected hit state information and the received hit state information, determining that the hit result is hit.
5. The method of claim 4, wherein updating the number of consecutive misses for the first MAC address based on the hit comprises:
adding 1 to the number of consecutive misses of the first MAC address when the hit result is a miss;
and when the hit result is hit, setting the number of continuous misses of the first MAC address to zero.
6. The method of claim 1, further comprising:
receiving an updating instruction of a second MAC address input by a user, wherein the updating instruction comprises updating state information of the MAC address, and the updating state information is an adding state or a deleting state;
and updating the second MAC address according to the updating instruction, and sending a second state notification message to the standby equipment, wherein the second state notification message carries the second MAC address and the updating state information.
7. The method of claim 1, further comprising:
when the synchronous MAC address of the standby equipment is received, the MAC address is stored in a preset temporary MAC address table;
and when the flow containing the third MAC address in the temporary MAC address table is detected, the third MAC address is issued to the driver.
8. A method for synchronizing MAC addresses, the method being applied to a standby device in a cross-device link aggregation group (M-LAG), the M-LAG further comprising a primary device, the method comprising:
sending a negotiation request message to the main device, wherein the negotiation request message carries the current configuration parameters of the standby device, so that the main device determines the configuration parameters after negotiation according to the received configuration parameters, the configuration parameters of the main device and the preset configuration parameter negotiation rules; the configuration parameters comprise a global maximum MAC number, a maximum MAC number of each aggregation group and an aging strategy of each aggregation group;
receiving a negotiation response message sent by a main device, wherein the negotiation response message carries the configuration parameters after negotiation;
and carrying out Media Access Control (MAC) address synchronization processing according to the negotiated configuration parameters.
9. The method of claim 8, further comprising:
aiming at a first MAC address with a locally stored aging type of no-flow aging, detecting hit state information of the first MAC address when a sampling period of the first MAC address is reached, wherein the hit state information indicates whether the current flow contains the first MAC address;
sending a first state notification message to the master device, wherein the first state notification message carries hit state information of the first MAC address;
receiving a first state response message sent by the master device, wherein the first state response message carries a hit result of the first MAC address;
updating the continuous miss times of the first MAC address according to the hit result;
and deleting the first MAC address when the continuous miss times reach a preset threshold value.
10. The method of claim 9, wherein updating the number of consecutive misses for the first MAC address based on the hit comprises:
adding 1 to the number of consecutive misses of the first MAC address when the hit result is a miss;
and when the hit result is hit, setting the number of continuous misses of the first MAC address to zero.
11. The method of claim 8, further comprising:
receiving a second state notification message sent by the master device, wherein the second state notification message carries a second MAC address and update state information, and the update state information is an addition state or a deletion state;
and updating the second MAC address according to the updating state information of the second MAC address.
12. The method of claim 8, further comprising:
when the MAC address synchronized by the master equipment is received, storing the MAC address into a preset temporary MAC address table;
and when the flow containing the fourth MAC address in the temporary MAC address table is detected, the fourth MAC address is issued to the driver.
13. The network equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing the communication between the processor and the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 7 or claims 8 to 12 when executing a program stored in a memory.
14. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any of the claims 1-7 or claims 8-12.
CN201910221668.1A 2019-03-22 2019-03-22 Method for synchronizing MAC addresses, network equipment and computer readable storage medium Active CN109842694B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910221668.1A CN109842694B (en) 2019-03-22 2019-03-22 Method for synchronizing MAC addresses, network equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910221668.1A CN109842694B (en) 2019-03-22 2019-03-22 Method for synchronizing MAC addresses, network equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN109842694A CN109842694A (en) 2019-06-04
CN109842694B true CN109842694B (en) 2022-02-25

Family

ID=66886188

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910221668.1A Active CN109842694B (en) 2019-03-22 2019-03-22 Method for synchronizing MAC addresses, network equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109842694B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112929193B (en) * 2019-12-06 2023-02-03 华为技术有限公司 Method and apparatus for configuring aging time of medium access control address
CN111355823B (en) * 2020-02-17 2023-04-07 杭州迪普科技股份有限公司 Aging processing method and device for MAC address table entry
CN111682927B (en) * 2020-04-27 2022-07-12 浪潮思科网络科技有限公司 Message synchronization method, device, equipment and medium based on MLAG environment
CN115706724A (en) * 2021-08-02 2023-02-17 中兴通讯股份有限公司 Address synchronization method, switch, cross-device link aggregation system and storage medium
CN114390023A (en) * 2021-12-27 2022-04-22 锐捷网络股份有限公司 Dynamic address non-aging method and device, electronic equipment and storage medium
CN114500007B (en) * 2022-01-07 2023-12-22 成都市联洲国际技术有限公司 Method, device, medium and equipment for realizing MACsec in M-LAG system
CN115174468A (en) * 2022-07-06 2022-10-11 中国联合网络通信集团有限公司 Route synchronization method, cross-device link aggregation group, electronic device and medium
CN116545914B (en) * 2023-04-21 2024-03-29 南京金阵微电子技术有限公司 Method and system for synchronizing switch chip logic stacking two-layer table items and switch

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8488608B2 (en) * 2010-08-04 2013-07-16 Alcatel Lucent System and method for traffic distribution in a multi-chassis link aggregation
CN102388581B (en) * 2011-06-29 2013-12-04 华为技术有限公司 Method, device and system of reference link negotiation
CN103401782B (en) * 2013-07-24 2017-04-05 杭州华三通信技术有限公司 A kind of MAC Address synchronous method and equipment
CN109462515A (en) * 2018-09-11 2019-03-12 锐捷网络股份有限公司 Loop circuit processing method, the network equipment, MLAG networking and storage medium

Also Published As

Publication number Publication date
CN109842694A (en) 2019-06-04

Similar Documents

Publication Publication Date Title
CN109842694B (en) Method for synchronizing MAC addresses, network equipment and computer readable storage medium
CN106888233B (en) Data updating system and method
US20220046088A1 (en) Systems and methods for distributing partial data to subnetworks
US9571569B2 (en) Method and apparatus for determining virtual machine migration
WO2015135495A1 (en) Method, client, server, and system for message pushing of webpage application
CN107315825B (en) Index updating system, method and device
US10361992B2 (en) Method for synchronizing virtual machine location information between data center gateways, gateway, and system
CN105049502B (en) The method and apparatus that device software updates in a kind of cloud network management system
CN108667575B (en) Backup method and device for BRAS transfer control separation
CN109218200B (en) Message processing method and device
CN111221619A (en) Method, device and equipment for opening and arranging service
CN109639449B (en) Method, device and medium for automated management of virtualized flow mirroring policy
CN109618174B (en) Live broadcast data transmission method, device, system and storage medium
CN103338243A (en) Method and system for updating cache data of Web node
US10425475B2 (en) Distributed data management
US20220150154A1 (en) Automatically managing a mesh network based on dynamically self-configuring node devices
CN109474495B (en) Tunnel detection method and device
CN109391548B (en) Table entry migration method and device and network communication system
US20170366441A1 (en) Transmitting test traffic on a communication link
CN108900441B (en) Network switching method, first electronic device and readable storage medium
JP6289879B2 (en) Communication terminal, communication method and program
CN109617817B (en) Method and device for generating forwarding table entry of MLAG networking
CN109218182B (en) Method and device for synchronizing routing information
JP2016158070A (en) Base station congestion management system and base station congestion management method
CN111629054B (en) Message processing method, device and system, electronic equipment and readable storage medium

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
TR01 Transfer of patent right

Effective date of registration: 20230619

Address after: 310052 11th Floor, 466 Changhe Road, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: H3C INFORMATION TECHNOLOGY Co.,Ltd.

Address before: 310052 Changhe Road, Binjiang District, Hangzhou, Zhejiang Province, No. 466

Patentee before: NEW H3C TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right