[go: up one dir, main page]

CN106603348B - A method and system for simulating DHCP Offer flooding - Google Patents

A method and system for simulating DHCP Offer flooding Download PDF

Info

Publication number
CN106603348B
CN106603348B CN201710079086.5A CN201710079086A CN106603348B CN 106603348 B CN106603348 B CN 106603348B CN 201710079086 A CN201710079086 A CN 201710079086A CN 106603348 B CN106603348 B CN 106603348B
Authority
CN
China
Prior art keywords
router
dhcp
address
measured
test
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.)
Active
Application number
CN201710079086.5A
Other languages
Chinese (zh)
Other versions
CN106603348A (en
Inventor
范清宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Huaxia Enterprise Service Technology Co.,Ltd.
Original Assignee
Shanghai Feixun Data Communication Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201710079086.5A priority Critical patent/CN106603348B/en
Publication of CN106603348A publication Critical patent/CN106603348A/en
Application granted granted Critical
Publication of CN106603348B publication Critical patent/CN106603348B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/32Flooding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

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

本发明公开了模拟DHCP Offer泛洪的方法,包括:测试主机组建DHCP Offer包;待测路由器通过集线器向陪测路由器请求IP,且在获取IP的租约期的1/2时间断开陪测路由器与集线器之间的连接;测试主机通过集线器向待测路由器发送大量DHCP Offer包;测试主机判断待测路由器是否获取了DHCP Offer包中的源IP,若是,则判断待测路由器DHCP功能异常;否则停止发送DHCP Offer包,并重新建立陪测路由器与集线器之间的连接,判断待测路由器能否获取陪测路由器发送的IP,若是,则判断待测路由器DHCP功能正常,否则判断待测路由器DHCP功能异常。本发明解决目前测试环境资源紧张的状况。

The invention discloses a method for simulating DHCP Offer flooding, which includes: a test host builds a DHCP Offer package; the router to be tested requests an IP from the companion router through a hub, and disconnects the companion router during the 1/2 time of the lease period for obtaining the IP Connection with the hub; the test host sends a large number of DHCP Offer packets to the router to be tested through the hub; the test host judges whether the router to be tested has obtained the source IP in the DHCP Offer packet, and if so, judges that the DHCP function of the router to be tested is abnormal; otherwise Stop sending the DHCP Offer packet, and re-establish the connection between the router under test and the hub, and judge whether the router under test can obtain the IP sent by the router under test. If so, judge that the DHCP function of the router under test is normal; Abnormal function. The invention solves the shortage of test environment resources at present.

Description

一种模拟DHCP Offer泛洪的方法及系统A method and system for simulating DHCP Offer flooding

技术领域technical field

本发明属于测试领域,尤其涉及一种模拟DHCP Offer泛洪的方法及系统。The invention belongs to the field of testing, in particular to a method and system for simulating DHCP Offer flooding.

背景技术Background technique

DHCP(Dynamic Host Configuration Protocol,DHCP)是动态主机设置协议,它是一个局域网的网络协议。通常被应用在大型的局域网络环境中,主要作用是集中的管理、分配IP地址,使网络环境中的主机动态的获得IP地址、Gateway地址、DNS服务器地址等信息,并能够提升地址的使用率。起初,实验室环境中采用泛洪来测试路由器DHCP功能并未出现,受环境干扰而拿错或多拿地址而无法上网的情况,该问题是经客户反馈现场查看才发现的。后来虽然有了测试环境,但是现有的实验室环境测试资源有限,并不能完全实现真实环境的测试,这需要准备多个DHCP服务器并设置不同IP,同时回应路由器发出的DHCPDiscover来模拟泛洪进行测试,测试环境资源非常紧张,测试环境费用高,且不测试DHCP功能时浪费测试资源,测试环境复杂,需要有人指导操作,耗时耗力。DHCP (Dynamic Host Configuration Protocol, DHCP) is a dynamic host configuration protocol, which is a network protocol for a local area network. It is usually applied in a large-scale local area network environment. Its main function is to centralize management and assign IP addresses, so that hosts in the network environment can dynamically obtain information such as IP addresses, Gateway addresses, and DNS server addresses, and can improve the utilization rate of addresses. . At first, the use of flooding in the laboratory environment to test the DHCP function of the router did not appear. Due to environmental interference, the wrong or too many addresses were taken and the Internet could not be accessed. This problem was only discovered after customer feedback on-site inspection. Later, although there is a test environment, the existing laboratory environment test resources are limited, and the test in the real environment cannot be fully realized. This requires preparing multiple DHCP servers and setting different IPs, and responding to the DHCPDiscover sent by the router to simulate flooding. Test, the test environment resources are very tight, the cost of the test environment is high, and the test resources are wasted when the DHCP function is not tested. The test environment is complex and requires someone to guide the operation, which is time-consuming and labor-intensive.

发明内容Contents of the invention

本发明提供一种模拟DHCP Offer(DHCP供给报文)泛洪的方法及系统,用以解决现有技术中存在的测试路由器的DHCP功能的测试环境资源紧张的状况问题。The present invention provides a method and system for simulating the flooding of DHCP Offer (DHCP offer message), which is used to solve the problem in the prior art that the resources of the test environment for testing the DHCP function of the router are tight.

本发明一种模拟DHCP Offer泛洪的方法,包括步骤:A kind of method of simulating DHCP Offer flooding of the present invention comprises steps:

S100所述测试主机组建DHCP Offer包;The test host described in S100 constructs a DHCP Offer package;

S200待测路由器通过集线器向陪测路由器请求IP地址,待所述待测路由器成功获取到所述陪测路由器分配的IP地址后,在租约期的1/2时间断开陪测路由器与集线器之间的连接;S200 The router to be tested requests an IP address from the router to be tested through the hub, and after the router to be tested successfully obtains the IP address assigned by the router to be tested, disconnect the router to be tested from the hub during 1/2 of the lease period connection between

S300所述测试主机通过集线器向待测路由器发送大量组建的DHCP Offer包,所述DHCP Offer包包含提供给所述待测路由器的源IP地址;S300 The test host sends a large number of formed DHCP Offer packets to the router to be tested through the hub, and the DHCP Offer packet includes a source IP address provided to the router to be tested;

S400所述测试主机判断所述待测路由器是否获取了DHCP Offer包中的源IP地址,若是,则进入步骤S500,否则进入步骤S600;The test host in S400 judges whether the router to be tested has obtained the source IP address in the DHCP Offer packet, if so, enters step S500, otherwise enters step S600;

S500判断所述待测路由器DHCP功能异常;S500 judges that the DHCP function of the router to be tested is abnormal;

S600所述测试主机停止发送所述DHCP Offer包,并重新建立陪测路由器与集线器之间的连接,判断所述待测路由器能否获取陪测路由器发送的IP地址,若是,则进入步骤S700,否则进入步骤S500;In S600, the test host stops sending the DHCP Offer packet, and re-establishes the connection between the test router and the hub, and judges whether the test router can obtain the IP address sent by the test router, and if so, enters step S700, Otherwise, enter step S500;

S700判断待测路由器DHCP功能正常。The S700 judges that the DHCP function of the router under test is normal.

本发明公开了一种模拟DHCP Offer泛洪的方法,适用于所有路由器。主要是通过组建DHCP Offer包,当路由器正常获取IP地址后,1/2租约期时间发DHCP Request时,断开与分配其IP地址的陪测路由器(相当于服务器)的连接,然后模拟环境中存在的干扰(大量发出DHCP Offer包),本发明的模拟DHCP Offer泛洪的方法可以用来来测试路由器会不会错拿地址,判断路由器的DHCP功能。该方法简单可行,易于操作和控制,测试环境简单,节约了测试资源,减少了成本,提高了测试效率,解决现有技术中存在的测试路由器的DHCP功能的测试环境资源紧张的状况问题。The invention discloses a method for simulating DHCP Offer flooding, which is applicable to all routers. Mainly by building a DHCP Offer package, when the router normally obtains an IP address, when sending a DHCP Request within 1/2 of the lease period, it disconnects from the accompanying test router (equivalent to a server) that assigns its IP address, and then simulates the environment Existing interference (sending a large number of DHCP Offer packets), the method for simulating DHCP Offer flooding of the present invention can be used to test whether the router will take the wrong address, and judge the DHCP function of the router. The method is simple and feasible, easy to operate and control, simple in the test environment, saves test resources, reduces costs, improves test efficiency, and solves the problem of tight resources in the test environment for testing the DHCP function of the router existing in the prior art.

进一步地,还包括:S010设置待测路由器上网方式为DHCP,并设置陪测路由器的租约期;S020将测试主机与集线器有线连接,待测路由器与陪测路由器分别与所述集线器有线连接,建立测试环境。Further, it also includes: S010 setting the Internet access mode of the router to be tested as DHCP, and setting the lease period of the router to be tested; S020 connecting the test host to the hub by wire, and the router to be tested and the router to be tested are connected to the hub by wire respectively, and the router is established. test environment.

进一步地,所述步骤S200包括:Further, the step S200 includes:

S210所述待测路由器以广播的方式发出DHCP Discover报文,请求租用IP地址;The router to be tested in S210 sends out a DHCP Discover message in broadcast mode, requesting to lease an IP address;

S220所述陪测路由器接收到所述DHCP Discover报文后,向所述待测路由器发送一个DHCP Offer报文,所述报文中包含所述陪测路由器能提供给待测路由器使用的IP地址及所述陪测路由器自身的IP地址;S220 After receiving the DHCP Discover message, the accompanying router sends a DHCP Offer message to the router under test, and the message includes the IP address that the accompanying router can provide to the router under test. and the IP address of the accompanying test router itself;

S230所述待测路由器接收所述DHCP Offer报文后,发出一个广播的DHCP Request报文,并在所述DHCP Request报文的选项字段加入所述陪测路由器地址及所述待测路由器申请的IP地址;S230 After receiving the DHCP Offer message, the router to be tested sends a broadcast DHCP Request message, and adds the address of the router to be tested and the address of the router to be tested to the option field of the DHCP Request message. IP address;

S240所述陪测路由器收到所述DHCP Request报文后发送响应DHCP ACK报文,并在所述DHCP ACK报文选项字段中增加所述待测路由器申请的IP地址的使用租约期信息;S240, the accompanying test router sends a response DHCP ACK message after receiving the DHCP Request message, and adds the use lease period information of the IP address applied for by the router to be tested in the option field of the DHCP ACK message;

S250所述待测路由器收到所述DHCP ACK报文后,检查所述陪测路由器分配的IP地址是否能够使用,若是则所述待测路由器成功获得所述选中的IP地址,并根据所述IP地址使用租约期自动启动延续过程;S250 After the router under test receives the DHCP ACK message, check whether the IP address assigned by the router under test can be used, if so, the router under test successfully obtains the selected IP address, and according to the The IP address uses the lease period to automatically start the continuation process;

S260在所述待测路由器获取的IP地址的租约期1/2时刻处,断开陪测路由器与集线器之间的通信连接,所述待测路由器会向所述陪测路由器发送DHCP Request报文来续租IP地址。S260 Disconnect the communication connection between the router under test and the hub at 1/2 of the lease period of the IP address acquired by the router under test, and the router under test will send a DHCP Request message to the router under test to renew the IP address lease.

选择租约期的1/2时刻断开陪测路由器与集线器的连接,使得待测路由器与陪测路由器之间无法通过报文沟通续租IP地址事宜,此时,加入大量外界干扰,即发送大量的DHCP Offer报文,看待测路由器是否会受其干扰,错拿干扰报文中的IP地址。Select 1/2 of the lease period to disconnect the connection between the router under test and the hub, so that the router under test and the router under test cannot communicate with each other about renewing the IP address through messages. At this time, add a lot of external interference, that is, send a large number of DHCP Offer message, to see if the router will be interfered by it and mistakenly take the IP address in the interfered message.

进一步地,所述步骤S100包括:S110所述测试主机通过xcap组建大量DHCP Offer包。本方案是利用xcap软件组包,来实现一种模拟DHCP Offer泛洪。xcap是一款windows发包工具,能够从系统中读取处所有的网络接口。xcap发包工具可以windows上从指定的接口发送构造的报文,支持两种简单的发送策略,一是发送选中的(用鼠标选中),二是循环发送复。xcap支持构造常见的以太网报文,包括arp、rarp、ipv4、ipv6、icmpv4、icmpv6、igmp、udp、tcp、pim、ospf、rip、snmp、ppp、pppoe、ipsec(ah/esp)等等,以及一些不常用的报文,如果802.3、STP等等。该xcap软件可模拟各种DHCP Offer包,从而全面测试无遗漏。xcap软件本就是测试协议一致性功能测试床中固有环境,有SOP参考文档,简单的操作让测试人员能够快速上手,具有易控制,资源复用,效率高等优点。此外,在于保证测试质量与效率的同时,还可以节约实验室资源、合理分配、固定测试环境,有利于保证测试结果的准确性。Further, the step S100 includes: S110, the test host constructs a large number of DHCP Offer packets through xcap. This solution uses the xcap software package to implement a simulated DHCP Offer flood. xcap is a windows contracting tool that can read all network interfaces from the system. The xcap sending tool can send structured messages from the specified interface on windows, and supports two simple sending strategies, one is to send the selected (selected with the mouse), and the other is to send the reply in a loop. xcap supports the construction of common Ethernet packets, including arp, rarp, ipv4, ipv6, icmpv4, icmpv6, igmp, udp, tcp, pim, ospf, rip, snmp, ppp, pppoe, ipsec (ah/esp), etc. And some uncommon packets, such as 802.3, STP, etc. The xcap software can simulate various DHCP Offer packages, so that there is no omission in the comprehensive test. The xcap software is the inherent environment of the test protocol conformance function test bed. It has SOP reference documents. The simple operation allows testers to get started quickly. It has the advantages of easy control, resource reuse, and high efficiency. In addition, while ensuring the quality and efficiency of the test, it can also save laboratory resources, rationally allocate, and fix the test environment, which is conducive to ensuring the accuracy of the test results.

进一步地,所述步骤S300包括:S310所述测试主机通过集线器向所述待测路由器循环发送大量组建的DHCP Offer包,所述DHCP Offer包包含提供给所述待测路由器的源IP地址。Further, the step S300 includes: S310, the test host cyclically sends a large number of formed DHCP Offer packets to the router under test through a hub, and the DHCP Offer package includes the source IP address provided to the router under test.

本发明还提供了一种模拟DHCP Offer泛洪的系统,包括:待测路由器、陪测路由器、测试主机及集线器,所述待测路由器、陪测路由器及测试主机分别与所述集线器有线连接,所述测试主机包括:组包模块、报文收发模块、及检查判断模块,所述报文收发模块分别与所述组包模块、检查判断模块相连,其中:The present invention also provides a system for simulating DHCP Offer flooding, comprising: a router to be tested, a router to be tested, a test host and a hub, and the router to be tested, the router to be tested and the host to be tested are respectively wired to the hub, The test host includes: a package module, a message transceiver module, and an inspection and judgment module, and the message transceiver module is connected to the package module and the inspection and judgment module respectively, wherein:

所述测试主机的组包模块组建DHCP Offer包;The package module of the test host builds a DHCP Offer package;

待测路由器通过集线器向陪测路由器请求IP地址,待所述待测路由器成功获取到所述陪测路由器分配的IP地址后,在租约期的1/2时间断开陪测路由器与集线器之间的连接;The router to be tested requests an IP address from the router to be tested through the hub, and after the router to be tested successfully obtains the IP address assigned by the router to be tested, disconnect the router to be tested from the hub during 1/2 of the lease period Connection;

所述测试主机的报文收发模块通过集线器向待测路由器发送所述组包模块组建的大量的DHCP Offer包;The message sending and receiving module of the test host sends a large amount of DHCP Offer packets formed by the grouping module to the router to be tested through the hub;

所述测试主机的检查判断模块判断所述待测路由器是否获取了所述DHCP Offer包中的源IP地址;The inspection and judgment module of the test host judges whether the router to be tested has obtained the source IP address in the DHCP Offer packet;

若所述测试主机的检查判断模块判断所述待测路由器获取了所述DHCP Offer包中的源IP地址,则判断所述待测路由器DHCP功能异常;If the inspection and judgment module of the test host judges that the router to be tested has obtained the source IP address in the DHCP Offer packet, then it is judged that the router to be tested has an abnormal DHCP function;

若所述测试主机的检查判断模块判断所述待测路由器未获取所述DHCP Offer包中的源IP地址,则所述测试主机的报文收发模块停止发送所述DHCP Offer包,重新建立陪测路由器与集线器之间的连接,所述测试主机的检查判断模块进一步判断所述待测路由器能否获取陪测路由器发送的IP地址,若是,则所述测试主机的检查判断模块判断待测路由器DHCP功能正常,否则所述测试主机的检查判断模块判断所述待测路由器DHCP功能异常。If the inspection and judgment module of the test host judges that the router to be tested has not obtained the source IP address in the DHCP Offer packet, then the message transceiver module of the test host stops sending the DHCP Offer packet, and re-establishes the companion test The connection between the router and the hub, the inspection and judgment module of the test host further judges whether the router to be tested can obtain the IP address sent by the router to be tested, if so, the inspection and judgment module of the test host judges whether the router under test DHCP If the function is normal, otherwise the checking and judging module of the test host judges that the DHCP function of the router under test is abnormal.

本发明的系统简单易控制,测试环境固定,测试人员上手快,效率高。此系统还可复用,节省测试资源,除了测试该路由器功能外,该环境还可进行ARP等协议测试、端口漏洞扫描测试等。The system of the present invention is simple and easy to control, the test environment is fixed, the test personnel can get started quickly, and the efficiency is high. This system can also be reused to save test resources. In addition to testing the router function, this environment can also perform protocol tests such as ARP and port vulnerability scanning tests.

进一步地,所述测试主机还包括与所述报文收发模块相连的设置模块,其中:所述测试主机的设置模块设置待测路由器上网方式为DHCP,并设置陪测路由器的租约期。Further, the test host also includes a setting module connected to the message sending and receiving module, wherein: the setting module of the test host sets the Internet access mode of the router to be tested to DHCP, and sets the lease period of the router to be tested.

进一步地,待测路由器通过集线器向陪测路由器请求IP地址,待所述待测路由器成功获取到所述陪测路由器分配的IP地址后,在租约期的1/2时间断开陪测路由器与集线器之间的连接;包括:Further, the router to be tested requests an IP address from the router to be tested through the hub, and after the router to be tested successfully obtains the IP address assigned by the router to be tested, disconnect the router to be tested from the router during the lease period. Connections between hubs; including:

所述待测路由器以广播的方式发出DHCP Discover报文,请求租用IP地址;The router to be tested sends a DHCP Discover message in a broadcast mode, requesting to lease an IP address;

所述陪测路由器接收到所述DHCP Discover报文后,向所述待测路由器发送一个DHCP Offer报文,所述报文中包含所述陪测路由器能提供给待测路由器使用的IP地址及所述陪测路由器自身的IP地址;After the accompanying test router receives the DHCP Discover message, it sends a DHCP Offer message to the test router, and the message includes the IP address and the IP address that the test companion router can provide to the test router. The IP address of the accompanying test router itself;

所述待测路由器接收所述DHCP Offer报文后,发出一个广播的DHCP Request报文,并在所述DHCP Request报文的选项字段加入所述陪测路由器地址及所述待测路由器申请的IP地址;After the router to be tested receives the DHCP Offer message, it sends a broadcast DHCP Request message, and adds the address of the router to be tested and the IP address applied for by the router to be tested in the option field of the DHCP Request message. address;

所述陪测路由器收到所述DHCP Request报文后发送响应DHCP ACK报文,并在所述DHCP ACK报文选项字段中增加所述待测路由器申请的IP地址的使用租约期信息;After the accompanying test router receives the DHCP Request message, it sends a response DHCP ACK message, and adds the lease period information of the IP address applied for by the router to be tested in the option field of the DHCP ACK message;

所述待测路由器收到所述DHCP ACK报文后,检查所述陪测路由器分配的IP地址是否能够使用,若是则所述待测路由器成功获得所述选中的IP地址,并根据所述IP地址使用租约期自动启动延续过程;After the router to be tested receives the DHCP ACK message, check whether the IP address assigned by the router to be tested can be used, if so, the router to be tested successfully obtains the selected IP address, and according to the IP The address uses the lease period to automatically start the continuation process;

在所述待测路由器获取的IP地址的租约期1/2时刻处,断开陪测路由器与集线器之间的通信连接,所述待测路由器会向所述陪测路由器发送DHCP Request报文来续租IP地址。At 1/2 of the lease period of the IP address acquired by the router to be tested, disconnect the communication connection between the router to be tested and the hub, and the router to be tested will send a DHCP Request message to the router to be tested. Renew IP address lease.

进一步地,所述测试主机的组包模块通过xcap软件组建DHCP Offer包。Further, the grouping module of the test host builds a DHCP Offer package through xcap software.

进一步地,所述测试主机的报文收发模块通过集线器向所述待测路由器循环发送大量组建的DHCP Offer包,所述DHCP Offer包包含提供给所述待测路由器的源IP地址。Further, the message sending and receiving module of the test host cyclically sends a large number of formed DHCP Offer packets to the router under test through the hub, and the DHCP Offer package includes the source IP address provided to the router under test.

本发明有益效果如下:The beneficial effects of the present invention are as follows:

(1)模拟组建各种DHCP Offer包,全面测试无遗漏。(1) Simulate the formation of various DHCP Offer packages, and comprehensively test without omissions.

(2)测试环境可复用,无需使用多台服务器,节约测试资源与空间利用。且该环境还可进行ARP等协议测试、端口漏洞扫描测试等。(2) The test environment can be reused without using multiple servers, saving test resources and space utilization. Moreover, the environment can also perform protocol tests such as ARP, port vulnerability scanning tests, etc.

(3)测试环境固定,保证测试质量。(3) The test environment is fixed to ensure the test quality.

(4)操作简单,测试环境易控制,操作人员易上手。(4) The operation is simple, the test environment is easy to control, and the operator is easy to use.

(5)成本低,在减少成本的同时,还提高了测试效率。(5) The cost is low, and the test efficiency is improved while reducing the cost.

综上所述,本发明具有保证测试质量、节约测试资源、提高测试效率等优点。In summary, the present invention has the advantages of ensuring test quality, saving test resources, and improving test efficiency.

附图说明Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without any creative effort.

图1为本发明一种模拟DHCP Offer泛洪的方法实施例一流程图;Fig. 1 is a flow chart of Embodiment 1 of a method for simulating DHCP Offer flooding in the present invention;

图2为本发明一种模拟DHCP Offer泛洪的方法另一实施例中待测路由器DHCP租约过程流程图;Fig. 2 is a flow chart of the DHCP lease process of the router to be tested in another embodiment of a method for simulating DHCP Offer flooding of the present invention;

图3为本发明一种模拟DHCP Offer泛洪的系统实施例框图;Fig. 3 is a block diagram of a system embodiment of simulating DHCP Offer flooding in the present invention;

图4为本发明一种模拟DHCP Offer泛洪的系统实施例拓扑图;Fig. 4 is a topological diagram of a system embodiment simulating DHCP Offer flooding in the present invention;

图5为本发明一种模拟DHCP Offer泛洪的方法另一实施例流程图。FIG. 5 is a flow chart of another embodiment of a method for simulating DHCP Offer flooding according to the present invention.

具体实施方式Detailed ways

为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部份实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments . Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本发明公开了一种模拟DHCP Offer泛洪的方法,实施例一如图1所示,包括步骤:The present invention discloses a method for simulating DHCP Offer flooding. Embodiment 1 is shown in FIG. 1 and includes steps:

S100所述测试主机组建DHCP Offer包;The test host described in S100 constructs a DHCP Offer package;

S200待测路由器通过集线器向陪测路由器请求IP地址,待所述待测路由器成功获取到所述陪测路由器分配的IP地址后,在租约期的1/2时间断开陪测路由器与集线器之间的连接;S200 The router to be tested requests an IP address from the router to be tested through the hub, and after the router to be tested successfully obtains the IP address assigned by the router to be tested, disconnect the router to be tested from the hub during 1/2 of the lease period connection between

S300所述测试主机通过集线器向待测路由器发送大量组建的DHCP Offer包,所述DHCP Offer包包含提供给所述待测路由器的源IP地址;S300 The test host sends a large number of formed DHCP Offer packets to the router to be tested through the hub, and the DHCP Offer packet includes a source IP address provided to the router to be tested;

S400所述测试主机判断所述待测路由器是否获取了DHCP Offer包中的源IP地址,若是,则进入步骤S500,否则进入步骤S600;The test host in S400 judges whether the router to be tested has obtained the source IP address in the DHCP Offer packet, if so, enters step S500, otherwise enters step S600;

S500判断所述待测路由器DHCP功能异常;S500 judges that the DHCP function of the router to be tested is abnormal;

S600所述测试主机停止发送所述DHCP Offer包,并重新建立陪测路由器与集线器之间的连接,判断所述待测路由器能否获取陪测路由器发送的IP地址,若是,则进入步骤S700,否则进入步骤S500;In S600, the test host stops sending the DHCP Offer packet, and re-establishes the connection between the test router and the hub, and judges whether the test router can obtain the IP address sent by the test router, and if so, enters step S700, Otherwise, enter step S500;

S700判断待测路由器DHCP功能正常。The S700 judges that the DHCP function of the router under test is normal.

本实施例模拟了DHCP Offer泛洪的测试环境,用陪测路由器来充当一台服务器,用测试主机组建大量DHCP Offer包实现模拟DHCP泛洪。首先,测试主机先组建大量的DHCPOffer包,先组建好不发送,待后续一起发送营造出泛洪现象。陪测路由充当了一台服务器的角色,因此,被测路由先向陪测路由器(相当于服务器)申请IP地址,看能否正常获得IP地址。如果被测路由能够成功获取陪测路由分配的IP地址,则在这个IP地址的租约期的1/2时间这一时刻,断开陪测路由器和集线器的连接,然后让测试主机通过集线器向待测路由器发送大量之前组建好的DHCP Offer包,这个DHCP Offer包里面含有提供给待测路由器使用的IP,这里称为源IP。注意,这里的源IP与之前陪测路由器提供给待测路由器的IP地址不是同一个地址,因为这里是测试主机仿冒服务器发起的报文,这个报文和之前陪测路由器分配IP地址给待测路由器的DHCP Offer报文除了提供的IP地址不一样外,其余差别不大。甚至,为了欺骗待测路由器,测试主机发送的DHCP Offer报文包含的发送方的IP也不是用的真正自己的IP地址,而是伪装成陪测路由器,该报文中包含的发送方的IP是陪测路由器的IP。因此,如果待测路由器不对报文进行进一步的验证确认,便获取该测试主机发送的DHCPOffer报文中的源IP地址的话,则说明该待测路由器DHCP功能出现了异常。也就是说,随后判断待测路由器有没有获取测试主机发送的DHCP Offer包中的源IP地址,如果获取了的话,则说明该待测路由器的DHCP功能异常。如果没有获取的话,则再连接上陪测路由器与集线器之间的网线,建立连接,再检查判断待测路由器有没有获取陪测路由器提供的IP,如果连接上后能获取到陪测路由器提供的IP,则说明该待测路由器DHCP功能正常,不能获取的话,则判断该待测路由器DHCP功能异常。This embodiment simulates a test environment for DHCP Offer flooding, using a testing router as a server, and using a test host to form a large number of DHCP Offer packets to simulate DHCP flooding. First of all, the test host builds a large number of DHCPOffer packets first, and does not send them after they are built, and then sends them together later to create a flooding phenomenon. The accompanying router acts as a server, so the tested router first applies for an IP address from the accompanying router (equivalent to a server) to see if it can obtain an IP address normally. If the route to be tested can successfully obtain the IP address assigned by the route to be tested, at the moment of 1/2 of the lease period of this IP address, disconnect the router to be tested from the hub, and then let the test host The router under test sends a large number of DHCP Offer packets that have been formed before. This DHCP Offer package contains the IP provided for the router under test, which is called the source IP here. Note that the source IP here is not the same as the IP address provided by the test router to the router under test, because this is a message sent by the test host counterfeiting the server. This message is the same as the IP address assigned by the test router to the test router. Except for the IP address provided by the DHCP Offer message of the router, the rest are not much different. Even, in order to deceive the router under test, the IP address of the sender included in the DHCP Offer message sent by the test host is not its real IP address, but pretends to be the router under test. The IP address of the sender contained in the message is It is the IP of the test router. Therefore, if the router to be tested does not further verify and confirm the message, but obtains the source IP address in the DHCPOffer message sent by the test host, it means that the DHCP function of the router to be tested is abnormal. That is to say, then it is judged whether the router to be tested has obtained the source IP address in the DHCP Offer packet sent by the test host, and if it is obtained, it means that the DHCP function of the router to be tested is abnormal. If it is not obtained, then connect the network cable between the test router and the hub to establish a connection, and then check to determine whether the router to be tested has obtained the IP provided by the test router. IP, it means that the DHCP function of the router to be tested is normal. If it cannot be obtained, it is judged that the DHCP function of the router to be tested is abnormal.

本实施例的方法简单易行,还可复用,节省了测试资源,无需提供多个DHCP服务器,通过模拟DHCP泛洪的方法解决了测试环境资源紧张的状况。减少了成本,提高了测试效率,且测试的质量有保证。The method of this embodiment is simple and easy to implement, can be reused, saves test resources, does not need to provide multiple DHCP servers, and solves the shortage of resources in the test environment by simulating DHCP flooding. The cost is reduced, the test efficiency is improved, and the test quality is guaranteed.

较佳的,在上述实施例的测试开始之前,还需要进行相应的设置,搭建测试环境。具体的,设置待测路由器上网方式为DHCP,并设置陪测路由器的租约期,比如1分钟,将测试主机与集线器有线连接,当然,待测路由器与陪测路由器分别与所述集线器有线连接,如此,搭建好了测试环境。Preferably, before the test in the above embodiment starts, corresponding settings need to be made to build a test environment. Specifically, set the Internet access mode of the router to be tested as DHCP, and set the lease period of the router to be tested, such as 1 minute, and connect the test host to the hub by wire. Of course, the router to be tested and the router to be tested are respectively wired to the hub. In this way, the test environment is set up.

较佳的,在上述实施例中,所述步骤S100中,测试主机组建大量DHCP Offer包,我们可以采用xcap软件来组建,xcap软件本就是测试协议一致性功能测试床中固有环境,有SOP参考文档,简单的操作让测试人员能够快速上手,不了解测试环境的测试人员,只需要参照SOP文档即可进行测试;此外具有易控制,资源复用,效率高等优点。Preferably, in the above embodiment, in the step S100, the test host builds a large number of DHCP Offer packages, which we can use xcap software to build. The xcap software is the inherent environment in the test protocol consistency function test bed, and there is a SOP reference Documentation, simple operation allows testers to get started quickly, and testers who don't know the test environment only need to refer to the SOP document to test; in addition, it has the advantages of easy control, resource reuse, and high efficiency.

较佳的,上述实施例中,如图2所示,所述步骤S200包括步骤:Preferably, in the above embodiment, as shown in FIG. 2, the step S200 includes the steps of:

S210所述待测路由器以广播的方式发出DHCP Discover报文,请求租用IP地址;The router to be tested in S210 sends out a DHCP Discover message in broadcast mode, requesting to lease an IP address;

S220所述陪测路由器接收到所述DHCP Discover报文后,向所述待测路由器发送一个DHCP Offer报文,所述报文中包含所述陪测路由器能提供给待测路由器使用的IP地址及所述陪测路由器自身的IP地址;S220 After receiving the DHCP Discover message, the accompanying router sends a DHCP Offer message to the router under test, and the message includes the IP address that the accompanying router can provide to the router under test. and the IP address of the accompanying test router itself;

S230所述待测路由器接收所述DHCP Offer报文后,发出一个广播的DHCP Request报文,并在所述DHCP Request报文的选项字段加入所述陪测路由器地址及所述待测路由器申请的IP地址;S230 After receiving the DHCP Offer message, the router to be tested sends a broadcast DHCP Request message, and adds the address of the router to be tested and the address of the router to be tested to the option field of the DHCP Request message. IP address;

S240所述陪测路由器收到所述DHCP Request报文后发送响应DHCP ACK报文,并在所述DHCP ACK报文选项字段中增加所述待测路由器申请的IP地址的使用租约期信息;S240, the accompanying test router sends a response DHCP ACK message after receiving the DHCP Request message, and adds the use lease period information of the IP address applied for by the router to be tested in the option field of the DHCP ACK message;

S250所述待测路由器收到所述DHCP ACK报文后,检查所述陪测路由器分配的IP地址是否能够使用,若是则所述待测路由器成功获得所述选中的IP地址,并根据所述IP地址使用租约期自动启动延续过程;S250 After the router under test receives the DHCP ACK message, check whether the IP address assigned by the router under test can be used, if so, the router under test successfully obtains the selected IP address, and according to the The IP address uses the lease period to automatically start the continuation process;

S260在所述待测路由器获取的IP地址的租约期1/2时刻处,断开陪测路由器与集线器之间的通信连接,所述待测路由器会向所述陪测路由器发送DHCP Request报文来续租IP地址。S260 Disconnect the communication connection between the router under test and the hub at 1/2 of the lease period of the IP address acquired by the router under test, and the router under test will send a DHCP Request message to the router under test to renew the IP address lease.

在达到租约规定的有效期的一半时间(即租约期的1/2时刻)后,待测路由器就进入“续租状态”,待测路由器会向为它分配IP地址的DHCP服务器(即陪测路由器)单播发送DHCP REQUEST报文,以进行IP租约的更新。,如果作为DHCP服务器的陪测路由器认为可以继续使用,就会给待测路由器返回一个确认消息,这样待测路由器成功续租IP地址。如果陪测路由器认为不可以再将该IP地址分配给该待测路由器,则会通知待测路由器不能获得新的租约。如果在租约的一半时间进行的续约操作失败,待测路由器会在租约期限达到7/8时候(87.5%)时,如果还没有获得服务器的确认消息,该IP地址就被服务器回收。客户机必须重新开始租约的申请过程。因此,在租约期的1/2时刻断开陪测路由器与集线器的通信连接,使得陪测路由器未能接收租约消息或者无法返回续租的答复消息给到待测路由器,此时,再通过测试主机发送大量DHCP Offer包,伪装成陪测路由器,模拟DHCP Offer泛洪,检测路由器的DHCP功能。After reaching half of the validity period stipulated in the lease contract (that is, 1/2 of the lease period), the router to be tested will enter the "renewal state", and the router to be tested will send an IP address to the DHCP server (that is, the companion router to be tested). ) Unicast sends a DHCP REQUEST message to renew the IP lease. , if the accompanying test router as the DHCP server thinks it can continue to use, it will return a confirmation message to the test router, so that the test router successfully renews the lease of the IP address. If the router under test thinks that the IP address can no longer be assigned to the router under test, it will notify the router under test that it cannot obtain a new lease. If the renewal operation fails during the half time of the lease, the router under test will be recycled by the server if it has not obtained the confirmation message from the server when the lease period reaches 7/8 (87.5%). The client must restart the lease application process. Therefore, disconnect the communication connection between the test router and the hub at 1/2 of the lease period, so that the test router fails to receive the lease message or cannot return a lease renewal reply message to the router to be tested. At this time, pass the test The host sends a large number of DHCP Offer packets, pretending to be a testing router, simulating the flooding of DHCP Offers, and testing the DHCP function of the router.

