通过tcpdump抓包DHCP分析
1. 通过linux命令抓包tcpdump -i lan -v -p udp port 67 and port 68
完整抓包过程先发送广播包:
DHCP客户端 -》 DHCP服务器
11:50:42.848908 IP (tos 0x10, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 313)
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from d0:b6:0a:b0:00:54 (oui Unknown), length 285, xid 0x67458b6b, secs 65535, Flags [none]
Client-Ethernet-Address d0:b6:0a:b0:00:54 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Parameter-Request Option 55, length 1:
Domain-Name-Server
Hostname Option 12, length 14: "MYTESTTESTTEST"
Vendor-Class Option 60, length 11: "DHCP 3.0.10"
Client-ID Option 61, length 7: ether d0:b6:0a:b0:00:54
11:50:43.350971 IP (tos 0xc0, ttl 64, id 56370, offset 0, flags [none], proto UDP (17), length 328)
OpenWrt.lan.bootps > MYTESTTESTTEST.lan.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x67458b6b, secs 65535, Flags [none]
Your-IP MYTESTTESTTEST.lan
Server-IP OpenWrt.lan
Client-Ethernet-Address d0:b6:0a:b0:00:54 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Offer
Server-ID Option 54, length 4: OpenWrt.lan
Lease-Time Option 51, length 4: 7200
RN Option 58, length 4: 3600
RB Option 59, length 4: 6300
Subnet-Mask Option 1, length 4: 255.255.255.0
BR Option 28, length 4: 192.168.11.255
Domain-Name-Server Option 6, length 4: OpenWrt.lan
11:50:43.352837 IP (tos 0x10, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 342)
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from d0:b6:0a:b0:00:54 (oui Unknown), length 314, xid 0xc6237b32, secs 65535, Flags [none]
Client-Ethernet-Address d0:b6:0a:b0:00:54 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Request
MSZ Option 57, length 2: 1456
Requested-IP Option 50, length 4: TEST.lan
Server-ID Option 54, length 4: OpenWrt.lan
Parameter-Request Option 55, length 14:
RN, RB, Subnet-Mask, BR
Classless-Static-Route, Static-Route, Default-Gateway, Hostname
Option 119, Domain-Name, Domain-Name-Server, YD
YS, NTP
Hostname Option 12, length 14: "MYTESTTESTTEST"
Vendor-Class Option 60, length 11: "DHCP 3.0.10"
Client-ID Option 61, length 7: ether d0:b6:0a:b0:00:54
11:50:43.353988 IP (tos 0xc0, ttl 64, id 56371, offset 0, flags [none], proto UDP (17), length 341)
OpenWrt.lan.bootps > MYTESTTESTTEST.lan.bootpc: BOOTP/DHCP, Reply, length 313, xid 0xc6237b32, secs 65535, Flags [none]
Your-IP MYTESTTESTTEST.lan
Server-IP OpenWrt.lan
Client-Ethernet-Address d0:b6:0a:b0:00:54 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Server-ID Option 54, length 4: OpenWrt.lan
Lease-Time Option 51, length 4: 7200
RN Option 58, length 4: 3600
RB Option 59, length 4: 6300
Subnet-Mask Option 1, length 4: 255.255.255.0
BR Option 28, length 4: 192.168.11.255
Default-Gateway Option 3, length 4: OpenWrt.lan
Domain-Name-Server Option 6, length 4: OpenWrt.lan
Domain-Name Option 15, length 3: "lan"
Hostname Option 12, length 14: "MYTESTTESTTEST"