Method for testing performance of double network ports based on link layer loopback

Through the dual-network link layer loopback test method, the network interface inside the system is directly used for self-testing, which solves the problem of the inability to fully verify the normality and test complexity of the hardware links in the existing technology, and realizes the efficiency and stability of network data transmission Accurate evaluation of sexuality and simplify testing process.

CN119299348APending Publication Date: 2025-01-10TRONLONG
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411552620.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing network port testing methods rely on the TCP/IP protocol, and cannot fully verify the normality of the hardware link. The interference impact of other devices during testing in the LAN increases the testing cost and complexity.

Method used

The dual network port is used to test the performance method of link layer loopback testing, and the link layer loopback is formed by connecting the first network port and the second network port, sending test data packets and recording sending and receiving information or packet loss information, and calculating the transmission rate and packet loss rate , directly use the internal network interface of the system for self-testing to avoid interference from external devices and protocols.

Benefits of technology

Accurate evaluation of hardware link performance is achieved, simplifies the testing process, reduces costs, provides a more direct and reliable link performance evaluation, and records key performance metrics to optimize network performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119299348A_ABST
    Figure CN119299348A_ABST
Patent Text Reader

Abstract

The invention discloses a method for testing performance of double network ports based on link layer loopback, which comprises the following steps of: sending a network test data packet from one network port by using a link layer loopback mechanism, and recycling the network test data packet to the other network port through link layer loopback, namely, directly circulating the data packet between the sending network port and the receiving network port; the efficiency and the stability of network data transmission can be tested, and the actual performance of a hardware link can be accurately evaluated; according to the invention, the first network port and the second network port in the system are directly utilized to carry out self-testing, additional communication equipment is not needed, the influence of external equipment and protocol interference is avoided, the network port testing process is simplified, the cost is remarkably reduced, and more direct and more reliable link performance evaluation is provided. In addition, key performance indexes of the packet loss rate and the transmission rate of data transmission can be recorded, and reliable data support is provided for optimizing network performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of performance testing of network interfaces, and in particular to a performance testing method for dual network ports based on link layer loopback. Background Art

[0002] The network port is the network interface. In the field of network communication, it is usually necessary to test the data transmission performance of the network port to optimize network performance. Existing network port testing methods usually rely on the TCP / IP protocol to communicate with the peer device, which may not be able to fully verify the normality of the hardware link due to the underlying packet loss and retransmission mechanism. In addition, when testing in a local area network, interference from other devices may affect the test results, so it is usually necessary to purchase additional routers or switches to establish a dedicated network port testing environment, which not only increases the cost of network port testing, but may also complicate the test settings. Summary of the invention

[0003] 1. Technical issues to be solved

[0004] In view of the deficiencies in the prior art, the present invention provides a dual network port link layer loopback performance test method, which can solve at least one of the above technical problems.

[0005] (II) Technical solution

[0006] To solve the above technical problems, the present invention provides the following technical solutions: a dual network port based link layer loopback test performance method, comprising the following steps:

[0007] S1, connecting the first network port and the second network port to form a link layer loop, wherein the first network port serves as a user end and the second network port serves as a server end;

[0008] S2, the first network port sends a test data packet to the second network port;

[0009] S3, the second network port waits to receive the test data packet;

[0010] S4. If the second network port receives the test data packet, the second network port sends response data to the first network port;

[0011] S5. If the first network port receives the response data, the received and sent data information is recorded; or, if the first network port cannot receive the response data, the packet loss information is recorded.

[0012] Preferably, in step S1, the first network port and the second network port are connected via a network cable to form a link layer loop.

[0013] Preferably, before step S2, the method further includes: the first network port opens a socket, and further, the first network port constructs a test data packet.

[0014] Preferably, the test data packet specifically includes a source MAC address, a target MAC address and test data.

[0015] Preferably, before step S3, the method further includes: the second network port opens a socket, and further, the second network port monitors its network port MAC address.

[0016] Preferably, in step S2, after the first network port sends the test data packet, the first network port further waits for the second network port to return response data.

[0017] Preferably, in step S2, the first network port cyclically sends a test data packet to the second network port within a first preset time period.

[0018] Preferably, in step S5, if the first network port receives response data within a second preset time period, the data sending and receiving information is recorded; or, if the first network port cannot receive response data within the second preset time period, the packet loss information is recorded, wherein the first preset time period is greater than the second preset time period.

