NAT router traffic replay method

By designing a NAT router traffic replay method, the problem that existing devices cannot be tested under high pressure and cannot be supported in high traffic environments is solved, realizing flexible traffic packet sending and reducing hardware costs.

CN115695270BActive Publication Date: 2026-03-27SHENSI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2026-03-27

Smart Images

  • Figure CN115695270B_ABST
    Figure CN115695270B_ABST
Patent Text Reader

Abstract

The application discloses a NAT router traffic replay method, relates to the field of traffic replay, and comprises the following steps: S1, recording traffic obtained by storage is acquired; S2, cache space is allocated to the traffic, and the cache space is loaded into a cache module; S3, k cache blocks are taken out and placed into a sending module, a sending speed is recorded, and a total sending speed is calculated; S4, a current time is recorded, and mac data frames of the k cache blocks are merged into a data frame stream; S5, the data stream is placed into a network card hardware queue, waits to be sent to a test network for application testing, and a total sending amount is recorded; S6, whether the cache blocks are sent completely is judged, if yes, the step S3 is returned, otherwise, the step S7 is proceeded; S7, whether the cache space has cache blocks is judged, if not, the method is ended, if yes, the step S3 is returned; the traffic packets in the storage module can be classified and configured, different types of traffic can be sent at different PPS speeds or different BPS speeds. Not only the sending speed of data can be ensured through the cache mode, but also any speed within 20Gpbs can be sent through the traffic packet amplification mode.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the field of traffic replay, in particular to a NAT router traffic replay method. BACKGROUND

[0002] Network traffic replay is a technology for network security testing and service pressure testing, and is widely used in various industries of the Internet. In recent years, with the emphasis on the network security industry, more and more security-related products appear, and the traffic replay technology is needed for product testing and research and development. However, the existing replay method and device have the following problems: for the traffic replay scene, the ordinary traffic replay device directly sends the replay traffic, cannot allocate the traffic components according to the network scene, does not consider the test under high pressure, cannot test in a high-traffic environment, well supports the traffic below 5Gbps, the hardware cost of the traffic replay device is high, and under the traffic of 10GBps, high storage and computing devices are needed, and under the scene of 20Gbps, there is basically no supporting traffic replay method. SUMMARY

[0003] The application aims to solve the above problems by designing a NAT router traffic replay method.

[0004] The application achieves the above-mentioned purpose through the following technical solutions:

[0005] The NAT router traffic replay method comprises the following steps:

[0006] S1, a storage module converts the recorded traffic into a fixed storage block size for storage;

[0007] S2, the stored traffic is allocated a cache space according to the traffic type k, the cache block size s of each traffic and the cache number n, and the cache space is loaded into the cache module according to the traffic type;

[0008] S3, one cache block is taken out from the cache of each traffic type and put into a sending module, the sending speed of each traffic type is recorded, and the total sending speed v is calculated;

[0009] S4, the current time t1 is recorded, and the k cache blocks are combined into one sending data frame stream according to the sending speed: the mac data frame with a taking-out speed of 1 / 300 ratio;

[0010] S5, the sending data stream is put into the network card hardware queue in batches of n packets in turn until all the network card queues are placed with data, and the network card sends the data to the test network, the test network performs application testing, and the total amount m of the current sending data is recorded;

[0011] S6, judging whether the k block cache blocks in the current sending module are sent, if yes, returning to S3, otherwise, entering S7;

[0012] S7, judging whether there is a cache block in the cache space, if no, directly ending, if yes, returning to S3.

[0013] The application has the advantages that the traffic packets stored in the storage module can be classified and configured according to the components of the traffic, different types of traffic are sent at different PPS speeds or different BPS speeds, the sending speed of data can be ensured by the cache mode, and the traffic packets can be enlarged to send at any speed within 20Gpbs. BRIEF DESCRIPTION OF DRAWINGS

[0014] Figure 1 is a schematic diagram of the NAT router traffic replay method of the application. DETAILED DESCRIPTION

[0015] In order to make the purpose, technical scheme and advantages of the embodiments of the application clearer, the technical scheme of the embodiments of the application will be described clearly and completely below in combination with the drawings in the embodiments of the application. Obviously, the described embodiments are part of the embodiments of the application, rather than all the embodiments. The components of the embodiments of the application described and shown in the drawings can be arranged and designed in various different configurations.

[0016] Therefore, the following detailed description of the embodiments of the application provided in the drawings is not intended to limit the scope of the claimed application, but only represents selected embodiments of the application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the application without creative labor are within the scope of protection of the application.