较佳的,实施例一种的步骤S300中,测试主机可以采用循环发送的方式,将组建的大量的DHCP Offer包循环发送给待测路由器。Preferably, in step S300 of Embodiment 1, the test host may send a large number of DHCP Offer packets to the router under test in a cyclic sending manner.

基于相同的技术构思,本发明实施例还提供一种模拟DHCP Offer泛洪的系统,该系统可执行上述方法实施例。本发明实施例提供的模拟DHCP Offer泛洪的系统,如图3所示,包括:待测路由器10、陪测路由器20、测试主机30及集线器40,所述待测路由器10、陪测路由器20及测试主机30分别与所述集线器40有线连接,所述测试主机30包括:组包模块31、报文收发模块32、及检查判断模块33,所述报文收发模块32分别与所述组包模块31、检查判断模块33相连,其中:Based on the same technical idea, the embodiment of the present invention also provides a system for simulating DHCP Offer flooding, and the system can execute the above method embodiment. The system for simulating DHCP Offer flooding provided by the embodiment of the present invention, as shown in FIG. And test host 30 is wired with described hub 40 respectively, and described test host 30 comprises: group package module 31, message transceiver module 32 and inspection judgment module 33, and described message transceiver module 32 is connected with described package respectively Module 31 and inspection judgment module 33 are connected, wherein:

