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