[0017] It should be noted that: similar numbers and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0018] In the description of the application, it should be understood that the terms "upper", "lower", "inner", "outer", "left", "right" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship commonly used when the product of the application is used, or the orientation or positional relationship commonly understood by those skilled in the art, which is only for the convenience of describing the application and simplifying the description, and does not indicate or imply that the indicated device or element must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the application.

[0019] In addition, the terms "first", "second" and the like are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

[0020] In the description of the present application, it should be further pointed out that, unless otherwise explicitly specified and limited, the terms "arrangement", "connection" and the like should be understood broadly, for example, "connection" can be fixed connection, or detachable connection, or integral connection; can be mechanical connection, or electrical connection; can be direct connection, or indirect connection through intermediate medium, or internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0021] The specific embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0022] As shown in Figure 1

[0023] The NAT router traffic replay method comprises:

[0024] S1, the storage module converts the recorded traffic into fixed storage block size for storage.

[0025] S2, according to the traffic type k, the cache block size s and the cache number n of each traffic, allocate cache space for the stored traffic, and load into the cache space of the cache module according to the traffic type;

[0026] The cache module is started in an independent thread, and constantly checks whether the cache block of each traffic type is taken out, if so, immediately loads the corresponding traffic type data into the cache, otherwise continues to check whether the cache is taken out.

[0027] S3, take out 1 block from each traffic type cache, a total of K block cache blocks are put into the sending module, record the sending speed of each traffic type, and calculate the total sending speed v;

[0028] S4, record the current time as t1, and merge the k block cache blocks taken out into one sending data frame stream according to the sending speed: the mac data frame taken out at a rate of 1 / 300;

[0029] S5, put the sending data stream into the network card hardware queue in batches according to n packets, until all the network card queues are placed with data, wait for the network card to send data to the test network, and the test network performs application test, and record the total amount of current sending data m;

[0030] S6, judge whether the k block cache blocks in the current sending module are sent, if so, return to S3, otherwise enter S7;

[0031] ​S7, judge whether the cache space has a cache block, if not, directly end, if yes, calculate the predicted time t2=m / v, record the current time t3, then calculate the next sending time t4=t1+t2, compare t3 and t4, if t3>t4, directly enter S3, otherwise, wait until t4, then enter S3.

[0032] The method can classify and configure the flow packets stored in the storage module according to the components of the flow, and send different PPS speeds or different BPS speeds for different types of flow. Not only can the sending speed of data be ensured through the caching mode, but also any speed within 20Gpbs can be sent through the flow packet amplification mode.

[0033] The limitation of only playing back one type of flow is solved; the problem of needing a large number of storage devices for flow storage in actual testing is solved; and the problem that large data flow cannot be played back when playing back one type of flow is solved.

[0034] The technical scheme of the present application is not limited to the above specific embodiments, and any technical modification made according to the technical scheme of the present application falls within the protection scope of the present application.

Claims

1. A NAT router traffic replay method, characterized in that, include: S1. The storage module converts the recorded traffic into fixed-block size for storage. S2. Allocate cache space to the stored traffic according to traffic type k, cache block size s for each type of traffic and cache quantity n, and load the cache space into the cache module according to traffic type; S3. Take one buffer block from the buffer of each traffic type and put it into the sending module. Record the sending speed of each traffic type and calculate the total sending speed as v. S4. Record the current time as t1, and merge the retrieved k buffer blocks into a single data frame stream according to the ratio of MAC data frames with a sending speed of 1 / 300 to the retrieval speed. S5. The data stream is sent in batches of n packets and placed into the network card hardware queues in sequence until all network card queues are filled with data. Then, the network card sends the data to the test network, and the test network performs application testing and records the total amount of data sent, m. S6. Determine whether the k buffer blocks in the current sending module have been sent. If yes, return to S3; otherwise, proceed to S7. S7. Determine if there are still cache blocks in the cache space. If not, end directly. If there are still cache blocks in the cache space, calculate the estimated transmission time t2=m / v, record the current time t3, and then calculate the next transmission time as t4=t1+t2. Compare the size of t3 and t4. If t3>t4, then directly enter S3. Otherwise, wait for the time to reach t4 before entering S3.

2. The NAT router traffic replay method according to claim 1, characterized in that, S2 also includes real-time detection of whether a cache block has been retrieved in each type of traffic in the caching module. If it is retrieved, the corresponding type of traffic in the storage module is loaded into the cache space.

Citation Information

Patent Citations

  • Network background generation system and network background generation method based on multi-node traffic playback

    CN108900360A

  • Map service traffic recording system and method of cloud native platform

    CN113971200A