CN111147624B - MAC (media Access control) table entry aging time adjusting method and device - Google Patents

MAC (media Access control) table entry aging time adjusting method and device Download PDF

Info

Publication number
CN111147624B
CN111147624B CN201911415259.1A CN201911415259A CN111147624B CN 111147624 B CN111147624 B CN 111147624B CN 201911415259 A CN201911415259 A CN 201911415259A CN 111147624 B CN111147624 B CN 111147624B
Authority
CN
China
Prior art keywords
mac
aging time
change
average value
same
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
CN201911415259.1A
Other languages
Chinese (zh)
Other versions
CN111147624A (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN201911415259.1A priority Critical patent/CN111147624B/en
Publication of CN111147624A publication Critical patent/CN111147624A/en
Application granted granted Critical
Publication of CN111147624B publication Critical patent/CN111147624B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Landscapes

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

Abstract

The invention discloses a method for adjusting the aging time of an MAC (media access control) table entry, which comprises the following steps of: acquiring the changed MAC addresses and the change times of the same MAC addresses in the MAC table item refreshing statistical period; and judging a change interval in which the change times of the same MAC address fall, calculating the average value of the aging time of all the same MAC addresses falling in the change interval, and taking the average value as the updated aging time of the MAC table entry. The utility model also discloses a MAC table entry aging time adjusting device, has solved in the current switch aging time setting mode once the drawback that the setting aging time can't automatic modification, optimizes switch MAC address aging function, has improved the stability of switch business and can reduce CPU's utilization ratio, improves the wholeness ability of switch.

Description

MAC table entry aging time adjusting method and device
Technical Field
The invention relates to the technical field of software testing, in particular to a method and a device for adjusting aging time of an MAC (media access control) table entry.
Background
The switch forwards the data frame according to the MAC address table. The exchange has a table recording the corresponding relation between the MAC address of the LAN host and the interface of the exchange, and the exchange is responsible for transmitting the data frame to the appointed host according to the table.
An address learning mechanism: the method comprises the steps that a switch receives all data frames on a network segment from a port, and an MAC address table is established by using a source MAC address in the received data frames; if the MAC address is not in the MAC table, the address and the corresponding port are recorded in the MAC table, if the port corresponding to the MAC address in the MAC table is different from the port corresponding to the ingress port of a data packet, port movement is generated, and the MAC address is learned to a new port again.
An address aging mechanism: if the exchanger does not receive the message sent by a certain host within a long period of time, the MAC address corresponding to the host is deleted, and the exchanger learns again when the next message comes. The specific mechanism is as follows: there is a HIT field in the MAC table, and whenever the source MAC of a packet matches a certain entry, the HIT bit of the entry is set. Meanwhile, the switch is provided with an aging timer, when the timer is overtime, all dynamic MAC in the MAC table are detected, and if the HIT of the corresponding table entry is 1, the bit is cleared to 0; if the HIT bit of a certain table entry is 0, the table entry is cleared (aged).
The current aging time setting mode of the switch has two types: 1. using the default aging time of the exchanger when leaving a factory; 2. the administrator manually sets the aging time through a corresponding command, and the aging time is not changed once the setting is set unless the setting is modified again. Because the environment in the network is complex, some machines may be frequently turned on and off, and some machines may not be turned on and off for a long time when running. Therefore, the machine is shut down, but the MAC address table entry in the switch still exists, the message can be normally forwarded, but the message cannot be recovered because the machine is shut down, so that the message is lost.
Disclosure of Invention
The invention aims to provide a method and a device for adjusting the aging time of an MAC table entry, which solve the technical defect that the aging time cannot be automatically modified once the aging time is set in the current aging time setting mode of an exchanger and optimize the aging function of the MAC address of the exchanger.
In order to achieve the purpose, the invention adopts the following technical scheme:
the first aspect of the present invention provides a method for adjusting MAC entry aging time, including the following steps:
acquiring the changed MAC addresses and the change times of the same MAC addresses in the MAC table item refreshing statistical period;
and judging a change interval in which the change times of the same MAC address fall, calculating the average value of the aging time of all the same MAC addresses falling in the change interval, and taking the average value as the updated aging time of the MAC table entry.
With reference to the first aspect, in a first possible implementation manner of the first aspect, before the step of obtaining the MAC address changed in the MAC entry refresh statistic period and the change times of the same MAC address, the method further includes:
the aging time for all MAC addresses is set to a default value.
With reference to the first aspect, in a second possible implementation manner of the first aspect, the obtaining a MAC address that changes within a MAC entry refresh statistic period and a number of changes of the same MAC address specifically includes:
recording the changed MAC content during each MAC table item refreshing in the MAC table item refreshing statistical period;
and counting the change times of the same MAC address in the MAC table item refreshing counting period.
With reference to the first aspect, in a third possible implementation manner of the first aspect, the determining a change interval in which the change times of the same MAC address falls, calculating an average value of aging times of all the same MAC addresses falling in the change interval, and taking the average value as an updated aging time of the MAC entry specifically includes:
if the change times of the same MAC address fall into a first change interval, calculating a first aging time average value of all the same MAC addresses falling into the first change interval, and setting the first aging time average value as updated MAC table entry aging time;
if the change times of the same MAC address fall into a second change interval, setting the updated MAC table entry aging time as a default value;
and if the change times of the same MAC address fall into a third change interval, calculating a third aging time average value of all the same MAC addresses falling into the third change interval, and setting the third aging time average value as the updated MAC table entry aging time.
With reference to the first aspect, in a fourth possible implementation manner of the first aspect, after the step of determining a change interval in which the change times of the same MAC address fall, and calculating an average value of aging times of all the same MAC addresses falling in the change interval, and taking the average value as an aging time of an updated MAC entry, the method further includes:
and clearing the MAC address table item change storage table.
With reference to the first aspect, in a fifth possible implementation manner of the first aspect, after the step of clearing the MAC address table entry change storage table, the method further includes:
and finishing the adjustment method step of the MAC table item aging time in the next MAC table item refreshing statistical period.
A second aspect of the present invention provides an apparatus for adjusting MAC entry aging time, including:
the MAC content acquisition module is used for acquiring the changed MAC addresses and the change times of the same MAC addresses in the MAC table item refreshing statistical period;
and the MAC table entry aging time updating module is used for judging a change interval in which the change times of the same MAC address fall, calculating an average value of the aging time of all the same MAC addresses falling in the change interval, and taking the average value as the updated MAC table entry aging time.
The MAC entry aging time adjustment apparatus according to the second aspect of the present invention can implement the method according to the first aspect, and achieve the same effect.
The effect provided in the summary of the invention is only the effect of the embodiment, not all the effects of the invention, and one of the above technical solutions has the following advantages or beneficial effects:
the invention can dynamically adjust the aging time of the MAC address learned by the switch by calculating the learning time of the MAC address table entry in real time, and can classify and set different MAC addresses, thereby solving the defect that the aging time of the whole MAC address can only be set originally, solving the defect that the aging time cannot be automatically modified once the aging time is set in the current aging time setting mode of the switch, optimizing the aging function of the MAC address of the switch, improving the stability of the switch service, reducing the utilization rate of a CPU (Central processing Unit) and improving the overall performance of the switch.
Drawings
FIG. 1 is a flow chart of a first embodiment of the method of the present invention;
FIG. 2 is a flowchart of step S1 of a first embodiment of the method of the present invention;
FIG. 3 is a flowchart of step S2 of a first embodiment of the method of the present invention;
FIG. 4 is a flow chart of a second embodiment of the method of the present invention;
FIG. 5 is a schematic diagram of an embodiment of the apparatus of the present invention.
Detailed Description
In order to clearly explain the technical features of the present invention, the following detailed description of the present invention is provided with reference to the accompanying drawings. The following disclosure provides many different embodiments, or examples, for implementing different features of the invention. To simplify the disclosure of the present invention, the components and arrangements of specific examples are described below. Moreover, the present disclosure may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed. It should be noted that the components illustrated in the figures are not necessarily drawn to scale. Descriptions of well-known components and processing techniques and processes are omitted so as to not unnecessarily limit the invention.
As shown in fig. 1, a method for adjusting aging time of an MAC entry includes the following steps:
s1, obtaining changed MAC addresses and the change times of the same MAC addresses in an MAC table item refreshing statistical period;
s2, judging a change interval in which the change times of the same MAC address fall, calculating an average value of the aging time of all the same MAC addresses falling in the change interval, and taking the average value as the updated aging time of the MAC table entry.
As an embodiment of the present application, before the step of obtaining a MAC address changed in a MAC entry refresh statistic period and a change number of the same MAC address in step S1, the method further includes:
the aging time for all MAC addresses is set to a default value.
As an embodiment of the present application, as shown in fig. 2, in step S1, the acquiring a MAC address that changes within a MAC entry refresh statistic period and a change number of the same MAC address specifically includes:
s11, recording the changed MAC content during each MAC table item refreshing in the MAC table item refreshing statistical period;
and S12, counting the change times of the same MAC address in the MAC table item refreshing counting period.
As an embodiment of the present application, as shown in fig. 3, in step S2, the determining a variation interval in which the number of changes of the same MAC address falls, calculating an average value of aging times of all the same MAC addresses falling in the variation interval, and taking the average value as an updated aging time of the MAC entry specifically includes:
s21, if the change times of the same MAC address fall into a first change interval, calculating a first aging time average value of all the same MAC addresses falling into the first change interval, and setting the first aging time average value as updated MAC table entry aging time;
s22, if the change times of the same MAC address fall into a second change interval, setting the updated MAC table entry aging time as a default value;
s23, if the change times of the same MAC address fall into a third change interval, calculating a third aging time average value of all the same MAC addresses falling into the third change interval, and setting the third aging time average value as the updated MAC table entry aging time.
As an embodiment of the present application, after the step of determining a variation interval in which the number of times of variation of the same MAC address falls in step S2, and calculating an average value of aging times of all the same MAC addresses falling in the variation interval, and using the average value as an aging time of an updated MAC entry, the method further includes:
and clearing the MAC address table item change storage table.
As an embodiment of the present application, as shown in fig. 4, a method for adjusting MAC entry aging time includes the following steps:
(1) Powering on the switch to start up;
(2) Setting all MAC address aging time as a default value;
(3) Clearing an MAC address table item change storage table;
(4) Recording the changed MAC content when each MAC table item is refreshed, and taking 1000 times as a statistical period;
(5) Counting the times of the change of the same MAC address in 1000 refreshes;
(6) Classifying the change times smaller than 10 times, storing corresponding change time intervals, calculating an aging time average value A smaller than 10 times in the change times, and setting the aging time of the corresponding MAC address as the average value A; classifying the change times greater than 200, storing corresponding change time intervals, calculating an aging time average value B greater than 200 in the change times, and setting the aging time of the corresponding MAC address as the average value B; and setting the MAC address aging time with the change times more than 10 and less than 200 as a default value.
As shown in fig. 5, based on the above method for adjusting the aging time of the MAC entry, an embodiment further provides a device for adjusting the aging time of the MAC entry, including:
the MAC content obtaining module 101 is configured to obtain a MAC address that changes within a MAC entry refresh statistic period and a change number of the same MAC address;
the MAC entry aging time updating module 102 is configured to determine a change interval in which the change times of the same MAC address fall, calculate an average value of aging times of all the same MAC addresses falling in the change interval, and use the average value as the updated MAC entry aging time.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, it is not intended to limit the scope of the present invention, and it should be understood by those skilled in the art that various modifications and variations can be made without inventive efforts by those skilled in the art based on the technical solution of the present invention.

Claims (6)

1. A MAC table entry aging time adjusting method is characterized by comprising the following steps:
acquiring the changed MAC addresses and the change times of the same MAC addresses in the MAC table item refreshing statistical period;
judging a change interval in which the change times of the same MAC address fall, calculating an average value of the aging time of all the same MAC addresses falling in the change interval, and taking the average value as the updated aging time of the MAC table entry;
the determining a variation interval in which the variation times of the same MAC address falls, calculating an average value of the aging times of all the same MAC addresses falling in the variation interval, and using the average value as the updated aging time of the MAC entry specifically includes:
if the change times of the same MAC address fall into a first change interval, calculating a first aging time average value of all the same MAC addresses falling into the first change interval, and setting the first aging time average value as updated MAC table entry aging time;
if the change times of the same MAC address fall into a second change interval, setting the updated MAC table entry aging time as a default value;
and if the change times of the same MAC address fall into a third change interval, calculating a third aging time average value of all the same MAC addresses falling into the third change interval, and setting the third aging time average value as the updated MAC table entry aging time.
2. The method for adjusting MAC entry aging time according to claim 1, wherein before the step of obtaining the MAC address that changes in the MAC entry refresh statistic period and the number of changes of the same MAC address, the method further comprises:
the aging time for all MAC addresses is set to a default value.
3. The method for adjusting MAC entry aging time according to claim 2, wherein the obtaining of the MAC address that changes in the MAC entry refresh statistic period and the number of changes of the same MAC address specifically includes:
recording the changed MAC content during each MAC table item refreshing in the MAC table item refreshing statistical period;
and counting the change times of the same MAC address in the MAC table item refreshing counting period.
4. The method for adjusting the aging time of the MAC entry according to claim 1, wherein the step of determining a variation interval in which the number of variations of the same MAC address falls, calculating an average value of aging times of all the same MAC addresses falling in the variation interval, and using the average value as the aging time of the updated MAC entry further comprises:
and clearing the MAC address table item change storage table.
5. The method for adjusting MAC entry aging time as claimed in claim 4, wherein after the step of clearing the MAC address entry change storage table, the method further comprises:
and finishing the step of the method for adjusting the aging time of the MAC table item in the next refreshing statistical period of the MAC table item.
6. An apparatus for adjusting MAC table entry aging time, comprising:
the MAC content acquisition module is used for acquiring the changed MAC addresses and the change times of the same MAC addresses in the MAC table item refreshing statistical period;
the MAC table entry aging time updating module is used for judging a change interval in which the change times of the same MAC address fall, calculating an average value of the aging time of all the same MAC addresses falling in the change interval, and taking the average value as the updated MAC table entry aging time;
the determining a variation interval in which the variation times of the same MAC address falls, calculating an average value of the aging times of all the same MAC addresses falling in the variation interval, and using the average value as the updated aging time of the MAC entry specifically includes:
if the change times of the same MAC address fall into a first change interval, calculating a first aging time average value of all the same MAC addresses falling into the first change interval, and setting the first aging time average value as updated MAC table entry aging time;
if the change times of the same MAC address fall into a second change interval, setting the updated MAC table entry aging time as a default value;
and if the change times of the same MAC address fall into a third change interval, calculating a third aging time average value of all the same MAC addresses falling into the third change interval, and setting the third aging time average value as the updated MAC table entry aging time.
CN201911415259.1A 2019-12-31 2019-12-31 MAC (media Access control) table entry aging time adjusting method and device Active CN111147624B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911415259.1A CN111147624B (en) 2019-12-31 2019-12-31 MAC (media Access control) table entry aging time adjusting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911415259.1A CN111147624B (en) 2019-12-31 2019-12-31 MAC (media Access control) table entry aging time adjusting method and device

Publications (2)

Publication Number Publication Date
CN111147624A CN111147624A (en) 2020-05-12
CN111147624B true CN111147624B (en) 2022-12-13

Family

ID=70522722

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911415259.1A Active CN111147624B (en) 2019-12-31 2019-12-31 MAC (media Access control) table entry aging time adjusting method and device

Country Status (1)

Country Link
CN (1) CN111147624B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959430A (en) * 2016-05-31 2016-09-21 深圳市风云实业有限公司 Switcher MAC address aging method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959430A (en) * 2016-05-31 2016-09-21 深圳市风云实业有限公司 Switcher MAC address aging method

Also Published As

Publication number Publication date
CN111147624A (en) 2020-05-12

Similar Documents

Publication Publication Date Title
JP5182427B2 (en) System and method for adaptive power saving based on traffic profile
TWI459840B (en) Radio link synchronization in a wireless communication device
US20120110360A1 (en) Application-specific power management
WO2015172725A1 (en) Method and device for adjusting hardware refresh rate of terminal
US8310969B2 (en) Mobile device and power saving method thereof
CN112489648B (en) Awakening processing threshold adjusting method, voice household appliance and storage medium
US20160021612A1 (en) Wireless transmission device, wireless reception device, wireless transmission program, wireless reception program, and wireless communication system
CN108833149B (en) Method and system for monitoring network availability and self-healing of express delivery cabinet
CN111147624B (en) MAC (media Access control) table entry aging time adjusting method and device
US20200288403A1 (en) Smart power saving method for terminal, terminal, and device having memory function
CN111884888A (en) Referee machine election method and device, intelligent equipment and computer readable storage medium
CN109548121B (en) Communication method and device of wireless local area network, access point equipment and site equipment
CN113242434B (en) Video compression method and related device
CN110602798A (en) Distributed determination method for optimal parameters of LTE network machine communication random access
US9847886B2 (en) Sleeping link waking method and apparatus
CN110072125A (en) Video broadcasting method and device
WO2023019842A1 (en) Power control method and apparatus
WO2019232925A1 (en) Hotspot data migration flow control method and apparatus, and electronic device and storage medium
WO2021103893A1 (en) Wireless fidelity (wifi) chip control method and related device thereof
US9877285B2 (en) Method and system for device aware power save
CN110533897B (en) Socket-based coffee roasting communication method
CN102591821A (en) Method and device for processing data reporting interrupt control
CN107272874B (en) Method and system for adjusting state of storage driver of server
CN109547948B (en) Communication method and device of wireless local area network, access point equipment and site equipment
WO2022169409A8 (en) Communication apparatus and communication method for multi-link address resolution

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