Use RSA instead of DSA by default for the OpenFlow PKI.
[openvswitch] / utilities / dpctl.8
1 .TH dpctl 8 "May 2008" "OpenFlow" "OpenFlow Manual"
2
3 .SH NAME
4 dpctl \- administer OpenFlow datapaths
5
6 .SH SYNOPSIS
7 .B dpctl
8 [\fIoptions\fR] \fIcommand \fR[\fIswitch\fR] [\fIargs\fR&...]
9
10 .SH DESCRIPTION
11 The
12 .B dpctl
13 program is a command line tool for monitoring and administering OpenFlow 
14 datapaths.  It is able to show the current state of a datapath,
15 including features, configuration, and tables entries.  When using the
16 OpenFlow kernel module,
17 .B dpctl
18 is used to add, delete, modify, and monitor datapaths.  
19
20 Most \fBdpctl\fR commands take an argument that specifies the
21 method for connecting to an OpenFlow switch.  The following connection
22 methods are supported:
23
24 .TP
25 \fBnl:\fIdp_idx\fR
26 The local Netlink datapath numbered \fIdp_idx\fR.  This form requires
27 that the local host has the OpenFlow kernel module for Linux loaded.
28
29 .TP
30 \fBssl:\fIhost\fR[\fB:\fIport\fR]
31 The specified SSL \fIport\fR (default: 976) on the given remote
32 \fIhost\fR.  The \fB--private-key\fR, \fB--certificate\fR, and
33 \fB--ca-cert\fR options are mandatory when this form is used.
34
35 .TP
36 \fBtcp:\fIhost\fR[\fB:\fIport\fR]
37 The specified TCP \fIport\fR (default: 975) on the given remote
38 \fIhost\fR.
39
40 .TP
41 \fBunix:\fIfile\fR
42 The Unix domain server socket named \fIfile\fR.
43
44 .SH COMMANDS
45
46 With the \fBdpctl\fR program, datapaths running in the kernel can be 
47 created, deleted, and modified.  A single machine may 
48 host up to 32 datapaths (numbered 0 to 31).  In most situations, 
49 a machine hosts only one datapath.
50
51 A newly created datapath is not associated with any of the
52 host's network devices thus does not process any incoming
53 traffic.  To intercept and process traffic on a given network device, the
54 network device must be explicitly added to a datapath through the
55 \fBaddif\fR command.
56
57 The following commands manage local datapaths.
58
59 .TP
60 \fBadddp nl:\fIdp_idx\fR
61 Creates datapath numbered \fIdp_idx\fR on the local host.  This will 
62 fail if \fIdp_idx\fR is not in the range 0 to 31, or if the datapath 
63 with that number already exists on the host.
64
65 .TP
66 \fBdeldp nl:\fIdp_idx\fR
67 Deletes datapath \fIdp_idx\fR on the local host.  \fIdp_idx\fR must be
68 an existing datapath.  All of a datapath's network devices must be
69 explicitly removed before the datapath can be deleted (see \fBdelif\fR
70 command).
71
72 .TP
73 \fBaddif nl:\fIdp_idx netdev\fR...
74 Adds each \fInetdev\fR to the list of network devices datapath
75 \fIdp_idx\fR monitors, where \fIdp_idx\fR is the ID of an existing
76 datapath, and \fInetdev\fR is the name of one of the host's
77 network devices, e.g. \fBeth0\fR.  Once a network device has been added
78 to a datapath, the datapath has complete ownership of the network device's
79 traffic and the network device appears silent to the rest of the system.
80
81 .TP
82 \fBdelif nl:\fIdp_idx netdev\fR...
83 Removes each \fInetdev\fR from the list of network devices datapath
84 \fIdp_idx\fR monitors.
85
86 .PP
87 The following commands can be apply to OpenFlow switches regardless of
88 the connection method.
89
90 .TP
91 \fBshow \fIswitch\fR
92 Prints to the console information on datapath \fIswitch\fR including
93 information on its flow tables and ports.
94
95 .TP
96 \fBstatus \fIswitch\fR [\fIkey\fR]
97 Prints to the console a series of key-value pairs that report the
98 status of \fIswitch\fR.  If \fIkey\fR is specified, only the key-value
99 pairs whose key names begin with \fIkey\fR are printed.  If \fIkey\fR is
100 omitted, all key-value pairs are printed.
101
102 (In the OpenFlow reference implementation, the \fBstatus\fR command is
103 implemented in \fBsecchan\fR(8), not in the kernel module, so the
104 \fBnl:\fIdp_idx\fR connection method should not be used with this
105 command.  Instead, specify \fB-l\fR or \fB--listen\fR on the
106 \fBsecchan\fR command line and tell \fBdpctl\fR to use the connection
107 method specified there.)
108
109 .TP
110 \fBdump-tables \fIswitch\fR
111 Prints to the console statistics for each of the flow tables used by
112 datapath \fIswitch\fR.
113
114 .TP
115 \fBdump-ports \fIswitch\fR
116 Prints to the console statistics for each of the network devices
117 associated with datapath \fIswitch\fR.
118
119 .TP
120 \fBmod-port \fIswitch\fR \fInetdev\fR \fIaction\fR
121 Modify characteristics of an interface monitored by \fIswitch\fR.  
122 \fInetdev\fR can be referred to by its OpenFlow assigned port number or 
123 the device name, e.g. \fBeth0\fR.  The \fIaction\fR may be any one of the
124 following:
125
126 .RS
127 .IP \fBup\fR
128 Enables the interface.  This is equivalent to ``ifconfig up'' on a Unix
129 system.
130
131 .IP \fBdown\fR
132 Disables the interface.  This is equivalent to ``ifconfig down'' on a Unix
133 system.
134
135 .IP \fBflood\fR
136 When a \fIflood\fR action is specified, traffic will be sent out this
137 interface.  This is the default posture for monitored ports.
138
139 .IP \fBnoflood\fR
140 When a \fIflood\fR action is specified, traffic will not be sent out 
141 this interface.  This is primarily useful to prevent loops when a
142 spanning tree protocol is not in use.
143
144 .RE
145
146 .TP
147 \fBdump-flows \fIswitch \fR[\fIflows\fR]
148 Prints to the console all flow entries in datapath \fIswitch\fR's
149 tables that match \fIflows\fR.  If \fIflows\fR is omitted, all flows
150 in the datapath are retrieved.  See \fBFLOW SYNTAX\fR, below, for the
151 syntax of \fIflows\fR.
152
153 .TP
154 \fBdump-aggregate \fIswitch \fR[\fIflows\fR]
155 Prints to the console aggregate statistics for flows in datapath
156 \fSWITCH\fR's tables that match \fIflows\fR.  If \fIflows\fR is omitted, 
157 the statistics are aggregated across all flows in the datapath's flow
158 tables.  See \fBFLOW SYNTAX\fR, below, for the syntax of \fIflows\fR.
159
160 .TP
161 \fBadd-flow \fIswitch flow\fR
162 Add the flow entry as described by \fIflow\fR to the datapath \fIswitch\fR's 
163 tables.  The flow entry is in the format described in \fBFLOW SYNTAX\fR, 
164 below.
165
166 .TP
167 \fBadd-flows \fIswitch file\fR
168 Add flow entries as described in \fIfile\fR to the datapath \fIswitch\fR's 
169 tables.  Each line in \fIfile\fR is a flow entry in the format
170 described in \fBFLOW SYNTAX\fR, below.
171
172 .TP
173 \fBmod-flows \fIswitch flow\fR
174 Modify the actions in entries from the datapath \fIswitch\fR's tables 
175 that match \fIflow\fR.  See \fBFLOW SYNTAX\fR, below, for the syntax 
176 of \fIflows\fR.
177
178 .TP
179 \fBdel-flows \fIswitch \fR[\fIflow\fR]
180 Deletes entries from the datapath \fIswitch\fR's tables that match
181 \fIflow\fR.  If \fIflow\fR is omitted, all flows in the datapath's
182 tables are removed.  See \fBFLOW SYNTAX\fR, below, for the syntax of
183 \fIflows\fR.
184
185 .TP
186 \fBmonitor \fIswitch\fR
187 Connects to \fIswitch\fR and prints to the console all OpenFlow
188 messages received.  Usually, \fIswitch\fR should specify a connection
189 named on \fBsecchan\fR(8)'s \fB-m\fR or \fB--monitor\fR command line
190 option, in which the messages printed will be all those sent or
191 received by \fBsecchan\fR to or from the kernel datapath module.  A
192 \fIswitch\fR of the form \fBnl:\fIdp_idx\fR will print all
193 asynchronously generated OpenFlow messages (such as packet-in
194 messages), but it will not print any messages sent to the kernel by
195 \fBsecchan\fR and other processes, nor will it print replies sent by
196 the kernel in response to those messages.
197
198 .PP
199 The following commands can be used regardless of the connection
200 method.  They apply to OpenFlow switches and controllers.
201
202 .TP
203 \fBprobe \fIvconn\fR
204 Connects to \fIvconn\fR and sends a single OpenFlow echo-request
205 packet and waits for the response.  With the \fB-t\fR or
206 \fB--timeout\fR option, this command can test whether an OpenFlow
207 switch or controller is up and running.
208
209 .TP
210 \fBping \fIvconn \fR[\fIn\fR]
211 Sends a series of 10 echo request packets to \fIvconn\fR and times
212 each reply.  The echo request packets consist of an OpenFlow header
213 plus \fIn\fR bytes (default: 64) of randomly generated payload.  This
214 measures the latency of individual requests.
215
216 .TP
217 \fBbenchmark \fIvconn n count\fR
218 Sends \fIcount\fR echo request packets that each consist of an
219 OpenFlow header plus \fIn\fR bytes of payload and waits for each
220 response.  Reports the total time required.  This is a measure of the
221 maximum bandwidth to \fIvconn\fR for round-trips of \fIn\fR-byte
222 messages.
223
224 .SH "FLOW SYNTAX"
225
226 Some \fBdpctl\fR commands accept an argument that describes a flow or
227 flows.  Such flow descriptions comprise a series
228 \fIfield\fB=\fIvalue\fR assignments, separated by commas or white
229 space.
230
231 The following field assignments describe how a flow matches a packet.
232 If any of these assignments is omitted from the flow syntax, the field
233 is treated as a wildcard; thus, if all of them are omitted, the
234 resulting flow matches all packets.  The string \fB*\fR or \fBANY\fR
235 may be specified a value to explicitly mark any of these fields as a
236 wildcard.
237
238 .IP \fBin_port=\fIport_no\fR
239 Matches physical port \fIport_no\fR.  Switch ports are numbered as
240 displayed by \fBdpctl show\fR.
241
242 .IP \fBdl_vlan=\fIvlan\fR
243 Matches IEEE 802.1q virtual LAN tag \fIvlan\fR.  Specify \fB0xffff\fR
244 as \fIvlan\fR to match packets that are not tagged with a virtual LAN;
245 otherwise, specify a number between 0 and 4095, inclusive, as the
246 12-bit VLAN ID to match.
247
248 .IP \fBdl_src=\fImac\fR
249 Matches Ethernet source address \fImac\fR, which should be specified
250 as 6 pairs of hexadecimal digits delimited by colons,
251 e.g. \fB00:0A:E4:25:6B:B0\fR.
252
253 .IP \fBdl_dst=\fImac\fR
254 Matches Ethernet destination address \fImac\fR.
255
256 .IP \fBdl_type=\fIethertype\fR
257 Matches Ethernet protocol type \fIethertype\fR, which should be
258 specified as a integer between 0 and 65535, inclusive, either in
259 decimal or as a hexadecimal number prefixed by \fB0x\fR,
260 e.g. \fB0x0806\fR to match ARP packets.
261
262 .IP \fBnw_src=\fIip\fR[\fB/\fInetmask\fR]
263 Matches IPv4 source address \fIip\fR, which should be specified as an
264 IP address or host name, e.g. \fB192.168.1.1\fR or
265 \fBwww.example.com\fR.  The optional \fInetmask\fR allows matching
266 only on an IPv4 address prefix.  It may be specified as a dotted quad
267 (e.g. \fB192.168.1.0/255.255.255.0\fR) or as a count of bits
268 (e.g. \fB192.168.1.0/24\fR).
269
270 .IP \fBnw_dst=\fIip\fR[\fB/\fInetmask\fR]
271 Matches IPv4 destination address \fIip\fR.
272
273 .IP \fBnw_proto=\fIproto\fR
274 Matches IP protocol type \fIproto\fR, which should be specified as a
275 decimal number between 0 and 255, inclusive, e.g. 6 to match TCP
276 packets.
277
278 .IP \fBtp_src=\fIport\fR
279 Matches UDP or TCP source port \fIport\fR, which should be specified
280 as a decimal number between 0 and 65535, inclusive, e.g. 80 to match
281 packets originating from a HTTP server.
282
283 .IP \fBtp_dst=\fIport\fR
284 Matches UDP or TCP destination port \fIport\fR.
285
286 .PP
287 The following shorthand notations are also available:
288
289 .IP \fBip\fR
290 Same as \fBdl_type=0x0800\fR.
291
292 .IP \fBicmp\fR
293 Same as \fBdl_type=0x0800,nw_proto=1\fR.
294
295 .IP \fBtcp\fR
296 Same as \fBdl_type=0x0800,nw_proto=6\fR.
297
298 .IP \fBudp\fR
299 Same as \fBdl_type=0x0800,nw_proto=17\fR.
300
301 .IP \fBarp\fR
302 Same as \fBdl_type=0x0806\fR.
303
304 .PP
305 The \fBadd-flow\fR and \fBadd-flows\fR commands require an additional field:
306
307 .IP \fIactions\fB=\fItarget\fR[\fB,\fItarget\fR...]\fR
308 Specifies a comma-separated list of actions to take on a packet when the 
309 flow entry matches.  The \fItarget\fR may be a decimal port number 
310 designating the physical port on which to output the packet, or one of 
311 the following keywords:
312
313 .RS
314 .IP \fBoutput\fR:\fIport\fR
315 Outputs the packet on the port specified by \fIport\fR.
316
317 .IP \fBnormal\fR
318 Subjects the packet to the device's normal L2/L3 processing.  (This
319 action is not implemented by all OpenFlow switches.)
320
321 .IP \fBflood\fR
322 Outputs the packet on all switch physical ports other than the port on
323 which it was received and any ports on which flooding is disabled
324 (typically, these would be ports disabled by the IEEE 802.1D spanning
325 tree protocol).
326
327 .IP \fBall\fR
328 Outputs the packet on all switch physical ports other than the port on
329 which it was received.
330
331 .IP \fBcontroller\fR:\fImax_len\fR
332 Sends the packet to the OpenFlow controller as a ``packet in''
333 message.  If \fImax_len\fR is a number, then it specifies the maximum
334 number of bytes that should be sent.  If \fImax_len\fR is \fBALL\fR or
335 omitted, then the entire packet is sent.
336
337 .IP \fBlocal\fR
338 Outputs the packet on the ``local port,'' which corresponds to the
339 \fBof\fIn\fR network device (see \fBCONTACTING THE CONTROLLER\fR in
340 \fBsecchan\fR(8) for information on the \fBof\fIn\fR network device).
341
342 .IP \fBmod_vlan\fR:\fIvlan_id\fR
343 Modifies the VLAN tag on a packet.  If \fIvlan_id\fR is a number, then 
344 the VLAN tag is added or modified as necessary to match the value 
345 specified.  If \fIvlan_id\fR is \fBSTRIP\fR, then the VLAN tag is 
346 stripped from the packet if one is present.  (This action is not 
347 implemented by all OpenFlow switches.)
348 .RE
349
350 .IP
351 (The OpenFlow protocol supports other actions that \fBdpctl\fR does
352 not yet expose to the user.)
353
354 .PP
355 The \fBadd-flow\fR, \fBadd-flows\fR, and \fBdel-flows\fR commands
356 support an additional optional field:
357
358 .IP \fBpriority=\fIvalue\fR
359 Sets the priority of the flow to be added or deleted to \fIvalue\fR,
360 which should be a number between 0 and 65535, inclusive.  If this
361 field is not specified, it defaults to 32768.
362
363 .PP
364 The \fBadd-flow\fR and \fBadd-flows\fR commands support additional
365 optional fields:
366
367 .TP
368 \fBidle_timeout=\fIseconds\fR
369 Causes the flow to expire after the given number of seconds of
370 inactivity.  A value of 0 prevents a flow from expiring due to
371 inactivity.  The default is 60 seconds.
372
373 .IP \fBhard_timeout=\fIseconds\fR
374 Causes the flow to expire after the given number of seconds,
375 regardless of activity.  A value of 0 (the default) gives the flow no
376 hard expiration deadline.
377
378 .PP
379 The \fBdump-flows\fR and \fBdump-aggregate\fR commands support an
380 additional optional field:
381
382 .IP \fBtable=\fInumber\fR
383 If specified, limits the flows about which statistics are gathered to
384 those in the table with the given \fInumber\fR.  Tables are numbered
385 as shown by the \fBdump-tables\fR command.
386
387 If this field is not specified, or if \fInumber\fR is given as
388 \fB255\fR, statistics are gathered about flows from all tables.
389
390 .SH OPTIONS
391 .TP
392 \fB-t\fR, \fB--timeout=\fIsecs\fR
393 Limits \fBdpctl\fR runtime to approximately \fIsecs\fR seconds.  If
394 the timeout expires, \fBdpctl\fR will exit with a \fBSIGALRM\fR
395 signal.
396
397 .TP
398 \fB-p\fR, \fB--private-key=\fIprivkey.pem\fR
399 Specifies a PEM file containing the private key used as the
400 identity for SSL connections to a switch.
401
402 .TP
403 \fB-c\fR, \fB--certificate=\fIcert.pem\fR
404 Specifies a PEM file containing a certificate, signed by the
405 controller's certificate authority (CA), that certifies the
406 private key to identify a trustworthy controller.
407
408 .TP
409 \fB-C\fR, \fB--ca-cert=\fIcacert.pem\fR
410 Specifies a PEM file containing the CA certificate used to verify that
411 a switch is trustworthy.
412
413 .TP
414 .BR \-h ", " \-\^\-help
415 Prints a brief help message to the console.
416
417 .TP
418 \fB-v\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]], \fB--verbose=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]
419 Sets the logging level for \fImodule\fR in \fIfacility\fR to
420 \fIlevel\fR.  The \fImodule\fR may be any valid module name (as
421 displayed by the \fB--list\fR action on \fBvlogconf\fR(8)), or the
422 special name \fBANY\fR to set the logging levels for all modules.  The
423 \fIfacility\fR may be \fBsyslog\fR or \fBconsole\fR to set the levels
424 for logging to the system log or to the console, respectively, or
425 \fBANY\fR to set the logging levels for both facilities.  If it is
426 omitted, \fIfacility\fR defaults to \fBANY\fR.  The \fIlevel\fR must
427 be one of \fBemer\fR, \fBerr\fR, \fBwarn\fR, or \fBdbg\fR, designating
428 the minimum severity of a message for it to be logged.  If it is
429 omitted, \fIlevel\fR defaults to \fBdbg\fR.
430
431 .TP
432 \fB-v\fR, \fB--verbose\fR
433 Sets the maximum logging verbosity level, equivalent to
434 \fB--verbose=ANY:ANY:dbg\fR.
435
436 .TP
437 .BR \-V ", " \-\^\-version
438 Prints version information to the console.
439
440 .SH EXAMPLES
441
442 A typical dpctl command sequence for controlling an OpenFlow kernel module:
443 .nf
444 .TP
445 Create datapath numbered 0:
446
447 .B % dpctl adddp nl:0
448
449 .TP
450 Add two network devices to the new datapath:
451
452 .B % dpctl addif nl:0 eth0
453 .B % dpctl addif nl:0 eth1
454
455 .TP
456 Monitor traffic received by the datapath (exit with control-C):
457
458 .B % dpctl monitor nl:0
459
460
461 .TP
462 View the datapath's table stats after some traffic has passed through:
463
464 .B % dpctl dump-tables nl:0
465
466 .TP
467 View the flow entries in the datapath:
468
469 .B % dpctl dump-flows nl:0 
470
471 .TP
472 Remove network devices from the datapath when finished:
473
474 .B % dpctl delif nl:0 eth0
475 .B % dpctl delif nl:0 eth1
476
477 .TP
478 Delete the datapath:
479
480 .B % dpctl deldp nl:0
481 .fi
482 .SH "SEE ALSO"
483
484 .BR secchan (8),
485 .BR switch (8),
486 .BR controller (8),
487 .BR vlogconf (8)