Address table aging duration determination method and device, electronic equipment and storage medium

By sending and receiving packets in the switching device and calculating the actual aging time, the problem of inaccurate aging time determination of the MAC address table is solved and the accuracy of Layer 2 packet forwarding is improved.

CN118612191APending Publication Date: 2024-09-06BEIJING XINERTEL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410761058.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

The aging time of the MAC address table in the existing technology is not accurately determined, causing packet loss and affecting the accuracy of Layer 2 packet forwarding.

Method used

By sending target packets and traffic packets in the switching device, recording the packet sending and receiving time points, and calculating the actual aging time, the real aging time of the MAC address table can be determined.

Benefits of technology

It improves the accuracy of the aging time of the MAC address table, avoids the problem of packet loss in Layer 2 packet forwarding caused by the inconsistency between the configured aging time and the real aging time, and improves the accuracy of Layer 2 packet forwarding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118612191A
    Figure CN118612191A
Patent Text Reader

Abstract

The invention provides an address table aging duration determination method and device, electronic equipment and a storage medium, and relates to the technical field of network tests.The method comprises the steps that a first message is sent to switching equipment through a first port, and a first time point is recorded, so that the switching equipment adds a first MAC table item in an MAC address table based on the first message, the source MAC address of the first message is a target address, and the MAC address corresponding to the first MAC table item is the target address; sending a target traffic message to the switching device through the second port, wherein a target MAC address of the target traffic message is a target address; when the third port receives the target traffic message, a second time point is recorded, and the second time point is the moment when the third port receives the target traffic message; and determining the actual aging duration of the MAC address table according to the second time point and the first time point. By implementing the technical scheme provided by the invention, the problem that the determined aging time of the MAC address table is inaccurate in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network testing technology, and in particular to a method, device, electronic device and storage medium for determining the aging time of an address table. Background Art

[0002] The switch guides the forwarding of Layer 2 messages through the MAC (Media Access Control Address) address table. The MAC address table stores the mapping relationship between the destination MAC and the forwarding port. When the switch receives a Layer 2 message, it extracts the destination MAC address and looks up the table to find the port to be forwarded, and sends the message out. The content of the MAC address table is learned dynamically. When a port receives a Layer 2 message, it will record the mapping from the source MAC to the port. If no message from the MAC is received for a period of time, the mapping relationship will be deleted. The length of time the switch waits for deletion is called the aging time. The aging time is generally configurable. In the related art, the configured aging time is generally used as the aging time of the MAC address table. However, sometimes the configured aging time and the actual effective aging time are inconsistent, which can easily lead to packet loss in Layer 2 message forwarding. It can be seen that the aging time of the MAC address table determined in the related art is inaccurate, which affects the accuracy of Layer 2 message forwarding.

[0003] The aging time of the MAC address table determined in the related art is inaccurate, and no effective solution has been proposed yet. Summary of the invention

[0004] The present application provides a method, device, electronic device and storage medium for determining an aging time of an address table, so as to at least solve the problem that the aging time of a MAC address table determined in the related art is inaccurate.

[0005] In the first aspect, the present application provides a method for determining the aging time of an address table, comprising: sending a first message to a switching device through a first port and recording a first time point, so that the switching device adds a first MAC table entry in the MAC address table based on the first message, wherein the source MAC address of the first message is the target address, the first time point is the moment when the first message is sent, and the MAC address corresponding to the first MAC table entry is the target address; when it is determined that the first message has been sent, sending a target flow message to the switching device through a second port, wherein the destination MAC address of the target flow message is the target address; when the target flow message is received at a third port, recording a second time point, wherein the second time point is the moment when the third port receives the target flow message; determining the actual aging time of the MAC address table according to the second time point and the first time point.

[0006] By adopting the above technical solution, a first message is first sent to the switching device through the first port, and the first time point of sending the first message is recorded, the source MAC address in the first message is the target address, and the purpose of sending the first message is to trigger the switching device to record the first MAC table item about the target address in the MAC address table; then a target flow message is sent to the switching device through the second port, the destination MAC address of the target flow message is the target address, and then when the third port receives the target flow message, the second time point is recorded, that is, the time point when the third port receives the target flow message is recorded, because the switching device will delete the mapping relationship related to the target address if it does not receive the message from the above target address within a period of time. When deleting the mapping relationship, the switching device will broadcast to all ports. Therefore, the time when the target flow message is received by the third port can determine the time when the switching device deletes the mapping relationship corresponding to the target address, and thus the real aging time of the MAC address table can be determined. Through this technical solution, the problem of packet loss in Layer 2 message forwarding and the problem of accuracy of Layer 2 message forwarding caused by inconsistency between the configured aging time and the actual aging time in the related technology are avoided, and the purpose of improving the accuracy of determining the aging time of the MAC address table is achieved, thereby achieving the effect of improving the accuracy of Layer 2 message forwarding.

