DHCP协议与抓包分析

合集下载

211084172_基于eNSP_的DHCP_攻击与防御技术的仿真实验设计与分析

211084172_基于eNSP_的DHCP_攻击与防御技术的仿真实验设计与分析

基于eNSP的DHCP攻击与防御技术的仿真实验设计与分析胡赐元(湖南开放大学湖南长沙410004)摘 要:D HCP协议是计算机网络系统中最常用的一种协议,它能够让网络管理员对终端IP地址的管理变得便捷;同时,由于DHCP协议在设计时未充分考虑网络安全因素,极易受到攻击。

在分析和总结常见的DHCP攻击种类及防御手段的基础上,基于eNSP仿真平台进行了仿真实验设计和实现,让学生对DHCP的攻击与防御技术有了更直观的认识,培养学生在使用DHCP协议的安全意识,并增强他们对DHCP攻击的防护能力。

关键词:e NSP DHCP仿真攻击与防御中图分类号:T P393.08文献标识码:A文章编号:1674-098X(2022)09(c)-0122-05Design and Analysis of Simulation Experiment of DHCP Attack and Defense Technology Based on eNSPHU Ciyuan( Hunan Open University, Changsha, Hunan Province, 410004 China )Abstract:DHCP protocol is the most commonly used protocol in computer network system. It enables network administrators to conveniently manage terminal IP addresses. At the same time, because the design of DHCP proto‐col does not fully consider the network security factors, it is very vulnerable to attacks. Based on the analysis and summary of common DHCP attack types and defense means, a simulation experiment is designed and implemented based on eNSP simulation platform, which enables students to have a more intuitive understanding of DHCP attack and defense technology, cultivate students' security awareness in using DHCP protocol, and enhance their ability to protect against DHCP attacks.Key Words: eNSP; DHCP; Simulation; Attack and defenseDHCP(Dynamic Host Configuration Protocol)动态主机配置协议,是计算机网络系统中最常用的一种协议。

DHCP完整过程详解及Wireshark抓包分析

DHCP完整过程详解及Wireshark抓包分析

DHCP完整过程详解及Wireshark抓包分析DHCP,Dynamic Host Configuration Protocol,动态主机配置协议,简单来说就是主机获取IP地址的过程,属于应⽤层协议。

DHCP采⽤UDP的68(客户端)和67(服务器)端⼝进⾏通信。

【过程】DHCP过程主要为DHCP Discover-->DHCP Offer-->DHCP Request-->DHCP Ack四个过程。

通过Wireshark抓取DHCP获取IP过程的数据报⽂。

1、开Wireshark抓包2、PC当前已有IP,使⽤cmd命令释放IP(ipconfig /release),并重新获取IP(ipconfig /renew)3、停⽌抓包,使⽤bootp过滤报⽂。

4、可以看到图中的5个报⽂,其中DHCP Release报⽂为PC释放IP时发出的报⽂。

获取IP时,PC会发送DHCP Discover⼴播报⽂,由于当前PC没有IP,故源IP为0.0.0.0;特别要注意到的是,PC会随机出⼀个Transaction ID,如果之后收到的Offer报⽂中的Transaction ID与PC模拟出的不同,PC会将该Offer报⽂直接丢弃。

DHCP Offer报⽂DHCP Request报⽂DHCP Ack报⽂【模拟服务器发送Offer报⽂的过程及注意事项】1、保证服务器与客户端的连通性2、准备好⼀个Offer报⽂(可编辑)3、使⽤Wireshark抓取客户端发出的Discover报⽂,确定当前客户端随机出的Transaction ID4、更改Offer报⽂中的Transaction ID与Discover报⽂中⼀致5、使⽤发包软件发送Offer报⽂注:Transaction ID【地址租期】DHCP服务器提供的每个IP地址都有相应的租⽤期,在Offer报⽂中的IP Address Lease Time中可以看到。

IP自动建链机制

IP自动建链机制

IP自动建链机制说明及配置方法IP自动建链机制引用了DHCP协议,本文为大家介绍DHCP工作原理、网管配置的使用方法和简单的故障排查方法。