所述测试主机30的组包模块31组建DHCP Offer包;The package module 31 of the test host 30 forms a DHCP Offer package;

所述待测路由器10通过集线器40向陪测路由器20请求IP地址,待所述待测路由器10成功获取到所述陪测路由器20分配的IP地址后,在租约期的1/2时间断开陪测路由器20与集线器40之间的连接;The router 10 to be tested requests an IP address from the router 20 to be tested through the hub 40, and after the router 10 to be tested successfully obtains the IP address allocated by the router 20 to be tested, it disconnects during 1/2 of the lease period. Accompanied by testing the connection between the router 20 and the hub 40;

所述测试主机30的报文收发模块32通过集线器40向待测路由器10发送所述组包模块31组建的大量的DHCP Offer包;The message transceiver module 32 of the test host 30 sends a large amount of DHCP Offer packets formed by the group module 31 to the router 10 to be tested through the hub 40;

所述测试主机30的检查判断模块33判断所述待测路由器10是否获取了所述DHCPOffer包中的源IP地址;The inspection and judgment module 33 of the test host 30 judges whether the router 10 under test has obtained the source IP address in the DHCPOffer packet;

若所述测试主机30的检查判断模块33判断所述待测路由器10获取了所述DHCPOffer包中的源IP地址,则判断所述待测路由器10DHCP功能异常;If the inspection and judgment module 33 of the test host 30 judges that the router under test 10 has obtained the source IP address in the DHCPOffer packet, then it is judged that the router under test 10DHCP function is abnormal;

