找回密码
 注册
查看: 4546|回复: 0

dhcp抓包分析

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2017-9-19 19:09:20 | 显示全部楼层 |阅读模式
在axm上dump包,然后重启k2a(192.168.253.12),可以dump到dhcp(bootp)的包1 j  J: a3 {3 U2 N9 l, ?  S) c
7 S$ D  T$ d4 w" C  O
toor@server:~# tcpdump -i k2a -ne   ##k2a是server端上连接client的接口6 P$ l2 G$ C% }+ X+ q- v
tcpdump: WARNING: k2a: no IPv4 address assigned7 S$ L& Z9 {3 x. Z$ I6 ~9 \
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode+ o- h. p3 ?7 n3 `( |
listening on k2a, link-type EN10MB (Ethernet), capture size 65535 bytes+ h& R8 ~! U+ \& Q
04:25:16.517103 b4:99:4c:b8:6f:69(clinet MAC) > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342:0.0.0.0.68 >255.255.255.255.67: BOOTP/DHCP, Request from b4:99:4c:b8:6f:69, length300 ##(见tcp/ip详解卷1,第16章). 68是client用端口,67是server用端口. client事先没有IP,所以client的bootp包中设置源ip是0.0.0.0
- K0 n! W7 \( q6 N8 q04:25:16.517349 02:40:43:77:07:01(server MAC) > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 342: 192.168.253.9.67 >192.168.253.12.68: BOOTP/DHCP, Reply, length 300 ## server端给client分配了IP为192.168.253.12,并reply给client端
  {/ \) A+ ^: F9 m6 y) g, d04:25:16.517613 b4:99:4c:b8:6f:69(client MAC) > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 64: Request who-has 192.168.253.9 tell 192.168.253.12, length 50  ##client要发送arp包得到server端MAC地址
  M$ O7 B* `! f% Y$ t8 R04:25:16.517641 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype ARP (0x0806), length 42: Reply 192.168.253.9 is-at 02:40:43:77:07:01, length 28
0 W4 E) A# ~) h" ]1 C04:25:16.517751 b4:99:4c:b8:6f:69(client MAC) > 02:40:43:77:07:01(server MAC), ethertype IPv4 (0x0800), length 65: 192.168.253.12.1234 > 192.168.253.9.69:  23 RRQ "u-boot-eth.bin" octet ##client端发送TFTP请求从server段读取client所需的引导文件(下面block 1~355)7 Y! t4 R  e( w$ V- V* t
04:25:16.645200 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 558: 192.168.253.9.69 > 192.168.253.12.1234:  516 DATA block 1
, ~& L0 J. O  w* U/ Z1 T04:25:16.645429 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 64: 192.168.253.12.1234 > 192.168.253.9.69:  4 ACK block 10 h+ Y% [8 X3 d
04:25:16.650059 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 558: 192.168.253.9.69 > 192.168.253.12.1234:  516 DATA block 26 Z0 G+ z! P! |
04:25:16.650281 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 64: 192.168.253.12.1234 > 192.168.253.9.69:  4 ACK block 2
8 l5 a: A& K" x3 `! f- ]; p04:25:16.653322 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 558: 192.168.253.9.69 > 192.168.253.12.1234:  516 DATA block 3, m  e: p, k& J- F; \) v% J( k3 \) U) J
04:25:16.653543 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 64: 192.168.253.12.1234 > 192.168.253.9.69:  4 ACK block 3
5 s* J# n# x# m) `# G+ m4 h... ...  K6 ?# D, n* z5 q  Q; v  s# q" k
09:46:29.947034 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 558: 192.168.253.9.69 > 192.168.253.12.1234:  516 DATA block 352
4 S- g( K+ W0 y- A# U$ Y8 Y( x09:46:29.947241 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 64: 192.168.253.12.1234 > 192.168.253.9.69:  4 ACK block 352
8 o% f; h# y$ K! M1 h" T09:46:29.947297 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 558: 192.168.253.9.69 > 192.168.253.12.1234:  516 DATA block 353" J! [2 G0 W$ V$ x, S. _, h. P
09:46:29.947504 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 64: 192.168.253.12.1234 > 192.168.253.9.69:  4 ACK block 353  B6 ~4 {1 S/ I8 k" o! P
09:46:29.947552 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 558: 192.168.253.9.69 > 192.168.253.12.1234:  516 DATA block 3541 N/ J! e  z! u+ s
09:46:29.947759 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 64: 192.168.253.12.1234 > 192.168.253.9.69:  4 ACK block 354
2 ^- ], R5 U' \0 V4 m09:46:29.947825 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 277: 192.168.253.9.69 > 192.168.253.12.1234:  235 DATA block 355
/ \! i: ~5 q; @3 t; t09:46:29.947997 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 64: 192.168.253.12.1234 > 192.168.253.9.69:  4 ACK block 355
' x9 i2 g( _2 s3 u* H$ h09:46:34.647872 b4:99:4c:b8:6f:69 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 303: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from b4:99:4c:b8:6f:69, length 261
3 P* v8 x- \7 D1 S09:46:34.648098 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 342: 192.168.253.9.67 > 192.168.253.12.68: BOOTP/DHCP, Reply, length 3007 ^- R) e( h' |
09:46:34.648213 b4:99:4c:b8:6f:69 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 315: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from b4:99:4c:b8:6f:69, length 273" }$ Z9 F) ^* n
09:46:34.649072 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 342: 192.168.253.9.67 > 192.168.253.12.68: BOOTP/DHCP, Reply, length 300
# l+ {6 t7 I2 A5 U( R# O& Y4 @09:46:34.947189 b4:99:4c:b8:6f:69 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 192.168.253.9 tell 192.168.253.12, length 46! i0 m; F1 V! H2 V8 h
09:46:34.947215 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype ARP (0x0806), length 42: Reply 192.168.253.9 is-at 02:40:43:77:07:01, length 28
; i+ i. b; h+ }09:46:34.947360 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 98: 192.168.253.12.1000 > 192.168.253.9.111: UDP, length 56  H2 B3 y2 z2 J) r. Y- V; J/ Q
09:46:34.947512 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 70: 192.168.253.9.111 > 192.168.253.12.1000: UDP, length 282 T$ Q7 P0 z; b2 U# K! d# A
09:46:34.947616 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 98: 192.168.253.12.1000 > 192.168.253.9.111: UDP, length 56
/ W! Y! H$ T7 M09:46:34.947710 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 70: 192.168.253.9.111 > 192.168.253.12.1000: UDP, length 28. G+ Z* E1 U) [/ j
09:46:34.947829 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 122: 192.168.253.12.1000 > 192.168.253.9.48232: UDP, length 80) U, v* M& Z) T" ~3 S
09:46:34.949267 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 102: 192.168.253.9.48232 > 192.168.253.12.1000: UDP, length 60
  ?" P( e5 D, s# b" ^: K! V09:46:34.949408 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 150: 192.168.253.12.4 > 192.168.253.9.2049: 108 lookup fh Unknown/0100010101000000C30000000000000000000000000000000000000000000000 "skern.bin"
