Merge citrix branch into master.
[sliver-openvswitch.git] / utilities / ovs-ofctl.8.in
1 .TH ovs\-ofctl 8 "June 2009" "Open vSwitch" "Open vSwitch Manual"
2 .ds PN ovs\-ofctl
3
4 .SH NAME
5 ovs\-ofctl \- administer OpenFlow switches
6
7 .SH SYNOPSIS
8 .B ovs\-ofctl
9 [\fIoptions\fR] \fIcommand \fR[\fIswitch\fR] [\fIargs\fR\&...]
10
11 .SH DESCRIPTION
12 The
13 .B ovs\-ofctl
14 program is a command line tool for monitoring and administering
15 OpenFlow switches.  It can also show the current state of an OpenFlow
16 switch, including features, configuration, and table entries.
17
18 .SS "OpenFlow Switch Management Commands"
19
20 These commands allow \fBovs\-ofctl\fR to monitor and administer an OpenFlow
21 switch.  It is able to show the current state of a switch, including
22 features, configuration, and table entries.
23
24 Most of these commands take an argument that specifies the method for
25 connecting to an OpenFlow switch.  The following connection methods
26 are supported:
27
28 .RS
29 .TP
30 \fBssl:\fIhost\fR[\fB:\fIport\fR]
31 The specified SSL \fIport\fR (default: 6633) 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: 6633) 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 .IP "\fIfile\fR"
45 This is short for \fBunix:\fIfile\fR, as long as \fIfile\fR does not
46 contain a colon.
47
48 .IP \fIdp\fR
49 This is short for \fBunix:@RUNDIR@/\fIdp\fB.mgmt\fR, as long as
50 \fIdp\fR does not contain a colon.
51 .RE
52
53 .TP
54 \fBshow \fIswitch\fR
55 Prints to the console information on \fIswitch\fR, including
56 information on its flow tables and ports.
57
58 .TP
59 \fBstatus \fIswitch\fR [\fIkey\fR]
60 Prints to the console a series of key-value pairs that report the
61 status of \fIswitch\fR.  If \fIkey\fR is specified, only the key-value
62 pairs whose key names begin with \fIkey\fR are printed.  If \fIkey\fR is
63 omitted, all key-value pairs are printed.
64
65 .TP
66 \fBdump-tables \fIswitch\fR
67 Prints to the console statistics for each of the flow tables used by
68 \fIswitch\fR.
69
70 .TP
71 \fBdump-ports \fIswitch\fR
72 Prints to the console statistics for each of the network devices
73 associated with \fIswitch\fR.
74
75 .TP
76 \fBmod-port \fIswitch\fR \fInetdev\fR \fIaction\fR
77 Modify characteristics of an interface monitored by \fIswitch\fR.  
78 \fInetdev\fR can be referred to by its OpenFlow assigned port number or 
79 the device name, e.g. \fBeth0\fR.  The \fIaction\fR may be any one of the
80 following:
81
82 .RS
83 .IP \fBup\fR
84 Enables the interface.  This is equivalent to ``ifconfig up'' on a Unix
85 system.
86
87 .IP \fBdown\fR
88 Disables the interface.  This is equivalent to ``ifconfig down'' on a Unix
89 system.
90
91 .IP \fBflood\fR
92 When a \fIflood\fR action is specified, traffic will be sent out this
93 interface.  This is the default posture for monitored ports.
94
95 .IP \fBnoflood\fR
96 When a \fIflood\fR action is specified, traffic will not be sent out 
97 this interface.  This is primarily useful to prevent loops when a
98 spanning tree protocol is not in use.
99
100 .RE
101
102 .TP
103 \fBdump-flows \fIswitch \fR[\fIflows\fR]
104 Prints to the console all flow entries in \fIswitch\fR's
105 tables that match \fIflows\fR.  If \fIflows\fR is omitted, all flows
106 in the switch are retrieved.  See \fBFlow Syntax\fR, below, for the
107 syntax of \fIflows\fR.  The output format is described in 
108 \fBTable Entry Output\fR.
109
110 .TP
111 \fBdump-aggregate \fIswitch \fR[\fIflows\fR]
112 Prints to the console aggregate statistics for flows in 
113 \fIswitch\fR's tables that match \fIflows\fR.  If \fIflows\fR is omitted, 
114 the statistics are aggregated across all flows in the switch's flow
115 tables.  See \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
116 The output format is descrbed in \fBTable Entry Output\fR.
117
118 .TP
119 \fBadd-flow \fIswitch flow\fR
120 Add the flow entry as described by \fIflow\fR to the \fIswitch\fR's 
121 tables.  The flow entry is in the format described in \fBFlow Syntax\fR, 
122 below.
123
124 .TP
125 \fBadd-flows \fIswitch file\fR
126 Add flow entries as described in \fIfile\fR to \fIswitch\fR's 
127 tables.  Each line in \fIfile\fR is a flow entry in the format
128 described in \fBFlow Syntax\fR, below.
129
130 .TP
131 \fBmod-flows \fIswitch flow\fR
132 Modify the actions in entries from the \fIswitch\fR's tables 
133 that match \fIflow\fR.  When invoked with the \fB--strict\fR option,
134 wildcards are not treated as active for matching purposes.  See 
135 \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
136
137 .TP
138 \fBdel-flows \fIswitch \fR[\fIflow\fR]
139 Deletes entries from the \fIswitch\fR's tables that match
140 \fIflow\fR.  When invoked with the \fB--strict\fR option, wildcards are 
141 not treated as active for matching purposes.  If \fIflow\fR is 
142 omitted and the \fB--strict\fR option is not used, all flows in the 
143 switch's tables are removed.  See \fBFlow Syntax\fR, below, for the 
144 syntax of \fIflows\fR.
145
146 .TP
147 \fBmonitor \fIswitch\fR [\fImiss-len\fR [\fIsend-exp]]
148 Connects to \fIswitch\fR and prints to the console all OpenFlow
149 messages received.  Usually, \fIswitch\fR should specify a connection
150 named on \fBovs\-openflowd\fR(8)'s \fB-l\fR or \fB--listen\fR command line
151 option.
152
153 If \fImiss-len\fR is provided, \fBovs\-ofctl\fR sends an OpenFlow ``set
154 configuration'' message at connection setup time that requests
155 \fImiss-len\fR bytes of each packet that misses the flow table.  The
156 OpenFlow reference implementation does not send these messages to the
157 \fBovs\-ofctl monitor\fR client connection unless a nonzero value is
158 specified on this argument.
159
160 If \fIsend-exp\fR is specified as \fB1\fR, \fBovs\-ofctl\fR will also
161 request to be sent flow expiration messages.  If this argument is
162 omitted, or \fB0\fR is specified, then \fRovs\-ofctl\fR will not request
163 flow expirations.
164
165 This command may be useful for debugging switch or controller
166 implementations.
167
168 .TP
169 \fBexecute \fIswitch command \fR[\fIarg\fR...]
170 Sends a request to \fIswitch\fR to execute \fIcommand\fR along with
171 each \fIarg\fR, if any, then waits for the command to complete and
172 reports its completion status on \fBstderr\fR and its output, if any,
173 on \fBstdout\fR.  The set of available commands and their argument is
174 switch-dependent.  (This command uses a Nicira extension to OpenFlow
175 that may not be available on all switches.)
176
177 .SS "OpenFlow Switch and Controller Commands"
178
179 The following commands, like those in the previous section, may be
180 applied to OpenFlow switches, using any of the connection methods
181 described in that section.  Unlike those commands, these may also be
182 applied to OpenFlow controllers.
183
184 .TP
185 \fBprobe \fItarget\fR
186 Sends a single OpenFlow echo-request message to \fItarget\fR and waits
187 for the response.  With the \fB-t\fR or \fB--timeout\fR option, this
188 command can test whether an OpenFlow switch or controller is up and
189 running.
190
191 .TP
192 \fBping \fItarget \fR[\fIn\fR]
193 Sends a series of 10 echo request packets to \fItarget\fR and times
194 each reply.  The echo request packets consist of an OpenFlow header
195 plus \fIn\fR bytes (default: 64) of randomly generated payload.  This
196 measures the latency of individual requests.
197
198 .TP
199 \fBbenchmark \fItarget n count\fR
200 Sends \fIcount\fR echo request packets that each consist of an
201 OpenFlow header plus \fIn\fR bytes of payload and waits for each
202 response.  Reports the total time required.  This is a measure of the
203 maximum bandwidth to \fItarget\fR for round-trips of \fIn\fR-byte
204 messages.
205
206 .SS "Flow Syntax"
207
208 Some \fBovs\-ofctl\fR commands accept an argument that describes a flow or
209 flows.  Such flow descriptions comprise a series
210 \fIfield\fB=\fIvalue\fR assignments, separated by commas or white
211 space.  (Embedding spaces into a flow description normally requires
212 quoting to prevent the shell from breaking the description into
213 multiple arguments.)
214
215 The following field assignments describe how a flow matches a packet.
216 If any of these assignments is omitted from the flow syntax, the field
217 is treated as a wildcard; thus, if all of them are omitted, the
218 resulting flow matches all packets.  The string \fB*\fR or \fBANY\fR
219 may be specified to explicitly mark any of these fields as a wildcard.  
220 (\fB*\fR should be quoted to protect it from shell expansion.)
221
222 .IP \fBin_port=\fIport_no\fR
223 Matches physical port \fIport_no\fR.  Switch ports are numbered as
224 displayed by \fBovs\-ofctl show\fR.
225
226 .IP \fBdl_vlan=\fIvlan\fR
227 Matches IEEE 802.1q Virtual LAN tag \fIvlan\fR.  Specify \fB0xffff\fR
228 as \fIvlan\fR to match packets that are not tagged with a Virtual LAN;
229 otherwise, specify a number between 0 and 4095, inclusive, as the
230 12-bit VLAN ID to match.
231
232 .IP \fBdl_src=\fImac\fR
233 Matches Ethernet source address \fImac\fR, which is specified as 6 pairs 
234 of hexadecimal digits delimited by colons (e.g. \fB00:0A:E4:25:6B:B0\fR).
235
236 .IP \fBdl_dst=\fImac\fR
237 Matches Ethernet destination address \fImac\fR.
238
239 .IP \fBdl_type=\fIethertype\fR
240 Matches Ethernet protocol type \fIethertype\fR, which is specified as an
241 integer between 0 and 65535, inclusive, either in decimal or as a 
242 hexadecimal number prefixed by \fB0x\fR (e.g. \fB0x0806\fR to match ARP 
243 packets).
244
245 .IP \fBnw_src=\fIip\fR[\fB/\fInetmask\fR]
246 Matches IPv4 source address \fIip\fR, which may be specified as an
247 IP address or host name (e.g. \fB192.168.1.1\fR or
248 \fBwww.example.com\fR).  The optional \fInetmask\fR allows restricting a
249 match to an IPv4 address prefix.  The netmask may be specified as a dotted 
250 quad (e.g. \fB192.168.1.0/255.255.255.0\fR) or as a CIDR block 
251 (e.g. \fB192.168.1.0/24\fR).
252
253 .IP \fBnw_dst=\fIip\fR[\fB/\fInetmask\fR]
254 Matches IPv4 destination address \fIip\fR.
255
256 .IP \fBnw_proto=\fIproto\fR
257 Matches IP protocol type \fIproto\fR, which is specified as a decimal 
258 number between 0 and 255, inclusive (e.g. 6 to match TCP packets).
259
260 .IP \fBtp_src=\fIport\fR
261 Matches UDP or TCP source port \fIport\fR, which is specified as a decimal 
262 number between 0 and 65535, inclusive (e.g. 80 to match packets originating 
263 from a HTTP server).
264
265 .IP \fBtp_dst=\fIport\fR
266 Matches UDP or TCP destination port \fIport\fR.
267
268 .IP \fBicmp_type=\fItype\fR
269 Matches ICMP message with \fItype\fR, which is specified as a decimal 
270 number between 0 and 255, inclusive.
271
272 .IP \fBicmp_code=\fIcode\fR
273 Matches ICMP messages with \fIcode\fR.
274
275 .PP
276 The following shorthand notations are also available:
277
278 .IP \fBip\fR
279 Same as \fBdl_type=0x0800\fR.
280
281 .IP \fBicmp\fR
282 Same as \fBdl_type=0x0800,nw_proto=1\fR.
283
284 .IP \fBtcp\fR
285 Same as \fBdl_type=0x0800,nw_proto=6\fR.
286
287 .IP \fBudp\fR
288 Same as \fBdl_type=0x0800,nw_proto=17\fR.
289
290 .IP \fBarp\fR
291 Same as \fBdl_type=0x0806\fR.
292
293 .PP
294 The \fBadd-flow\fR and \fBadd-flows\fR commands require an additional field:
295
296 .IP \fBactions=\fR[\fItarget\fR][\fB,\fItarget\fR...]\fR
297 Specifies a comma-separated list of actions to take on a packet when the 
298 flow entry matches.  If no \fItarget\fR is specified, then packets
299 matching the flow are dropped.  The \fItarget\fR may be a decimal port 
300 number designating the physical port on which to output the packet, or one 
301 of the following keywords:
302
303 .RS
304 .IP \fBoutput\fR:\fIport\fR
305 Outputs the packet on the port specified by \fIport\fR.
306
307 .IP \fBnormal\fR
308 Subjects the packet to the device's normal L2/L3 processing.  (This
309 action is not implemented by all OpenFlow switches.)
310
311 .IP \fBflood\fR
312 Outputs the packet on all switch physical ports other than the port on
313 which it was received and any ports on which flooding is disabled
314 (typically, these would be ports disabled by the IEEE 802.1D spanning
315 tree protocol).
316
317 .IP \fBall\fR
318 Outputs the packet on all switch physical ports other than the port on
319 which it was received.
320
321 .IP \fBcontroller\fR:\fImax_len\fR
322 Sends the packet to the OpenFlow controller as a ``packet in''
323 message.  If \fImax_len\fR is a number, then it specifies the maximum
324 number of bytes that should be sent.  If \fImax_len\fR is \fBALL\fR or
325 omitted, then the entire packet is sent.
326
327 .IP \fBlocal\fR
328 Outputs the packet on the ``local port,'' which corresponds to the
329 \fBof\fIn\fR network device (see \fBCONTACTING THE CONTROLLER\fR in
330 \fBovs\-openflowd\fR(8) for information on the \fBof\fIn\fR network device).
331
332 .IP \fBdrop\fR
333 Discards the packet, so no further processing or forwarding takes place.
334 If a drop action is used, no other actions may be specified.
335
336 .IP \fBmod_vlan_vid\fR:\fIvlan_vid\fR
337 Modifies the VLAN id on a packet.  The VLAN tag is added or modified 
338 as necessary to match the value specified.  If the VLAN tag is added,
339 a priority of zero is used (see the \fBmod_vlan_pcp\fR action to set
340 this).
341
342 .IP \fBmod_vlan_pcp\fR:\fIvlan_pcp\fR
343 Modifies the VLAN priority on a packet.  The VLAN tag is added or modified 
344 as necessary to match the value specified.  Valid values are between 0
345 (lowest) and 7 (highest).  If the VLAN tag is added, a vid of zero is used 
346 (see the \fBmod_vlan_vid\fR action to set this).
347
348 .IP \fBstrip_vlan\fR
349 Strips the VLAN tag from a packet if it is present.
350
351 .IP \fBmod_dl_src\fB:\fImac\fR
352 Sets the source Ethernet address to \fImac\fR.
353
354 .IP \fBmod_dl_dst\fB:\fImac\fR
355 Sets the destination Ethernet address to \fImac\fR.
356 .RE
357
358 .IP
359 (The OpenFlow protocol supports other actions that \fBovs\-ofctl\fR does
360 not yet expose to the user.)
361
362 .PP
363 The \fBadd-flow\fR, \fBadd-flows\fR, and \fBdel-flows\fR commands
364 support an additional optional field:
365
366 .IP \fBpriority=\fIvalue\fR
367 The priority at which a wildcarded entry will match in comparison to
368 others.  \fIvalue\fR is a number between 0 and 65535, inclusive.  A higher 
369 \fIvalue\fR will match before a lower one.  An exact-match entry will always 
370 have priority over an entry containing wildcards, so it has an implicit 
371 priority value of 65535.  When adding a flow, if the field is not specified, 
372 the flow's priority will default to 32768.
373
374 .PP
375 The \fBadd-flow\fR and \fBadd-flows\fR commands support additional
376 optional fields:
377
378 .TP
379 \fBidle_timeout=\fIseconds\fR
380 Causes the flow to expire after the given number of seconds of
381 inactivity.  A value of 0 prevents a flow from expiring due to
382 inactivity.  The default is 60 seconds.
383
384 .IP \fBhard_timeout=\fIseconds\fR
385 Causes the flow to expire after the given number of seconds,
386 regardless of activity.  A value of 0 (the default) gives the flow no
387 hard expiration deadline.
388
389 .PP
390 The \fBdump-flows\fR, \fBdump-aggregate\fR, \fBdel-flow\fR 
391 and \fBdel-flows\fR commands support one additional optional field:
392
393 .TP
394 \fBout_port=\fIport\fR
395 If set, a matching flow must include an output action to \fIport\fR.
396
397 .PP
398 The \fBdump-flows\fR and \fBdump-aggregate\fR commands support an
399 additional optional field:
400
401 .IP \fBtable=\fInumber\fR
402 If specified, limits the flows about which statistics are gathered to
403 those in the table with the given \fInumber\fR.  Tables are numbered
404 as shown by the \fBdump-tables\fR command.
405
406 If this field is not specified, or if \fInumber\fR is given as
407 \fB255\fR, statistics are gathered about flows from all tables.
408
409 .SS "Table Entry Output"
410
411 The \fBdump-tables\fR and \fBdump-aggregate\fR commands print information 
412 about the entries in a datapath's tables.  Each line of output is a 
413 unique flow entry, which begins with some common information:
414
415 .IP \fBduration\fR
416 The number of seconds the entry has been in the table.
417
418 .IP \fBtable_id\fR
419 The table that contains the flow.  When a packet arrives, the switch 
420 begins searching for an entry at the lowest numbered table.  Tables are 
421 numbered as shown by the \fBdump-tables\fR command.
422
423 .IP \fBpriority\fR
424 The priority of the entry in relation to other entries within the same
425 table.  A higher value will match before a lower one.
426
427 .IP \fBn_packets\fR
428 The number of packets that have matched the entry.
429
430 .IP \fBn_bytes\fR
431 The total number of bytes from packets that have matched the entry.
432
433 .PP
434 The rest of the line consists of a description of the flow entry as 
435 described in \fBFlow Syntax\fR, above.
436
437
438 .SH OPTIONS
439 .TP
440 \fB--strict\fR
441 Uses strict matching when running flow modification commands.
442
443 .TP
444 \fB-t\fR, \fB--timeout=\fIsecs\fR
445 Limits \fBovs\-ofctl\fR runtime to approximately \fIsecs\fR seconds.  If
446 the timeout expires, \fBovs\-ofctl\fR will exit with a \fBSIGALRM\fR
447 signal.
448
449 .TP
450 \fB-p\fR, \fB--private-key=\fIprivkey.pem\fR
451 Specifies a PEM file containing the private key used as the
452 identity for SSL connections to a switch.
453
454 .TP
455 \fB-c\fR, \fB--certificate=\fIcert.pem\fR
456 Specifies a PEM file containing a certificate, signed by the
457 controller's certificate authority (CA), that certifies the
458 private key to identify a trustworthy controller.
459
460 .TP
461 \fB-C\fR, \fB--ca-cert=\fIcacert.pem\fR
462 Specifies a PEM file containing the CA certificate used to verify that
463 a switch is trustworthy.
464
465 .so lib/vlog.man
466 .so lib/common.man
467
468 .SH EXAMPLES
469
470 The following examples assume that an OpenFlow switch on the local
471 host has been configured to listen for management connections on a
472 Unix domain socket named \fB@RUNDIR@/openflow.sock\fR, e.g. by
473 specifying \fB--listen=punix:@RUNDIR@/openflow.sock\fR on the
474 \fBovs\-openflowd\fR(8) command line.
475
476 .TP
477 \fBovs\-ofctl dump-tables unix:@RUNDIR@/openflow.sock\fR
478 Prints out the switch's table stats.  (This is more interesting after
479 some traffic has passed through.)
480
481 .TP
482 \fBovs\-ofctl dump-flows unix:@RUNDIR@/openflow.sock\fR
483 Prints the flow entries in the switch.
484
485 .SH "SEE ALSO"
486
487 .BR ovs\-appctl (8),
488 .BR ovs\-controller (8),
489 .BR ovs\-vswitchd (8)