若所述测试主机30的检查判断模块33判断所述待测路由器10未获取所述DHCPOffer包中的源IP地址,则所述测试主机30的报文收发模块32停止发送所述DHCP Offer包,重新建立陪测路由器20与集线器40之间的连接,所述测试主机30的检查判断模块33进一步判断所述待测路由器10能否获取陪测路由器20发送的IP地址,若是,则所述测试主机30的检查判断模块33判断待测路由器10DHCP功能正常,否则所述测试主机30的检查判断模块33判断所述待测路由器10的DHCP功能异常。If the inspection and judgment module 33 of the test host 30 judges that the router 10 under test does not obtain the source IP address in the DHCP Offer packet, the message transceiver module 32 of the test host 30 stops sending the DHCP Offer packet, Re-establish the connection between the accompanying test router 20 and the hub 40, and the inspection and judgment module 33 of the test host 30 further judges whether the described test router 10 can obtain the IP address sent by the accompanying test router 20, if so, the test The checking and judging module 33 of the host computer 30 judges that the DHCP function of the router under test 10 is normal; otherwise, the checking and judging module 33 of the testing host 30 judges that the DHCP function of the router under test 10 is abnormal.

本系统节省测试资源,除了测试该功能外,该环境还可进行ARP等协议测试、端口漏洞扫描测试等。效率高,测试环境固定,简单易懂,测试人员上手快。在于保证测试质量与效率的同时,还可以节约实验室资源、合理分配、固定测试环境,有利于保证测试结果的准确性。This system saves test resources. In addition to testing this function, the environment can also perform protocol tests such as ARP and port vulnerability scanning tests. High efficiency, fixed test environment, simple and easy to understand, testers get started quickly. While ensuring the quality and efficiency of the test, it can also save laboratory resources, rationally allocate, and fix the test environment, which is conducive to ensuring the accuracy of the test results.