[0007] Optionally, sending a first message to the switching device through the first port and recording a first time point includes: obtaining a current aging time of the MAC address table, wherein the current aging time is a pre-configured aging time of the MAC address table; after waiting for a first preset time, sending a first message to the switching device through the first port, and recording a first time point, wherein the first preset time is greater than or equal to twice the current aging time.

[0008] By adopting the above technical solution, the current aging time of the MAC address table is obtained, and after waiting for the first preset time, the first message is sent to the switching device through the first port, and the first time point is recorded. The purpose of waiting for the first preset time is to clear the MAC address table of the switching device, so that it is convenient for the switching device to learn the MAC address after sending the first message.

[0009] Optionally, determining the actual aging duration of the MAC address table according to the second time point and the first time point includes: determining a difference between the second time point and the first time point as the actual aging duration.

[0010] By adopting the above technical solution, the difference between the second time point and the first time point can be used as the actual aging time of the MAC address table. The aging time determined by this technical solution is more accurate and more accurate and reliable than the configured aging time.

[0011] Optionally, when it is determined that the first message has been sent, sending the target flow message to the switching device through the second port includes: when it is determined that the first message has been sent, sending the target flow message to the switching device through the second port according to a preset rule.

[0012] By adopting the above technical solution, the target flow message can be sent to the switching device through the second port according to the preset rule, so as to achieve the purpose of continuously sending the flow message to the switching device through the second port.

[0013] Optionally, sending the target traffic message to the switching device through the second port according to preset rules includes one of the following: continuously sending the target traffic message to the switching device at a predetermined frequency; sending the target traffic message to the switching device, wherein the target traffic message includes a predetermined number of messages; sending the target traffic message to the switching device, wherein the target traffic message is a traffic message of a preset duration.

[0014] By adopting the above technical solution, target traffic messages can be sent to the switching device in different ways, which can be a fixed number of messages, a traffic message of a preset duration, or a continuous flow at a preset frequency.

[0015] Optionally, before sending the target traffic message to the switching device through the second port, the method further includes: configuring target flow information, wherein the target flow information is used to indicate that the target traffic message is sent through the second port.

[0016] By adopting the above technical solution, before sending the target flow message, the target flow information can be pre-configured, and the target flow information is used to instruct the tester to generate and send the target flow message of the corresponding rule. That is, the corresponding target flow message can be obtained by configuring the target flow information.

[0017] Optionally, when it is determined that the first message has been sent, sending the target traffic message to the switching device through the second port includes: sending the target traffic message to the switching device through the second port within a second preset time period after the first time point.

[0018] By adopting the above technical solution, the target traffic message is sent to the switching device through the second port within the second preset time after the first time point. The second preset time is set to ensure that the time point for sending the target traffic message cannot be too long from the first time point, that is, the second preset time cannot be too long. Otherwise, when the target traffic message is sent, the mapping relationship corresponding to the target address in the MAC address table will be deleted.

[0019] In the second aspect of the present application, a device for determining the aging time of an address table is also provided, including: a first sending module, used to send a first message to a switching device through a first port and record a first time point, so that the switching device adds a first MAC table entry in the MAC address table based on the first message, wherein the source MAC address of the first message is the target address, the first time point is the moment of sending the first message, and the MAC address corresponding to the first MAC table entry is the target address; a second sending module, used to send a target flow message to the switching device through a second port when it is determined that the first message has been sent, wherein the destination MAC address of the target flow message is the target address; a recording module, used to record a second time point when the target flow message is received at a third port, wherein the second time point is the moment when the target flow message is received at the third port; a determination module, used to determine the actual aging time of the MAC address table according to the second time point and the first time point.

[0020] In a third aspect of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, any one of the above methods is implemented.

[0021] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the above-described methods is executed.

