CN112260884A - Network card self-loop test method, system, equipment and readable storage medium - Google Patents
Network card self-loop test method, system, equipment and readable storage medium Download PDFInfo
- Publication number
- CN112260884A CN112260884A CN202011001293.7A CN202011001293A CN112260884A CN 112260884 A CN112260884 A CN 112260884A CN 202011001293 A CN202011001293 A CN 202011001293A CN 112260884 A CN112260884 A CN 112260884A
- Authority
- CN
- China
- Prior art keywords
- network
- address
- port
- network port
- ports
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000010998 test method Methods 0.000 title claims abstract description 17
- 238000012360 testing method Methods 0.000 claims abstract description 73
- 230000003068 static effect Effects 0.000 claims abstract description 26
- 238000000034 method Methods 0.000 claims abstract description 7
- 238000004590 computer program Methods 0.000 claims description 10
- 230000002093 peripheral effect Effects 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 238000001914 filtration Methods 0.000 description 3
- 101000652292 Homo sapiens Serotonin N-acetyltransferase Proteins 0.000 description 2
- 102100030547 Serotonin N-acetyltransferase Human genes 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000011056 performance test Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0817—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0876—Network utilisation, e.g. volume of load or congestion level
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/74—Address processing for routing
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention has proposed network card from the loop test method, system, apparatus and readable storage medium, said method comprises setting up source address and target address for two net mouths separately; respectively adding the MAC addresses of the two network ports into a routing analysis address list of the network port of the other network port; exchanging the source address and the target address of the two network ports, and exchanging the independent static IP of the first network port with the default routing address of the first network port; interchanging the independent static IP of the second network port with the default routing address of the second network port; the two ports after address exchange are connected for testing. Based on the network card self-loop test method, the invention also provides a network card self-loop test system, equipment and a readable storage medium, the invention simulates a sending end and a receiving end by utilizing the strategy of iptables under a linux system to realize the iperf test between two network ports in a single network card; the requirement of an additional network card and a server peripheral is eliminated, and the requirement of a test environment is greatly reduced.
Description
Technical Field
The invention belongs to the technical field of network card testing, and particularly relates to a network card self-loop testing method, a system, equipment and a readable storage medium.
Background
A Network card, also called a Network adapter or a Network Interface Card (NIC), is generally used for connecting a server and Network devices such as a switch, and is an essential component on a server product. Generally, a server manufacturer will perform hardware performance evaluation on a server before leaving the factory, wherein the hardware performance includes network card performance, and a tool commonly used in network card testing is Iperf. Iperf is a network performance testing tool. Iperf can test TCP and UDP bandwidth quality. Iperf can measure the maximum TCP bandwidth with various parameters and UDP characteristics. Iperf may report bandwidth, delay jitter and packet loss.
At present, the use of an iperf tool in the industry to test a network card generally requires that two network cards are inserted into two servers for butt-joint test, wherein one server is used as a server end and the other server is used as a client end. The test mode is available in a laboratory environment, but the complexity of a large number of network card test environments in a production environment is very unfavorable for the development of automatic tests, the test efficiency is influenced, and the test cost is increased.
Disclosure of Invention
In order to solve the technical problems, the invention provides a network card self-loop test method, a system, equipment and a readable storage medium, and the IPerf test between two network ports in a single network card is realized by simulating a sending end and a receiving end of the test by using the strategy and the rule of iptables under a linux system.
In order to achieve the purpose, the invention adopts the following technical scheme:
the network card self-loop test method comprises the following steps:
respectively setting a source address and a target address for the two network ports;
respectively adding the MAC addresses of the two network ports into a routing analysis address list of the network port of the other network port;
and exchanging the source address and the target address of the two network ports, and connecting the two network ports after the addresses are exchanged for testing.
Further, the setting the source address and the destination address for the two ports respectively includes:
setting independent static IP for the first network port and the second network port respectively; enabling the first network port and the second network port to be respectively used as a server side and a client side for testing;
and setting default routing addresses for the first internet access and the second internet access respectively.
Further, the adding the MAC addresses of the two network ports to the route resolution address list of the network port of the other network port respectively specifically includes:
adding the MAC address of the first network port into a routing resolution address list of the second network port;
and adding the MAC address of the second network port into the routing resolution address list of the first network port.
Further, the interchanging the source address and the destination address of each of the two ports includes:
interchanging the independent static IP of the first internet access with the default routing address of the first internet access;
and interchanging the independent static IP of the second internet access with the default routing address of the second internet access.
Furthermore, the two network ports after the connection and the interchange of the addresses firstly adopt a ping command to detect whether the routes between the first network port and the second network port are communicated; then an iperf test is performed between the first port and the second port.
The network card self-loop test system comprises a setting module, an adding module and an interchange test module;
the setting module is used for setting a source address and a target address for the two network ports respectively;
the adding module is used for respectively adding the MAC addresses of the two network ports into a routing analysis address list of the network port of the other network port;
the interchange testing module is used for interchanging the source address and the target address of the two network ports and connecting the two network ports after the interchange addresses for testing.
Further, the setting module specifically includes: setting independent static IP for the first network port and the second network port respectively; enabling the first network port and the second network port to be respectively used as a server side and a client side for testing; and setting default routing addresses for the first internet access and the second internet access respectively.
Further, the interchange test module specifically includes:
interchanging the independent static IP of the first internet access with the default routing address of the first internet access;
interchanging the independent static IP of the second network port with the default routing address of the second network port;
detecting whether the route between the first network port and the second network port is communicated by adopting a ping command; then an iperf test is performed between the first port and the second port.
The equipment for the network card self-loop test comprises:
a memory for storing a computer program;
and the processor is used for realizing the network card self-loop test method when executing the computer program.
A readable storage medium having stored thereon a computer program which, when executed by a processor, implements a network card self-loop testing method.
The effect provided in the summary of the invention is only the effect of the embodiment, not all the effects of the invention, and one of the above technical solutions has the following advantages or beneficial effects:
the invention has proposed network card from the loop test method, system, apparatus and readable storage medium, said method comprises setting up source address and target address for two net mouths separately; respectively adding the MAC addresses of the two network ports into a routing analysis address list of the network port of the other network port; exchanging the source address and the target address of the two network ports, and exchanging the independent static IP of the first network port with the default routing address of the first network port; interchanging the independent static IP of the second network port with the default routing address of the second network port; the two ports after address exchange are connected for testing. Detecting whether the route between the first network port and the second network port is communicated by adopting a ping command; then an iperf test is performed between the first port and the second port. Based on the network card self-loop test method, the invention also provides a network card self-loop test system, equipment and a readable storage medium, the invention simulates a sending end and a receiving end by utilizing the strategy and the rule of iptables under the linux system, and realizes the iperf test between two network ports in the single network card; the method can realize the test automation, has no additional network card and server peripheral equipment, greatly reduces the requirement of the test environment, and is a very convenient and efficient method for the production environment with the requirement of batch test of the network cards.
Drawings
Fig. 1 is a schematic diagram 1 of a network card configuration according to embodiment 1 of the present invention;
fig. 2 is a schematic diagram of a network card configuration flow in embodiment 1 of the present invention;
fig. 3 is a schematic diagram of a network card self-loop test system according to embodiment 2 of the present invention.
Detailed Description
In order to clearly explain the technical features of the present invention, the following detailed description of the present invention is provided with reference to the accompanying drawings. The following disclosure provides many different embodiments, or examples, for implementing different features of the invention. To simplify the disclosure of the present invention, the components and arrangements of specific examples are described below. Furthermore, the present invention may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed. It should be noted that the components illustrated in the figures are not necessarily drawn to scale. Descriptions of well-known components and processing techniques and procedures are omitted so as to not unnecessarily limit the invention.
Example 1
The embodiment 1 of the invention provides a network card self-loop test method. iptables is an excellent and completely free packet filtering based firewall tool owned by unix/linux system, it is very powerful, flexible to use, and can finely control the data packets flowing into, out and through the server. It can replace expensive commercial firewall solutions to accomplish packet filtering, packet redirection, and Network Address Translation (NAT) functions.
iptables may be used to create filtering (filter) and NAT rules. Structure of iptables: the invention utilizes the rules of iptables to respectively simulate two network ports of a network card into a service end and a client end to realize interconnection test.
Fig. 1 shows a schematic diagram 1 of a network card configuration according to embodiment 1 of the present invention. First, to implement the network performance test on the same network card, a sending end and a receiving end are needed. The sending end is responsible for sending data, the receiving end is responsible for receiving data, in the iperf test, the client sends data to the server end, and the upper and lower bandwidth tests are carried out at a certain sending rate. Therefore, independent static IP is set for the first internet access and the second internet access respectively. In embodiment 1 of the present invention, the independent static IP of the first portal is IP 11; the independent static IP of the second portal is IP 12. The first network port and the second network port have the conditions for sending and receiving data messages, namely the first network port and the second network are respectively used as a test sending end and a client.
Default routing addresses are set for the first internet access and the second internet access respectively, where in embodiment 1 of the present invention, the default routing address of the first internet access is IP21, and the default routing address of the second internet access is IP 22.
Fig. 2 is a schematic diagram of a network card configuration flow in embodiment 1 of the present invention.
In step S1, setting independent static IPs to be IPs 11 for the first portal, respectively; setting independent static IP for second network port to IP12
In step S2, the first network port is a test server and the second network port is a test receiver.
In step S3, the default routing address of the first portal is set to IP21, and the default routing address of the second portal is set to IP 22.
In step S4, adding the MAC address of the first port to the route resolution address list of the second port; and adding the MAC address of the second network port into the routing resolution address list of the first network port.
In step S5, the independent static IP11 of the first portal is modified to IP21 according to the iptables for action SNAT rule.
In step S6, the first portal default routing address IP21 is modified to the IP11 of the real address according to the iptables rule on action DNAT.
In step S7, the independent static IP12 of the second portal is modified to IP22 according to the iptables for action SNAT rule.
In step S8, the second portal default routing address IP22 is modified to the real address IP12 according to the iptables rule on action DNAT.
Through the operation setting, the IP address conversion of the two network ports is completed, and then the two network ports can be connected for iperf test.
After the network card configuration is completed and before an iperf test is started, the network connection condition is checked, a ping command is used for ping a routing IP (simulation client IP) of the network port 0, if the ping command can be used for ping, the fact that the network connection from the server side to the client side is no problem is proved, and the next test can be carried out.
And connecting the two net ports by using a net wire, and confirming that the communication state is normal.
And starting the iperf server.
And starting the iperf client, sending data to a routing IP (simulation server IP) of the second network port, and performing uplink and downlink bandwidth test and the like at a set data sending rate.
The invention depends on the native commands of iptables, IP and route under the linux system, and according to the rules and strategies of iptables, two network ports of the double network cards are respectively simulated into a data receiving end and a data sending end, and then the addresses are converted into real IP addresses of the two network ports, so that the data sending and receiving tests are realized on a single network card.
Example 2
Embodiment 2 of the present invention further provides a network card self-loop test system, and as shown in fig. 3, the network card self-loop test system in embodiment 2 of the present invention is schematically illustrated, and includes a setting module, an adding module, and an interchanging test module; the setting module is used for setting a source address and a target address for the two network ports respectively; the adding module is used for respectively adding the MAC addresses of the two network ports into a routing analysis address list of the network port of the other network port; the interchange testing module is used for interchanging the source address and the target address of the two network ports and testing the two network ports after the address is interchanged.
The setting module specifically includes: setting independent static IP for the first network port and the second network port respectively; enabling the first network port and the second network port to be respectively used as a server side and a client side for testing; and setting default routing addresses for the first internet access and the second internet access respectively.
The interchange test module specifically comprises: interchanging the independent static IP of the first internet access with the default routing address of the first internet access; interchanging the independent static IP of the second network port with the default routing address of the second network port; detecting whether the route between the first network port and the second network port is communicated by adopting a ping command; then an iperf test is performed between the first port and the second port.
The invention also provides a device for testing the network card self-loop, which comprises: a memory for storing a computer program; and the processor is used for realizing the network card self-loop test method when executing the computer program.
A readable storage medium, on which a computer program is stored, the computer program, when executed by a processor, implementing a network card self-loop testing method.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, the scope of the present invention is not limited thereto. Various modifications and alterations will occur to those skilled in the art based on the foregoing description. And are neither required nor exhaustive of all embodiments. On the basis of the technical scheme of the invention, various modifications or changes which can be made by a person skilled in the art without creative efforts are still within the protection scope of the invention.
Claims (10)
1. The network card self-loop test method is characterized by comprising the following steps:
respectively setting a source address and a target address for the two network ports;
respectively adding the MAC addresses of the two network ports into a routing analysis address list of the network port of the other network port;
and exchanging the source address and the target address of the two network ports, and connecting the two network ports after the addresses are exchanged for testing.
2. The network card self-loop test method of claim 1, wherein the setting of the source address and the destination address for the two ports respectively comprises:
setting independent static IP for the first network port and the second network port respectively; enabling the first network port and the second network port to be respectively used as a server side and a client side for testing;
and setting default routing addresses for the first internet access and the second internet access respectively.
3. The method for testing the self-loop of the network card according to claim 1, wherein the step of adding the MAC addresses of the two ports to the routing resolution address list of the port of the other port respectively specifically comprises:
adding the MAC address of the first network port into a routing resolution address list of the second network port;
and adding the MAC address of the second network port into the routing resolution address list of the first network port.
4. The network card self-loop test method of claim 1, wherein the interchanging the source address and the destination address of each of the two ports comprises:
interchanging the independent static IP of the first internet access with the default routing address of the first internet access;
and interchanging the independent static IP of the second internet access with the default routing address of the second internet access.
5. The network card self-loop test method of claim 1, wherein the two network ports after the connection interchange addresses firstly adopt ping commands to detect whether the routes between the first network port and the second network port are connected; then an iperf test is performed between the first port and the second port.
6. The network card self-loop test system is characterized by comprising a setting module, an adding module and an interchange test module;
the setting module is used for setting a source address and a target address for the two network ports respectively;
the adding module is used for respectively adding the MAC addresses of the two network ports into a routing analysis address list of the network port of the other network port;
the interchange testing module is used for interchanging the source address and the target address of the two network ports and connecting the two network ports after the interchange addresses for testing.
7. The network card self-loop test system of claim 6, wherein the setting module specifically comprises: setting independent static IP for the first network port and the second network port respectively; enabling the first network port and the second network port to be respectively used as a server side and a client side for testing; and setting default routing addresses for the first internet access and the second internet access respectively.
8. The network card self-loop test system of claim 6, wherein the interchange test module specifically comprises:
interchanging the independent static IP of the first internet access with the default routing address of the first internet access;
interchanging the independent static IP of the second network port with the default routing address of the second network port;
detecting whether the route between the first network port and the second network port is communicated by adopting a ping command; then an iperf test is performed between the first port and the second port.
9. The network card is from equipment of return circuit test, its characterized in that includes:
a memory for storing a computer program;
a processor for implementing the network card self-loop test method of any one of claims 1 to 5 when executing the computer program.
10. A readable storage medium, characterized in that the readable storage medium has stored thereon a computer program which, when executed by a processor, implements the network card self-loop test method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011001293.7A CN112260884A (en) | 2020-09-25 | 2020-09-25 | Network card self-loop test method, system, equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011001293.7A CN112260884A (en) | 2020-09-25 | 2020-09-25 | Network card self-loop test method, system, equipment and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112260884A true CN112260884A (en) | 2021-01-22 |
Family
ID=74232816
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011001293.7A Pending CN112260884A (en) | 2020-09-25 | 2020-09-25 | Network card self-loop test method, system, equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112260884A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115357445A (en) * | 2022-10-20 | 2022-11-18 | 中国兵器装备集团自动化研究所有限公司 | PCI bus testing arrangement based on CPCI framework |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090109864A1 (en) * | 2007-10-24 | 2009-04-30 | Inventec Corporation | Network card testing system |
CN107547304A (en) * | 2017-07-13 | 2018-01-05 | 紫光华山信息技术有限公司 | Network card testing method, device and machinable medium |
CN109462526A (en) * | 2019-01-08 | 2019-03-12 | 郑州云海信息技术有限公司 | A kind of double network interface network card test systems, method and device |
-
2020
- 2020-09-25 CN CN202011001293.7A patent/CN112260884A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090109864A1 (en) * | 2007-10-24 | 2009-04-30 | Inventec Corporation | Network card testing system |
CN107547304A (en) * | 2017-07-13 | 2018-01-05 | 紫光华山信息技术有限公司 | Network card testing method, device and machinable medium |
CN109462526A (en) * | 2019-01-08 | 2019-03-12 | 郑州云海信息技术有限公司 | A kind of double network interface network card test systems, method and device |
Non-Patent Citations (1)
Title |
---|
陈松等: "基于双向NAT和智能DNS内网服务器安全快速访问策略", 《计算机工程与设计》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115357445A (en) * | 2022-10-20 | 2022-11-18 | 中国兵器装备集团自动化研究所有限公司 | PCI bus testing arrangement based on CPCI framework |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11323354B1 (en) | Methods, systems, and computer readable media for network testing using switch emulation | |
US11388081B1 (en) | Methods, systems, and computer readable media for impairment testing using an impairment device | |
CN107566152B (en) | Method and device for virtual network link detection | |
CN103401726B (en) | Network path detection method and device, system | |
US9146826B2 (en) | Method and apparatus for scaling network simulation | |
US11483228B2 (en) | Methods, systems, and computer readable media for network testing using an emulated data center environment | |
US10110556B2 (en) | Methods, systems, and computer readable media for initiating and executing performance tests of a private network and/or components thereof | |
US20150100693A1 (en) | Real world traffic | |
US9641419B2 (en) | Methods and systems for providing background pretesting of communications or storage network equipment | |
US10958616B2 (en) | Methods, systems, and computer readable media for network test configuration using virtual local area network (VLAN) scanning | |
CN113141281A (en) | FPGA accelerator, network parameter measurement system, method and medium | |
CN101277225B (en) | Method for analyzing network quality as well as network quality analysis terminal-initiating equipment | |
CA2755005A1 (en) | Method and system for videoconferencing or data transfer between clients behind different network address translators | |
CN110519122A (en) | A kind of network quality automatic monitoring device and method based on Mtr | |
Bednarek et al. | Selected practical aspects of communication diagnosis in the industrial network | |
CN112260884A (en) | Network card self-loop test method, system, equipment and readable storage medium | |
CN115914042A (en) | Methods, systems, and computer readable media for network traffic generation using machine learning | |
CN114189492A (en) | Network card pressure testing method and system based on network address translation technology | |
GB2620841A (en) | Methods, systems, and computer readable media for processing control plane messages for emulated data center switching fabric | |
Tivig et al. | Layer 3 forwarder application-implementation experiments based on Ryu SDN Controller | |
CN112449024B (en) | Intranet penetration method, equipment and storage medium of NAT (network Address translation) simulation gateway | |
CN116232869B (en) | Cross-protocol stack network fault positioning method and system | |
CN110830602A (en) | Distribution network terminal communication test system and method based on dynamic domain name resolution | |
KR20020058767A (en) | Apparatus and Method for an efficiency test of Internet Quality Measurement System | |
US20240073131A1 (en) | Methods, systems, and computer readable media for implementing routing path groups between emulated switches |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210122 |