1 DHCPDHCP(Dynamic Host Configuration Protocol, DHCP)动态主机设置协议,是一个局域网的网络协议,使用UDP协议工作,主要有两个用途:给内部网络或网络服务供应商自动分配IP地址;给用户给内部网络管理员作为对所有计算机作中央管理的手段。

1.1 DHCP 的工作原理根据客户端是否第一次登录网络,DHCP 的工作形式会有所不同。

第一次登录的时候:1.1.1寻找Server当DHCP 客户端第一次登录网络的时候,也就是客户发现本机上没有任何IP 数据设定,它会向网络发出一个DHCP DISCOVER 封包。

因为客户端还不知道自己属于哪一个网络,所以封包的来源地址会为0.0.0.0 ,而目的地址则为255.255.255.255 ,然后再附上DHCP discover 的信息,向网络进行广播。

在Windows 的预设情形下,DHCP discover 的等待时间预设为1 秒,也就是当客户端将第一个DHCP discover 封包送出去之后,在1 秒之内没有得到响应的话,就会进行第二次DHCP discover 广播。

若一直得不到响应的情况下,客户端一共会有四次DHCP discover 广播(包括第一次在内),除了第一次会等待1 秒之外,其余三次的等待时间分别是9、13、16 秒。

如果都没有得到DHCP 服务器的响应,客户端则会显示错误信息,宣告DHCP discover 的失败。

之后,基于使用者的选择,系统会继续在5 分钟之后再重复一次DHCP discover 的过程。

1.1.2提供IP 租用地址当DHCP 服务器监听到客户端发出的DHCP discover 广播后,它会从那些还没有租出的地址范围内,选择最前面的空置IP ,连同其它TCP/IP 设定,响应给客户端一个DHCP OFFER 封包。

实验7_使用Wireshark分析DHCP协议

实验7_使用Wireshark分析DHCP协议

实验7_使用Wireshark分析DHCP协议DHCP(Dynamic Host Configuration Protocol)是一种网络协议,用于动态分配IP地址、子网掩码、默认网关、DNS服务器等网络配置信息给计算机设备。

在本实验中,我们将使用Wireshark工具来分析DHCP协议的工作流程和数据包的结构。

首先,我们需要准备一个局域网环境,并在其中设置一个DHCP服务器和至少一个客户端设备。

DHCP服务器负责为客户端设备分配IP地址和其他网络配置信息。

客户端设备在启动时会发送DHCP请求,以获取分配给它的IP地址和其他配置信息。

使用Wireshark进行DHCP协议分析的步骤如下:1. 打开Wireshark软件,并选择适当的网络接口进行抓包。

在“捕获”选项卡中,选择正确的网络接口,然后点击“开始”按钮开始抓包。

2.在客户端设备上,启动DHCP服务发现过程。

客户端将发送一个DHCP发现广播消息,以寻找可用的DHCP服务器。

3. 在Wireshark中,我们可以看到DHCP发现消息的数据包。

可以通过在过滤器栏中输入“bootp”或“dhcp”来过滤只显示与DHCP相关的数据包。

4.DHCP服务器接收到DHCP发现消息后,会回复一个DHCP提供消息。

该消息包含了DHCP服务器可以提供给客户端的IP地址和其他配置信息。

5.客户端接收到DHCP提供消息后,会发送一个DHCP请求消息,以确认接受DHCP服务器提供的配置信息。

6.DHCP服务器接收到DHCP请求消息后,会发送一个DHCP确认消息,将IP地址和其他配置信息分配给客户端。

7. 在Wireshark中,我们可以查看这些DHCP消息的详细信息。

可以看到每个消息的源IP地址、目的IP地址、消息类型、配置选项等。

8.客户端设备在接收到DHCP确认消息后,将使用分配给它的IP地址和其他配置信息来配置自己的网络连接。

通过分析DHCP协议的数据包,我们可以了解到DHCP协议的工作流程和数据包的结构。

Wireshark抓包工具计算机网络实验

Wireshark抓包工具计算机网络实验

Wireshark抓包⼯具计算机⽹络实验实验⼀ Wireshark 使⽤⼀、实验⽬的1、熟悉并掌握Wireshark 的基本使⽤;2、了解⽹络协议实体间进⾏交互以及报⽂交换的情况。

⼆、实验环境与因特⽹连接的计算机,操作系统为Windows ,安装有Wireshark 、IE 等软件。