[0022] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. The present invention avoids the problem of packet loss in Layer 2 message forwarding and the problem of affecting the accuracy of Layer 2 message forwarding due to the inconsistency between the configured aging time and the actual effective aging time in the related technology, thereby achieving the purpose of improving the accuracy of determining the aging time of the MAC address table, and thus achieving the effect of improving the accuracy of Layer 2 message forwarding. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 It is a flowchart of a method for determining the aging time of an address table provided in an embodiment of the present application; Figure 2 is a schematic diagram of a test application scenario provided in an embodiment of the present application; Figure 3 It is a flow chart of a method for verifying the aging time of a switch MAC table provided in an embodiment of the present application; Figure 4 This is a structural block diagram of a device for determining an aging time of an address table provided in an embodiment of the present application; Figure 5 It is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application.

[0024] Description of the reference numerals: 500 - electronic device; 501 - processor; 502 - communication bus; 503 - user interface; 504 - network interface; 505 - memory. DETAILED DESCRIPTION

[0025] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0026] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.

[0027] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0028] This application provides a method for determining the aging time of an address table. Figure 1 , Figure 1 1 is a flow chart of a method for determining an address table aging time provided in an embodiment of the present application, comprising the following steps: Step S101, sending a first message to a switching device through a first port and recording a first time point, so that the switching device adds a first MAC table entry in a MAC address table based on the first message, wherein the source MAC address of the first message is the target address, the first time point is the moment when the first message is sent, and the MAC address corresponding to the first MAC table entry is the target address; Step S102, when it is determined that the first message has been sent, sending a target flow message to the switching device through the second port, wherein the destination MAC address of the target flow message is the target address; Step S103, when the third port receives the target flow message, record the second time point, wherein the second time point is the moment when the third port receives the target flow message; Step S104: determining the actual aging time of the MAC address table according to the second time point and the first time point.

[0029] The execution subject of the above steps may be a network tester or other equipment.

[0030] Through the above steps, first send the first message to the switching device through the first port, and record the first time point of sending the first message, the source MAC address in the first message is the target address, for example, the target address is A, the purpose of sending the first message is to trigger the switching device to record the first MAC table entry about the target address in the MAC address table; then send the target flow message to the switching device through the second port, the destination MAC address of the target flow message is the target address, such as the above address A, that is, forward the target flow message to the tester through the switching device, and then when the third port receives the target flow message, record the second time point, that is, record the time point when the third port receives the target flow message, because the switching device has not received the message from the above for a period of time. In the case of a message to the target address, the mapping relationship related to the target address in the MAC address table will be deleted. When the mapping relationship is deleted, the switching device will broadcast to all ports. Therefore, the time when the target traffic message is received through the third port can determine the time when the switching device deletes the mapping relationship corresponding to the target address, and the real aging time of the MAC address table can be determined; when the target traffic message is sent at the second port, the first port can receive the target traffic message at the beginning, but the third port cannot receive it. When the switching device does not receive the message sent by the target address within the real aging time, it will delete the mapping relationship corresponding to the target address, so that the third port can receive the target traffic message. The first message can be a single message, the target traffic message can be one or more messages, and the target traffic message is a continuously sent flow; the first port can be a receiving port of a network tester, the second port can be a sending port of a network tester, and the third port can be other ports of the network tester except the first port and the second port. Through this technical solution, the problem of packet loss in Layer 2 message forwarding and the problem of accuracy of Layer 2 message forwarding caused by inconsistency between the configured aging time and the actual aging time in the related technology are avoided, and the purpose of improving the accuracy of determining the aging time of the MAC address table is achieved, thereby achieving the effect of improving the accuracy of Layer 2 message forwarding.

[0031] In an optional embodiment, sending a first message to a switching device through a first port and recording a first time point includes: obtaining a current aging time of a MAC address table, wherein the current aging time is a pre-configured aging time of the MAC address table; after waiting for a first preset time, sending a first message to the switching device through the first port and recording a first time point, wherein the first preset time is greater than or equal to twice the current aging time.