较佳的,上述实施例中的测试主机30还包括与所述报文收发模块32相连的设置模块34,其中:所述测试主机30的设置模块34设置待测路由器10上网方式为DHCP,并设置陪测路由器20的租约期。由于本系统用于模拟DHCP Offer泛洪,用于测试,因此一般将租约期设置为1分钟即可,设置租约期过长会影响测试效率。Preferably, the test host 30 in the above-mentioned embodiment also includes a setting module 34 connected to the message sending and receiving module 32, wherein: the setting module 34 of the test host 30 sets the router 10 Internet access mode to be DHCP, and Set the lease period of the accompanying router 20. Since this system is used to simulate DHCP Offer flooding for testing, it is generally sufficient to set the lease period to 1 minute. Setting the lease period too long will affect the test efficiency.

较佳的,上述实施例一种的所述测试主机30的组包模块31通过xcap软件组建DHCPOffer包。xcap软件本就是测试协议一致性功能测试床中固有环境,有SOP参考文档,简单的操作让测试人员能够快速上手,具有易控制,资源复用,效率高等优点。Preferably, the package module 31 of the test host 30 in the above-mentioned embodiment 1 forms a DHCPOffer package through xcap software. The xcap software is the inherent environment of the test protocol conformance function test bed. It has SOP reference documents. The simple operation allows testers to get started quickly. It has the advantages of easy control, resource reuse, and high efficiency.