[0019] Preferably, the dual network port link layer loopback performance test method further includes the step: S6, calculating the transmission rate and packet loss rate of the test data packet within the first preset time length.

[0020] (III) Beneficial effects

[0021] Compared with the prior art, the present invention provides a dual network port based link layer loopback test performance method, which has the following beneficial effects: the present invention utilizes the link layer loopback mechanism, by sending a network test data packet from one network port (first network port) and recycling it to another network port (second network port) through a link layer loopback, that is, directly circulating the data packet between the sending and receiving network ports, it is possible to test the efficiency and stability of network data transmission, and accurately evaluate the actual performance of the hardware link; and the present invention directly utilizes the first network port and the second network port of the system for self-testing, without the need for additional communication equipment, avoiding the influence of external equipment and protocol interference, simplifying the network port test process and significantly reducing costs, and providing a more direct and reliable link performance evaluation. In addition, the present invention can record the key performance indicators of packet loss rate and transmission rate of data transmission, providing reliable data support for optimizing network performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A first flow chart of a dual network port link layer loopback performance test method according to the present invention;

[0023] Figure 2 This is a second flow chart of a dual network port link layer loopback performance testing method according to the present invention. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] The present invention provides a dual network port link layer loopback test performance method, comprising the following steps:

[0026] S1. Connect a first network port and a second network port to form a link layer loop, wherein the first network port serves as a client and the second network port serves as a server.

[0027] In step S1, a first network port and a second network port are connected by a network cable to form a link layer loop. The first network port is network port 1, and the second network port is network port 2. The network port is a network interface. The first network port and the second network port are two network interfaces inside the local system.

[0028] S2. The first network port sends a test data packet to the second network port.

[0029] Before the first network port sends the test data packet to the second network port in step S2, the method further includes: the first network port opens a socket, and further, the first network port constructs a test data packet. The test data packet specifically includes a source MAC address, a target MAC address, and test data, etc. The source MAC address corresponds to the MAC address of the first network port, and the target MAC address corresponds to the MAC address of the second network port.

[0030] In step S2, after the first network port sends the test data packet, the first network port further waits for the second network port to return response data.

[0031] S3. The second network port waits to receive a test data packet.

[0032] Before step S3, the method further includes: the second network port opens a socket, and further, the second network port monitors its network port MAC address to wait for receiving a test data packet. It can be understood that a socket is a socket, and the first network port and the second network port open their socket ports respectively. The first network port and the second network port implement link layer communication based on the socket. Since the link layer protocol is used, the network port does not need to be configured with an IP, and the communication between the network ports can be completed conveniently and quickly through the network port MAC address.

[0033] S4. If the second network port receives the test data packet, the second network port sends response data to the first network port; it can be understood that the response data is used to indicate that the second network port has successfully received the test data packet sent by the first network port. Preferably, the second network port does not perform task processing upon receiving the test data packet and directly returns the above response data to the first network port to better ensure the reliability of the network port test. In addition, if the second network port cannot receive the test data packet sent by the first network port, the second network port does not create response data and naturally cannot send response data, that is, the transmission of this test data packet is a packet loss situation.

[0034] S5. If the first network port receives response data, the sending and receiving data information is recorded, indicating that the transmission of this test data packet is a normal and successful transmission. The sending and receiving data information may specifically include information such as the time when the first network port sends the test data packet, the time when the second network port receives the test data packet, and the time when the first network port receives the response data; or, if the first network port cannot receive the response data, the packet loss information is recorded. This situation may be caused by the second network port being unable to receive the test data packet sent by the first network port or by the response data being lost during the transmission process from the second network port to the first network port, that is, the transmission of this test data packet is a packet loss situation. The packet loss information may specifically include information such as the detailed content of the test data packet and the time when the first network port sends the test data packet.

[0035] Preferably, in step S2, the first network port cyclically sends a test data packet to the second network port within a first preset time period, so as to more accurately and realistically test the continuous data transmission performance of the network port. Further preferably, within the above-mentioned first preset time length, the time intervals before and after the first network port cyclically sends the test data packet to the second network port adopts a combination of fixed time intervals and non-fixed time intervals, so as to test the transmission performance of the network port under different data transmission conditions such as fixed transmission intervals and non-fixed burst random transmission intervals, so as to more realistically and reliably evaluate the actual performance of the link: for example, within the first preset time length, the first network port sends test data packets A1, A2, A3, A4, and A5 to the second network port in sequence, wherein the time interval before and after A1 and A2 are 1ms, the time interval before and after A2 and A3 are 1ms, the time interval before and after A3 and A4 are 1.5ms, and the time interval before and after A4 and A5 are 1ms, that is, A1 and A2, A2 and A3, A4 and A5 are all sent at fixed time intervals, while A3 and A4 are sent at non-fixed time intervals.