[0032] In the above embodiment, the current aging time of the MAC address table is obtained, and after waiting for the first preset time, the first message is sent to the switching device through the first port, and the first time point is recorded. The purpose of waiting for the first preset time is to clear the MAC address table of the switching device, so that it is convenient for the switching device to learn the MAC address after sending the first message. In actual applications, the network tester can be connected to the test PC end, and the current aging time of the corresponding MAC address table can be input through the interactive interface of the test PC end. For example, the current aging time is 60s (or 300s, or other time), and the first preset time is 130s (or 610s, or other time). After waiting for the first preset time, the MAC address table has been cleared, and then the first message is sent, so that the table entry of the above-mentioned target address can be learned.

[0033] In an optional embodiment, determining the actual aging duration of the MAC address table according to the second time point and the first time point includes: determining the difference between the second time point and the first time point as the actual aging duration.

[0034] In the above embodiment, the difference between the second time point and the first time point can be used as the actual aging time of the MAC address table, because the first time point can represent the time when the table entry about the target address is added to the MAC address table, and the second time point can be understood as the time when the table entry about the target address is deleted from the MAC address table, that is, the switching device does not receive the message sent by the source MAC address to the target address during this period (from the first time point to the second time point), so the switching device will delete the mapping relationship corresponding to the target address, and the aging time determined in this way is the most real aging time of the MAC address table. Therefore, the aging time determined by this technical solution is more accurate and more accurate and reliable than the configured aging time.

[0035] In an optional embodiment, when it is determined that the first message has been sent, the target traffic message is sent to the switching device through the second port, including: when it is determined that the first message has been sent, the target traffic message is sent to the switching device through the second port according to a preset rule.

[0036] In the above embodiment, the target flow message can be sent to the switching device through the second port according to the preset rule, so as to achieve the purpose of continuously sending the flow message to the switching device through the second port. The preset rule can be set in advance by the user or the tester.

[0037] In an optional embodiment, sending a target traffic message to a switching device through a second port according to a preset rule includes one of the following: continuously sending a target traffic message to a switching device at a predetermined frequency; sending a target traffic message to a switching device, wherein the target traffic message includes a predetermined number of messages; sending a target traffic message to a switching device, wherein the target traffic message is a traffic message of a preset duration.

[0038] In the above embodiment, the target traffic message can be sent to the switching device in different ways, which can be a fixed number of messages, a traffic message of a preset duration, or a continuous flow at a preset frequency. Regardless of the method used to send the target traffic message, the duration for the network tester to send the target traffic message must be long enough.

[0039] In an optional embodiment, before sending the target flow message to the switching device through the second port, the method further includes: configuring target flow information, wherein the target flow information is used to indicate that the target flow message is sent through the second port.

[0040] In the above embodiment, before sending the target flow message, the target flow information can be pre-configured, and the target flow information is used to instruct the tester to generate and send the target flow message of the corresponding rule. That is, the corresponding target flow message can be obtained by configuring the target flow information. In actual application, the user or tester can pre-configure the relevant flow information, such as the number, length, or interval of the message, through the test PC.

[0041] In an optional embodiment, when it is determined that the first message has been sent, sending the target traffic message to the switching device through the second port includes: sending the target traffic message to the switching device through the second port within a second preset time after the first time point.

[0042] In the above embodiment, the target flow message is sent to the switching device through the second port within the second preset time after the first time point. The second preset time is set to ensure that the time point of sending the target flow message cannot be too long from the first time point, that is, the second preset time cannot be too long. Otherwise, when sending the target flow message, the mapping relationship corresponding to the target address in the MAC address table has been deleted. For example, taking the aforementioned current aging time of 60s as an example, the second preset time can be half of the current aging time, such as 30s, or one tenth of the current aging time, such as 6s, or the second preset time can be set to a fixed value, such as 1s. The second preset time can be set as needed. In short, the interval between the time point of sending the target flow message and the first time point cannot be too long.

[0043] In the above embodiment, both the first message and the target traffic message are layer 2 messages.

[0044] Obviously, the above-described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application will be described in detail below in conjunction with specific embodiments.