较佳的,在上述实施例一种的模拟DHCP Offer泛洪的系统中,所述待测路由器10通过集线器40向陪测路由器20请求IP地址,待所述待测路由器10成功获取到所述陪测路由器20分配的IP地址后,在租约期的1/2时间断开陪测路由器20与集线器40之间的连接;这一过程包括:Preferably, in the system for simulating DHCP Offer flooding in the above-mentioned embodiment, the router 10 to be tested requests an IP address from the accompanying router 20 through the hub 40, and the router 10 to be tested is to be successfully obtained the IP address. After the IP address assigned by the accompanying test router 20, disconnect the connection between the accompanying test router 20 and the hub 40 in 1/2 of the lease period; this process includes:

所述待测路由器10以广播的方式发出DHCP Discover报文,请求租用IP地址;The router 10 to be tested sends a DHCP Discover message in broadcast mode, requesting to lease an IP address;

所述陪测路由器20接收到所述DHCP Discover报文后,向所述待测路由器10发送一个DHCP Offer报文,所述报文中包含所述陪测路由器20能提供给待测路由器10使用的IP地址及所述陪测路由器20自身的IP地址;After the router for testing 20 receives the DHCP Discover message, it sends a DHCP Offer message to the router 10 under test, and the message includes that the router for testing 20 can provide to the router 10 for testing. IP address and the IP address of the accompanying test router 20 itself;

所述待测路由器10接收所述DHCP Offer报文后,发出一个广播的DHCP Request报文,并在所述DHCP Request报文的选项字段加入所述陪测路由器20地址及所述待测路由器10申请的IP地址;After the router 10 to be tested receives the DHCP Offer message, it sends a broadcast DHCP Request message, and adds the address of the accompanying router 20 and the router 10 to be tested in the option field of the DHCP Request message. The IP address of the application;

所述陪测路由器20收到所述DHCP Request报文后发送响应DHCP ACK报文,并在所述DHCP ACK报文选项字段中增加所述待测路由器10申请的IP地址的使用租约期信息;The accompanying test router 20 sends a response DHCP ACK message after receiving the DHCP Request message, and increases the use lease period information of the IP address applied for by the router to be tested 10 in the DHCP ACK message option field;

所述待测路由器10收到所述DHCP ACK报文后,检查所述陪测路由器20分配的IP地址是否能够使用,若是则所述待测路由器10成功获得所述选中的IP地址,并根据所述IP地址使用租约期自动启动延续过程;After the router 10 to be tested receives the DHCP ACK message, check whether the IP address distributed by the accompanying router 20 can be used, if so, the router 10 to be tested successfully obtains the selected IP address, and according to The IP address automatically initiates the continuation process using the lease period;

在所述待测路由器10获取的IP地址的租约期1/2时刻处,断开陪测路由器20与集线器40之间的通信连接,所述待测路由器10会向所述陪测路由器20发送DHCP Request报文来续租IP地址。At the 1/2 moment of the lease period of the IP address acquired by the router 10 to be tested, the communication connection between the router 20 for testing and the hub 40 is disconnected, and the router 10 for testing will send a message to the router 20 for testing DHCP Request message to renew the IP address lease.

较佳的,在上述任一实施例的基础上,所述测试主机30的报文收发模块32通过集线器40向所述待测路由器10循环发送大量组建的DHCP Offer包,所述DHCP Offer包包含提供给所述待测路由器10的源IP地址。循环发送组建好的大量DHCP Offer包使得模拟泛洪的效果更好。Preferably, on the basis of any of the above-mentioned embodiments, the message transceiver module 32 of the test host 30 sends a large amount of DHCP Offer packets to the router under test 10 through the hub 40, and the DHCP Offer packets include The source IP address provided to the router 10 under test. Cyclic sending of a large number of assembled DHCP Offer packets makes the effect of simulated flooding better.

本发明的另一实施例,本发明的系统采用本发明的方法进行测试,该模拟DHCPOffer泛洪的方法适用于所有路由器。主要是利用xcap软件手动组建In another embodiment of the present invention, the system of the present invention adopts the method of the present invention for testing, and the method of simulating DHCPOffer flooding is applicable to all routers. Mainly use xcap software to build manually

DHCP Offer包,当路由器获取地址后,1/2租约期时间发DHCP Request时,模拟环境中存在的干扰(大量发出DHCP Offer包),来解决路由器会不会错拿地址等测试问题。DHCP Offer package, when the router obtains the address, when it sends a DHCP Request within 1/2 of the lease period, it simulates the interference in the environment (a large number of DHCP Offer packages are sent out), to solve test problems such as whether the router will take the wrong address.

基本的,具体测试流程图详见图5:The basic, specific test flow chart is shown in Figure 5:

S501搭建测试环境:PC设置路由器上网方式为DHCP,陪测路由器租约期设置为1分钟,以上设置完成后将PC与HUB连接,具体环境拓扑图如图4所示;S501 builds the test environment: PC sets the router’s Internet access mode to DHCP, and the lease period of the accompanying test router is set to 1 minute. After the above settings are completed, connect the PC to the HUB. The specific environment topology is shown in Figure 4;

