1 .TH ovs\-ofctl 8 "June 2009" "Open vSwitch" "Open vSwitch Manual"
5 ovs\-ofctl \- administer OpenFlow switches
9 [\fIoptions\fR] \fIcommand \fR[\fIswitch\fR] [\fIargs\fR\&...]
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.
18 .SS "OpenFlow Switch Management Commands"
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.
24 Most of these commands take an argument that specifies the method for
25 connecting to an OpenFlow switch. The following connection methods
29 .IP "\fBssl:\fIip\fR[\fB:\fIport\fR]"
30 The 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).
32 The \fB--private-key\fR, \fB--certificate\fR, and \fB--ca-cert\fR
33 options are mandatory when this form is used.
35 .IP "\fBtcp:\fIip\fR[\fB:\fIport\fR]"
36 The 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).
41 The Unix domain server socket named \fIfile\fR.
44 This is short for \fBunix:\fIfile\fR, as long as \fIfile\fR does not
48 This is short for \fBunix:@RUNDIR@/\fIdp\fB.mgmt\fR, as long as
49 \fIdp\fR does not contain a colon.
54 Prints to the console information on \fIswitch\fR, including
55 information on its flow tables and ports.
58 \fBstatus \fIswitch\fR [\fIkey\fR]
59 Prints to the console a series of key-value pairs that report the
60 status of \fIswitch\fR. If \fIkey\fR is specified, only the key-value
61 pairs whose key names begin with \fIkey\fR are printed. If \fIkey\fR is
62 omitted, all key-value pairs are printed.
65 \fBdump-tables \fIswitch\fR
66 Prints to the console statistics for each of the flow tables used by
70 \fBdump-ports \fIswitch\fR
71 Prints to the console statistics for each of the network devices
72 associated with \fIswitch\fR.
75 \fBmod-port \fIswitch\fR \fInetdev\fR \fIaction\fR
76 Modify characteristics of an interface monitored by \fIswitch\fR.
77 \fInetdev\fR can be referred to by its OpenFlow assigned port number or
78 the device name, e.g. \fBeth0\fR. The \fIaction\fR may be any one of the
83 Enables the interface. This is equivalent to ``ifconfig up'' on a Unix
87 Disables the interface. This is equivalent to ``ifconfig down'' on a Unix
91 When a \fIflood\fR action is specified, traffic will be sent out this
92 interface. This is the default posture for monitored ports.
95 When a \fIflood\fR action is specified, traffic will not be sent out
96 this interface. This is primarily useful to prevent loops when a
97 spanning tree protocol is not in use.
102 \fBdump-flows \fIswitch \fR[\fIflows\fR]
103 Prints to the console all flow entries in \fIswitch\fR's
104 tables that match \fIflows\fR. If \fIflows\fR is omitted, all flows
105 in the switch are retrieved. See \fBFlow Syntax\fR, below, for the
106 syntax of \fIflows\fR. The output format is described in
107 \fBTable Entry Output\fR.
110 \fBdump-aggregate \fIswitch \fR[\fIflows\fR]
111 Prints to the console aggregate statistics for flows in
112 \fIswitch\fR's tables that match \fIflows\fR. If \fIflows\fR is omitted,
113 the statistics are aggregated across all flows in the switch's flow
114 tables. See \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
115 The output format is descrbed in \fBTable Entry Output\fR.
118 \fBadd-flow \fIswitch flow\fR
119 Add the flow entry as described by \fIflow\fR to the \fIswitch\fR's
120 tables. The flow entry is in the format described in \fBFlow Syntax\fR,
124 \fBadd-flows \fIswitch file\fR
125 Add flow entries as described in \fIfile\fR to \fIswitch\fR's
126 tables. Each line in \fIfile\fR is a flow entry in the format
127 described in \fBFlow Syntax\fR, below.
130 \fBmod-flows \fIswitch flow\fR
131 Modify the actions in entries from the \fIswitch\fR's tables
132 that match \fIflow\fR. When invoked with the \fB--strict\fR option,
133 wildcards are not treated as active for matching purposes. See
134 \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
137 \fBdel-flows \fIswitch \fR[\fIflow\fR]
138 Deletes entries from the \fIswitch\fR's tables that match
139 \fIflow\fR. When invoked with the \fB--strict\fR option, wildcards are
140 not treated as active for matching purposes. If \fIflow\fR is
141 omitted and the \fB--strict\fR option is not used, all flows in the
142 switch's tables are removed. See \fBFlow Syntax\fR, below, for the
143 syntax of \fIflows\fR.
146 \fBmonitor \fIswitch\fR [\fImiss-len\fR [\fIsend-exp]]
147 Connects to \fIswitch\fR and prints to the console all OpenFlow
148 messages received. Usually, \fIswitch\fR should specify a connection
149 named on \fBovs\-openflowd\fR(8)'s \fB-l\fR or \fB--listen\fR command line
152 If \fImiss-len\fR is provided, \fBovs\-ofctl\fR sends an OpenFlow ``set
153 configuration'' message at connection setup time that requests
154 \fImiss-len\fR bytes of each packet that misses the flow table. The
155 OpenFlow reference implementation does not send these messages to the
156 \fBovs\-ofctl monitor\fR client connection unless a nonzero value is
157 specified on this argument.
159 If \fIsend-exp\fR is specified as \fB1\fR, \fBovs\-ofctl\fR will also
160 request to be sent flow expiration messages. If this argument is
161 omitted, or \fB0\fR is specified, then \fRovs\-ofctl\fR will not request
164 This command may be useful for debugging switch or controller
167 .SS "OpenFlow Switch and Controller Commands"
169 The following commands, like those in the previous section, may be
170 applied to OpenFlow switches, using any of the connection methods
171 described in that section. Unlike those commands, these may also be
172 applied to OpenFlow controllers.
175 \fBprobe \fItarget\fR
176 Sends a single OpenFlow echo-request message to \fItarget\fR and waits
177 for the response. With the \fB-t\fR or \fB--timeout\fR option, this
178 command can test whether an OpenFlow switch or controller is up and
182 \fBping \fItarget \fR[\fIn\fR]
183 Sends a series of 10 echo request packets to \fItarget\fR and times
184 each reply. The echo request packets consist of an OpenFlow header
185 plus \fIn\fR bytes (default: 64) of randomly generated payload. This
186 measures the latency of individual requests.
189 \fBbenchmark \fItarget n count\fR
190 Sends \fIcount\fR echo request packets that each consist of an
191 OpenFlow header plus \fIn\fR bytes of payload and waits for each
192 response. Reports the total time required. This is a measure of the
193 maximum bandwidth to \fItarget\fR for round-trips of \fIn\fR-byte
198 Some \fBovs\-ofctl\fR commands accept an argument that describes a flow or
199 flows. Such flow descriptions comprise a series
200 \fIfield\fB=\fIvalue\fR assignments, separated by commas or white
201 space. (Embedding spaces into a flow description normally requires
202 quoting to prevent the shell from breaking the description into
205 The following field assignments describe how a flow matches a packet.
206 If any of these assignments is omitted from the flow syntax, the field
207 is treated as a wildcard; thus, if all of them are omitted, the
208 resulting flow matches all packets. The string \fB*\fR or \fBANY\fR
209 may be specified to explicitly mark any of these fields as a wildcard.
210 (\fB*\fR should be quoted to protect it from shell expansion.)
212 .IP \fBin_port=\fIport_no\fR
213 Matches physical port \fIport_no\fR. Switch ports are numbered as
214 displayed by \fBovs\-ofctl show\fR.
216 .IP \fBdl_vlan=\fIvlan\fR
217 Matches IEEE 802.1q Virtual LAN tag \fIvlan\fR. Specify \fB0xffff\fR
218 as \fIvlan\fR to match packets that are not tagged with a Virtual LAN;
219 otherwise, specify a number between 0 and 4095, inclusive, as the
220 12-bit VLAN ID to match.
222 .IP \fBdl_src=\fImac\fR
223 Matches Ethernet source address \fImac\fR, which is specified as 6 pairs
224 of hexadecimal digits delimited by colons (e.g. \fB00:0A:E4:25:6B:B0\fR).
226 .IP \fBdl_dst=\fImac\fR
227 Matches Ethernet destination address \fImac\fR.
229 .IP \fBdl_type=\fIethertype\fR
230 Matches Ethernet protocol type \fIethertype\fR, which is specified as an
231 integer between 0 and 65535, inclusive, either in decimal or as a
232 hexadecimal number prefixed by \fB0x\fR (e.g. \fB0x0806\fR to match ARP
235 .IP \fBnw_src=\fIip\fR[\fB/\fInetmask\fR]
236 Matches IPv4 source address \fIip\fR, which may be specified as an
237 IP address or host name (e.g. \fB192.168.1.1\fR or
238 \fBwww.example.com\fR). The optional \fInetmask\fR allows restricting a
239 match to an IPv4 address prefix. The netmask may be specified as a dotted
240 quad (e.g. \fB192.168.1.0/255.255.255.0\fR) or as a CIDR block
241 (e.g. \fB192.168.1.0/24\fR).
243 .IP \fBnw_dst=\fIip\fR[\fB/\fInetmask\fR]
244 Matches IPv4 destination address \fIip\fR.
246 .IP \fBnw_proto=\fIproto\fR
247 Matches IP protocol type \fIproto\fR, which is specified as a decimal
248 number between 0 and 255, inclusive (e.g. 6 to match TCP packets).
250 .IP \fBtp_src=\fIport\fR
251 Matches UDP or TCP source port \fIport\fR, which is specified as a decimal
252 number between 0 and 65535, inclusive (e.g. 80 to match packets originating
255 .IP \fBtp_dst=\fIport\fR
256 Matches UDP or TCP destination port \fIport\fR.
258 .IP \fBicmp_type=\fItype\fR
259 Matches ICMP message with \fItype\fR, which is specified as a decimal
260 number between 0 and 255, inclusive.
262 .IP \fBicmp_code=\fIcode\fR
263 Matches ICMP messages with \fIcode\fR.
266 The following shorthand notations are also available:
269 Same as \fBdl_type=0x0800\fR.
272 Same as \fBdl_type=0x0800,nw_proto=1\fR.
275 Same as \fBdl_type=0x0800,nw_proto=6\fR.
278 Same as \fBdl_type=0x0800,nw_proto=17\fR.
281 Same as \fBdl_type=0x0806\fR.
284 The \fBadd-flow\fR and \fBadd-flows\fR commands require an additional field:
286 .IP \fBactions=\fR[\fItarget\fR][\fB,\fItarget\fR...]\fR
287 Specifies a comma-separated list of actions to take on a packet when the
288 flow entry matches. If no \fItarget\fR is specified, then packets
289 matching the flow are dropped. The \fItarget\fR may be a decimal port
290 number designating the physical port on which to output the packet, or one
291 of the following keywords:
294 .IP \fBoutput\fR:\fIport\fR
295 Outputs the packet on the port specified by \fIport\fR.
298 Subjects the packet to the device's normal L2/L3 processing. (This
299 action is not implemented by all OpenFlow switches.)
302 Outputs the packet on all switch physical ports other than the port on
303 which it was received and any ports on which flooding is disabled
304 (typically, these would be ports disabled by the IEEE 802.1D spanning
308 Outputs the packet on all switch physical ports other than the port on
309 which it was received.
311 .IP \fBcontroller\fR:\fImax_len\fR
312 Sends the packet to the OpenFlow controller as a ``packet in''
313 message. If \fImax_len\fR is a number, then it specifies the maximum
314 number of bytes that should be sent. If \fImax_len\fR is \fBALL\fR or
315 omitted, then the entire packet is sent.
318 Outputs the packet on the ``local port,'' which corresponds to the
319 \fBof\fIn\fR network device (see \fBCONTACTING THE CONTROLLER\fR in
320 \fBovs\-openflowd\fR(8) for information on the \fBof\fIn\fR network device).
323 Discards the packet, so no further processing or forwarding takes place.
324 If a drop action is used, no other actions may be specified.
326 .IP \fBmod_vlan_vid\fR:\fIvlan_vid\fR
327 Modifies the VLAN id on a packet. The VLAN tag is added or modified
328 as necessary to match the value specified. If the VLAN tag is added,
329 a priority of zero is used (see the \fBmod_vlan_pcp\fR action to set
332 .IP \fBmod_vlan_pcp\fR:\fIvlan_pcp\fR
333 Modifies the VLAN priority on a packet. The VLAN tag is added or modified
334 as necessary to match the value specified. Valid values are between 0
335 (lowest) and 7 (highest). If the VLAN tag is added, a vid of zero is used
336 (see the \fBmod_vlan_vid\fR action to set this).
339 Strips the VLAN tag from a packet if it is present.
341 .IP \fBmod_dl_src\fB:\fImac\fR
342 Sets the source Ethernet address to \fImac\fR.
344 .IP \fBmod_dl_dst\fB:\fImac\fR
345 Sets the destination Ethernet address to \fImac\fR.
347 .IP \fBmod_nw_src\fB:\fIip\fR
348 Sets the IPv4 source address to \fIip\fR.
350 .IP \fBmod_nw_dst\fB:\fIip\fR
351 Sets the IPv4 destination address to \fIip\fR.
353 .IP \fBmod_tp_src\fB:\fIport\fR
354 Sets the TCP or UDP source port to \fIport\fR.
356 .IP \fBmod_tp_dst\fB:\fIport\fR
357 Sets the TCP or UDP destination port to \fIport\fR.
361 (The OpenFlow protocol supports other actions that \fBovs\-ofctl\fR does
362 not yet expose to the user.)
365 The \fBadd-flow\fR, \fBadd-flows\fR, and \fBdel-flows\fR commands
366 support an additional optional field:
368 .IP \fBpriority=\fIvalue\fR
369 The priority at which a wildcarded entry will match in comparison to
370 others. \fIvalue\fR is a number between 0 and 65535, inclusive. A higher
371 \fIvalue\fR will match before a lower one. An exact-match entry will always
372 have priority over an entry containing wildcards, so it has an implicit
373 priority value of 65535. When adding a flow, if the field is not specified,
374 the flow's priority will default to 32768.
377 The \fBadd-flow\fR and \fBadd-flows\fR commands support additional
381 \fBidle_timeout=\fIseconds\fR
382 Causes the flow to expire after the given number of seconds of
383 inactivity. A value of 0 prevents a flow from expiring due to
384 inactivity. The default is 60 seconds.
386 .IP \fBhard_timeout=\fIseconds\fR
387 Causes the flow to expire after the given number of seconds,
388 regardless of activity. A value of 0 (the default) gives the flow no
389 hard expiration deadline.
392 The \fBdump-flows\fR, \fBdump-aggregate\fR, \fBdel-flow\fR
393 and \fBdel-flows\fR commands support one additional optional field:
396 \fBout_port=\fIport\fR
397 If set, a matching flow must include an output action to \fIport\fR.
400 The \fBdump-flows\fR and \fBdump-aggregate\fR commands support an
401 additional optional field:
403 .IP \fBtable=\fInumber\fR
404 If specified, limits the flows about which statistics are gathered to
405 those in the table with the given \fInumber\fR. Tables are numbered
406 as shown by the \fBdump-tables\fR command.
408 If this field is not specified, or if \fInumber\fR is given as
409 \fB255\fR, statistics are gathered about flows from all tables.
411 .SS "Table Entry Output"
413 The \fBdump-tables\fR and \fBdump-aggregate\fR commands print information
414 about the entries in a datapath's tables. Each line of output is a
415 unique flow entry, which begins with some common information:
418 The number of seconds the entry has been in the table.
421 The table that contains the flow. When a packet arrives, the switch
422 begins searching for an entry at the lowest numbered table. Tables are
423 numbered as shown by the \fBdump-tables\fR command.
426 The priority of the entry in relation to other entries within the same
427 table. A higher value will match before a lower one.
430 The number of packets that have matched the entry.
433 The total number of bytes from packets that have matched the entry.
436 The rest of the line consists of a description of the flow entry as
437 described in \fBFlow Syntax\fR, above.
443 Uses strict matching when running flow modification commands.
446 \fB-t\fR, \fB--timeout=\fIsecs\fR
447 Limits \fBovs\-ofctl\fR runtime to approximately \fIsecs\fR seconds. If
448 the timeout expires, \fBovs\-ofctl\fR will exit with a \fBSIGALRM\fR
452 \fB-p\fR, \fB--private-key=\fIprivkey.pem\fR
453 Specifies a PEM file containing the private key used as the
454 identity for SSL connections to a switch.
457 \fB-c\fR, \fB--certificate=\fIcert.pem\fR
458 Specifies a PEM file containing a certificate, signed by the
459 controller's certificate authority (CA), that certifies the
460 private key to identify a trustworthy controller.
463 \fB-C\fR, \fB--ca-cert=\fIcacert.pem\fR
464 Specifies a PEM file containing the CA certificate used to verify that
465 a switch is trustworthy.
472 The following examples assume that an OpenFlow switch on the local
473 host has been configured to listen for management connections on a
474 Unix domain socket named \fB@RUNDIR@/openflow.sock\fR, e.g. by
475 specifying \fB--listen=punix:@RUNDIR@/openflow.sock\fR on the
476 \fBovs\-openflowd\fR(8) command line.
479 \fBovs\-ofctl dump-tables unix:@RUNDIR@/openflow.sock\fR
480 Prints out the switch's table stats. (This is more interesting after
481 some traffic has passed through.)
484 \fBovs\-ofctl dump-flows unix:@RUNDIR@/openflow.sock\fR
485 Prints the flow entries in the switch.
490 .BR ovs\-controller (8),
491 .BR ovs\-vswitchd (8)