Method and device for measuring capacity of MAC address table of switch and medium
The method and device measure switch MAC address table capacity by sending broadcast traffic and analyzing port traffic, addressing the issue of full MAC tables and unicast flooding, enhancing network management efficiency and accuracy.
Patent Information
- Application Number
- CN202411152826.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-17
AI Technical Summary
Switches face issues when their MAC address tables become full, leading to network bandwidth occupation due to unicast traffic flooding, as they stop learning new MAC addresses.
A method and device for measuring the capacity of a switch MAC address table by connecting a tester with multiple ports to the switch, sending broadcast traffic, and determining MAC address table capacity based on port traffic feedback, allowing for automatic adjustment of test parameters to accommodate switches of varying capacities.
Accurately calculates MAC address table capacity with improved efficiency and accuracy, supporting effective network management and maintenance by simplifying the measurement process.
Smart Images

Figure CN119155216A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of switches, and in particular to a method, device and medium for measuring the capacity of a MAC address table of a switch. Background Art
[0002] In the switch test environment, the switch MAC learning and addressing forwarding functions are often involved. When the switch MAC capacity is full, the switch will no longer learn new MAC addresses, and some unicast traffic will flood, causing network bandwidth occupation. Summary of the invention
[0003] In order to solve the above problems, the present application proposes a method for measuring the capacity of a switch MAC address table, including: determining a pre-set tester and connecting the switch to the tester; sending broadcast traffic to the switch through the tester to determine the port traffic of the switch, so as to provide feedback to the port of the tester based on the port traffic; determining the MAC address table capacity of the switch based on the port traffic of the tester and the port traffic of the switch.
[0004] In one example, the tester includes multiple ports, wherein the tester includes at least a first test port, a second test port, and a third test port, and the switch includes multiple ports, wherein the switch includes at least a first switching port, a second switching port, and a third switching port.
[0005] In one example, sending broadcast traffic to the switch through the tester specifically includes: sending first broadcast traffic to the switch through the first test port to determine parameters of the first broadcast traffic, wherein the parameters include a source address, an incremental step, and a destination address; learning the first broadcast traffic through the first switch port to determine the number of MAC addresses learned by the first switch port; determining the amount of the first broadcast traffic based on the parameters, determining the amount of traffic received by the second test port based on the amount of the first broadcast traffic, and determining the amount of traffic received by the third test port.
[0006] In one example, sending broadcast traffic to the switch through the tester specifically also includes: sending second broadcast traffic to the switch through the second test port, setting the destination address of the second broadcast traffic to the source address of the first broadcast traffic; determining the unicast traffic in the second broadcast traffic according to the number of MAC addresses learned by the first switch port, and sending the unicast traffic to the first switch port so that the first test port receives the unicast traffic; determining the remaining traffic according to the second broadcast traffic and the unicast traffic, and flooding the remaining traffic to the first switch port and the third switch port so that the first test port and the third test port receive the remaining traffic.
[0007] In one example, the method further includes: determining a total amount of traffic received by the third test port, and determining the MAC address table capacity of the switch according to the total amount of traffic, the amount of first broadcast traffic, and the amount of second broadcast traffic.
[0008] In one example, the method further includes: comparing the MAC address table capacity with the amount of the first broadcast traffic; if the MAC address table capacity is less than the amount of the first broadcast traffic, determining the MAC address table capacity of the switch; if the MAC address table capacity is greater than or equal to the amount of the first broadcast traffic, clearing the MAC address table of the switch and clearing the statistics of the tester.
[0009] In one example, after clearing the statistics of the tester, the method further includes: changing the quantity of the first broadcast traffic according to a preset increase amount, so as to perform measurement according to the changed first broadcast traffic.
[0010] In one example, the amount of the second broadcast traffic is equal to the amount of the first broadcast traffic.
[0011] On the other hand, the present application also proposes a device for measuring the capacity of a switch MAC address table, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the device for measuring the capacity of a switch MAC address table can perform the following: determining a pre-set tester and connecting the switch to the tester; sending broadcast traffic to the switch through the tester to determine the port traffic of the switch, so as to provide feedback to the port of the tester based on the port traffic; and determining the MAC address table capacity of the switch based on the port traffic of the tester and the port traffic of the switch.
[0012] On the other hand, the present application also proposes a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to: determine a pre-set tester and connect a switch to the tester; send broadcast traffic to the switch through the tester to determine the port traffic of the switch, so as to provide feedback to the port of the tester based on the port traffic; determine the MAC address table capacity of the switch based on the port traffic of the tester and the port traffic of the switch.
[0013] This application uses the characteristics of switch MAC learning and addressing forwarding to use a tester to measure the capacity of the switch MAC address table. By connecting the pre-set tester to the switch, sending broadcast traffic and monitoring port traffic feedback, the MAC address table capacity of the switch can be accurately calculated. Not only is the operation simple, but the test parameters can also be automatically adjusted to cope with switches of different capacities, which greatly improves the measurement efficiency and accuracy, and provides strong support for network management and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0015] Figure 1 A schematic diagram of a flow chart of a method for measuring the capacity of a switch MAC address table in an embodiment of the present application;
[0016] Figure 2 This is a schematic diagram of the connection between the switch and the measuring instrument in the embodiment of the present application;
[0017] Figure 3 A schematic diagram of a device for measuring the capacity of a switch MAC address table in an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0019] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0020] like Figure 1As shown, in order to solve the above problem, an embodiment of the present application provides a method for measuring the capacity of a switch MAC address table, the method comprising:
[0021] S101, determine a pre-set tester, and connect a switch to the tester.
[0022] like Figure 2 As shown, the three ports of the tester with traffic statistics function, port A (referred to as the first test port here), port B (referred to as the second test port here), and port C (referred to as the third test port here), are directly connected to the three ports of the switch, port 1 (referred to as the first switching port here), port 2 (referred to as the second switching port here), and port 3 (referred to as the third switching port here), respectively, and the capacity of the switch MAC address table is recorded as N.
[0023] S102: Send broadcast traffic to the switch through the tester to determine the port traffic of the switch, and provide feedback to the port of the tester according to the port traffic.
[0024] In one embodiment, port A of the tester sends broadcast traffic (referred to as the first broadcast traffic) to the switch, with the source MAC address starting from a preset starting value and increasing in a fixed step size X, and the destination MAC address being FFFF-FFFF-FFFF, until the number of MAC addresses learned on switch port 1 reaches its capacity N, at which time tester ports B and C each receive X traffic A.
[0025] In one embodiment, port B of the tester sends X flows (referred to as second broadcast flows herein), the source MAC address of each flow is any MAC address that is not the same as any source MAC address in the first broadcast flow, and the destination MAC address is set to the source MAC address sent in the first broadcast flow in sequence; wherein, the first N flows are unicast to switch port 1 because the MAC address already exists in the switch MAC address table, and are received by tester port A. The remaining XN flows are flooded to switch ports 1 and 3 because the destination MAC address is unknown, and are then received by tester ports A and C.
[0026] S103: Determine the MAC address table capacity of the switch according to the port flow of the tester and the port flow of the switch.
[0027] In one embodiment, the total amount of traffic received by the statistical tester port C is recorded as Y, and the current capacity N of the switch MAC address table is calculated according to the formula N=2X-Y.
[0028] In one embodiment, N is compared with X. If N ≥ X, it indicates that the MAC address table of switch port 1 is not fully learned or is just fully learned. At this time, the switch port is downed and then uped again to clear the MAC address table and reset the statistical data of the tester. The value of X is increased according to the preset increment, and the above steps are repeated until N < X. At this time, the obtained N is the MAC address table capacity of the switch.
[0029] As Figure 3 shown, an embodiment of the present application also provides a measuring device for the MAC address table capacity of a switch, including:
[0030] At least one processor; and,
[0031] A memory communicatively connected to the at least one processor; wherein,
[0032] The memory stores instructions executable by the at least one processor. The instructions are executed by the at least one processor so that a measuring device for the MAC address table capacity of a switch can execute:
[0033] Determine a preset tester and connect the switch to the tester;
[0034] Send broadcast traffic to the switch through the tester, determine the port traffic of the switch, and feedback to the port of the tester according to the port traffic;
[0035] Determine the MAC address table capacity of the switch according to the port traffic of the tester and the port traffic of the switch.
[0036] An embodiment of the present application also provides a non-volatile computer storage medium storing computer-executable instructions, and the computer-executable instructions are set as:
[0037] Determine a preset tester and connect the switch to the tester;
[0038] Send broadcast traffic to the switch through the tester, determine the port traffic of the switch, and feedback to the port of the tester according to the port traffic;
[0039] Determine the MAC address table capacity of the switch according to the port traffic of the tester and the port traffic of the switch.
[0040] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0041] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0042] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0043] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0044] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0045] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0046] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0047] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0048] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0049] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0050] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0051] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0052] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0053] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0054] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for measuring the capacity of a switch MAC address table. It is characterized in that include: Determine a pre-set tester, and connect the switch to the tester; Sending broadcast traffic to the switch through the tester to determine the port traffic of the switch, so as to provide feedback to the port of the tester according to the port traffic; The MAC address table capacity of the switch is determined according to the port flow of the tester and the port flow of the switch.
2. The method according to claim 1, It is characterized in that The tester comprises a plurality of ports, wherein the tester comprises at least a first test port, a second test port, and a third test port; the switch comprises a plurality of ports, wherein the switch comprises at least a first switching port, a second switching port, and a third switching port.
3. The method according to claim 2, It is characterized in that Sending broadcast traffic to the switch through the tester specifically includes: Sending first broadcast traffic to the switch through the first test port to determine parameters of the first broadcast traffic, wherein the parameters include a source address, an increment step, and a destination address; Learning the first broadcast traffic through the first switch port to determine the number of MAC addresses learned by the first switch port; The amount of the first broadcast traffic is determined according to the parameter, so as to determine the amount of traffic received by the second test port according to the amount of the first broadcast traffic, and to determine the amount of traffic received by the third test port.
4. The method according to claim 3, It is characterized in that Sending broadcast traffic to the switch through the tester specifically includes: Sending second broadcast traffic to the switch through the second test port, and setting the destination address of the second broadcast traffic to the source address of the first broadcast traffic; Determine the unicast traffic in the second broadcast traffic according to the number of MAC addresses learned by the first switch port, and send the unicast traffic to the first switch port so that the first test port receives the unicast traffic; The remaining traffic is determined according to the second broadcast traffic and the unicast traffic, and the remaining traffic is flooded to the first switch port and the third switch port, so that the first test port and the third test port receive the remaining traffic.
5. The method according to claim 3, It is characterized in that The method further comprises: The total amount of traffic received by the third test port is determined, and the MAC address table capacity of the switch is determined according to the total amount of traffic, the amount of the first broadcast traffic, and the amount of the second broadcast traffic.
6. The method according to claim 3, It is characterized in that The method further comprises: comparing the MAC address table capacity with the amount of the first broadcast traffic; If the MAC address table capacity is less than the amount of the first broadcast traffic, determining the MAC address table capacity of the switch; If the capacity of the MAC address table is greater than or equal to the amount of the first broadcast traffic, the MAC address table of the switch is cleared, and the statistics of the tester are cleared.
7. The method according to claim 6, It is characterized in that After clearing the statistics of the tester, the method further includes: The amount of the first broadcast traffic is changed according to a preset increase amount, so as to perform measurement according to the changed first broadcast traffic.
8. The method according to claim 4, It is characterized in that The amount of the second broadcast traffic is equal to the amount of the first broadcast traffic.
9. A device for measuring the capacity of a switch MAC address table, It is characterized in that include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the device for measuring the capacity of a switch MAC address table to perform: Determine a pre-set tester, and connect the switch to the tester; Sending broadcast traffic to the switch through the tester to determine the port traffic of the switch, so as to provide feedback to the port of the tester according to the port traffic; The MAC address table capacity of the switch is determined according to the port flow of the tester and the port flow of the switch.
10. A non-volatile computer storage medium storing computer executable instructions, It is characterized in that The computer executable instructions are configured to: Determine a pre-set tester, and connect the switch to the tester; Sending broadcast traffic to the switch through the tester to determine the port traffic of the switch, so as to provide feedback to the port of the tester according to the port traffic; The MAC address table capacity of the switch is determined according to the port flow of the tester and the port flow of the switch.
Citation Information
Patent Citations
Testing method for Ethernet media access control table capacity
CN101150457A
Method for testing size of MAC address table of switch product
CN103647680A
System and method for testing switch MAC address learning
CN105141553A
Network device MAC address capacity test system and method
CN107483336A
Method and device for expanding capacity of MAC address table and medium
CN115665066A