S502组建DHCP Offer包:将协议一致性测试环境中已组好的报文中,目的MAC(ff:ff:ff:ff:ff:ff/01:00:5e:01:01:01除外)修改为路由器LAN口MAC;S502 Build a DHCP Offer package: modify the destination MAC (except ff:ff:ff:ff:ff:ff/01:00:5e:01:01:01) in the packet that has been assembled in the protocol conformance test environment It is the router LAN port MAC;

S503路由器正常获取地址;The S503 router obtains the address normally;

S504断开陪测路由器与HUB之间的网线:路由器正常获取地址后,租约期的1/2时间(30s)断开陪测路由器与HUB之间的网线;S504 Disconnect the network cable between the test router and the HUB: After the router obtains the address normally, disconnect the network cable between the test router and the HUB for 1/2 of the lease period (30s);

S505发送DHCP Offer包:协议测试PC向路由器循环发送大量源IP为192.168.1.170的DHCP Offer包;S505 sends a DHCP Offer packet: the protocol test PC cyclically sends a large number of DHCP Offer packets whose source IP is 192.168.1.170;

S506检查路由器获IP情况:检查路由器有没有获取offer包中地址192.168.1.170;如果有的话进入步骤S510,否则进入S507;S506 Check the IP status of the router: check whether the router has obtained the address 192.168.1.170 in the offer packet; if yes, go to step S510, otherwise go to S507;

S507停发DHCP Offer包:如果路由器没有获取offer包中地址192.168.1.170;协议测试PC停止发送DHCP Offer包;S507 Stop sending the DHCP Offer packet: if the router does not obtain the address 192.168.1.170 in the offer packet; the protocol test PC stops sending the DHCP Offer packet;

S508重连陪测路由器与HUB之间的网线;S508 reconnects the network cable between the test router and the HUB;

S509检查路由器获IP情况:检查路由器是否能够正确获取地址,若是则进入S511,否则进入S510;S509 checks the IP status of the router: check whether the router can obtain the address correctly, if so, go to S511, otherwise go to S510;

S510判断路由器DHCP功能异常;S510 judges that the DHCP function of the router is abnormal;

S511判断路由器DHCP功能正常。S511 judges that the DHCP function of the router is normal.

与现有最好技术相比,本发明的优点在于:Compared with the best existing technology, the advantages of the present invention are:

易控制:不了解测试环境的测试人员,只需参照SOP文档即可进行测试;Easy to control: Testers who don't know the test environment can test only by referring to the SOP document;

可复用:节省测试资源,除了测试该功能外,该环境还可进行ARP等协议测试、端口漏洞扫描测试等;Reusable: Save test resources. In addition to testing this function, the environment can also perform ARP and other protocol tests, port vulnerability scanning tests, etc.;

效率高:测试环境固定,简单易懂,测试人员上手快。High efficiency: The test environment is fixed, easy to understand, and testers can get started quickly.

尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While preferred embodiments of the invention have been described, additional changes and modifications to these embodiments can be made by those skilled in the art once the basic inventive concept is appreciated. Therefore, it is intended that the appended claims be construed to cover the preferred embodiment as well as all changes and modifications which fall within the scope of the invention.

显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and equivalent technologies thereof, the present invention also intends to include these modifications and variations.

Claims (10)

1. a kind of method that simulation DHCP Offer floods, which is characterized in that comprising steps of
S100, which tests host, sets up DHCP Offer packet, and the DHCP Offer packet is that counterfeit accompany of test host surveys router initiation Message;
S200 router to be measured surveys router solicitation IP address to described accompany by hub, successfully obtains to the router to be measured After getting the IP address for accompanying survey router distribution, at the 1/2 of the lease phase of the IP address accompanied and survey router distribution The separated connection accompanied between survey router and the hub;
Test host described in S300 sends the DHCP Offer packet largely set up to the router to be measured by the hub, The DHCP Offer packet includes the source IP address that the test host is 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 It is then to enter step S500, otherwise enters step S600;
S500 judges the router DHCP dysfunction to be measured;
Test host described in S600 stops sending the DHCP Offer packet, and re-establishes described accompany and survey router and the collection Connection between line device judges that can the router to be measured obtain to accompany and surveys the IP address that router is sent, if so, entering step Rapid S700, otherwise enters step S500;
S700 judges that router DHCP function to be measured is normal.
2. a kind of method that simulation DHCP Offer floods according to claim 1, which is characterized in that further include:
It is DHCP that the net playing mode of router to be measured, which is arranged, in S010, and the lease phase for surveying router is accompanied described in setting;
S020 is by the test host and the hub wired connection, and the survey router and described accompany survey router difference With the hub wired connection, test environment is established.
3. a kind of method that simulation DHCP Offer floods according to claim 1, which is characterized in that 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, one is sent to the router to be measured DHCP Offer message surveys router and can distribute to IP address and the institute of the router to be measured in the message comprising described accompany State the IP address accompanied and survey router itself;
After the router reception to be measured DHCP Offer message described in S230, 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 described accompany surveys router point The IP address of router to be measured described in dispensing;
It accompanies to survey after router receives the DHCP Request message described in S240 and sends response DHCP ACK message, and described The use for surveying the IP address that router distributes to the router to be measured is accompanied to rent described in increasing in DHCP ACK message Option Field Contract period information;
After router to be measured described in S250 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 accompanied and survey router distribution, and according to described IP address starts continuity process using the lease phase automatically;
S260 is surveyed at 1/2 moment of lease phase for the IP address that router distributes to the router to be measured in described accompany, and disconnects institute The communication connection accompanied and surveyed between router and the hub is stated, the router to be measured can survey router transmission to described accompany DHCP Request message re-rents IP address.
4. a kind of method that simulation DHCP Offer floods according to claim 1, which is characterized in that the step S100 Comprising steps of
Test host described in S110 sets up a large amount of DHCP Offer packets by xcap.
5. a kind of method that simulation DHCP Offer floods according to claim 1-4, which is characterized in that described Step S300 comprising steps of
Test host described in S310 cycles through the DHCP largely set up to the router to be measured by the hub Offer packet, the DHCP Offer packet include the source IP address for being supplied to the router to be measured.
6. a kind of system that simulation DHCP Offer floods characterized by comprising router to be measured accompanies and surveys router, test Host and hub, the router to be measured accompany and survey router and test host respectively with the hub wired connection, described Test host include: a group packet module, packet sending and receiving module and check judgment module, the packet sending and receiving module respectively with it is described Group packet module checks that judgment module is connected, in which:
The group packet module of the test host sets up DHCP Offer packet, and the DHCP Offer packet is to test that host is counterfeit accompanies survey The message that router is initiated;
The router to be measured, to survey router solicitation IP address is accompanied, is successfully obtained by the hub to the router to be measured After getting the IP address for accompanying survey router distribution, at the 1/2 of the lease phase of the IP address accompanied and survey router distribution The separated connection accompanied between survey router and the hub;
The packet sending and receiving module of the test host sends described group of packet module to the router to be measured by the hub The a large amount of DHCP Offer packet set up, the DHCP Offer packet include that the test host is supplied to the router to be measured Source IP address;
The inspection judgment module of the test host judges whether the router to be measured obtains in the DHCP Offer packet Source IP address;
If the inspection judgment module of the test host judges that the router to be measured obtains in the DHCP Offer packet Source IP address then judges the router DHCP dysfunction to be measured;
If the inspection judgment module of the test host judges that the router to be measured has not been obtained in the DHCP Offer packet Source IP address, then the packet sending and receiving module of the test host stops sending the DHCP Offer packet, re-establishes described accompany The connection between router and the hub is surveyed, the inspection judgment module of the test host further judges the road to be measured Can the IP address that survey router be accompanied to send be obtained by device, if so, the inspection judgment module judgement of the test host The router DHCP function to be measured is normal, and otherwise the inspection judgment module of the test host judges the router to be measured DHCP dysfunction.
7. a kind of system that simulation DHCP Offer floods according to claim 6, which is characterized in that the test host It further include the setup module being connected with the packet sending and receiving module, in which:
It is DHCP that the net playing mode of router to be measured, which is arranged, in the setup module of the test host, and accompanies survey to route described in setting The lease phase of device.
8. a kind of system that simulation DHCP Offer floods according to claim 6, which is characterized in that router to be measured is logical Hub is crossed to survey router solicitation IP address is accompanied, described accompany successfully is got to the router to be measured and surveys router distribution After IP address, at the 1/2 of the lease phase for accompanying the IP address for surveying router distribution, separated accompany surveys router and hub Between connection;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 a DHCP to the router to be measured Offer message surveys router and can distribute to the IP address of the router to be measured and described accompany in the message comprising described accompany Survey the IP address of router itself;
After the router to be measured receives the DHCP Offer message, the DHCP Request message of a broadcast is issued, and Survey router address and described accompany is accompanied to survey router point described in being added in the Option Field of the DHCP Request message The IP address of dispensing router to be measured;
It is described accompany to survey router and receive response DHCP ACK message is sent after the DHCP Request message, and in the DHCP Survey router is accompanied to distribute to believing using the lease phase for the IP address of the router to be measured described in increasing in ACK message Option Field Breath;
After the router to be measured receives the DHCP ACK message, the IP address for surveying router distribution is accompanied whether described in inspection It is enough to use, if then the router to be measured successfully obtains the IP address accompanied and survey router distribution, and according to the IP Location starts continuity process using the lease phase automatically;
It surveys at 1/2 moment of lease phase for the IP address that router distributes to the router to be measured in described accompany, is accompanied described in disconnection The communication connection between router and the hub is surveyed, the router to be measured can survey router transmission DHCP to described accompany Request message re-rents IP address.
9. a kind of system that simulation DHCP Offer floods according to claim 6, which is characterized in that the test host Group packet module pass through xcap set up DHCP Offer packet.
10. according to a kind of described in any item systems that simulation DHCP Offer floods of claim 6-9, it is characterised in that:
The packet sending and receiving module of the test host cycles through a large amount of establishments to the router to be measured by the hub DHCP Offer packet, the DHCP Offer packet includes to be supplied to the source IP address of the router to be measured.
CN201710079086.5A 2017-02-14 2017-02-14 A method and system for simulating DHCP Offer flooding Active CN106603348B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710079086.5A CN106603348B (en) 2017-02-14 2017-02-14 A method and system for simulating DHCP Offer flooding

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710079086.5A CN106603348B (en) 2017-02-14 2017-02-14 A method and system for simulating DHCP Offer flooding

