DHCP release报文16进制 解析

以这张图为例,我们分析一下DHCP这种最基本报文的结构和实现过程

以下是dhcp release报文的16进制分析方法,主要是为了人为的构造报文方便而分析的,请参考,主要是针对一开始比较害怕看那种的16进制的东西。后来看懂了,也就那么一回事。
DHCP release报文16进制 解析_第1张图片
Frame 67: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Cybertan_e6:c2:13 (b0:fc:36:e6:c2:13), Dst: Tp-LinkT_57:4e:9c (9c:21:6a:57:4e:9c)
Destination: Tp-LinkT_57:4e:9c (9c:21:6a:57:4e:9c)
Address: Tp-LinkT_57:4e:9c (9c:21:6a:57:4e:9c)
… …0. … … … … = LG bit: Globally unique address (factory default)
… …0 … … … … = IG bit: Individual address (unicast)
Source: Cybertan_e6:c2:13 (b0:fc:36:e6:c2:13)
Address: Cybertan_e6:c2:13 (b0:fc:36:e6:c2:13)
… …0. … … … … = LG bit: Globally unique address (factory default)
… …0 … … … … = IG bit: Individual address (unicast)
Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 192.168.0.108, Dst: 192.168.0.1
0100 … = Version: 4
… 0101 = Header Length: 20 bytes (5)
Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
0000 00… = Differentiated Services Codepoint: Default (0)
… …00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
Total Length: 328
Identification: 0x6da5 (28069)
Flags: 0x0000
0… … … … = Reserved bit: Not set
.0… … … … = Don’t fragment: Not set
…0. … … … = More fragments: Not set
…0 0000 0000 0000 = Fragment offset: 0
Time to live: 64
Protocol: UDP (17)
Header checksum: 0x8a42 [validation disabled]
[Header checksum status: Unverified]
Source: 192.168.0.108
Destination: 192.168.0.1
User Datagram Protocol, Src Port: 68, Dst Port: 67
Source Port: 68
Destination Port: 67
Length: 308
Checksum: 0xe27f [unverified]
[Checksum Status: Unverified]
[Stream index: 10]
[Timestamps]
[Time since first frame: 0.000000000 seconds]
[Time since previous frame: 0.000000000 seconds]
Dynamic Host Configuration Protocol (Release)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0xd22e0373
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0… … … … = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 192.168.0.108
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: Cybertan_e6:c2:13 (b0:fc:36:e6:c2:13)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Release)
Length: 1
DHCP: Release (7)
Option: (54) DHCP Server Identifier (192.168.0.1)
Length: 4
DHCP Server Identifier: 192.168.0.1
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: Cybertan_e6:c2:13 (b0:fc:36:e6:c2:13)
Option: (255) End
Option End: 255
Padding: 000000000000000000000000000000000000000000000000…

9c216a574e9cb0fc36e6c2130800450001486da5000040118a42c0a8006cc0a80001004400430134e27f01010600d22e037300000000c0a8006c000000000000000000000000b0fc36e6c21300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000638253633501073604c0a800013d0701b0fc36e6c213ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000

9c216a574e9c b0fc36e6c213 0800 Ethernet II
9c216a574e9c Des mac (目的mac地址)
b0fc36e6c213 Src mac (源mac地址)
0800 Type(ipv4 or ipv6)这个是ipv4

4500 0148 6da5 0000 40 11 8a42 c0a8006c c0a80001 IPV4
45 ipv4的4位版本号
00 服务类型
0148 包的长度信息
6da5 identification唯一标识主机发送的每一个数据报
0000 分片信息(分片信息,禁止分片等等)
40 time to live生存时间
11 协议类型(17表示UDP)
8a42 checksum效验和
c0a8006c 源IP
c0a80001 目的IP

0044 0043 0134 e27f UDP
0044 源端口号
0043 目的端口号
0134 UDP报文长度
e27f 效验和

01 01 06 00 d22e0373 0000 0000 c0a8006c 00000000 00000000 00000000 b0fc36e6c213 00000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 63825363 350107 36 04 c0a80001 3d 07 01 b0fc36e6c213 ff 0000000000000000000000000000000000000000000000000000000000000000000000000000000000
DHCP
01 Message type 报文类型,比方说01表示请求request;02表示回应reply
01 Hardware type硬件类型 表示 Ethernet
06 硬件地址长度
00 0表示没有经过代理
d22e0373 Transaction ID表示会话ID
0000 seconds elapsed :传输过程消耗的时间
00 Bootp flags:表示类型,单播
c0a8006c 客户端IP地址
00000000 代理IP地址
00000000 下一个服务器IP地址
00000000 relay agent ip address转发中继代理IP地址
b0fc36e6c213 src mac地址
00000000000000000000 客户端硬件地址填充
63825363 Magic cookie
35 表示option 53
01 表示长度
07 Dhcp type 01 discover; 02 offer; 03 request; 05 ACK; 07 release ; 09 force renew
36 表示 option 54
04 表示长度
c0a80001 dhcp服务器ip地址
3d 表示option61 客户端的mac唯一标识
07 表示长度
01 表示硬件类型
b0fc36e6c213 表示src mac
ff 表示option 255
0000000000000000000000000000000000000000000000000000000000000000000000000000000000 表示填充

你可能感兴趣的:(通信协议)