三、预备知识要深⼊理解⽹络协议,需要观察它们的⼯作过程并使⽤它们,即观察两个协议实体之间交换的报⽂序列,探究协议操作的细节,使协议实体执⾏某些动作,观察这些动作及其影响。

这种观察可以在仿真环境下或在因特⽹这样的真实⽹络环境中完成。

Wireshark 是⼀种可以运⾏在Windows, UNIX, Linux 等操作系统上的分组嗅探器,是⼀个开源免费软件,可以从/doc/d2530113af45b307e871976b.html 下载。

运⾏Wireshark 程序时,其图形⽤户界⾯如图2所⽰。

最初,各窗⼝中并⽆数据显⽰。

Wireshark 的界⾯主要有五个组成部分:图1命令和菜单协议筛选框捕获分组列表选定分组⾸部明细分组内容左:⼗六进制右:ASCII 码●命令菜单(command menus):命令菜单位于窗⼝的最顶部,是标准的下拉式菜单。

●协议筛选框(display filter specification):在该处填写某种协议的名称,Wireshark 据此对分组列表窗⼝中的分组进⾏过滤,只显⽰你需要的分组。

●捕获分组列表(listing of captured packets):按⾏显⽰已被捕获的分组内容,其中包括:分组序号、捕获时间、源地址和⽬的地址、协议类型、协议信息说明。

单击某⼀列的列名,可以使分组列表按指定列排序。

其中,协议类型是发送或接收分组的最⾼层协议的类型。

●分组⾸部明细(details of selected packet header):显⽰捕获分组列表窗⼝中被选中分组的⾸部详细信息。

包括该分组的各个层次的⾸部信息,需要查看哪层信息,双击对应层次或单击该层最前⾯的“+”即可。

网络嗅探工具wireshark在网络安全中的应用

网络嗅探工具wireshark在网络安全中的应用

网络与信息安全课程设计网络嗅探工具wireshark在网络安全中的应用学生姓名:宋琪学号: 20134088130专业年级: 13级信息与计算科学指导教师:信息技术学院二〇一五年12月日网络嗅探wireshark工具应用摘要随着网络技术的发展和网络应用的普及,越来越多的信息资源放在了互联网上,网络的安全性和可靠性显得越发重要。

因此,对于能够分析、诊断网络,测试网络性能与安全性的工具软件的需求也越来越迫切。

网络嗅探器具有两面性,攻击者可以用它来监听网络中数据,达到非法获得信息的目的,网络管理者可以通过使用嗅探器捕获网络中传输的数据包并对其进行分析,分析结果可供网络安全分析之用。

本文对网络嗅探技术进行简要分析,了解wireshark抓包软件的一部分功能,并用wireshark抓包软件来作为网络数据包的捕获工具,对相应的数据包进行捕获,并对所抓到数据包进行简要的分析。

关键词:网络嗅探器;数据包捕获;数据包分析;目录第一章引言 (4)1.1 网络安全的现状 (4)1.1.1 计算机网络安全的问题 (4)1.1.2 网络安全机制及技术措施 (4)1.2本课题的研究意义 (6)1.3本文研究的内容 (6)第二章网络嗅探器的基本原理 (7)2.1网络嗅探器概述 (7)2.2 嗅探器实现基础 (7)第三章数据包的捕获 (9)3.1 wireshark抓包软件的解析 (9)3.2 Wireshark嗅探器对ICMP协议数据包的捕获以及分析 (10)3.2.1 ICMP协议的原理 (10)3.2.2 利用网络嗅探工具开始捕获ICMP协议的数据包 (10)3.2.3 对所抓到的数据包的分析 (12)3.3 Wireshark嗅探器对DHCP协议数据包捕获及分析 (13)3.3.1 DHCP 协议的原理 (13)3.3.2利用Wireshark嗅探器抓捕DHCP协议的数据包并分析 (14)3.3.3 分析所抓到的数据包 (17)3.4用wireshark实现和分析三次握手 (24)3.5 FTP协议数据包的捕获 (26)3.5.1 FTP原理 (26)3.5.2实验准备 (26)3.5.3 FTP协议数据包的捕获 (30)总结 (32)参考文献 (32)第一章引言1.1 网络安全的现状1.1.1 计算机网络安全的问题随着各种新的网络技术的不断出现、应用和发展,计算机网络的应用越来越广泛,其作用也越来越重要。

