forked from ragnarlonn/dhcptool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdhcptool.1
347 lines (347 loc) · 7.74 KB
/
dhcptool.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
.\" Copyright (C) 2006 Ragnar Lonn
.\" This file is part of the dhcptool package
.\" Author: Ragnar Lonn <dhcptool@gatorhole.com>
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the license agreement specified in the file
.\" LICENSE, that should have been included in this software package.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" LICENSE file for more details.
.\"
.TH dhcptool 1 "June 2006" "dhcptool 0.8b"
.SH NAME
dhcptool - generate and transmit custom DHCP/BOOTP packets
.SH SYNOPSIS
.B dhcptool
.BR \-w " DHCP-option"
.br
.B dhcptool
.BI \-i " interface"
[
.BI \-o " operation"
]
[
.BI \-S " siaddr"
]
[
.BI \-O " DHCP-opnum=opval[:opval]"
]
[
.BI \-X " DHCP-opnum=opval"
]
[
.BI \-c " ciaddr"
]
[
.BI \-s " secs"
]
[
.BI \-h " chaddr"
]
[
.BI \-x " xid"
]
[
.BI \-f " BOOTP flags"
]
[
.BI \-y " yiaddr"
]
[
.BI \-g " giaddr"
]
[
.BI \-A " servername"
]
[
.BI \-B " filename"
]
[
.BI \-v " verbosity"
]
[
.BI \-t " read-timeout"
]
[
.BI \-F " source-ip"
]
[
.BI \-T " dest-ip"
]
[
.BI \-L " TTL"
]
[
.BI \-Q " tos"
]
[
.BI \-E " dest_mac"
]
[
.BI \-n " reply_cnt"
]
[
.BR \-m
]
.br
.LP
.SH DESCRIPTION
.B dhcptool
generates and transmits customized DHCP/BOOTP packets. Optionally,
it also waits for a server response, dumping (response) packet
content to stdout. A decent understanding of the DHCP/BOOTP protocol
is probably necessary in order to be able to use this tool effectively.
.B dhcptool
will make very few attempts to enforce standards as it is intended to
be used for emulating all kinds of broken DHCP clients. Given the right
options it can of course perform perfectly valid DHCP transactions also.
.SH OPTIONS
.TP
.BI \-i " interface"
Specify a network interface to use.
.TP
.TP
.BI \-o " operation"
DHCP message type (default: "request"). Should be one of "discover",
"request", "release", "decline" or "inform". Default is "request".
.TP
.BI \-S " siaddr"
Server IP address BOOTP field. Should be used in a request,
release, decline or inform message. Default value is 0.0.0.0.
.TP
.BI \-O " DHCP-opnum=opval[:opval]"
Specify a DHCP option. Options are specified as "opnum=opval". E.g.
to specify DHCP server ID (DHCP option 54) "-O 54=192.168.0.1"
might be used. The option value is interpreted differently depending
on what DHCP option is being set. In the case with DHCP option 54
in the example above, dhcptool will try to interpret the option
value as an IP address in string format. Multiple option values
can be specified as "opnum=opval1:opval2:opval3...". I.e.
"-O 54=192.168.0.1:192.168.0.2" to specify two DHCP Server Id
values. See also the -X option, described below.
.TP
.BI \-X " DHCP-opnum=opval"
Specify a DHCP option, using a hex string as option value. E.g.
to specify DHCP server ID (DHCP option 54), and providing IP
address 192.168.0.1 as option value, one would use "-X 54=0100a8c0".
The bytes are reversed to be in network byte order. Every byte is
represented by two hex characters. The -X option will allow you to
specify any data to use as option value for an option, regardless of
whether it fits the option type or not. For instance, DHCP option
52 ("Overload" option) has a boolean type that is represented by
a single byte which should be 1 or 0. Still, you could craft a
DHCP packet that set option 52 to have an option value that was
many bytes in length by doing e.g. "-X 52=00000000" (this
option 52 would have its option length set to 4 and the option
value would be 4 bytes, all zeroed).
.TP
.BI \-c " ciaddr"
Client IP address BOOTP field. Default value is the IP address
configured on the network interface chosen with the -i option.
.TP
.BI \-s " secs"
"Seconds since client acquisition process began" BOOTP field.
Default value is 0.
.TP
.BI \-h " chaddr"
Client hardware address, chaddr, BOOTP field. Default is the
MAC address of the interface specified with -i.
.TP
.BI \-x " xid"
Transaction ID BOOTP field. Default is a random number.
.TP
.BI \-f " flags"
Flags BOOTP field. Default is 0x8000 (broadcast bit set).
.TP
.BI \-y " yip"
Your (client) IP address BOOTP field. Default is 0.0.0.0.
.TP
.BI \-g " gip"
Gateway/relay agent IP address BOOTP field. Default is 0.0.0.0.
.TP
.BI \-A " servername"
Server name string BOOTP field. Default is none.
.TP
.BI \-B " filename"
Client boot file path BOOTP field. Default is none.
.TP
.BI \-v " verbosity"
Verbosity level of dhcptool. 0 = silent. 1 = normal/default
2 = chatty, 3 = debug.
.TP
.BI \-t " timeout"
Tells
.B dhcptool
to wait
.IR timeout
seconds for any incoming DHCP/BOOTP replies. Default is 0 unless
"operation" (set using the -o option) is "discover", "request" or
"inform", in which case the default value for
.IR timeout
is 5.
.TP
.BI \-F " source_ip"
"From-address". IPv4 source address to use in outgoing IP packets.
Default is the IP address configured on the chosen network interface.
.TP
.BI \-T " dest_ip"
"To-address". IPv4 destination address to use in outgoing
IP packets. Default is 255.255.255.255.
.TP
.BI \-L " ttl"
Time-To-Live value to use in outgoing IP packets. Default
is 64.
.TP
.BI \-Q " tos"
Value to use in IPv4 "tos" field (Type Of Service). Default
is 0.
.TP
.BI \-E " dest_mac"
Destination MAC address to use in outgoing ethernet packets.
Default is ff:ff:ff:ff:ff:ff.
.TP
.BI \-n " reply_cnt"
Maximum number of replies to wait for before exiting. Default
is 0 (unlimited). This parameter takes precedence over the
.I timeout
parameter.
.TP
.BI \-m
Allow multiple definitions of DHCP options. I.e. option 53
(DHCP message type) can be specified more than once, for those
who really want to violate standard. The default behaviour of
.B dhcptool
is otherwise to complain when an option is specified more
than once.
.TP
.BI \-w " DHCP-option"
"Whatis". Lookup the specified DHCP option number and give
a short description of it and its option value data type.
Example:
.RS
.PP
# dhcptool -w 54
.br
[DHCP Option 54]
.br
Description: DHCP Server Id
.br
Option data type: 32-bit IPv4 address(es), network byte order
.RE
.PP
.SH EXAMPLES
.br
Broadcasting a DHCP DISCOVER request through interface em0, asking
for parameters 1 (subnet mask), 3 (router), 6 (domain name server)
and using transaction ID 12345:
.RS
.PP
# dhcptool -i em0 -o discover -x 12345 -O 55=1:3:6
.br
DHCP REPLY
.br
xid: 12345
.br
secs: 0
.br
flags: 32768
.br
cip: 0.0.0.0
.br
yip: 10.103.128.97
.br
sip: 0.0.0.0
.br
gip: 0.0.0.0
.br
chaddr: 00 03 ba 96 7c e8
.br
Option 053: 2
.br
Option 001: 255.255.254.0
.br
Option 003: 10.103.128.1
.br
Option 028: 10.103.129.255
.br
Option 054: 10.103.128.1
.br
Option 006: 10.64.1.253
.br
Option 051: 120
.br
Option 058: 60
.br
Option 059: 105
.br
Option 255:
.RE
.PP
Asking server 10.103.128.1 to give us IP address 10.103.128.97 (DHCP option
50), using the same transaction ID as in the above DISCOVER message:
.RS
.PP
# dhcptool -i em0 -o request -x 12345 -S 10.103.128.1 -O 50=10.103.128.97 -O 55=1:3:6
.br
DHCP REPLY
.br
xid: 12345
.br
secs: 0
.br
flags: 32768
.br
cip: 0.0.0.0
.br
yip: 10.103.128.97
.br
sip: 10.103.128.1
.br
gip: 0.0.0.0
.br
chaddr: 00 03 ba 96 7c e8
.br
Option 053: 2
.br
Option 001: 255.255.254.0
.br
Option 003: 10.103.128.1
.br
Option 028: 10.103.129.255
.br
Option 054: 10.103.128.1
.br
Option 006: 10.64.1.253
.br
Option 051: 120
.br
Option 058: 60
.br
Option 059: 105
.br
Option 255:
.br
.SH DEPENDENCIES
.br
.B
dhcptool
is dependent on
.BR pcap (3)
- http://www.tcpdump.org/ and
.BR libnet
- http://www.packetfactory.net/Projects/Libnet/
.br
.SH BUGS
.br
Undoubtedly.
.br
.SH "SEE ALSO"
.BR dhcpdump (1),
.BR dhcp-options (5),
.BR dhclient (8)
.LP
.SH AUTHOR
Ragnar Lonn <dhcptool@gatorhole.com>.