Publications (2)

Publication Number Publication Date
CN106603348A CN106603348A (en) 2017-04-26
CN106603348B true CN106603348B (en) 2019-10-11

Family

ID=58587488

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710079086.5A Active CN106603348B (en) 2017-02-14 2017-02-14 A method and system for simulating DHCP Offer flooding

Country Status (1)

Country Link
CN (1) CN106603348B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108667953A (en) * 2018-04-27 2018-10-16 四川斐讯信息技术有限公司 A kind of the lease function test method and system, test device of DHCP service
CN113740748B (en) * 2021-09-03 2024-04-26 深圳市新威尔电子有限公司 Battery detection method based on CAN bus sending message

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101453495A (en) * 2008-12-30 2009-06-10 杭州华三通信技术有限公司 Method, system and equipment for preventing authentication address resolution protocol information loss
CN102438028A (en) * 2012-01-19 2012-05-02 神州数码网络(北京)有限公司 Method, device and system for preventing fraud of dynamic host configuration protocol (DHCP) server
CN103701825A (en) * 2013-12-31 2014-04-02 工业和信息化部电子第五研究所 Security testing system oriented to mobile intelligent terminal IPv6 protocol and application of protocol
EP2757743A1 (en) * 2011-11-16 2014-07-23 Huawei Technologies Co., Ltd Method, device, apparatus and system for generation of dhcp snooping binding table
CN104009967A (en) * 2013-02-27 2014-08-27 上海斐讯数据通信技术有限公司 Method for preventing attack of untrusted servers
CN105323120A (en) * 2015-11-26 2016-02-10 上海斐讯数据通信技术有限公司 Test method, test device and test terminal for DHCP service side

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101453495A (en) * 2008-12-30 2009-06-10 杭州华三通信技术有限公司 Method, system and equipment for preventing authentication address resolution protocol information loss
EP2757743A1 (en) * 2011-11-16 2014-07-23 Huawei Technologies Co., Ltd Method, device, apparatus and system for generation of dhcp snooping binding table
CN102438028A (en) * 2012-01-19 2012-05-02 神州数码网络(北京)有限公司 Method, device and system for preventing fraud of dynamic host configuration protocol (DHCP) server
CN104009967A (en) * 2013-02-27 2014-08-27 上海斐讯数据通信技术有限公司 Method for preventing attack of untrusted servers
CN103701825A (en) * 2013-12-31 2014-04-02 工业和信息化部电子第五研究所 Security testing system oriented to mobile intelligent terminal IPv6 protocol and application of protocol
CN105323120A (en) * 2015-11-26 2016-02-10 上海斐讯数据通信技术有限公司 Test method, test device and test terminal for DHCP service side

Also Published As

Publication number Publication date
CN106603348A (en) 2017-04-26

Similar Documents

Publication Publication Date Title
WO2017211235A1 (en) Client device management method and system, automatic configuration server, and storage medium
CN100536438C (en) Method for testing DHCPv6 service and client
CN102148879A (en) Port mapping method and device and communication system
CN107592209A (en) A kind of multi-network card server automatically configures the method and system of IP address information
CN104935564B (en) Make the equipment based on mDNS agreements and service the method found mutually in a local network
CN101494669B (en) Method and apparatus for distributing IP address for user terminal
CN103873826A (en) Media stream sending control method and device
CN105376754A (en) Method for testing number of connectable wireless users of router
CN102780602B (en) Method and device for data transmission
CN106603348B (en) A method and system for simulating DHCP Offer flooding
US20140280467A1 (en) Method of managing port dhcp server protocol addresses
CN103401954B (en) The implementation method of virtual DHCP
CN111447302B (en) Method and system for simulating multi-client to test DHCP (dynamic host configuration protocol) by using raw socket
WO2023010821A1 (en) Host discovery and addition method and apparatus in data center, and device and medium
CN104468467A (en) Dynamic host configuration protocol (DHCP) message transmitting method and device
US20200267116A1 (en) Internet protocol version six address management
TW201517601A (en) Media streaming providing device, method of connecting to media streaming providing device, media streaming system and computer readable media
CN105338131A (en) Testing method and system for address pool capacity of DHCP server
CN106878485B (en) Message processing method and device
CN103546594B (en) Method and device for configuration of isolation region pointed address
CN102045317B (en) Realize the method for multi-party communication, Apparatus and system
CN109151859B (en) Multi-machine test method for AP (access point) product without fixed IP (Internet protocol) at network port
CN106789256B (en) Test system and test method for simulating wide area network environment
KR20140102280A (en) Methods and systems for enabling nat traversal
CN102761425A (en) Charging method and device

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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201105

Address after: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240410

Address after: 313000 room 1019, Xintiandi commercial office, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee after: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Country or region after: China

Address before: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20250515

Address after: 30619, 3rd Floor, Building 1, No. 19 Zhengtong Road, Liangxiang, Fangshan District, Beijing, 100000 (registered as a cluster)

Patentee after: Beijing Huaxia Enterprise Service Technology Co.,Ltd.

Country or region after: China

Address before: 313000 room 1019, Xintiandi commercial office, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee before: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Country or region before: China