wireshark DHCP DNS 抓包分析

wireshark DHCP DNS 抓包分析

Using WireShark for DHCP capture andDNS capture0921282109B04The configuration of the WireSharkThe WireShark interface in Linux is as above.The capture is done in the lab, in an café house as well as in the dorm. The connection to cafe is wireless connection, in the lab thelaptop is allocated to a public IP address and in dorm, where it iswired connection, the laptop is allocated to a private IP address, while the router’s IP is 192.168.1.1.While with wired connection, the interface selected is eth0,with wireless connection, the interface selected is eth 2.When capturing DHCP packet, the configuration of capture is as follows:When capturing DNS message, the configuration is as follows:●The procedure of captureClick on the third button to While capturing, click thethird start capture. button to stop.●DHCP analysisAfter input and in cmd ,,Release the link and rebuild the link using DHCP protocol.The five messages that the Wireshark packed are release, discover, offer, request and ACK. It can be inferred from the picture above that the source port number is 68 and the destination port number is 67. And the destination is a DHCP server as well as a router. The server’s IP address is 192.168.1.1(which is a private IP address used by a router) and the host’s IP address is 192.168.1.100(which is also a private IP address).1.Discover messageThe client broadcasts messages on the physical subnet to discover available DHCP servers. Network administrators can configure a local router to forward DHCP packets to a DHCP server from a different subnet. This client-implementation creates a User Datagram Protocol (UDP) packet with the broadcast destination of 255.255.255.255 or the specific subnet broadcast address.field value meaning2.Transaction ID an integer For client to match response4.Your IPaddress 0.0.0.0 The client is waiting to beassigned for an IP address, so thisis all 0.5.Next serverIP address 0.0.0.0 The server’s IP address isunknown.6.t=53 DHCP type =DHCP discoveryCompare with the example in the lectureExcept for the mac address and the transaction ID all fields are the same.2.Offer messageWhen a DHCP server receives an IP lease request from a client, it reserves an IP address for the client and extends an IP lease offer by sending a DHCPOFFER message to the client. This message contains the client's MAC address, the IP address that the server is offering, the subnet mask, the lease duration, and the IP address of the DHCP server making the offer.The server determines the configuration based on the client's hardware address as specified in the CHADDR (Client Hardware Address) field. Here the server, 192.168.1.1, specifies the IP address in the YIADDR (Your IP Address) field.field value meaning2 Transaction ID an integer For client to match response3 Client IP address 0.0.0.0 Only field if the client isBOUND, REVEW, orREBIND, so it’s all 0.4 Your IP address 192.168.1.100 The client is offered with anIP address5 Next server IP address 0.0.0.0 The server’s IP address is inoption 546 t=53 DHCP type =DHCP offer Compare with the example in the lectureExcept for the mac address, the next server IP address and the transaction ID all fields are the same. The next IP address that captured is all zero because the server IP is in the 54 flag.3.Request messageIn response to the offer Client requests the server. The client replies DHCP request, unicast to the server, requesting the offered address. A client can receive DHCP offers from multiple servers, but it will accept only one DHCP offer. Based on the Transaction ID field in the request, servers are informed whose offer the client has accepted. When other DHCP servers receive this message, they withdraw any offers that they might have made to the client and return the offered address to the pool of available addresses. In some cases DHCP request message is broadcast, instead of being unicast to a particular DHCP server, because the DHCP client has still not received an IP address. Also, this way one message can let all other DHCP servers know that another server will be supplying the IP address without missing any of the servers with a series of unicast messages.field value meaning2 Transaction IDan integerFor client to match response4 Your IP address0.0.0.0The client is still waiting for an IP address so it is all 05 Next server IP address 0.0.0.0 The server’s IP address is in option 546 t=53DHCP type =DHCP request 7 t=54 Server’s identifier is 192.168.1.1 8 t=50 Re quested IP address is 192.168.1.100Compare with the example in the lectureExcept for the mac address and the transaction ID all fields are the same.4.ACK messageWhen the DHCP server receives the DHCPREQUEST message from the client, the configuration process enters its final phase. The acknowledgement phase involves sending a DHCPACK packet to the client. This packet includes the lease duration and any other configuration information that the client might have requested. At this point, the IP configuration process is completed.field value meaning2 TransactionIDan integer For client to match response3 Client IPaddress 0.0.0.0 Only field if the client isBOUND, REVEW, orREBIND, so it’s all 0.4 Your IPaddress 192.168.1.100 The client is allocated withthe address6 t=53 DHCP type =DHCP request7 t=54 Server’s identifier is 192.168.1.18 t=1 Subnet mask 255.255.255.09 t=3 Router is 192.168.1.110 T=6 Domain name serverThe server’s IP address is in option 54Compare with the example in the lecturecomparefield12 3 4f8fdea2e f8fdea2e f8fdea2e f8fdea2e TransactionID0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 Client IPaddress0.0.0.0 192.168.1.100 0.0.0.0 192.168.1.100 Your IPaddress●DHCP sequenceThe Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities.A Domain Name Service translates queries for domain names (which are meaningful to humans) into IP addresses for the purpose of locating computer services and devices worldwide.Input in the broserThere are 2 DNS messages, the host asks for and the server send back the address of server.1.query1 Frame address3 Port number DNS port: 53 src port: 48376The DNS port is 53 and the port of the host is a random number. 4 DNS ID 4a 36Correlate querieswithresponses.5 Flags 01 00 This is a message that the host send to server, so it is a quire.6 Question section1 The number of availablequestion is 1 (the question is at the end of the message)7 Answer section 0These three ars in answer section. This is a query message, so the three are all 0.8Authority section9 Additional section2.answer1 Frame address2 Destination ipaddress 192.168.1.112 The private IP in the localnetwork that the router allocatedit to the laptop. Which is also thehost.3 Port number src port: 53dst port: 48376 The DNS port is 53 and the port of the host is a random number.4 DNS ID 4a 36 Correlate queries withresponses.5 Flags 81 80 The server can de recursivequery and the message is aresponce.6 Questionsection 1 The number of availablequestion is 1 (the question is atthe end of the message)7 Questionsection 1 The same as the previousmessage sent.8 Answer section 7 There are 7 IPAddress for google server.9 Authoritysection0 No Authority section。

