Summary of the invention
The present invention provides a kind of method and system that simulation DHCP Offer (DHCP supply message) floods, existing to solve
There is the condition problem of the test environmental resource anxiety of the DHCP function of test router present in technology.
A kind of method that simulation DHCP Offer floods of the present invention, comprising steps of
Test host described in S100 sets up DHCP Offer packet;
S200 router to be measured, to survey router solicitation IP address is accompanied, is successfully obtained by hub to the router to be measured
After getting the IP address for accompanying survey router distribution, at the 1/2 of lease phase, separated accompany is surveyed between router and hub
Connection;
Test host described in S300 sends the DHCP Offer packet largely set up to router to be measured by hub, described
DHCP Offer packet includes the source IP address for being supplied to the router to be measured;
Test host described in S400 judges whether the router to be measured obtains the source IP address in DHCP Offer packet,
If so, entering step S500, S600 is otherwise entered step;
S500 judges the router DHCP dysfunction to be measured;
Test host described in S600 stops sending the DHCP Offer packet, and re-establishes to accompany and survey router and hub
Between connection, judge the router to be measured can obtain accompany survey router send IP address, if so, entering step
Otherwise S700 enters step S500;
S700 judges that router DHCP function to be measured is normal.
The invention discloses a kind of methods that simulation DHCP Offer floods, and are suitable for all-router.Mainly pass through
DHCP Offer packet is set up, after router normally obtains IP address, when 1/2 time lease phase sent out DHCP Request, is disconnected
With the connection for accompanying survey router (being equivalent to server) for distributing its IP address, then interference present in simulated environment is (a large amount of
Issue DHCP Offer packet), the method that simulation DHCP Offer of the invention floods can be used to carry out test router can or can not
Mistake takes address, judges the DHCP function of router.This method simple possible, is easy to operate and control, and test environment is simple, saves
Test resource, reduces cost, improves testing efficiency, solve the DHCP function of test router existing in the prior art
Test environmental resource anxiety condition problem.
Further, further includes: it is DHCP that net playing mode of router to be measured, which is arranged, in S010, and the rent accompanied and survey router is arranged
Contract period;S020 will test host and hub wired connection, and router to be measured has with the hub respectively with survey router is accompanied
Test environment is established in line connection.
Further, the step S200 includes:
Router to be measured described in S210 issues DHCP Discover message in a broadcast manner, and IP address is rented in request;
After accompanying survey router to receive the DHCP Discover message described in S220, sent to the router to be measured
One DHCP Offer message surveys router and can be supplied to the IP address that router to be measured uses in the message comprising described accompany
And the IP address for accompanying survey router itself;
After the router reception to be measured DHCP Offer message described in S230, the DHCP Request of a broadcast is issued
Message, and accompany described in being added in the Option Field of the DHCP Request message and survey router address and the router to be measured
The IP address of application;
It is sent after accompanying survey router to receive the DHCP Request message described in S240 and responds DHCP ACK message, and
Increase the IP address of the router solicitation to be measured in the DHCP ACK message Option Field uses lease phase information;
After router to be measured described in S250 receives the DHCP ACK message, the IP for surveying router distribution is accompanied described in inspection
Whether location is able to use, if then the router to be measured successfully obtains the IP address chosen, and according to the IP address
Start continuity process automatically using the lease phase;
For S260 at 1/2 moment of lease phase for the IP address that the router to be measured obtains, disconnection, which is accompanied, surveys router and collection
Communication connection between line device, the router to be measured can accompany survey router transmission DHCP Request message to re-rent to described
IP address.
1/2 moment of selection lease phase disconnects the connection accompanied and survey router and hub, so that router to be measured and accompanying survey
It can not be linked up by message between router and re-rent IP address matters, at this point, a large amount of external interferences are added, that is, sent a large amount of
DHCP Offer message, sees whether router to be measured can be interfered by it, and mistake takes the IP address in interference message.
Further, the step S100 includes: and tests host described in S110 to set up a large amount of DHCP Offer by xcap
Packet.This programme is using xcap software group packet, to realize that a kind of simulation DHCP Offer floods.Xcap is a windows hair
Job contract tool, can read the network interface that place has from system.Xcap give out a contract for a project tool can on windows from specified interface
The message of construction is sent, supports two kinds of simple sending strategys, first is that (being chosen with mouse) chosen is sent, second is that cycling through
It is multiple.Xcap supports to construct common ether network packet, including arp, rarp, ipv4, ipv6, icmpv4, icmpv6, igmp,
Udp, tcp, pim, ospf, rip, snmp, ppp, pppoe, ipsec (ah/esp) etc. and some messages being of little use, such as
Fruit 802.3, STP etc..The various DHCP Offer packets of xcap software analog, to test exhaustive comprehensively.Xcap software
Originally it is intrinsic environment in test protocol consistency function test envelope, there are a SOP reference documents, shirtsleeve operation allows tester's energy
Enough quickly upper hands, have the advantages that easy to control, resource multiplex, high-efficient.In addition, be guarantee test quality and efficiency it is same
When, lab resources, reasonable distribution, fixed test environment can also be saved, advantageously ensures that the accuracy of test result.
Further, the step S300 includes: that test host described in S310 passes through hub to the router to be measured
The DHCP Offer packet largely set up is cycled through, the DHCP Offer packet includes the source IP for being supplied to the router to be measured
Address.
The present invention also provides a kind of systems that simulation DHCP Offer floods, comprising: router to be measured accompanies survey to route
Device, test host and hub, the router to be measured, accompany survey router and test host respectively with the wired company of the hub
It connects, the test host includes: a group packet module, packet sending and receiving module and checks judgment module, and the packet sending and receiving module is distinguished
It is connected with described group of packet module, inspection judgment module, in which:
The group packet module of the test host sets up DHCP Offer packet;
Router to be measured, to survey router solicitation IP address is accompanied, is successfully got by hub to the router to be measured
It is separated at the 1/2 of lease phase to accompany the company surveyed between router and hub after the IP address for accompanying survey router distribution
It connects;
The packet sending and receiving module of the test host sends described group of packet module to router to be measured by hub and sets up
A large amount of DHCP Offer packet;
The inspection judgment module of the test host judges whether the router to be measured obtains the DHCP Offer
Source IP address in packet;
If the inspection judgment module of the test host judges that the router to be measured obtains the DHCP Offer packet
In source IP address, then judge the router DHCP dysfunction to be measured;
If the inspection judgment module of the test host judges that the DHCP Offer packet has not been obtained in the router to be measured
In source IP address, then the packet sending and receiving module of the test host stops sending the DHCP Offer packet, re-establishes and accompanies
The connection between router and hub is surveyed, the inspection judgment module of the test host further judges the router to be measured
It can obtain to accompany and survey the IP address that router is sent, if so, the inspection judgment module of the test host judges routing to be measured
Device DHCP function is normal, and otherwise the inspection judgment module of the test host judges the router DHCP dysfunction to be measured.
System of the invention is simple and easy to control, and test environment is fixed, and tester is upper quick-moving, high-efficient.This system may be used also
Test resource is saved in multiplexing, and other than testing the router feature, which can also carry out the protocol tests such as ARP, port loophole
Sweep test etc..
Further, the test host further includes the setup module being connected with the packet sending and receiving module, in which: described
It is DHCP that net playing mode of router to be measured, which is arranged, in the setup module for testing host, and the lease phase accompanied and survey router is arranged.
Further, router to be measured passes through hub to survey router solicitation IP address is accompanied, to the router to be measured
After successfully getting the IP address for accompanying survey router distribution, at the 1/2 of lease phase, separated accompany surveys router and line concentration
Connection between device;Include:
The router to be measured issues DHCP Discover message in a broadcast manner, and IP address is rented in request;
Described accompany is surveyed after router receives the DHCP Discover message, sends one to the router to be measured
DHCP Offer message surveys router and can be supplied to the IP address and institute that router to be measured uses in the message comprising described accompany
State the IP address accompanied and survey router itself;
After the router to be measured receives the DHCP Offer message, the DHCP Request report of a broadcast is issued
Text, and accompany described in being added in the Option Field of the DHCP Request message and survey router address and the router Shen to be measured
IP address please;
It is described accompany to survey router and receive response DHCP ACK message is sent after the DHCP Request message, and described
Increase the IP address of the router solicitation to be measured in DHCP ACK message Option Field uses lease phase information;
After the router to be measured receives the DHCP ACK message, the IP address for surveying router distribution is accompanied to be described in inspection
It is no to be able to use, if then the router to be measured successfully obtains the IP address chosen, and used according to the IP address
The lease phase starts continuity process automatically;
At 1/2 moment of lease phase for the IP address that the router to be measured obtains, disconnection, which is accompanied, surveys router and hub
Between communication connection, the router to be measured can to it is described accompany survey router send DHCP Request message come with re-renting IP
Location.
Further, the group packet module of the test host sets up DHCP Offer packet by xcap software.
Further, the packet sending and receiving module of the test host is cycled through by hub to the router to be measured
The DHCP Offer packet largely set up, the DHCP Offer packet include the source IP address for being supplied to the router to be measured.
The present invention has the beneficial effect that:
(1) various DHCP Offer packets are set up in simulation, test exhaustive comprehensively.
(2) environment reusable is tested, without using multiple servers, saves test resource and space utilization.And the environment
The protocol tests such as ARP, the test of port vulnerability scanning etc. can also be carried out.
(3) test environment is fixed, and guarantees test quality.
(4) easy to operate, test environment is easy to control, and operator is easy to get started.
(5) at low cost, while reducing cost, also improve testing efficiency.
In conclusion the present invention has many advantages, such as to guarantee test quality, saves test resource, improves testing efficiency.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into
It is described in detail to one step, it is clear that the described embodiments are only some of the embodiments of the present invention, rather than whole implementation
Example.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts
All other embodiment, shall fall within the protection scope of the present invention.
The invention discloses a kind of method that simulation DHCP Offer floods, embodiment one as shown in Figure 1, comprising steps of
Test host described in S100 sets up DHCP Offer packet;
S200 router to be measured, to survey router solicitation IP address is accompanied, is successfully obtained by hub to the router to be measured
After getting the IP address for accompanying survey router distribution, at the 1/2 of lease phase, separated accompany is surveyed between router and hub
Connection;
Test host described in S300 sends the DHCP Offer packet largely set up to router to be measured by hub, described
DHCP Offer packet includes the source IP address for being supplied to the router to be measured;
Test host described in S400 judges whether the router to be measured obtains the source IP address in DHCP Offer packet,
If so, entering step S500, S600 is otherwise entered step;
S500 judges the router DHCP dysfunction to be measured;
Test host described in S600 stops sending the DHCP Offer packet, and re-establishes to accompany and survey router and hub
Between connection, judge the router to be measured can obtain accompany survey router send IP address, if so, entering step
Otherwise S700 enters step S500;
S700 judges that router DHCP function to be measured is normal.
The present embodiment simulates the test environment that DHCP Offer floods, and serves as a server with survey router is accompanied,
A large amount of DHCP Offer packets, which are set up, with test host realizes that simulation DHCP floods.Firstly, test host first sets up a large amount of DHCP
Offer packet, first group, which is built up, does not send, builds the phenomenon that floods to subsequent send together.Survey routing is accompanied to act as a server
Role, therefore, tested routing first surveys router (being equivalent to server) application IP address to accompanying, and can see with normally obtaining IP
Location.If tested routing can successfully obtain the IP address accompanied and survey route assignment, at the 1/2 of the lease phase of this IP address
Between this moment, disconnect the connection accompanied and survey router and hub, then allow test host by hub to router to be measured
A large amount of DHCP Offer packets that group is built up before are sent, this DHCP Offer packet the inside is used containing router to be measured is supplied to
IP, referred to herein as source IP.Note that source IP here is not with the IP address for accompanying survey router to be supplied to router to be measured before
It this message and accompanies before because being here the message testing the counterfeit server of host and initiating and surveys router and divide in the same address
Give the DHCP Offer message of router to be measured other than the IP address of offer is different with IP address, remaining difference is little.Very
Extremely, in fraud of router to be measured, the IP for the sender that the DHCP Offer message that test host is sent includes are also not
The really IP address of oneself, but disguise oneself as and accompany survey router, the IP for the sender for including in the message, which is accompanied, surveys router
IP.Therefore, if router to be measured does not carry out further verifying confirmation to message, the DHCP of test host transmission is just obtained
If source IP address in Offer message, then illustrate that exception occurs in the router DHCP function to be measured.That is, then
Judge the source IP address that router to be measured is tested either with or without acquisition in the DHCP Offer packet that host is sent, if obtain
Words, then illustrate the DHCP dysfunction of the router to be measured.If not obtaining, reconnects to accompany and survey router and collection
Cable between line device establishes connection, and re-inspection judges that router to be measured accompanies the IP for surveying router and providing either with or without acquisition, if
It can get to accompany after in connection and survey the IP that router provides, then illustrate that the router DHCP function to be measured is normal, cannot obtain
Words, then judge the router DHCP dysfunction to be measured.
The method of the present embodiment is simple and easy, goes back reusable, saves test resource, without providing multiple DHCP services
Device solves the situation of test environmental resource anxiety by simulating the method that DHCP floods.Reduce cost, improves test effect
Rate, and the quality tested is guaranteed.
Preferably, before the test of above-described embodiment starts, it is also necessary to be arranged accordingly, build test environment.
Specifically, it is DHCP that net playing mode of router to be measured, which is arranged, and be set, such as 1 minute the lease phase accompanied and survey router, will test
Host and hub wired connection, certainly, router to be measured and accompanying survey router respectively with the hub wired connection, such as
This, has put up test environment.
Preferably, in the above-described embodiments, in the step S100, test host sets up a large amount of DHCP Offer packets, I
Can be set up using xcap software, xcap software is originally intrinsic environment in test protocol consistency function test envelope, is had
SOP reference documents, shirtsleeve operation allow tester that can quickly go up hand, do not know about the tester of test environment, it is only necessary to
It can be tested referring to SOP document;Furthermore there is the advantages that easy to control, resource multiplex, high-efficient.
Preferably, in above-described embodiment, as shown in Fig. 2, the step S200 comprising steps of
Router to be measured described in S210 issues DHCP Discover message in a broadcast manner, and IP address is rented in request;
After accompanying survey router to receive the DHCP Discover message described in S220, sent to the router to be measured
One DHCP Offer message surveys router and can be supplied to the IP address that router to be measured uses in the message comprising described accompany
And the IP address for accompanying survey router itself;
After the router reception to be measured DHCP Offer message described in S230, the DHCP Request of a broadcast is issued
Message, and accompany described in being added in the Option Field of the DHCP Request message and survey router address and the router to be measured
The IP address of application;
It is sent after accompanying survey router to receive the DHCP Request message described in S240 and responds DHCP ACK message, and
Increase the IP address of the router solicitation to be measured in the DHCP ACK message Option Field uses lease phase information;
After router to be measured described in S250 receives the DHCP ACK message, the IP for surveying router distribution is accompanied described in inspection
Whether location is able to use, if then the router to be measured successfully obtains the IP address chosen, and according to the IP address
Start continuity process automatically using the lease phase;
For S260 at 1/2 moment of lease phase for the IP address that the router to be measured obtains, disconnection, which is accompanied, surveys router and collection
Communication connection between line device, the router to be measured can accompany survey router transmission DHCP Request message to re-rent to described
IP address.
After the half the time (i.e. 1/2 moment of lease phase) for reaching validity period as defined in lease, router to be measured just into
Enter " re-renting state ", router to be measured (can accompany and survey router) unicast to send to the Dynamic Host Configuration Protocol server for distributing IP address for it
DHCP REQUEST message, to carry out the update of IP lease.If as Dynamic Host Configuration Protocol server accompany survey that router thinks can be after
It is continuous to use, a confirmation message will be returned to router to be measured, router to be measured so successfully re-rents IP address.If accompanying survey
Router thinks the IP address to be distributed to the router to be measured again, then it is new to be notified that router to be measured cannot obtain
Lease.If router to be measured can be when reaching 7/8 in the lease time limit in the renewed treaty operation failure that the half the time of lease carries out
(87.5%) when, if there is no the confirmation message of server, which is just recycled by server.Client computer must weigh
The new application process for starting lease.Therefore, it is disconnected at 1/2 moment of lease phase and accompanies the communication connection for surveying router and hub,
Fail to receive lease message or the answer message re-rented can not be returned to be given to router to be measured so that accompanying and surveying router, at this point,
A large amount of DHCP Offer packets are sent by test host again, disguises oneself as and accompanies survey router, simulation DHCP Offer floods, and detects road
By the DHCP function of device.
Preferably, test host can be by the way of cycling through, by establishment in the step S300 of embodiment one kind
A large amount of DHCP Offer packet loop is sent to router to be measured.
Based on the same technical idea, the embodiment of the present invention also provides a kind of system that simulation DHCP Offer floods, should
Above method embodiment can be performed in system.The system that simulation DHCP Offer provided in an embodiment of the present invention floods, such as Fig. 3 institute
Show, comprising: router 10 to be measured accompanies and surveys router 20, test host 30 and hub 40, and the router 10 to be measured accompanies survey
Router 20 and test host 30 respectively with 40 wired connection of hub, the test host 30 include: a group packet module 31,
Packet sending and receiving module 32 and inspection judgment module 33, the packet sending and receiving module 32 are sentenced with described group of packet module 31, inspection respectively
Disconnected module 33 is connected, in which:
The group packet module 31 of the test host 30 sets up DHCP Offer packet;
The router to be measured 10 passes through hub 40 to survey 20 IP address requesting of router is accompanied, to the router to be measured
After 10 successfully get the IP address for accompanying survey router 20 to distribute, at the 1/2 of lease phase, separated accompany surveys router 20
With the connection between hub 40;
The packet sending and receiving module 32 of the test host 30 sends described group of packet to router 10 to be measured by hub 40
The a large amount of DHCP Offer packet that module 31 is set up;
The inspection judgment module 33 of the test host 30 judges whether the router to be measured 10 obtains the DHCP
Source IP address in Offer packet;
If the inspection judgment module 33 of the test host 30 judges that the router to be measured 10 obtains the DHCP
Source IP address in Offer packet then judges the router 10DHCP dysfunction to be measured;
If the inspection judgment module 33 of the test host 30 judges that the DHCP has not been obtained in the router to be measured 10
Source IP address in Offer packet, then the packet sending and receiving module 32 of the test host 30 stops sending the DHCP Offer packet,
The connection accompanied and surveyed between router 20 and hub 40 is re-established, the inspection judgment module 33 of the test host 30 is further
Judge that can the router to be measured 10 obtain to accompany and surveys the IP address that router 20 is sent, if so, the test host 30
Check that judgment module 33 judges that router 10DHCP function to be measured is normal, otherwise the inspection judgment module 33 of the test host 30
Judge the DHCP dysfunction of the router to be measured 10.
This system saves test resource, and other than testing the function, which can also carry out the protocol tests such as ARP, port
Vulnerability scanning test etc..High-efficient, test environment is fixed, and is easily understood, tester is upper quick-moving.Be guarantee test quality with
While efficiency, lab resources, reasonable distribution, fixed test environment can also be saved, advantageously ensures that the standard of test result
True property.
Preferably, the test host 30 in above-described embodiment further includes the setting mould being connected with the packet sending and receiving module 32
Block 34, in which: it is DHCP that 10 network access of router to be measured, which is arranged, in the setup module 34 of the test host 30, and is arranged and accompanies survey
The lease phase of router 20.Since this system floods for simulating DHCP Offer, the lease phase is set for testing, therefore generally
It is set to 1 minute, the setting lease phase too long will affect testing efficiency.
Preferably, the group packet module 31 of the test host 30 of above-described embodiment one kind sets up DHCP by xcap software
Offer packet.Xcap software is originally intrinsic environment in test protocol consistency function test envelope, has SOP reference documents, simply
Operation allows tester that can quickly go up hand, has the advantages that easy to control, resource multiplex, high-efficient.
Preferably, in the system that the simulation DHCP Offer of above-described embodiment one kind floods, the router 10 to be measured
By hub 40 to survey 20 IP address requesting of router is accompanied, described accompany successfully is got to the router 10 to be measured and surveys routing
It is separated at the 1/2 of lease phase to accompany the connection surveyed between router 20 and hub 40 after the IP address that device 20 distributes;This
Process includes:
The router to be measured 10 issues DHCP Discover message in a broadcast manner, and IP address is rented in request;
Described accompany is surveyed after router 20 receives the DHCP Discover message, is sent to the router 10 to be measured
One DHCP Offer message surveys router 20 and can be supplied to the IP that router 10 to be measured uses in the message comprising described accompany
Address and the IP address for accompanying survey router 20 itself;
After the router to be measured 10 receives the DHCP Offer message, the DHCP Request report of a broadcast is issued
Text, and accompany described in being added in the Option Field of the DHCP Request message and survey 20 address of router and the router to be measured
The IP address of 10 applications;
It is described accompany to survey router 20 and receive response DHCP ACK message is sent after the DHCP Request message, and in institute
That states the IP address for increasing that the router to be measured 10 is applied in DHCP ACK message Option Field uses lease phase information;
After the router to be measured 10 receives the DHCP ACK message, the IP for surveying that router 20 distributes is accompanied described in inspection
Whether location is able to use, if then the router to be measured 10 successfully obtains the IP address chosen, and according to the IP
Location starts continuity process using the lease phase automatically;
At 1/2 moment of lease phase for the IP address that the router 10 to be measured obtains, disconnection, which is accompanied, surveys router 20 and collection
Communication connection between line device 40, the router 10 to be measured can survey the transmission DHCP Request message of router 20 to described accompany
To re-rent IP address.
Preferably, based on any of the above embodiments, the packet sending and receiving module 32 of the test host 30 passes through collection
Line device 40 cycles through the DHCP Offer packet largely set up to the router 10 to be measured, and the DHCP Offer packet includes to mention
Supply the source IP address of the router to be measured 10.A large amount of DHCP Offer packets that group is built up are cycled through so that immersion simulations
Effect is more preferable.
Another embodiment of the present invention, system of the invention are tested using method of the invention, simulation DHCP
The method that Offer floods is suitable for all-router.Mainly set up manually using xcap software
DHCP Offer packet, after router obtains address, when 1/2 time lease phase sent out DHCP Request, analog loop
Interference present in border (a large amount of to issue DHCP Offer packet) wrong can or can not take the test problems such as address to solve router.
Basic, specific test flow chart is detailed in Fig. 5:
S501 builds test environment: it is DHCP that net playing mode of router, which is arranged, in PC, and the survey router lease phase is accompanied to be set as 1 point
PC is connect by clock, arrangement above with HUB after the completion, and specific environment topological diagram is as shown in Figure 4;
S502 sets up DHCP Offer packet: by the message organized in testing protocol consistency environment, purpose MAC (ff:
Except ff:ff:ff:ff:ff/01:00:5e:01:01:01) it is revised as LAN mouthfuls of MAC of router;
S503 router normally obtains address;
S504, which is disconnected, accompanies the cable surveyed between router and HUB: after router normally obtains address, the lease phase 1/2 when
Between (30s) disconnect the cable accompanied and surveyed between router and HUB;
S505 sends DHCP Offer packet: protocol test PC cycles through a large amount of source IPs to router and is
192.168.1.170 DHCP Offer packet;
S506 checks that router obtains IP situation: checking router either with or without address in acquisition offer packet
192.168.1.170;S510 is entered step if any, otherwise enters S507;
S507 stops paying out DHCP Offer packet: if router does not obtain address 192.168.1.170 in offer packet;Association
View test PC stops sending DHCP Offer packet;
The cable surveyed between router and HUB is accompanied in S508 reconnection;
S509 checks that router obtains IP situation: check whether router can correctly obtain address, if then entering S511,
Otherwise enter S510;
S510 judges router DHCP dysfunction;
S511 judges that router DHCP function is normal.
Compared with existing best technique, the present invention has the advantages that
It is easy to control: not know about the tester of test environment, need to can only be tested referring to SOP document;
Reusable: test resource is saved, other than testing the function, which can also carry out the protocol tests such as ARP, port
Vulnerability scanning test etc.;
High-efficient: test environment is fixed, and is easily understood, tester is upper quick-moving.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic
Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as
It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art
Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to include these modifications and variations.