Embodiment
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Fig. 1 is the ddos attack method of testing first embodiment flow chart of the present invention.As shown in Figure 1, present embodiment comprises:
The network subsystem (Network Subsystem) and the memory management subsystem (Memory Management Subsystem) of step 11, modification Li nux kernel;
Modification to described network subsystem comprises: the spin lock (Qdisc) that flow-control module comprises in the network subsystem of removal linux kernel; According to predefined data packet format, expand the device (pktgen) of giving out a contract for a project of kernel in the described core network subsystem and allow the packets fields of customization;
Modification to described memory management subsystem comprises: the attribute of the packet Memory Allocation interface function that the memory management subsystem of linux kernel provides is set to storage allocation in the privately owned memory pool of each CPU, and the attribute of packet internal memory realizing interface function is set to discharge internal memory in the privately owned memory pool of each CPU.
Step 12, call in the amended core network subsystem kernel device of giving out a contract for a project, generate the mass data bag, and send the mass data bag that generates to cluster to be tested; Source address change at random in the scope that sets in advance of the described packet that generates, the address of service that destination address provides for cluster to be tested;
Step 13, when receiving the response data packet that described cluster to be tested returns, abandon the response data packet that described cluster to be tested sends; Or, send the part request data package to described cluster to be tested based on amended linux kernel; Or, send complete request data package, and when receiving the request response data packet that described cluster to be tested returns, abandon the described request response data packet to described cluster to be tested based on amended linux kernel.
Present embodiment is to the modification of code in the linux kernel or function, based on the mass data bag of amended linux kernel to cluster transmission source address change at random to be tested.
When receiving the response data packet that cluster to be tested returns,, can realize that the DDoS of protocol level connects the simulation of exhaustion attacks if the response data packet that receives is carried out discard processing;
If when receiving response data packet, the partial data section (that is: part request data package) in full request packet of cluster transmission to be tested can realize the simulation of connection slowly (the reading overtime) attack of application;
If when receiving response data packet, send a full request packet to cluster to be tested, when when receiving the request response data packet of cluster transmission to be tested, abandon all response data packet, can realize that then application connects the simulation that (writing overtime) attacks slowly.
Because present embodiment is based on amended linux kernel, having realized treating test cluster carries out simulation, application layer that protocol layer in the ddos attack connects exhaustion attacks and connects the simulation of exhaustion attacks, the analogue simulation that application layer connects the multiple ddos attack types such as simulation of attack slowly, can be used as the emulation attack source of the ddos attack of cluster to be tested, help the accuracy of cluster protection ddos attack usefulness to be tested and limiting performance test; In addition, present embodiment ddos attack method of testing may operate in the hardware of supporting linux kernel, therefore, does not need the hardware for the special use of ddos attack Test Design, obviously reduce the cost of ddos attack test products, helped improving the flexibility of DDoS test.
Fig. 2 is the ddos attack method of testing second embodiment flow chart of the present invention.It is example that present embodiment is attacked with distributed synchronization-flood (SYN-FLOOD), and the technical scheme of present embodiment based on the simulation of linux kernel realization protocol layer ddos attack is described.Fig. 3 is a ddos attack test system structure schematic diagram one of the present invention.Embodiment illustrated in fig. 2 can based on system configuration as shown in Figure 3.Ginseng Fig. 2 and shown in Figure 3, ddos attack method of testing of the present invention comprises:
Core network subsystem and the memory management subsystem of step 21, modification linux kernel A11.
Step 21 can comprise step 211, step 212 and step 213.
The spin lock (Qdisc) that flow-control module comprises in the network subsystem of step 211, removal linux kernel.
Spin lock is to aim at a kind of lock that prevents that multiprocessor is concurrent and introduce, and it is widely used in parts such as Interrupt Process in kernel.Spin lock can only be held by a kernel task at most, if kernel task attempts to ask one by contention or the spin lock held, this task circulation of will always hurrying so is until waiting for that spin lock is available again; If spin lock is by contention, just ask its kernel task to obtain it at once and proceed.Step 21 is removed spin lock (Qdisc) back in the linux kernel code and is realized not having lock and give out a contract for a project, but concurrent running kernel task, competition shared resource on the multiprocessor, thus promote the processing data packets ability of linux kernel.
Packet Memory Allocation interface function dev_alloc_skb and internal memory realizing interface kfree_skb function that step 212, modification memory management subsystem provide make it to distribute and discharge internal memory in the privately owned memory pool of every CPU.
In the prior art, dev_alloc_skb is assigned as the allocation of packets internal memory in global memory pool; Kfree_skb discharges internal memory in global memory pool.Under the situation of many CPU or single CPU multinuclear/multithreading, need fight for the protection spin lock of global memory pool.If revise above-mentioned two interfaces; make it in the privately owned memory pool of every CPU, to distribute and discharge internal memory; then can avoid contention to the protection spin lock of memory pool; thereby can further improve processing data packets speed; that is: the attribute of the packet Memory Allocation interface function that provides of the memory management subsystem of linux kernel is set to storage allocation in the privately owned memory pool of each CPU, and the attribute of packet internal memory realizing interface function is set to discharge internal memory in the privately owned memory pool of each CPU.
If do not have microprocessor (the Microprocessor withoutInterlocked Piped Stages of inner interlocking pipelining-stage at some, abbreviation MIPS) on the hardware platform (for example XLR7 series processors of RMI Corp.), the hardware memory management mechanism that can utilize hardware platform to provide realizes this purpose, for example: fast message bus (the Fast Message Ring that calls the XLR-732 processor and provide is provided for dev_alloc_skb and kfree_skb function, be called for short FMR) interface, thus realize that the hardware memory management mechanism that carries by the XLR-732 processor realizes the distribution and the release of packet internal memory.
Step 213, revise kernel in the linux kernel network subsystem device (pktgen) of giving out a contract for a project, the expansion kernel device (pktgen) of giving out a contract for a project allows the packets fields of customization.
The linux kernel device (pktgen) of giving out a contract for a project only can send the packet of limited several types in the prior art, and customizability is not strong.This step need internally be authorized bag device (pktgen) and be allowed the packets fields of customization to expand, and comprising: the field, data load content and the length that comprise in each field that comprises in each field that comprises in ether (Ethernet) frame head, the IP data head and the tcp data head; Kernel is given out a contract for a project after function pktgen_if_write carries out relative set according to the value of the above-mentioned fields of data structure among the device pktgen, generates packet.Owing to expansion back each field of skb kernel data structure can freely customize combination by configuration, message loaded length/content that the transmission packet comprises also can realize freely customizing by configuration.This step also can directly be added packet and sends thread by handling at the kernel data bag in the framework, replace kernel device (pktgen) realization of giving out a contract for a project.
Step 22, packet generation module A12 call the amended linux kernel device (pktgen) of giving out a contract for a project, and generate the mass data bag, according to predefined ddos attack analog type, the attribute of packet are set.
Suppose: need the ddos attack analog type of simulation to attack for synchronous-flood (SYN-FLOOD), service cluster to be tested is the Web service cluster; Step 22 comprises:
Step 221, the service IP that the purpose IP address of the packet of generation provides for the Web service cluster is set, IP address of picked at random is as source IP address in predefined scope.
After so being provided with, can form the mass data bag of source IP address, point to same destination address simultaneously.
The target MAC (Media Access Control) address of the packet of step 222, generation is set to the interface MAC of Web service cluster, and the source MAC of packet is set to a non-existent MAC Address (that is: pseudo-MAC Address).
After so being provided with, when the Web service cluster returned response data packet, because the source MAC of packet is pseudo-MAC Address, the response data packet that makes the Web service cluster return can't be sent to and be dropped.
Step 223, data pack protocol type are set to Transmission Control Protocol, and (SYN) flag bit synchronously is set in the flag bit son field of tcp option.
More similar for the packet that analogue data bag generation module generates to the packet that (SuSE) Linux OS main frame or Windows operating system main frame send, can be arranged on [60S-62S] or [120S-125S] change at random in information life span (TTL) field with the Transmission Control Protocol type data packets.
For the packet that makes the packet generation module generate more approaches packet in the real network environment, but also tcp option is set to support maximum transmission data segmentation (Maximum Segment is called for short MSS Size) and time mark (timestamp).
Step 23, packet generation module A12 send to Web service cluster A8 to be tested via two layers of convergence device A7 with the packet that generates.
Owing to, can form the mass data bag of source IP address by the setting of step 221 and step 222, point to same destination address simultaneously, i.e. Web service cluster, therefore, but the packet generation module can be to the different mass data bag of Web service cluster transmission source address.
Step 24, Web service cluster A8 return response data packet (SYN/ACK packet) when receiving packet (SYN packet).
Step 25, two layers of convergence device A7 abandon the packet (SYN/ACK packet) that Web service cluster A8 returns.
Because by the setting of step 223, when the Web service cluster returned response data packet, because the source MAC of packet is pseudo-MAC Address, the response data packet that makes the Web service cluster return can't be sent to, thereby is abandoned by two layers of convergence device.
Present embodiment packet generation module constantly sends the SYN packet of magnanimity to the Web service cluster, and the SYN/ACK response data packet that the Web service cluster returns is abandoned by two layers of convergence device, thereby can set up the ample resources that a large amount of connections consumes the Web service cluster by protocol layer, thereby, help improving the test accuracy of Web service cluster security protection performance and limiting performance for Web service cluster to be tested provides the simulated strike of the DDoS protocol layer in the high real network environment of fidelity.
Fig. 4 is ddos attack method of testing the 3rd an embodiment flow chart of the present invention.Present embodiment connects to set up TCP/IP that to set up process be example, illustrate that present embodiment realizes the technical scheme that the application layer ddos attack is simulated based on linux kernel.Fig. 5 is a ddos attack test system structure schematic diagram two of the present invention.Embodiment illustrated in fig. 4 can based on system configuration as shown in Figure 5.Ginseng Fig. 4 and shown in Figure 5, ddos attack method of testing of the present invention comprises:
Core network subsystem, memory management subsystem and the Packet Filtering framework (Netfilter) of step 41, modification linux kernel A11.
This step can repeat no more referring to the record of step 21 in embodiment illustrated in fig. 2 about the core network subsystem of modification linux kernel A11 and the detailed description of memory management subsystem.
This step comprises about the modification to Packet Filtering framework in the linux kernel: PRE_ROUTING point in the Packet Filtering framework, add a Hook function (hereinafter referred to as the PRE_ROUTING_Hook point) that is used for direct reversal data Bao Yuan/destination address after receiving packet.Concrete, PRE_ROUTING point at linux kernel A11 Packet Filtering framework has added a new hook (Hook) function, this function is after having received that SYN/ACK sign, source MAC are the packet of MAC Address of packet reflecting module A13 place main frame, direct reversal data Bao Yuan/purpose IP address and source/target MAC (Media Access Control) address, and ACK flag bit and other necessary fields (for example the ACK sequence number is that the SYN/ACK sequence of data packet number adds 1) are set on this packet, and A13 sends by the packet reflecting module.This step can avoid reflecting module A3 to repeat to call the allocation of packets/release function of kernel, can further improve the processing data packets ability of packet reflecting module A13.
Step 42, packet generation module A12 call the amended linux kernel device (pktgen) of giving out a contract for a project, and generate the mass data bag.
Be different from the setting of source data packet MAC Address in the step 223 embodiment illustrated in fig. 2, the source MAC of present embodiment packet is set to the MAC Address of packet reflecting module A13 place host network card; And the default gateway ip address that tested cluster is set is the IP address of packet reflecting module A13 place host network card.
After so being provided with, packet reflecting module A13 will be used to receive the rate of discharge that Web service cluster A8 sends via two layers of convergence device, and send the response packet.
Step 43, packet generation module A12 send to Web service cluster A8 to be tested via two layers of convergence device A7 with the packet that generates.
Step 44, Web service cluster A8 when receiving the SYN packet, return data bag SYN/ACK response data packet.
The SYN/ACK packet that step 45, two layers of convergence device A7 return Web service cluster A8 sends to packet reflecting module A13.
Step 46, packet reflecting module A13 are according to the description structure ack msg bag as step 41, and the bag that directly calls network interface card sends function hard_start_xmit, sends multiplexing ack msg bag via two layers of convergence device to the Web service cluster.
Step 47, Web service cluster receive the ack msg bag from packet reflecting module A13, wait for the request data package (GET request data package) of packet reflecting module A13.
This moment is from the angle of Web server, and the Web service cluster is connected to set up with TCP between the packet reflecting module A13 to be finished, and the Web service cluster is waited for distributing system resource the request data package of the further transmission of packet reflecting module A13.
Step 48, packet reflecting module A13 carry out different feedback via two layers of convergence device to the Web service cluster according to predefined ddos attack analog type.
Step 481-step 483 is respectively to realize the specific implementation of three kinds of different application layer ddos attack analog types.
Step 481, when predefined ddos attack analog type is application layer DDoS exhaustion attacks when simulation, packet reflecting module A13 does not send the GET request data package to the Web service cluster.
After above-mentioned steps finishes, because packet reflecting module A13 has set up being connected of magnanimity with the Web service cluster, the Web service cluster is respectively these connections and has all distributed resource, this step is attempted by setting up a large amount of connections, cause the Web service cluster resource to exhaust and stop response, thereby can realize the simulation of the distributed connection exhaustion attacks of application layer.
Step 482, when predefined ddos attack analog type be that application layer DDoS connects when reading overtime attack simulation slowly, packet reflecting module A13 calls the linux kernel function of giving out a contract for a project, send part GET request data package, and abandon reply data bag from the Web service cluster.
Packet reflecting module A13 calls network interface card and sends function hard_start_xmit, to ask (GET) packet to be divided into a plurality of data segments, with the partial data section in full request packet of Web service cluster transmission of the default time interval successively, promptly send part request (GET) packet.The time interval that the part request data package sends can be provided with according to the operating system and the hardware of actual motion linux kernel, as: it is 100us that this time interval is set.This step attempts to allow a large amount of processes of Web service cluster be in the state (read states) of waiting for user's request, thereby can realize that application layer DDoS connects slowly reads overtime attack simulation.
DDoS connects the attack commonly used in the Web application when reading overtime the attack slowly, for example: apache-httpd can use the mechanism of overtime disconnection connection to prevent server overload to the assailant of the request that do not send that only connects, and to connecting but only send the assailant of part request, there is not suitable timeout mechanism to handle, so this kind attack is very common in the Web based on apache-httpd uses.Present embodiment can be and need carry out DDoS and connect the Web service cluster of reading overtime attack test slowly, and the ddos attack source of emulation is provided, and helps improving the test accuracy of Web service cluster security protection performance and limiting performance.
Step 483, when predefined ddos attack analog type be that application layer DDoS connects when writing overtime attack simulation slowly, packet reflecting module A13 calls the linux kernel function of giving out a contract for a project, send complete GET request data package, and abandon the reply data bag that the Web service cluster sends subsequently.
For the very long HTTP request (for example video flowing) of reply data, because reply data need divide a plurality of packets to send, if the Web service cluster does not receive the packet reflecting module according to the affirmation packet (ACK) that reply data sends, will cause the Web server end to write obstruction.Present embodiment can be and need carry out DDoS and connect the Web service cluster of reading overtime attack test slowly, and the ddos attack source of emulation is provided, and helps improving the test accuracy of Web service cluster security protection performance and limiting performance.
Except 3 kinds of above-mentioned attacks, for also realizing simulation by the ddos attack that dwindles type such as TCP receive window.
Fig. 6 is ddos attack method of testing the 4th an embodiment flow chart of the present invention.Present embodiment is on the basis of above-mentioned ddos attack method of testing first embodiment to the three embodiment technical schemes, also can comprise: based on amended linux kernel, to with the mutual packet of cluster to be tested, the time delay of giving out a contract for a project control or selectivity packet loss control, promptly to packet generation module and packet reflecting module and the mutual packet of cluster to be tested, the time delay of giving out a contract for a project control or selectivity packet loss control are with time delay or the packet loss simulation that realizes true link.Fig. 7 is a ddos attack test system structure schematic diagram three of the present invention.Embodiment illustrated in fig. 6 can based on system configuration as shown in Figure 7.Ginseng Fig. 6 and shown in Figure 7, ddos attack method of testing of the present invention comprises:
Step 61, abandon the downlink data packet that satisfies the packet filtering rules set in advance.
Step 61 can specifically comprise the steps:
The packet filtering rules that step 611, basis set in advance, and utilize and revise back Packet Filtering framework, the integer grid generated.
Step 612, be a random number in each allocation of packets default value scope, as the numbering of packet, according to the numbering and the packet size information of packet, the positional information of the integer grid of calculated data bag correspondence.
The control information of the integer grid of step 613, the positional information correspondence that calculate to obtain according to step 612 selects to abandon or keep this packet.
Illustrate:
The size of supposing downlink data packet in 1 byte between 500 bytes.Table 1 is the relation of packet size and packet loss in the real network environment, and wherein, the probability distribution of packet loss meets normal distribution.
Table 1 is the relation of packet size and packet loss
| Packet size (byte) |
Packet loss |
| 1-50 |
0.0175 |
| 51-100 |
0.0439 |
| 101-150 |
0.2178 |
| 151-200 |
0.2178 |
| 201-250 |
0.3332 |
| 251-300 |
0.3331 |
| 301-350 |
0.2178 |
| 351-400 |
0.1109 |
| 401-450 |
0.0439 |
| 451-500 |
0.0175 |
Need the normal distribution packet loss of simulation now according to the packet size.Supposing that the integer grid is the two-dimensional array of 10 row * 10000 row, is n for length, is numbered the packet of m, the positional information of the integer grid of calculated data bag correspondence, i.e. integer grid subscript (n mod 10, m mod 10000); N and m are the integer greater than 0.If the control information of grid subscript correspondence position is " 0 ", then the retention data bag; If the control information of grid subscript correspondence position is " 1 ", then packet discard.By be provided with control information in i (1≤i≤10) row for the number of " 1 " divided by 10000 numerical value that equal i row in the table 2, can simulate normal distribution packet loss according to the packet size.
According to the Meng Takaluo principle, because the numbering m of packet is equally distributed, so the corresponding control information of the positional information of the integer grid of packet correspondence is the probability of " 0 " or " 1 ", number decision by the control information that distributes in the integer grid " 0 " and " 1 ", so, as long as guarantee that the distribution ratio of the control information " 0 " that distributes in each row integer grid and " 1 " meets normal distribution and requires, the position of " 0 " and " 1 " do not had specific (special) requirements.
Obviously grid is thin more, and is good more to the simulate effect of normal distribution packet loss.Can use the integer two-dimension array of fixing 4096 row * 4096 row to form grid in actual applications.
If the individual percentage of control information " 0 " and " 1 " is a steady state value in each row of grid, then deteriorate to even distribution, this example is the special case of carrying out the selectivity packet loss control.
Use the advantage of grid to be, grid just finishes after setting as calculated, only need afterwards to calculate a random number for each packet, and carry out twice modulo operation according to packet size and package number and get final product, need not call complicated function and calculate packet loss, therefore, under big flow, can improve data throughput significantly.
On the basis of technique scheme, the packet filtering rules that sets in advance by adjustment, can realize probability packet loss according to difference bag type, bag content, bag size distribution, by adjusting the generating algorithm of integer grid, can realize specific probability Distribution Model, as: evenly distribution, Poisson distribution and normal distribution packet loss model, the ddos attack better authenticity that makes the simulation of employing present embodiment.
Step 62, link simulator are provided with the temporal information of the delayed delivery of packet when receiving the downlink data packet of packet generation module and packet reflecting module transmission, the time delay value of packet promptly is set.
Step 63, link simulator utilize the POST_ROUTING Hook dot generation downlink data packet transmit queue of linux kernel processing data packets framework, and wherein, the added field of each packet in the downlink data packet transmit queue records the timestamp of joining the team.This timestamp, is added on the packet by the PRE_ROUTINGHook point when utilizing the PRE_ROUTING Hook dot generation downlink data packet transmit queue of processing data packets framework at link simulator.
The timestamp of joining the team comprises that packet adds the corresponding time delay value of packet of the join the team temporal information and step 61 setting of downlink data packet transmit queue.As: the time delay value of tentation data bag setting is t, and packet is joined the team and is ti constantly, and the timestamp of then joining the team is Ti=ti+t.
Step 64, link simulator utilize the timestamp of joining the team of the first packet of POST_ROUTING Hook point poll downlink data packet transmit queue, and join the team timestamp and the current time of the first packet of downlink data packet transmit queue compared, when the timestamp of joining the team of first packet is less than or equal to current time, send first packet.
Like this, give out a contract for a project the time with respect to without crossing giving out a contract for a project the time after the time delay processing, postpone default time delay value t through the first packet after the time delay processing.
In addition, according to from the Web service cluster to the upstream data bag that packet generation module or packet reflecting module send, set up upstream data bag transmit queue, and it is similar to step 62-step 64 that the upstream data bag is carried out the method for time delay control, repeats no more.
Present embodiment can be on the basis in analog D DoS attack source, to simulating of chain-circuit time delay, make the ddos attack simulation consider the factor of physical link time delay, the authenticity of ddos attack is more reliable, helps improving the test accuracy of Web service cluster security protection performance and limiting performance.
Can be the time delay value that user's real experiences arrives in the real network environment for the time delay value of packet setting in the step 62.For example: in real network environment, the ADSL user experience on, downlink delay and packet loss are different, suppose descending time delay 10ms, packet loss 0.1%, descending time delay 5ms, packet loss 0.2%, then can simulate this situation by following configuration:
The packet loss that sets in advance downlink packet is a steady state value 0.1%, and time delay is 10ms; And the packet loss that sets in advance uplink data packet is a steady state value 0.2%, and time delay is 5ms; And adopt the technical scheme of step 61-64, can realize the time delay and the packet loss of the true link of packet.
Because present embodiment is based on linux kernel, realized treating the simulation that test cluster carries out protocol layer connection exhaustion attacks in the ddos attack, application layer connects the simulation of exhaustion attacks, application layer connects the analogue simulation of the multiple ddos attack types such as simulation of attack slowly, also can realize the time delay and the packet loss simulation of link simultaneously, make the ddos attack of simulating more near the ddos attack in the real network environment, embodiment of the invention method is formed the emulation attack source of the ddos attack of cluster to be tested, help the accuracy of cluster protection ddos attack usefulness to be tested and limiting performance test; In addition, present embodiment ddos attack method of testing may operate in the hardware of supporting linux kernel, therefore, do not need hardware for the special use of ddos attack Test Design, obviously reduced the cost of ddos attack test products, help improving the flexibility of DDoS test, ddos attack method of testing of the present invention can satisfy product line, and particularly the miscellaneous goods line is to the technical need of test and diverse network new industrial research under assessment, the line on protocol layer/application layer ddos attack line.
On the basis of technique scheme, the present invention also provides a kind of ddos attack testing apparatus.The structure of ddos attack testing apparatus can be referring to Fig. 3, Fig. 5 and shown in Figure 7.Concrete, ddos attack testing apparatus A1 can comprise: linux kernel A11, packet generation module A12 and packet reflecting module A13; Packet generation module A12 and packet reflecting module A13 communicate to connect with linux kernel A11 respectively.
Linux kernel A11 is used to provide network subsystem API and the memory management subsystem application DLL (dynamic link library) of revising the back kernel; Modification to described network subsystem comprises the spin lock that flow-control module comprises in the network subsystem of removing linux kernel; According to predefined data packet format, expand the device of giving out a contract for a project of kernel in the described core network subsystem and allow the packets fields of customization; Modification to described memory management subsystem comprises: the attribute of the packet Memory Allocation interface function that the memory management subsystem of linux kernel provides is set to storage allocation in the privately owned memory pool of each CPU, and the attribute of packet internal memory realizing interface function is set to discharge internal memory in the privately owned memory pool of each CPU.
Packet generation module A12 is used for based on linux kernel A11, calls in the amended core network subsystem kernel device of giving out a contract for a project, and generates the mass data bag, and sends the mass data bag that generates to cluster to be tested; Source address change at random in the scope that sets in advance of the described packet that generates, the address of service that destination address provides for cluster to be tested;
Packet reflecting module A13 is used for when receiving the response data packet that described cluster to be tested returns, and abandons the response data packet that described cluster to be tested sends; Perhaps, based on amended linux kernel, send the part request data package to described cluster to be tested; Perhaps,, send complete request data package, and when receiving the request response data packet that described cluster to be tested returns, abandon the described request response data packet to described cluster to be tested based on amended linux kernel.
On the basis of technique scheme, linux kernel A11 also is used to provide amended Packet Filtering framework; Modification to described Packet Filtering framework comprises: PRE_ROUTING point in described Packet Filtering framework, add hook (Hook) function that is used for direct reversal data Bao Yuan/destination address after receiving packet.
On the basis of technique scheme, ddos attack testing apparatus A1 also can comprise link simulation modules A 14; Link simulation modules A 14 communicates to connect with linux kernel A11, packet generation module A12 and packet reflecting module A13 respectively.
Link simulation modules A 14 is used for based on amended linux kernel A11, to packet generation module A12 and packet reflecting module A13 and the mutual packet of cluster to be tested, and the time delay of giving out a contract for a project control or selectivity packet loss control.
Fig. 8 is a ddos attack testing apparatus link simulation modular structure schematic diagram of the present invention.As shown in Figure 8, on the basis of technique scheme, link simulation modules A 14 can further comprise:
Packet filtering unit A141 is used to abandon the packet that satisfies the packet filtering rules that sets in advance.
Time-delay calculation unit A142 is used to packet generation module A12, packet reflecting module A13 and each mutual packet of cluster to be tested, respectively the delay time information of calculated data packet delay transmission;
Packet transmit queue generation unit A143 is used for based on amended linux kernel A11, generate upstream or downstream packet transmit queue according to described packet generation module A12, packet reflecting module A13 and the mutual packet of cluster to be tested, the added field of each packet in the described packet transmit queue records the timestamp of joining the team; The described timestamp of joining the team comprises that packet adds the join the team temporal information and the corresponding delay time information of described packet of described packet transmit queue;
Delayed delivery unit A144 is used for the timestamp of joining the team of the first packet of the described packet transmit queue of poll, and join the team timestamp and the current time of described first packet compared, when the timestamp of joining the team of described first packet is less than or equal to current time, send described first packet.
Concrete, packet filtering unit A141 can specifically comprise:
The integer grid generates subelement A1411 and is used for generating the integer grid according to the packet filtering rules that sets in advance.
Contraposition subelement A1412 is used to a random number in each allocation of packets default value scope, as the numbering of packet, according to the numbering and the packet size information of packet, calculates the positional information of the integer grid of described packet correspondence.
Filtration subelement A1413 is used for the numerical information according to the integer grid of described positional information correspondence, selects to abandon or keep described packet.
The present invention also provides a kind of ddos attack test macro.This system comprises ddos attack testing apparatus, two layers of convergence device and cluster to be tested, wherein, the ddos attack testing apparatus is connected with trunking communication to be tested by two layers of convergence device, in service at native system, ddos attack testing apparatus and the mutual packet of cluster to be tested filter and transmit by described two layers of convergence device.
The structural representation of ddos attack test macro provided by the invention such as Fig. 3, Fig. 5 and shown in Figure 7, the ddos attack device that comprises in the system can be referring to the record of ddos attack testing apparatus embodiment of the present invention, the operation principle of system repeats no more referring to the specific descriptions of ddos attack method of testing embodiment of the present invention.
One of ordinary skill in the art will appreciate that: accompanying drawing is the schematic diagram of a preferred embodiment, and module in the accompanying drawing or flow process might not be that enforcement the present invention is necessary.
One of ordinary skill in the art will appreciate that: the module in the device among the embodiment can be described according to embodiment and be distributed in the device of embodiment, also can carry out respective change and be arranged in the one or more devices that are different from present embodiment.The module of the foregoing description can be merged into a module, also can further split into a plurality of submodules.
The invention described above embodiment sequence number is not represented the quality of embodiment just to description.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be finished by the relevant hardware of program command, aforesaid program can be stored in the computer read/write memory medium, this program is carried out the step that comprises said method embodiment when carrying out; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
It should be noted that at last: above embodiment only in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment the present invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that previous embodiment is put down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the spirit and scope of embodiment of the invention technical scheme.