CN114390023A - Dynamic address non-aging method and device, electronic equipment and storage medium - Google Patents
Dynamic address non-aging method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN114390023A CN114390023A CN202111615752.5A CN202111615752A CN114390023A CN 114390023 A CN114390023 A CN 114390023A CN 202111615752 A CN202111615752 A CN 202111615752A CN 114390023 A CN114390023 A CN 114390023A
- Authority
- CN
- China
- Prior art keywords
- mac address
- aging
- address table
- preset value
- updating
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 230000032683 aging Effects 0.000 title claims abstract description 151
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000001514 detection method Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 9
- 230000002776 aggregation Effects 0.000 description 6
- 238000004220 aggregation Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000001360 synchronised effect Effects 0.000 description 6
- 230000007246 mechanism Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/255—Maintenance or indexing of mapping tables
- H04L61/2553—Binding renewal aspects, e.g. using keep-alive messages
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Small-Scale Networks (AREA)
Abstract
The embodiment of the invention provides a dynamic address non-aging method and device, electronic equipment and a storage medium. The method comprises the following steps: in a MAC address aging period T1, if a no-flow notice aiming at a first MAC address in a MAC address table is received, judging whether the first MAC address is a dynamic unaged address; and if so, updating the updating identification corresponding to the first MAC address in the MAC address table. In the dynamic address non-aging method provided by the embodiment of the invention, in an MAC address aging period T1, if a no-flow notification for a first MAC address in an MAC address table is received, it is determined whether the first MAC address is a dynamic non-aging address; if yes, updating the updating identification corresponding to the first MAC address in the MAC address table, so that a dynamic address non-aging scheme is realized, the CPU resource occupancy rate is low, and the CPU resource of the switching equipment is saved.
Description
Technical Field
The embodiment of the invention relates to the technical field of network communication, in particular to a dynamic address non-aging method and device, electronic equipment and a storage medium.
Background
Media Access Control (MAC) addresses are used to define the location of network devices, and MAC addresses are composed of 16-digit numbers of 48 bits long and 12 bits, starting from left to right, where 0 to 23 bits are codes that manufacturers apply to IETF and other organizations for identifying manufacturers, and 24 to 47 bits are self-assigned by manufacturers and are unique numbers of all network cards manufactured by each manufacturer.
The MAC address table records the MAC address, interface number, and Virtual Local Area Network (VLAN) ID of the device connected to the device. When the device forwards the message, the device searches the corresponding forwarding output port in the MAC address table through the destination MAC address of the message and the information of the VLAN ID to which the message belongs, and can forward the message in a unicast, multicast or broadcast mode after searching the forwarding output port according to the MAC address.
In general, the MAC address table is maintained by a dynamic address learning method, and the MAC address table of the peer device is learned by the dynamic address learning method, where the entry includes an MAC address, a VLAN ID, and an entry exit (i.e., a port where the peer device communicates with the peer device), and when the location of the peer device changes and causes a change in the port where the peer device communicates with the peer device, the MAC address needs to be learned again, the MAC address entry is updated, the VLAN ID and the MAC address are not changed, and the exit is changed, i.e., the MAC address table is migrated.
MAC addresses in the MAC address table can be divided into two categories according to whether the addresses can be aged and migrated: the method comprises the following steps of dynamic addresses and static addresses, wherein the dynamic addresses are aged in 1 aging period, the MAC addresses can be migrated, and the static addresses are MAC addresses which cannot be aged and cannot be migrated.
At present, dynamic address non-aging needs to be supported in some scenarios, and an existing scheme for implementing dynamic address non-aging generally sets a synchronized MAC address into an MAC address table by using a dynamic address, and then updates an aging flag bit of the synchronized address in the MAC address table of the device before an aging period is completed, so that the MAC address can be migrated without aging, however, when the number of MAC entries in the MAC address table is large, resetting consumes more CPU resources.
Disclosure of Invention
Aiming at the defects in the prior art, the embodiment of the invention provides a dynamic address non-aging method, a dynamic address non-aging device, electronic equipment and a storage medium.
In a first aspect, an embodiment of the present invention provides a dynamic address non-aging method, including:
in a MAC address aging period T1, if a no-flow notice aiming at a first MAC address in a MAC address table is received, judging whether the first MAC address is a dynamic unaged address;
and if so, updating the updating identification corresponding to the first MAC address in the MAC address table.
As in the above method, optionally, before the receiving the no-traffic advertisement for the first MAC address in the MAC address table, the method further includes:
and in an updating period T2, if the traffic of a second MAC address in the MAC address table is not received, generating a no-traffic notification aiming at the second MAC address, wherein 0.5T 1 is not more than T2 and is less than T1.
As above, optionally, before receiving the no-traffic advertisement for the first MAC address in the MAC address table, the method further includes:
if a third MAC address is learned, adding an MAC address table item aiming at the third MAC address in the MAC address table, setting an updating identifier in the MAC address table item, and marking the updating identifier as a first preset value;
correspondingly, the updating the update identifier corresponding to the first MAC address in the MAC address table includes:
and marking the updating identifier of the MAC address table entry corresponding to the first MAC address as the first preset value.
As above, optionally, after marking the update identifier as the first preset value, the method further includes:
if the third MAC address is determined to be a dynamic non-aging address, an aging identifier is set in an MAC address table entry corresponding to the third MAC address, and the aging identifier is marked as a third preset value;
correspondingly, the determining whether the first MAC address is a dynamic non-aged address includes:
and judging whether an aging identification bit in an MAC address table entry corresponding to the first MAC address is the third preset value or not, if so, determining that the first MAC address is a dynamic non-aging address.
As above, optionally, the method further includes:
if the aging identifier of the fourth MAC address in the MAC table entry is the third preset value and the update identifier thereof is the second preset value within the detection period T3;
marking the updating identifier of the MAC address table entry corresponding to the fourth MAC address as the first preset value;
wherein T3 is less than or equal to T1-T2.
As above, optionally, the method further includes:
deleting the MAC address table item which is updated and identified as the second preset value in the MAC address table after the aging period T1 is reached;
and marking the update identification of the MAC address table entry which is updated in the aging period T1 without traffic flow in the MAC address table as the second preset value.
In a second aspect, an embodiment of the present invention provides a dynamic address non-aging apparatus, including:
a receiving and judging module, configured to, in a MAC address aging period T1, judge whether a first MAC address in a MAC address table is a dynamic non-aging address if a no-traffic notification for the first MAC address is received;
and the updating module is used for updating the updating identification corresponding to the first MAC address in the MAC address table if the first MAC address is determined to be a dynamic non-aging address.
The above apparatus, optionally, further comprises:
an advertisement module, configured to generate a no-traffic advertisement for a second MAC address in the MAC address table if no traffic for the second MAC address is received within an update period T2 before receiving the no-traffic advertisement for a first MAC address in the MAC address table, where 0.5 × T1 ≦ T2< T1.
The above apparatus, optionally, further comprises:
the learning module is used for adding an MAC address table item aiming at a third MAC address in an MAC address table if the third MAC address is learned before receiving a no-flow notice aiming at a first MAC address in the MAC address table, setting an updating identifier in the MAC address table item, and marking the updating identifier as a first preset value;
correspondingly, the update module is specifically configured to:
and marking the updating identifier of the MAC address table entry corresponding to the first MAC address as the first preset value.
As in the above apparatus, optionally, the learning module is further configured to:
after the updating identifier is marked as a first preset value, if the third MAC address is determined to be a dynamic non-aging address, an aging identifier is set in an MAC address table entry corresponding to the third MAC address, and the aging identifier is marked as a third preset value;
correspondingly, the receiving and judging module is specifically configured to:
and judging whether an aging identification bit in an MAC address table entry corresponding to the first MAC address is the third preset value or not, if so, determining that the first MAC address is a dynamic non-aging address.
The above apparatus, optionally, further comprises:
a detection module to:
if the aging identifier of the fourth MAC address in the MAC table entry is the third preset value and the update identifier thereof is the second preset value within the detection period T3;
marking the updating identifier of the MAC address table entry corresponding to the fourth MAC address as the first preset value;
wherein T3 is less than or equal to T1-T2.
The above apparatus, optionally, further comprises:
an aging module to:
deleting the MAC address table item which is updated and identified as the second preset value in the MAC address table after the aging period T1 is reached;
and marking the update identification of the MAC address table entry which is updated in the aging period T1 without traffic flow in the MAC address table as the second preset value.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform a method comprising: in a MAC address aging period T1, if a no-flow notice aiming at a first MAC address in a MAC address table is received, judging whether the first MAC address is a dynamic unaged address; and if so, updating the updating identification corresponding to the first MAC address in the MAC address table.
In a fourth aspect, an embodiment of the present invention provides a storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the following method: in a MAC address aging period T1, if a no-flow notice aiming at a first MAC address in a MAC address table is received, judging whether the first MAC address is a dynamic unaged address; and if so, updating the updating identification corresponding to the first MAC address in the MAC address table.
In the dynamic address non-aging method provided by the embodiment of the invention, in an MAC address aging period T1, if a no-flow notification for a first MAC address in an MAC address table is received, it is determined whether the first MAC address is a dynamic non-aging address; if yes, updating the updating identification corresponding to the first MAC address in the MAC address table, so that a dynamic address non-aging scheme is realized, the CPU resource occupancy rate is low, and the CPU resource of the switching equipment is saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention 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, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a diagram illustrating a prior art address learning process of a switching device;
FIG. 2 is a schematic diagram of a prior art M-LAG;
FIG. 3 is a diagram illustrating a MAC address synchronization process in an M-LAG scenario in the prior art;
FIG. 4 is a flowchart illustrating a dynamic address non-aging method according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a dynamic address non-aging apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of an address learning process of a switching device in the prior art, as shown in fig. 1, when an MAC address table of the switching device is empty, if a User a wants to communicate with a User B, the User a first sends a packet to a gigabit ethernet0/2 of a port of the switching device, and at this time, the device learns the MAC address of the User a into the MAC address table, as shown in table 1:
table 1 switching device MAC address table
Status | VLAN | MAC address | Port(s) |
|
1 | 00d0.f8a6.51f7 | GigabitEthernet 0/2 |
Since the MAC address of User B is not learned in the address table, the device will send the message to all ports except User a in a broadcast manner, including the ports of User B and User C, and at this time, User C can receive the message sent by User a that does not belong to it (refer to the line indicated by the arrow in fig. 1). After receiving the message, User B sends a response message to User a through the gigabit ethernet 0/3 of the device, at this time, the MAC address of User a already exists in the MAC address table of the device, so that the message is forwarded to the gigabit ethernet0/2 port in a unicast manner, and at the same time, the device learns the MAC address of User B (refer to the line indicated by the arrow in fig. 1). At this time, the device learns the MAC address table as shown in table 2:
table 2 switching device MAC address table
Status | VLAN | MAC address | Port(s) |
|
1 | 00d0.f8a6.51f7 | GigabitEthernet 0/2 |
|
1 | 00d0.f864.e9b6 | GigabitEthernet 0/3 |
After one interactive process of the User A and the User B, the switching equipment learns the source MAC addresses of the User A and the User B, then the message interaction between the User A and the User B is forwarded in a unicast mode, and then the User C does not receive the interactive message between the User A and the User B.
The User A is connected with the port gigabit Ethernet0/2 of the equipment, the MAC address of the equipment learns the address of the User A through the automatic address learning process, and the outlet of the table entry is the gigabit Ethernet 0/2. If the User a changes location, the port connected to the device changes from gigabit ethernet0/2 to gigabit ethernet 0/1, and when learning is performed again, the Mac address of User a in the device Mac address table is updated, and the exit is changed from gigabit ethernet0/2 to gigabit ethernet 0/1, as shown in table 3:
table 3 switching device MAC address table
The MAC address table of the switching equipment has capacity limitation, and the equipment eliminates the inactive address table items by adopting an address table aging mechanism. In an aging period, if a message with the address as a source MAC address is not received, the MAC address is deleted from a hardware MAC address table.
However, in the current M-LAG/VXLAN scenario, a dynamic unaged address needs to be used, that is, in an aging period, even if a message with the address as a source MAC address is not received, the MAC address is not deleted from the hardware MAC address table, that is, the MAC address is not aged.
Taking M-LAG as an example, an M-LAG (multimedia Link Aggregation group), that is, a cross-device Link Aggregation group, is a mechanism for implementing cross-device Link Aggregation, and performs cross-device Link Aggregation on one device and two other devices, thereby improving Link reliability from a single board level to a device level and forming a dual active system.
Fig. 2 is a schematic diagram of an M-LAG in the prior art, fig. 3 is a schematic diagram of a MAC address synchronization process in an M-LAG scenario in the prior art, and as shown in fig. 2 and fig. 3, 2 devices forming the M-LAG need to perform MAC address synchronization with each other:
1) SW1-AP1 of SW1 and SW2-AP1 of SW2 form a cross-device link aggregation group;
2) assuming that the server just starts to walk through the link SW1-AP1, at this time, SW1 learns a MAC address table with a MAC address of 00d0.f8a6.51f7, a VLAN of VLAN 1 and an exit of SW1-AP 1;
3) the MAC address learned by SW1 will be synchronized to SW2, which is mainly used for fast switching when a fault occurs, for example, SW1-AP1 is faulty, and the traffic of SW1 will be switched from peer-link to SW2 and then to the server through the synchronized MAC address table.
Since server traffic normally does not go to SW2, the remote addresses synchronized from SW1 on SW2 will be aged out within 1 aging period according to the nature of dynamic addresses. In order to ensure the reliability of the cross-device link aggregation port, it is necessary to require that these synchronized addresses cannot be aged off, so how to implement dynamic unaged addresses becomes an important issue to be solved urgently.
In order to solve the problem, in the embodiment of the present invention, in a MAC address aging period T1, if a no-traffic notification for a first MAC address in a MAC address table is received, it is determined whether the first MAC address is a dynamic unaged address; and if so, updating the updating identification corresponding to the first MAC address in the MAC address table, so that the dynamic address is not aged. The following describes embodiments of the present invention in detail.
Fig. 4 is a schematic flow chart of a dynamic address non-aging method according to an embodiment of the present invention, as shown in fig. 4, the method includes:
step S41, in the MAC address aging period T1, if a no-flow notice aiming at a first MAC address in an MAC address table is received, whether the first MAC address is a dynamic unaged address is judged;
step S42, if yes, updating the update identifier corresponding to the first MAC address in the MAC address table.
Specifically, address aging in the switching device is divided into 2 steps. First, when the switching device learns a new MAC address, it sets its update flag bit hit in the MAC address table entry, and then updates the hit bit if the MAC address traffic is received. The aging thread of hardware or software will periodically traverse all MAC addresses in the MAC address table, delete the MAC address table entry with empty hit bit, and clear away the hit bit of the rest table entries, so the exchange device starts the aging timing of the address while learning a new address, before reaching the aging timing, if the device does not receive the message with the address as the source MAC address again, the address will be deleted from the MAC address table after reaching the aging time. In the embodiment of the invention, a no-flow notice is added, when the flow of a certain MAC address in the MAC address table of the switching equipment is not received in the MAC address aging period T1, the no-flow notice aiming at the MAC address is generated, at the moment, if the equipment receives the no-flow notice aiming at the first MAC address in the MAC address table, whether the first MAC address is a dynamic non-aging address is judged, if so, the updating mark corresponding to the first MAC address is updated in the MAC address table, if not, the processing is not needed, thus, as the updating mark of the no-flow MAC address is actively updated, the MAC address table item can not be aged because the MAC address is updated with the flow when the aging processing is carried out on the system, and the embodiment of the invention only needs to update the updating mark of the dynamic non-aging address without the flow, the updating marks of all MAC addresses are not needed to be updated, thereby saving CPU resources, the dynamic address non-aging scheme is realized.
In the dynamic address non-aging method provided by the embodiment of the invention, in an MAC address aging period T1, if a no-flow notification for a first MAC address in an MAC address table is received, it is determined whether the first MAC address is a dynamic non-aging address; if yes, updating the updating identification corresponding to the first MAC address in the MAC address table, so that a dynamic address non-aging scheme is realized, the CPU resource occupancy rate is low, and the CPU resource of the switching equipment is saved.
On the basis of the foregoing embodiment, further before receiving a no-traffic advertisement for a first MAC address in a MAC address table, the method further includes:
and in an updating period T2, if the traffic of a second MAC address in the MAC address table is not received, generating a no-traffic notification aiming at the second MAC address, wherein 0.5T 1 is not more than T2 and is less than T1.
Specifically, in the aging period T1, the update period T2 is set, and if the update period T2 is set too small, the update flag hit may be changed multiple times in one aging period T1, which results in CPU resource waste, and if the update period T2 is set too large, the aging period T1 may be reached when the update flag has not been changed, which is erroneously aged by the aging operation, so that, when the update period T2 is actually set, 0.5T 1 is not more than T2< T1 is set, i.e., the update period is more than half of the aging period, optionally, T2 is 0.5T 1 is set, i.e., in half of the aging period T1, if the traffic of the second MAC address in the MAC address table is not received, a no-notification traffic for the second MAC address is generated, so that, in the latter half of the aging period T1, the corresponding update flag hit belonging to the non-aged MAC address can be updated dynamically, therefore, after the aging period T1 is reached, since the update identifier corresponding to the MAC address is updated, the MAC address is not aged by the aging operation, and a scheme of dynamic address aging is implemented.
On the basis of the foregoing embodiments, further before receiving the no-traffic advertisement for the first MAC address in the MAC address table, the method further includes:
if a third MAC address is learned, adding an MAC address table item aiming at the third MAC address in the MAC address table, setting an updating identifier in the MAC address table item, and marking the updating identifier as a first preset value;
correspondingly, the updating the update identifier corresponding to the first MAC address in the MAC address table includes:
and marking the updating identifier of the MAC address table entry corresponding to the first MAC address as the first preset value.
Specifically, after the switching device learns the third MAC address, an MAC address table entry for the third MAC address is added to the stored MAC address table, an update identifier hit and an aging identifier class id are set in the MAC address table entry, the update identifier hit is marked as a first preset value, for example, the update identifier hit is marked as 1, after the third MAC address is determined to be a dynamic non-aging address, the aging identifier class id is set as a third preset value, for example, the aging identifier class id is marked as 1, and if the third MAC address is not a dynamic non-aging address, the aging identifier class id is set as a fourth preset value, for example, the aging identifier class id is marked as 0. Thus, when the switching device receives a no-flow notification for a first MAC address in the MAC address table, it determines whether the classID bit in the MAC address table entry corresponding to the MAC address in the MAC address table is 1, if so, it indicates that the first MAC address is a dynamic non-aged address, and marks the hit bit in the MAC address table entry as 1, and after an aging period is reached, because the hit bit in the MAC address table entry corresponding to the first MAC address is 1, the first MAC address is not aged.
On the basis of the above embodiments, further, the method further includes:
if the aging identifier of the fourth MAC address in the MAC table entry is the third preset value and the update identifier thereof is the second preset value within the detection period T3;
marking the updating identifier of the MAC address table entry corresponding to the fourth MAC address as the first preset value;
wherein T3 is less than or equal to T1-T2.
Specifically, in order to ensure that each dynamic unaged address is not aged, it may be further determined whether a MAC address entry having an aging identifier classID of 1 and an update identifier hit of 0 exists in a detection period T3(T3 is not greater than T1-T2), that is, whether a dynamic unaged address has an un-updated hit of 1, if yes, the update identifier hit of the MAC address entry is marked as 1, so as to avoid the problem of incorrect aging of the dynamic unaged address, which may be caused by too many performance or MAC address entries being too late to update.
On the basis of the above embodiments, further, the method further includes:
deleting the MAC address table item which is updated and identified as the second preset value in the MAC address table after the aging period T1 is reached;
and marking the update identification of the MAC address table entry which is updated in the aging period T1 without traffic flow in the MAC address table as the second preset value.
Specifically, after the aging period T1 is reached, the MAC address table entry whose update flag hit is 0 in the MAC address table is deleted, and the update flag hit of the MAC address table entry whose flow is not updated in the aging period T1 in the MAC address table is marked as 0. Since the MAC address table entry whose hit is 0 is deleted first, then the hit bit of the MAC address table entry without traffic update is updated, and before the aging period T1 arrives, the hit bit of the MAC address table entry of the dynamic non-aging address without traffic update is changed to 1, the MAC address table entry is not aged by the aging operation. After deleting, the hit bit is updated to 0 by the aging operation, so in the next aging period, if the MAC address has no traffic, the hit bit is updated to 1 again because of no traffic notification, and therefore the MAC address cannot be aged.
For example, the aging mechanism of the MAC address table in the broadcom switch chip of the boston company is:
1) setting an update identifier hit identifier bit in a hardware MAC address table item, wherein the identifier bit is set to be 1 when an MAC address is learned or flow hits the MAC address in the MAC address table item;
2) when the broadcom exchange chip starts, a software aging thread is created, the aging thread traverses a hardware MAC address table, the table entry with the hit identification bit of 0 is aged, and the hit identification bit of 0 is set for the MAC address table entry with the hit identification bit of 1.
Taking fig. 3 as an example, the port SW1-AP1 receives a message with a source MAC of 00d0.f8a6.51f7, the hit flag is 1, and the MAC address table is:
table 4 switching device MAC address table
Status | VLAN | MAC address | Port(s) | Hit mark |
|
1 | 00d0.f8a6.51f7 | SW1- |
1 |
If the port SW1-AP1 does not receive the message with the source MAC being 00d0.f8a6.51f7 in 1 aging period, the aging thread will update the hit flag bit to be 0;
table 5 switching device MAC address table
Status | VLAN | MAC address | Port(s) | Hit mark |
|
1 | 00d0.f8a6.51f7 | SW1-AP1 | 0 |
3) After 1 aging period, the entry with hit of 0 is deleted by the hardware.
The MAC address table entry in the broadcom switch chip supports the marking function, and can mark on the basis of each address table, for example, the ClassID field of the MAC address table entry is selected to be used, so that the dynamic non-aging address and the normal dynamic address can be distinguished according to this characteristic, as shown in table 6 and table 7:
table 6 common dynamic addresses in the MAC address table of a switching device
Status | VLAN | MAC address | Port(s) | Hit mark | |
Dynamic state | |||||
1 | 00d0.f8a6.51f7 | SW1- |
1 | 0 |
Table 7 dynamic unaged addresses in the MAC address table of a switching device
Under the condition that the dynamic non-aging address has no flow updating in a half aging period, the hit identification bit of the MAC address is 0, the broadcom switching chip sends a no-flow notice to the aging thread, the no-hit notice is recorded, the aging thread receives the no-hit notice, when the MAC address is judged to be the dynamic non-aging address according to the mark of the classID in the address table, the hit identification bit of the MAC address table item in the MAC address table of the broadcom switching chip is actively set to be 1, only the dynamic non-aging address without flow updating in the half aging period needs to be updated, CPU resources are saved, and the problem that the dynamic non-aging address is mistakenly aged due to too much performance or MAC items is solved.
Based on the same inventive concept, an embodiment of the present invention further provides a dynamic address non-aging apparatus, as shown in fig. 5, including: a reception judging module 51 and an updating module 52, wherein:
the receiving and determining module 51 is configured to, in a MAC address aging period T1, determine whether a first MAC address in a MAC address table is a dynamic unaged address if a no-traffic notification for the first MAC address is received; the updating module 52 is configured to update the update identifier corresponding to the first MAC address in the MAC address table if it is determined that the first MAC address is a dynamic unaged address.
The above apparatus, optionally, further comprises:
an advertisement module, configured to generate a no-traffic advertisement for a second MAC address in the MAC address table if no traffic for the second MAC address is received within an update period T2 before receiving the no-traffic advertisement for a first MAC address in the MAC address table, where 0.5 × T1 ≦ T2< T1.
The above apparatus, optionally, further comprises:
the learning module is used for adding an MAC address table item aiming at a third MAC address in an MAC address table if the third MAC address is learned before receiving a no-flow notice aiming at a first MAC address in the MAC address table, setting an updating identifier in the MAC address table item, and marking the updating identifier as a first preset value;
accordingly, the update module 52 is specifically configured to:
and marking the updating identifier of the MAC address table entry corresponding to the first MAC address as the first preset value.
As in the above apparatus, optionally, the learning module is further configured to:
after the updating identifier is marked as a first preset value, if the third MAC address is determined to be a dynamic non-aging address, an aging identifier is set in an MAC address table entry corresponding to the third MAC address, and the aging identifier is marked as a third preset value;
correspondingly, the receiving and judging module is specifically configured to:
and judging whether an aging identification bit in an MAC address table entry corresponding to the first MAC address is the third preset value or not, if so, determining that the first MAC address is a dynamic non-aging address.
The above apparatus, optionally, further comprises:
a detection module to:
if the aging identifier of the fourth MAC address in the MAC table entry is the third preset value and the update identifier thereof is the second preset value within the detection period T3;
marking the updating identifier of the MAC address table entry corresponding to the fourth MAC address as the first preset value;
wherein T3 is less than or equal to T1-T2.
The above apparatus, optionally, further comprises:
an aging module to:
deleting the MAC address table item which is updated and identified as the second preset value in the MAC address table after the aging period T1 is reached;
and marking the update identification of the MAC address table entry which is updated in the aging period T1 without traffic flow in the MAC address table as the second preset value.
The apparatus provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 6, the electronic device includes: a processor (processor)61, a memory (memory)62, and a bus 63;
wherein, the processor 61 and the memory 62 complete the communication with each other through the bus 63;
the processor 61 is configured to call program instructions in the memory 62 to perform the methods provided by the above-described method embodiments, including, for example: in a MAC address aging period T1, if a no-flow notice aiming at a first MAC address in a MAC address table is received, judging whether the first MAC address is a dynamic unaged address; and if so, updating the updating identification corresponding to the first MAC address in the MAC address table.
An embodiment of the present invention discloses a computer program product, which includes a computer program stored on a non-transitory computer readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer can execute the methods provided by the above method embodiments, for example, the method includes: in a MAC address aging period T1, if a no-flow notice aiming at a first MAC address in a MAC address table is received, judging whether the first MAC address is a dynamic unaged address; and if so, updating the updating identification corresponding to the first MAC address in the MAC address table.
Embodiments of the present invention provide a non-transitory computer-readable storage medium, which stores computer instructions, where the computer instructions cause the computer to perform the methods provided by the above method embodiments, for example, the methods include: in a MAC address aging period T1, if a no-flow notice aiming at a first MAC address in a MAC address table is received, judging whether the first MAC address is a dynamic unaged address; and if so, updating the updating identification corresponding to the first MAC address in the MAC address table.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the apparatuses and the like are merely illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (14)
1. A method for dynamic address non-aging, comprising:
in a MAC address aging period T1, if a no-flow notice aiming at a first MAC address in a MAC address table is received, judging whether the first MAC address is a dynamic unaged address;
and if so, updating the updating identification corresponding to the first MAC address in the MAC address table.
2. The method of claim 1, wherein prior to receiving the no-traffic advertisement for the first MAC address in the MAC address table, further comprising:
and in an updating period T2, if the traffic of a second MAC address in the MAC address table is not received, generating a no-traffic notification aiming at the second MAC address, wherein 0.5T 1 is not more than T2 and is less than T1.
3. The method of claim 2, wherein prior to receiving the no-traffic advertisement for the first MAC address in the MAC address table, further comprising:
if a third MAC address is learned, adding an MAC address table item aiming at the third MAC address in the MAC address table, setting an updating identifier in the MAC address table item, and marking the updating identifier as a first preset value;
correspondingly, the updating the update identifier corresponding to the first MAC address in the MAC address table includes:
and marking the updating identifier of the MAC address table entry corresponding to the first MAC address as the first preset value.
4. The method of claim 3, wherein after marking the update identifier as the first preset value, further comprising:
if the third MAC address is determined to be a dynamic non-aging address, an aging identifier is set in an MAC address table entry corresponding to the third MAC address, and the aging identifier is marked as a third preset value;
correspondingly, the determining whether the first MAC address is a dynamic non-aged address includes:
and judging whether an aging identification bit in an MAC address table entry corresponding to the first MAC address is the third preset value or not, if so, determining that the first MAC address is a dynamic non-aging address.
5. The method of claim 4, further comprising:
if the aging identifier of the fourth MAC address in the MAC table entry is the third preset value and the update identifier thereof is the second preset value within the detection period T3;
marking the updating identifier of the MAC address table entry corresponding to the fourth MAC address as the first preset value;
wherein T3 is less than or equal to T1-T2.
6. The method of claim 5, further comprising:
deleting the MAC address table item which is updated and identified as the second preset value in the MAC address table after the aging period T1 is reached;
and marking the update identification of the MAC address table entry which is updated in the aging period T1 without traffic flow in the MAC address table as the second preset value.
7. A dynamic address non-aging apparatus, comprising:
a receiving and judging module, configured to, in a MAC address aging period T1, judge whether a first MAC address in a MAC address table is a dynamic non-aging address if a no-traffic notification for the first MAC address is received;
and the updating module is used for updating the updating identification corresponding to the first MAC address in the MAC address table if the first MAC address is determined to be a dynamic non-aging address.
8. The apparatus of claim 7, further comprising:
an advertisement module, configured to generate a no-traffic advertisement for a second MAC address in the MAC address table if no traffic for the second MAC address is received within an update period T2 before receiving the no-traffic advertisement for a first MAC address in the MAC address table, where 0.5 × T1 ≦ T2< T1.
9. The apparatus of claim 8, further comprising:
the learning module is used for adding an MAC address table item aiming at a third MAC address in an MAC address table if the third MAC address is learned before receiving a no-flow notice aiming at a first MAC address in the MAC address table, setting an updating identifier in the MAC address table item, and marking the updating identifier as a first preset value;
correspondingly, the update module is specifically configured to:
and marking the updating identifier of the MAC address table entry corresponding to the first MAC address as the first preset value.
10. The apparatus of claim 9, wherein the learning module is further configured to:
after the updating identifier is marked as a first preset value, if the third MAC address is determined to be a dynamic non-aging address, an aging identifier is set in an MAC address table entry corresponding to the third MAC address, and the aging identifier is marked as a third preset value;
correspondingly, the receiving and judging module is specifically configured to:
and judging whether an aging identification bit in an MAC address table entry corresponding to the first MAC address is the third preset value or not, if so, determining that the first MAC address is a dynamic non-aging address.
11. The apparatus of claim 10, further comprising:
a detection module to:
if the aging identifier of the fourth MAC address in the MAC table entry is the third preset value and the update identifier thereof is the second preset value within the detection period T3;
marking the updating identifier of the MAC address table entry corresponding to the fourth MAC address as the first preset value;
wherein T3 is less than or equal to T1-T2.
12. The apparatus of claim 10, further comprising:
an aging module to:
deleting the MAC address table item which is updated and identified as the second preset value in the MAC address table after the aging period T1 is reached;
and marking the update identification of the MAC address table entry which is updated in the aging period T1 without traffic flow in the MAC address table as the second preset value.
13. An electronic device, comprising:
the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of claims 1 to 6.
14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111615752.5A CN114390023B (en) | 2021-12-27 | 2021-12-27 | Dynamic address non-aging method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111615752.5A CN114390023B (en) | 2021-12-27 | 2021-12-27 | Dynamic address non-aging method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114390023A true CN114390023A (en) | 2022-04-22 |
CN114390023B CN114390023B (en) | 2024-08-20 |
Family
ID=81197240
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111615752.5A Active CN114390023B (en) | 2021-12-27 | 2021-12-27 | Dynamic address non-aging method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114390023B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1571381A (en) * | 2003-07-12 | 2005-01-26 | 华为技术有限公司 | Method for timed processing of list item in communication equipment and apparatus thereof |
CN101702687A (en) * | 2009-11-27 | 2010-05-05 | 北京傲天动联技术有限公司 | Method for utilizing device with exchange board structure as broadband access server |
US20160352622A1 (en) * | 2015-06-01 | 2016-12-01 | Ciena Corporation | Enhanced forwarding database synchronization for media access control addresses learned in interconnected layer-2 architectures |
CN106603468A (en) * | 2015-10-15 | 2017-04-26 | 中兴通讯股份有限公司 | Data message processing method and device |
CN107707690A (en) * | 2017-11-28 | 2018-02-16 | 锐捷网络股份有限公司 | A kind of non-ageing method, apparatus of dynamic address and medium |
CN109391548A (en) * | 2018-11-06 | 2019-02-26 | 迈普通信技术股份有限公司 | List item moving method, device and network communicating system |
CN109842694A (en) * | 2019-03-22 | 2019-06-04 | 新华三技术有限公司 | A kind of method, the network equipment and the computer readable storage medium of synchronous MAC Address |
CN112838993A (en) * | 2019-11-22 | 2021-05-25 | 武汉神州数码云科网络技术有限公司 | Method for realizing dynamic issuing of MAC VLAN |
CN113765812A (en) * | 2020-09-16 | 2021-12-07 | 北京京东尚科信息技术有限公司 | Method and device for marking message |
-
2021
- 2021-12-27 CN CN202111615752.5A patent/CN114390023B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1571381A (en) * | 2003-07-12 | 2005-01-26 | 华为技术有限公司 | Method for timed processing of list item in communication equipment and apparatus thereof |
CN101702687A (en) * | 2009-11-27 | 2010-05-05 | 北京傲天动联技术有限公司 | Method for utilizing device with exchange board structure as broadband access server |
US20160352622A1 (en) * | 2015-06-01 | 2016-12-01 | Ciena Corporation | Enhanced forwarding database synchronization for media access control addresses learned in interconnected layer-2 architectures |
CN106603468A (en) * | 2015-10-15 | 2017-04-26 | 中兴通讯股份有限公司 | Data message processing method and device |
CN107707690A (en) * | 2017-11-28 | 2018-02-16 | 锐捷网络股份有限公司 | A kind of non-ageing method, apparatus of dynamic address and medium |
CN109391548A (en) * | 2018-11-06 | 2019-02-26 | 迈普通信技术股份有限公司 | List item moving method, device and network communicating system |
CN109842694A (en) * | 2019-03-22 | 2019-06-04 | 新华三技术有限公司 | A kind of method, the network equipment and the computer readable storage medium of synchronous MAC Address |
CN112838993A (en) * | 2019-11-22 | 2021-05-25 | 武汉神州数码云科网络技术有限公司 | Method for realizing dynamic issuing of MAC VLAN |
CN113765812A (en) * | 2020-09-16 | 2021-12-07 | 北京京东尚科信息技术有限公司 | Method and device for marking message |
Non-Patent Citations (1)
Title |
---|
卢明星: "局域网网上邻居工作原理及使用探析", 《网络安全技术与应用 》, 15 December 2014 (2014-12-15) * |
Also Published As
Publication number | Publication date |
---|---|
CN114390023B (en) | 2024-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10305801B2 (en) | Forwarding data packets | |
US8391289B1 (en) | Managing a forwarding table in a switch | |
CN108011958B (en) | Network device and MAC address table synchronization method | |
CN107786450B (en) | Data message transmission method and device and machine-readable storage medium | |
US10652145B2 (en) | Managing data frames in switched networks | |
CN109274592B (en) | MAC address table item processing method and device and computer readable medium | |
CN114244810A (en) | Virtual IP management method, device, electronic equipment and storage medium | |
CN105634952A (en) | Fast notification method and apparatus for LSP message | |
CN109218458B (en) | Writing method and device of MAC address and computer readable storage medium | |
CN101834781B (en) | Media access control address keep-alive device and method for convergence port | |
CN110768917B (en) | Message transmission method and device | |
CN111327509B (en) | Information updating method and device | |
CN110391919B (en) | Multicast traffic forwarding method and device, and electronic device | |
CN114422437A (en) | Method and device for forwarding heterogeneous messages | |
US9419909B2 (en) | Determining when to relearn a relationship between a network address and a port | |
CN109413225B (en) | MAC table item processing method and equipment | |
WO2020119317A1 (en) | Message forwarding method and apparatus, storage medium, and electronic apparatus | |
CN114390023A (en) | Dynamic address non-aging method and device, electronic equipment and storage medium | |
CN106059810B (en) | Message notification method and system | |
WO2022057865A1 (en) | Mac address keep-alive method and device for aggregated link, and storage medium | |
CN111131045B (en) | Message forwarding method and network equipment | |
CN109218207B (en) | Multicast traffic processing method and device and routing equipment | |
CN114884878A (en) | MAC address synchronization method for multi-switch chip stacking in hardware learning mode | |
CN111556179B (en) | ARP (Address resolution protocol) table entry updating method and device | |
US10862801B1 (en) | Selective media access control (MAC) learning and purging to reduce flooding and replication in a network |
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 |