|
|
在axm上dump包,然后重启k2a(192.168.253.12),可以dump到dhcp(bootp)的包+ @ f! ^' t- w) Y3 J d
5 H3 i3 e, b) I7 ztoor@server:~# tcpdump -i k2a -ne ##k2a是server端上连接client的接口
! [7 E$ e3 W% k. ^! O/ ]; _1 ?tcpdump: WARNING: k2a: no IPv4 address assigned; {3 v/ b! q! U* ^0 S5 X3 x4 t
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode8 J1 x4 \# R; m0 W6 Y0 y& L
listening on k2a, link-type EN10MB (Ethernet), capture size 65535 bytes+ U, I# \6 E1 c( M& A
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.03 x" A2 j4 n+ r7 A$ x" W
04: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端9 Z* p* P: ?/ z, V
04: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地址
# s; M: x- l8 v1 r1 w04: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
- m( y1 w$ |1 j7 A04: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)
. X4 b/ n% _% h) f1 q }# g$ A04: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
: v# z" ^. r9 z, N& G6 y04: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 1% |7 t$ Y( e% R
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 22 K4 Q) ^: C& k" ~+ Y s% ^3 F" r
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! B* w+ C) [6 B. a. V$ l
04: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 35 f, r E# i9 [+ j% T+ K
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
& e k. d6 K7 c... ...
, j5 Q% Q8 `. h3 ?: O6 B5 n09: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
7 ^/ n4 Y% R; J9 h5 J09: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 3524 R% ~* h% i" [, L; E
09: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+ U$ s5 q) L" h* W! p3 L
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
: C* r+ T! [! m) [+ M ~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 354, k" b% g3 t* x, `0 [) I9 v
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
, H, i# x1 G5 ^0 t09: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
) `2 j' C8 h. y$ B; @7 A09: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 3558 _, X; w6 q5 i
09: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
# [/ ~, Q# c! c4 f09: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 300# M& y2 n& o0 R5 I# i( V1 C! Y
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 t) n Y; @+ `$ c5 t' ]
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; b9 ]$ j( P0 h; N) {5 c; p
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 464 r* M5 u* t# T2 M& n$ p
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+ E( G4 |9 J; B: d+ F' e* A0 h% s
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 567 u0 m5 k2 d( E. g% e
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 28
. N- c% n6 e1 S7 h9 t+ a7 ~. A- Q09: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
3 B1 K. s% O$ |8 g' o5 A09: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
5 u! e+ W5 U/ h2 [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; w2 B+ l$ n! M+ \7 m- E0 J
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
4 T8 w+ ], Z# M7 Y09: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"
7 ^+ x- y" G" I) ]' G& ^7 c% ~& a09: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$ l1 {8 D" A* ^, g) l/ Y u
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 @ 0" M6 m! |( O- a
7 j6 d5 W2 ?% t. n
server端dhcp配置文件:
/ W9 e4 \6 n+ Z' J" s/etc/dhcp/dhcpd.conf:
! [1 U9 B% g ?$ pone-lease-per-client on; # 每一个客户机对应一个租约信息
, v) I1 y3 b# i6 `subnet 192.168.253.8 netmask 255.255.255.248 {
5 j# X# ?( I3 s+ ]) | range dynamic-bootp 192.168.253.10 192.168.253.14;
8 _5 @0 P+ U( O) S1 z& F 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.3 e1 c( B9 G" X( B4 _" q& P7 H
option subnet-mask 255.255.255.248;" ~; p" D' f' U3 y. `4 t
filename "u-boot-eth.bin"; ##下载启动文档的文件名,这个filename语句可以用来指定客户端启动要载入的初始启动文件,这个文件名应该是客户端能够识别的任何文件传送协议,可以用来传送那个文件。1 B$ r I, g/ v$ i) x
option root-path "/squash/ks";, i$ ~+ n+ L4 {$ u; ]" j, [- q
default-lease-time -1; #无限租约时间
' w& H) [; K1 U$ L max-lease-time -1; #无限租约时间3 A2 e- g9 o' }( T5 O, O! I: c
}5 V' u: g8 f' `/ B$ [3 Y; B) s
* p5 |+ p, P; s! ~* MThe next-server directive is used to specify the IP address of the TFTP server.
3 M3 h0 E/ Y1 Y! |5 Y8 H7 ^The filename directive defines the path to /boot/pxeboot. A relative filename is used, meaning that /b/tftpboot is not included in the path.+ ?, h/ t! D! ?' k) D" H) w& B
The root-path option defines the path to the NFS root file system.5 S7 b D, }- a- G o- a) O" P5 ^% n
5 s' N" M, ~/ L8 V
|
|