DHCP 报文解析

DHCP 报文解析

‘’各位同学,老师昨天给大家介绍了DHCP 协议的报文格式和DHCP的工作流程。

想必大家对这个协议应该有一个清楚的认识了。

那么今天我们通过数据抓包,再次详细分析下DHCP协议在地址分配过程中协议报文的封装过程。

在正式开始这个过程之前,我们还是有必要对昨天的的内容做一个回忆。

好的,我们先看下DHCP 报文的格式,请看下图:OP:操作码(1=bootrequest ,2=bootreply)Htype: 硬件地址类型(1=10mb ethernet)Hlen: 硬件地址长度(ethernet 为10)Hops:表示当前的DHCP报文经过的DHCP Relay的数目。

该字段由客户端设置为0,每经过一个DHCP Relay时,该字段加1。

此字段的作用是限制DHCP报文所经过的DHCP中继数目。

服务器和客户端之间的DHCP中继不能超过4次,也就是Hops值不能大于4,否则DHCP报文将被丢弃。

Xid: 传输ID,在同服务器的交互中,由客户机所选择Secs: 客户机所使用的地址,在最近一次地址获取/地址更新后所经过的时间Flags:此字段在BOOTP中保留未用,在DHCP中表示标志字段。

只有标志字段的最高位才有意义,其余的位均被置为0。

最左边的字段被解释为广播响应标志位,内容如下所示:0:客户端请求服务器以单播形式发送响应报文1:客户端请求服务器以广播形式发送响应报文Client IP address: 客户机在BOUND,RENEW或REBINDING状态所使用,可以用来回应ARP请求报文Client IP Address :该字段表示客户端的IP地址。

可以是服务器分配给客户端的IP地址或者客户端已有的IP地址。

客户端在初始化状态时没有IP地址,此字段为0.0.0.0。

IP地址0.0.0.0仅在采用DHCP方式的系统启动时允许本主机利用它进行临时的通信,并且永远不是有效目的地址。

Your IP address: 服务器给客户机分配的IP地址。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档