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 .so lib/vconn-active.man
32 This is short for \fBunix:\fIfile\fR, as long as \fIfile\fR does not
36 This is short for \fBunix:@RUNDIR@/\fIbridge\fB.mgmt\fR, as long as
37 \fIbridge\fR does not contain a colon.
39 .IP [\fItype\fB@\fR]\fIdp\fR
40 Attempts to look up the bridge associated with \fIdp\fR and open as
41 above. If \fItype\fR is given, it specifies the datapath provider of
42 \fIdp\fR, otherwise the default provider \fBsystem\fR is assumed.
47 Prints to the console information on \fIswitch\fR, including
48 information on its flow tables and ports.
51 \fBstatus \fIswitch\fR [\fIkey\fR]
52 Prints to the console a series of key-value pairs that report the
53 status of \fIswitch\fR. If \fIkey\fR is specified, only the key-value
54 pairs whose key names begin with \fIkey\fR are printed. If \fIkey\fR is
55 omitted, all key-value pairs are printed.
58 \fBdump-tables \fIswitch\fR
59 Prints to the console statistics for each of the flow tables used by
63 \fBdump-ports \fIswitch\fR
64 Prints to the console statistics for each of the network devices
65 associated with \fIswitch\fR.
68 \fBmod-port \fIswitch\fR \fInetdev\fR \fIaction\fR
69 Modify characteristics of an interface monitored by \fIswitch\fR.
70 \fInetdev\fR can be referred to by its OpenFlow assigned port number or
71 the device name, e.g. \fBeth0\fR. The \fIaction\fR may be any one of the
76 Enables the interface. This is equivalent to ``ifconfig up'' on a Unix
80 Disables the interface. This is equivalent to ``ifconfig down'' on a Unix
84 When a \fIflood\fR action is specified, traffic will be sent out this
85 interface. This is the default posture for monitored ports.
88 When a \fIflood\fR action is specified, traffic will not be sent out
89 this interface. This is primarily useful to prevent loops when a
90 spanning tree protocol is not in use.
95 \fBdump-flows \fIswitch \fR[\fIflows\fR]
96 Prints to the console all flow entries in \fIswitch\fR's
97 tables that match \fIflows\fR. If \fIflows\fR is omitted, all flows
98 in the switch are retrieved. See \fBFlow Syntax\fR, below, for the
99 syntax of \fIflows\fR. The output format is described in
100 \fBTable Entry Output\fR.
103 \fBdump-aggregate \fIswitch \fR[\fIflows\fR]
104 Prints to the console aggregate statistics for flows in
105 \fIswitch\fR's tables that match \fIflows\fR. If \fIflows\fR is omitted,
106 the statistics are aggregated across all flows in the switch's flow
107 tables. See \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
108 The output format is descrbed in \fBTable Entry Output\fR.
111 \fBadd-flow \fIswitch flow\fR
112 Add the flow entry as described by \fIflow\fR to the \fIswitch\fR's
113 tables. The flow entry is in the format described in \fBFlow Syntax\fR,
117 \fBadd-flows \fIswitch file\fR
118 Add flow entries as described in \fIfile\fR to \fIswitch\fR's
119 tables. Each line in \fIfile\fR is a flow entry in the format
120 described in \fBFlow Syntax\fR, below.
123 \fBmod-flows \fIswitch flow\fR
124 Modify the actions in entries from the \fIswitch\fR's tables
125 that match \fIflow\fR. When invoked with the \fB--strict\fR option,
126 wildcards are not treated as active for matching purposes. See
127 \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
130 \fBdel-flows \fIswitch \fR[\fIflow\fR]
131 Deletes entries from the \fIswitch\fR's tables that match
132 \fIflow\fR. When invoked with the \fB--strict\fR option, wildcards are
133 not treated as active for matching purposes. If \fIflow\fR is
134 omitted and the \fB--strict\fR option is not used, all flows in the
135 switch's tables are removed. See \fBFlow Syntax\fR, below, for the
136 syntax of \fIflows\fR.
139 \fBmonitor \fIswitch\fR [\fImiss-len\fR [\fIsend-exp]]
140 Connects to \fIswitch\fR and prints to the console all OpenFlow
141 messages received. Usually, \fIswitch\fR should specify a connection
142 named on \fBovs\-openflowd\fR(8)'s \fB-l\fR or \fB--listen\fR command line
145 If \fImiss-len\fR is provided, \fBovs\-ofctl\fR sends an OpenFlow ``set
146 configuration'' message at connection setup time that requests
147 \fImiss-len\fR bytes of each packet that misses the flow table. The
148 OpenFlow reference implementation does not send these messages to the
149 \fBovs\-ofctl monitor\fR client connection unless a nonzero value is
150 specified on this argument.
152 If \fIsend-exp\fR is specified as \fB1\fR, \fBovs\-ofctl\fR will also
153 request to be sent flow expiration messages. If this argument is
154 omitted, or \fB0\fR is specified, then \fRovs\-ofctl\fR will not request
157 This command may be useful for debugging switch or controller
160 .SS "OpenFlow Switch and Controller Commands"
162 The following commands, like those in the previous section, may be
163 applied to OpenFlow switches, using any of the connection methods
164 described in that section. Unlike those commands, these may also be
165 applied to OpenFlow controllers.
168 \fBprobe \fItarget\fR
169 Sends a single OpenFlow echo-request message to \fItarget\fR and waits
170 for the response. With the \fB-t\fR or \fB--timeout\fR option, this
171 command can test whether an OpenFlow switch or controller is up and
175 \fBping \fItarget \fR[\fIn\fR]
176 Sends a series of 10 echo request packets to \fItarget\fR and times
177 each reply. The echo request packets consist of an OpenFlow header
178 plus \fIn\fR bytes (default: 64) of randomly generated payload. This
179 measures the latency of individual requests.
182 \fBbenchmark \fItarget n count\fR
183 Sends \fIcount\fR echo request packets that each consist of an
184 OpenFlow header plus \fIn\fR bytes of payload and waits for each
185 response. Reports the total time required. This is a measure of the
186 maximum bandwidth to \fItarget\fR for round-trips of \fIn\fR-byte
191 Some \fBovs\-ofctl\fR commands accept an argument that describes a flow or
192 flows. Such flow descriptions comprise a series
193 \fIfield\fB=\fIvalue\fR assignments, separated by commas or white
194 space. (Embedding spaces into a flow description normally requires
195 quoting to prevent the shell from breaking the description into
198 The following field assignments describe how a flow matches a packet.
199 If any of these assignments is omitted from the flow syntax, the field
200 is treated as a wildcard; thus, if all of them are omitted, the
201 resulting flow matches all packets. The string \fB*\fR or \fBANY\fR
202 may be specified to explicitly mark any of these fields as a wildcard.
203 (\fB*\fR should be quoted to protect it from shell expansion.)
205 .IP \fBin_port=\fIport_no\fR
206 Matches physical port \fIport_no\fR. Switch ports are numbered as
207 displayed by \fBovs\-ofctl show\fR.
209 .IP \fBdl_vlan=\fIvlan\fR
210 Matches IEEE 802.1q Virtual LAN tag \fIvlan\fR. Specify \fB0xffff\fR
211 as \fIvlan\fR to match packets that are not tagged with a Virtual LAN;
212 otherwise, specify a number between 0 and 4095, inclusive, as the
213 12-bit VLAN ID to match.
215 .IP \fBdl_vlan_pcp=\fIpriority\fR
216 Matches IEEE 802.1q Priority Code Point (PCP) \fIpriority\fR, which is
217 specified as a value between 0 and 7, inclusive. A higher value
218 indicates a higher frame priority level.
220 .IP \fBdl_src=\fImac\fR
221 Matches Ethernet source address \fImac\fR, which is specified as 6 pairs
222 of hexadecimal digits delimited by colons (e.g. \fB00:0A:E4:25:6B:B0\fR).
224 .IP \fBdl_dst=\fImac\fR
225 Matches Ethernet destination address \fImac\fR.
227 .IP \fBdl_type=\fIethertype\fR
228 Matches Ethernet protocol type \fIethertype\fR, which is specified as an
229 integer between 0 and 65535, inclusive, either in decimal or as a
230 hexadecimal number prefixed by \fB0x\fR (e.g. \fB0x0806\fR to match ARP
233 .IP \fBnw_src=\fIip\fR[\fB/\fInetmask\fR]
234 Matches IPv4 source address \fIip\fR, which may be specified as an
235 IP address or host name (e.g. \fB192.168.1.1\fR or
236 \fBwww.example.com\fR). The optional \fInetmask\fR allows restricting a
237 match to an IPv4 address prefix. The netmask may be specified as a dotted
238 quad (e.g. \fB192.168.1.0/255.255.255.0\fR) or as a CIDR block
239 (e.g. \fB192.168.1.0/24\fR).
241 .IP \fBnw_dst=\fIip\fR[\fB/\fInetmask\fR]
242 Matches IPv4 destination address \fIip\fR.
244 .IP \fBnw_proto=\fIproto\fR
245 Matches IP protocol type \fIproto\fR, which is specified as a decimal
246 number between 0 and 255, inclusive (e.g. 6 to match TCP packets).
248 .IP \fBtp_src=\fIport\fR
249 Matches UDP or TCP source port \fIport\fR, which is specified as a decimal
250 number between 0 and 65535, inclusive (e.g. 80 to match packets originating
253 .IP \fBtp_dst=\fIport\fR
254 Matches UDP or TCP destination port \fIport\fR.
256 .IP \fBicmp_type=\fItype\fR
257 Matches ICMP message with \fItype\fR, which is specified as a decimal
258 number between 0 and 255, inclusive.
260 .IP \fBicmp_code=\fIcode\fR
261 Matches ICMP messages with \fIcode\fR.
264 The following shorthand notations are also available:
267 Same as \fBdl_type=0x0800\fR.
270 Same as \fBdl_type=0x0800,nw_proto=1\fR.
273 Same as \fBdl_type=0x0800,nw_proto=6\fR.
276 Same as \fBdl_type=0x0800,nw_proto=17\fR.
279 Same as \fBdl_type=0x0806\fR.
282 The \fBadd-flow\fR and \fBadd-flows\fR commands require an additional field:
284 .IP \fBactions=\fR[\fItarget\fR][\fB,\fItarget\fR...]\fR
285 Specifies a comma-separated list of actions to take on a packet when the
286 flow entry matches. If no \fItarget\fR is specified, then packets
287 matching the flow are dropped. The \fItarget\fR may be a decimal port
288 number designating the physical port on which to output the packet, or one
289 of the following keywords:
292 .IP \fBoutput\fR:\fIport\fR
293 Outputs the packet on the port specified by \fIport\fR.
296 Subjects the packet to the device's normal L2/L3 processing. (This
297 action is not implemented by all OpenFlow switches.)
300 Outputs the packet on all switch physical ports other than the port on
301 which it was received and any ports on which flooding is disabled
302 (typically, these would be ports disabled by the IEEE 802.1D spanning
306 Outputs the packet on all switch physical ports other than the port on
307 which it was received.
309 .IP \fBcontroller\fR:\fImax_len\fR
310 Sends the packet to the OpenFlow controller as a ``packet in''
311 message. If \fImax_len\fR is a number, then it specifies the maximum
312 number of bytes that should be sent. If \fImax_len\fR is \fBALL\fR or
313 omitted, then the entire packet is sent.
316 Outputs the packet on the ``local port,'' which corresponds to the
317 \fBof\fIn\fR network device (see \fBCONTACTING THE CONTROLLER\fR in
318 \fBovs\-openflowd\fR(8) for information on the \fBof\fIn\fR network device).
321 Discards the packet, so no further processing or forwarding takes place.
322 If a drop action is used, no other actions may be specified.
324 .IP \fBmod_vlan_vid\fR:\fIvlan_vid\fR
325 Modifies the VLAN id on a packet. The VLAN tag is added or modified
326 as necessary to match the value specified. If the VLAN tag is added,
327 a priority of zero is used (see the \fBmod_vlan_pcp\fR action to set
330 .IP \fBmod_vlan_pcp\fR:\fIvlan_pcp\fR
331 Modifies the VLAN priority on a packet. The VLAN tag is added or modified
332 as necessary to match the value specified. Valid values are between 0
333 (lowest) and 7 (highest). If the VLAN tag is added, a vid of zero is used
334 (see the \fBmod_vlan_vid\fR action to set this).
337 Strips the VLAN tag from a packet if it is present.
339 .IP \fBmod_dl_src\fB:\fImac\fR
340 Sets the source Ethernet address to \fImac\fR.
342 .IP \fBmod_dl_dst\fB:\fImac\fR
343 Sets the destination Ethernet address to \fImac\fR.
345 .IP \fBmod_nw_src\fB:\fIip\fR
346 Sets the IPv4 source address to \fIip\fR.
348 .IP \fBmod_nw_dst\fB:\fIip\fR
349 Sets the IPv4 destination address to \fIip\fR.
351 .IP \fBmod_tp_src\fB:\fIport\fR
352 Sets the TCP or UDP source port to \fIport\fR.
354 .IP \fBmod_tp_dst\fB:\fIport\fR
355 Sets the TCP or UDP destination port to \fIport\fR.
357 .IP \fBmod_nw_tos\fB:\fItos\fR
358 Sets the IP ToS/DSCP field to \fItos\fR. Valid values are between 0 and
359 255, inclusive. Note that the two lower reserved bits are never
365 (The OpenFlow protocol supports other actions that \fBovs\-ofctl\fR does
366 not yet expose to the user.)
369 The \fBadd-flow\fR, \fBadd-flows\fR, and \fBdel-flows\fR commands
370 support an additional optional field:
372 .IP \fBpriority=\fIvalue\fR
373 The priority at which a wildcarded entry will match in comparison to
374 others. \fIvalue\fR is a number between 0 and 65535, inclusive. A higher
375 \fIvalue\fR will match before a lower one. An exact-match entry will always
376 have priority over an entry containing wildcards, so it has an implicit
377 priority value of 65535. When adding a flow, if the field is not specified,
378 the flow's priority will default to 32768.
381 The \fBadd-flow\fR and \fBadd-flows\fR commands support additional
385 \fBidle_timeout=\fIseconds\fR
386 Causes the flow to expire after the given number of seconds of
387 inactivity. A value of 0 prevents a flow from expiring due to
388 inactivity. The default is 60 seconds.
390 .IP \fBhard_timeout=\fIseconds\fR
391 Causes the flow to expire after the given number of seconds,
392 regardless of activity. A value of 0 (the default) gives the flow no
393 hard expiration deadline.
396 The \fBdump-flows\fR, \fBdump-aggregate\fR, \fBdel-flow\fR
397 and \fBdel-flows\fR commands support one additional optional field:
400 \fBout_port=\fIport\fR
401 If set, a matching flow must include an output action to \fIport\fR.
404 The \fBdump-flows\fR and \fBdump-aggregate\fR commands support an
405 additional optional field:
407 .IP \fBtable=\fInumber\fR
408 If specified, limits the flows about which statistics are gathered to
409 those in the table with the given \fInumber\fR. Tables are numbered
410 as shown by the \fBdump-tables\fR command.
412 If this field is not specified, or if \fInumber\fR is given as
413 \fB255\fR, statistics are gathered about flows from all tables.
415 .SS "Table Entry Output"
417 The \fBdump-tables\fR and \fBdump-aggregate\fR commands print information
418 about the entries in a datapath's tables. Each line of output is a
419 unique flow entry, which begins with some common information:
422 The number of seconds the entry has been in the table.
425 The table that contains the flow. When a packet arrives, the switch
426 begins searching for an entry at the lowest numbered table. Tables are
427 numbered as shown by the \fBdump-tables\fR command.
430 The priority of the entry in relation to other entries within the same
431 table. A higher value will match before a lower one.
434 The number of packets that have matched the entry.
437 The total number of bytes from packets that have matched the entry.
440 The rest of the line consists of a description of the flow entry as
441 described in \fBFlow Syntax\fR, above.
447 Uses strict matching when running flow modification commands.
455 The following examples assume that an OpenFlow switch on the local
456 host has been configured to listen for management connections on a
457 Unix domain socket named \fB@RUNDIR@/openflow.sock\fR, e.g. by
458 specifying \fB--listen=punix:@RUNDIR@/openflow.sock\fR on the
459 \fBovs\-openflowd\fR(8) command line.
462 \fBovs\-ofctl dump-tables unix:@RUNDIR@/openflow.sock\fR
463 Prints out the switch's table stats. (This is more interesting after
464 some traffic has passed through.)
467 \fBovs\-ofctl dump-flows unix:@RUNDIR@/openflow.sock\fR
468 Prints the flow entries in the switch.
473 .BR ovs\-controller (8),
474 .BR ovs\-vswitchd (8)