[0036] In addition, preferably, in step S5, if the first network port receives response data within a second preset time period, the data sending and receiving information is recorded, or if the first network port cannot receive response data within the second preset time period, the packet loss information is recorded, wherein the first preset time period is greater than the second preset time period; by setting the second preset time period to test whether the data transmission performance of the network port meets the real-time requirements.

[0037] In addition, the dual network port performance test method based on the link layer loopback of the present invention can also include the steps: S6, calculating the transmission rate and packet loss rate of the test data packet within the first preset time length to accurately evaluate the actual performance of the link. It can be understood that the transmission rate can be calculated by dividing the number of test data packets successfully transmitted within the first preset time length by the total transmission time of the test data packets successfully transmitted, wherein the transmission time can be calculated by the moment when the first network port sends the test data packet and the moment when the first network port receives the response data. The packet loss rate can be calculated by dividing the number of test data packets with packet loss within the first preset time length by the total number of test data packets sent by the first network port within the first preset time length. Further preferably, it is determined whether the transmission rate and packet loss rate meet the requirements of the corresponding preset transmission rate and preset packet loss rate respectively. If not, an early warning message is generated to indicate that the data transmission performance of the first network port and the second network port does not meet the preset requirements.

[0038] Compared with the prior art, the present invention provides a dual network port based link layer loopback test performance method, which has the following beneficial effects: the present invention utilizes the link layer loopback mechanism, by sending a network test data packet from one network port (first network port) and recycling it to another network port (second network port) through a link layer loopback, that is, directly circulating the data packet between the sending and receiving network ports, it is possible to test the efficiency and stability of network data transmission, and accurately evaluate the actual performance of the hardware link; and the present invention directly utilizes the first network port and the second network port of the system for self-testing, without the need for additional communication equipment, avoiding the influence of external equipment and protocol interference, simplifying the network port test process and significantly reducing costs, and providing a more direct and reliable link performance evaluation. In addition, the present invention can record the key performance indicators of packet loss rate and transmission rate of data transmission, providing reliable data support for optimizing network performance.

[0039] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0040] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A dual network port link layer loopback test performance method, characterized in that: The following steps are involved: S1, connecting a first network port and a second network port to form a link layer loop, wherein the first network port serves as a user end and the second network port serves as a server end; S2. The first network port sends a test data packet to the second network port; S3, the second network port waits to receive the test data packet; S4. If the second network port receives the test data packet, the second network port sends response data to the first network port; S5. If the first network port receives the response data, record the data sending and receiving information; or, if the first network port cannot receive the response data, record the packet loss information.

2. The dual network port link layer loopback test performance method according to claim 1, characterized in that: In the step S1, the first network port and the second network port are connected via a network cable to form a link layer loop.

3. The dual network port link layer loopback test performance method according to claim 1, characterized in that: Before step S2, the method further includes: the first network port opens a socket, and further, the first network port constructs the test data packet.

4. The dual network port link layer loopback test performance method according to claim 3 is characterized in that: The test data packet specifically includes a source MAC address, a target MAC address and test data.

5. The dual network port link layer loopback test performance method according to claim 4 is characterized in that: Before step S3, the method further includes: the second network port opens a socket, and further, the second network port monitors its network port MAC address.

6. The dual network port link layer loopback test performance method according to claim 1, characterized in that: In the step S2, after the first network port sends the test data packet, the first network port further waits for the second network port to return the response data.

7. The dual network port link layer loopback test performance method according to claim 1, characterized in that: In the step S2, the first network port cyclically sends the test data packet to the second network port within a first preset time period.

8. The dual network port link layer loopback test performance method according to claim 7, characterized in that: In step S5, if the first network port receives the response data within a second preset time period, the data sending and receiving information is recorded; or if the first network port cannot receive the response data within the second preset time period, the packet loss information is recorded, wherein the first preset time period is greater than the second preset time period.

9. The dual network port link layer loopback test performance method according to claim 8, characterized in that: The method also includes the step: S6, calculating the transmission rate and packet loss rate of the test data packet within the first preset time length.