[0045] There is no clear test method in the related art for verifying the aging time of the MAC table of a switch. The embodiment of the present application provides a method for automatically verifying the aging time of the MAC table of a switch. Figure 2 is a schematic diagram of a test application scenario provided in an embodiment of the present application. In the embodiment of the present application, three ports are used: a sending port (such as Figure 2 Tx Port in), receiving port (such as Figure 2 The sending port is configured with an L2 traffic Stream1, the destination MAC is A (corresponding to the aforementioned target address), and the DUT is the device under test, such as a switch. The Flood port here is only an example, and it can also be other ports besides the sending port and receiving port mentioned above, and A is the destination MAC address.

[0046] Figure 3 The method for verifying the aging time of the switch MAC table provided in the embodiment of the present application is a flow chart, comprising the following steps: S301, obtaining the aging time of the current MAC table of the switch; For example, the tester (i.e., network tester) inputs the current MAC table aging time of the switch through an interactive interface. In actual applications, the tester can be connected to a test PC, and the user can input the current MAC table aging time of the switch in the interactive interface of the test PC.

[0047] S302, wait for twice the aging time; That is, the tester first waits for twice the aging time (the aging time of the current MAC table mentioned above) to ensure that the MAC table of the switch has been cleared.

[0048] S303, sending a message whose source MAC is A through the receiving port, and recording the time T1; A L2 message with source MAC A is sent through the receiving port to trigger the switch to record the entry of MAC address A and the time T1, which is the time when the message in this step is sent.

[0049] S304, continue to send messages whose destination MAC is A; That is, after step S303, Stream1 is immediately started to continuously send messages whose destination MAC is A.

[0050] S305, the Flood port receives the message and records the time T2; At first, the receiving port can receive the message, but the flood port does not receive the message; when the switch corresponding to MAC address A ages out, the flood port will receive the message and record the time T2, which is the time of receiving the message in this step. When the switch corresponding to MAC address A ages out (referring to the actual aging time), the switch will delete the mapping relationship of MAC address A. At this time, the switch will broadcast to each port, so the flood port will receive the message.

[0051] S306, determining the real address aging time of the switch; It can be concluded that T2-T1 is the actual address aging time of the switch.

[0052] Through the embodiments of the present application, the purpose of automatically verifying the aging time of the switch MAC address table can be achieved, and compared with the configured aging time, the actual aging time determined by the embodiments of the present application is more accurate, thereby improving the correctness of Layer 2 message forwarding.

[0053] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0054] The present application also provides a device for determining the aging time of an address table, such as Figure 4 As shown, Figure 4 : is a structural block diagram of a device for determining an address table aging time provided in an embodiment of the present application, the device comprising: A first sending module 401 is configured to send a first message to a switching device through a first port and record a first time point, so that the switching device adds a first MAC table entry in a MAC address table based on the first message, wherein a source MAC address of the first message is a target address, the first time point is a moment when the first message is sent, and a MAC address corresponding to the first MAC table entry is the target address; The second sending module 402 is used to send a target flow message to the switching device through the second port when it is determined that the first message has been sent, wherein the destination MAC address of the target flow message is the target address; The recording module 403 is used to record a second time point when the third port receives the target flow message, wherein the second time point is the moment when the third port receives the target flow message; The determination module 404 is used to determine the actual aging time of the MAC address table according to the second time point and the first time point.

[0055] In an optional embodiment, the above-mentioned first sending module 401 includes: an acquisition unit, used to obtain the current aging time of the MAC address table, wherein the current aging time is a pre-configured aging time of the MAC address table; a first sending unit, used to send a first message to the switching device through the first port after waiting for a first preset time, and record a first time point, wherein the first preset time is greater than or equal to twice the current aging time.

[0056] In an optional embodiment, the determination module 404 includes: a determination unit, configured to determine the difference between the second time point and the first time point as the actual aging duration.

[0057] In an optional embodiment, the second sending module 402 includes: a second sending unit, configured to send the target flow message to the switching device through the second port according to a preset rule when it is determined that the first message has been sent.

[0058] In an optional embodiment, the above-mentioned second sending unit is used to send the target traffic message to the switching device in one of the following ways: continuously sending the target traffic message to the switching device at a predetermined frequency; sending the target traffic message to the switching device, wherein the target traffic message includes a predetermined number of messages; sending the target traffic message to the switching device, wherein the target traffic message is a traffic message of a preset duration.

[0059] In an optional embodiment, the above-mentioned apparatus further includes: a configuration module, configured to configure target flow information before sending the target flow message to the switching device through the second port, wherein the target flow information is used to indicate that the target flow message is sent through the second port.

[0060] In an optional embodiment, the second sending module 402 includes: a third sending unit, configured to send the target traffic message to the switching device through the second port within a second preset time period after the first time point.

[0061] The present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed, any one of the method steps described above is executed.