/ E6 B$ u  L5 `, e% J# n4 G6 n09:46:34.949711 02:40:43:77:07:01 > b4:99:4c:b8:6f:69, ethertype IPv4 (0x0800), length 170: 192.168.253.9.2049 > 192.168.253.12.4: reply ok 128 lookup fh Unknown/0100010101000000B20800000000000000000000000000000000000000000000. R8 J7 ?2 G! e
09:46:34.949835 b4:99:4c:b8:6f:69 > 02:40:43:77:07:01, ethertype IPv4 (0x0800), length 146: 192.168.253.12.5 > 192.168.253.9.2049: 104 read fh Unknown/0100010101000000B20800000000000000000000000000000000000000000000 1024 bytes @ 02 i4 {- f$ N0 z- y& j) y9 p3 M
( e3 y$ `9 u0 _, ]
server端dhcp配置文件:
- ]) c7 t$ i( M7 `$ ]/etc/dhcp/dhcpd.conf:9 p6 U: W; }# j: b2 D
one-lease-per-client on;          # 每一个客户机对应一个租约信息0 X8 k, ?5 Q" g2 M# b+ U: p
subnet 192.168.253.8 netmask 255.255.255.248 {6 O+ c& C! {% ?7 D: W
    range dynamic-bootp 192.168.253.10 192.168.253.14;
- i7 C6 h+ x  k   next-server 192.168.253.9;#设定存放初始启动文档的主机地址,The next-server statement is used to specify the host address of the server from which the initial boot file (specified in the filename statement) is to be loaded. Server-name should be a numeric IP address or a domain name. If no next-server statement applies to a given client, the address 0.0.0.0 is used." G) V3 P3 f% s" `
    option subnet-mask 255.255.255.248;9 b/ b- g, p7 X  Y/ s: H* S  s! _
    filename "u-boot-eth.bin";   ##下载启动文档的文件名,这个filename语句可以用来指定客户端启动要载入的初始启动文件,这个文件名应该是客户端能够识别的任何文件传送协议,可以用来传送那个文件。* M! j: T# D8 G
    option root-path "/squash/ks";
2 h! q$ N3 b4 {  O    default-lease-time -1;         #无限租约时间
& U7 J8 e0 d- _; f    max-lease-time -1;             #无限租约时间
% f# h' m/ B, W  w# r  }
* c- s6 r; e0 {0 c$ u! ~. D
: J: W% H2 c$ F: X. X. lThe next-server directive is used to specify the IP address of the TFTP server.4 J+ @/ @+ x1 _, y. K
The filename directive defines the path to /boot/pxeboot. A relative filename is used, meaning that /b/tftpboot is not included in the path.
& c- _; A+ a: I) S7 o6 KThe root-path option defines the path to the NFS root file system.# K. B; P, b. e2 B% _5 _( j

' }! s! n! M( \. k- O. z. L
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-11 23:20 , Processed in 0.016468 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表