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