[0062] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0063] The present application also discloses an electronic device. Figure 5 As shown, Figure 5 The electronic device 500 may include: at least one processor 501 , at least one network interface 504 , a user interface 503 , a memory 505 , and at least one communication bus 502 .

[0064] The communication bus 502 is used to realize the connection and communication between these components.

[0065] The user interface 503 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 503 may also include a standard wired interface and a wireless interface.

[0066] The network interface 504 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0067] Among them, the processor 501 may include one or more processing cores. The processor 501 uses various interfaces and lines to connect various parts of the entire electronic device (such as a server), and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 505, and calling data stored in the memory 505. Optionally, the processor 501 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 501 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 501, and can be implemented separately through a chip.

[0068] Among them, the memory 505 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 505 includes a non-transitory computer-readable storage medium. The memory 505 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 505 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 505 may also be optionally at least one storage device located away from the aforementioned processor 501. Refer to Figure 5 , the memory 505 as a computer storage medium may include an operating system, a network communication module, a user interface module and an application program of a method for determining an aging time of an address table.

[0069] exist Figure 5In the electronic device 500 shown, the user interface 503 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 501 can be used to call an application program of a method for determining the aging time of an address table stored in the memory 505, and when executed by one or more processors 501, the electronic device 500 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.

[0070] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0071] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0072] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0073] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0074] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.

[0075] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.

[0076] This application is intended to cover any modifications, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the technical field not recorded in the present disclosure.

Claims

1. A method for determining the aging time of an address table, characterized in that: include: Sending a first message to a switching device through a first port and recording a first time point, so that the switching device adds a first MAC table entry in a MAC address table based on the first message, wherein the source MAC address of the first message is a target address, the first time point is a moment of sending the first message, and the MAC address corresponding to the first MAC table entry is the target address; When it is determined that the first message has been sent, sending a target flow message to the switching device through the second port, wherein the destination MAC address of the target flow message is the target address; When the third port receives the target traffic message, record a second time point, wherein the second time point is the moment when the third port receives the target traffic message; An actual aging duration of the MAC address table is determined according to the second time point and the first time point.

2. The method according to claim 1, characterized in that Sending a first message to a switching device through a first port and recording a first time point includes: Obtaining a current aging time of the MAC address table, wherein the current aging time is a pre-configured aging time of the MAC address table; After waiting for a first preset time period, sending the first message to the switching device through the first port, and recording the first time point, wherein the first preset time period is greater than or equal to twice the current aging time period.

3. The method according to claim 1, characterized in that Determining an actual aging time of the MAC address table according to the second time point and the first time point includes: The difference between the second time point and the first time point is determined as the actual aging duration.

4. The method according to claim 1, characterized in that: When it is determined that the first message has been sent, sending a target flow message to the switching device through the second port includes: When it is determined that the first message has been sent, the target traffic message is sent to the switching device through the second port according to a preset rule.

5. The method according to claim 4, characterized in that Sending the target traffic message to the switching device through the second port according to a preset rule includes one of the following: Continuously sending the target traffic message to the switching device at a predetermined frequency; Sending the target traffic message to the switching device, wherein the target traffic message includes a predetermined number of messages; The target traffic message is sent to the switching device, wherein the target traffic message is a traffic message of a preset duration.

6. The method according to claim 1, characterized in that Before sending the target traffic message to the switching device through the second port, the method further includes: Configure target flow information, wherein the target flow information is used to indicate that the target flow message is sent through the second port.

7. The method according to claim 1, characterized in that When it is determined that the first message has been sent, sending a target flow message to the switching device through the second port includes: Within a second preset time period after the first time point, the target traffic message is sent to the switching device through the second port.

8. A device for determining the aging time of an address table, characterized in that: include: A first sending module, configured to send a first message to a switching device through a first port and record a first time point, so that the switching device adds a first MAC table entry in a MAC address table based on the first message, wherein the source MAC address of the first message is a target address, the first time point is a moment when the first message is sent, and the MAC address corresponding to the first MAC table entry is the target address; A second sending module, configured to send a target flow message to the switching device through a second port when it is determined that the first message has been sent, wherein the destination MAC address of the target flow message is the target address; A recording module, configured to record a second time point when the third port receives the target flow message, wherein the second time point is the moment when the third port receives the target flow message; A determination module is used to determine the actual aging time of the MAC address table according to the second time point and the first time point.

9. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is performed.