1ovs-dpctl(8) Open vSwitch Manual ovs-dpctl(8)
2
3
4
6 ovs-dpctl - administer Open vSwitch datapaths
7
9 ovs-dpctl [options] command [switch] [args...]
10
12 The ovs-dpctl program can create, modify, and delete Open vSwitch data‐
13 paths. A single machine may host any number of datapaths.
14
15 This program works only with datapaths that are implemented outside of
16 ovs-vswitchd itself, such as the Linux and Windows kernel-based data‐
17 paths. To manage datapaths that are integrated into ovs-vswitchd, such
18 as the userspace (netdev) datapath, use ovs-appctl(8) to invoke the
19 dpctl/* commands, which are documented in ovs-vswitchd(8).
20
21 A newly created datapath is associated with only one network device, a
22 virtual network device sometimes called the datapath's ``local port''.
23 A newly created datapath is not, however, associated with any of the
24 host's other network devices. To intercept and process traffic on a
25 given network device, use the add-if command to explicitly add that
26 network device to the datapath.
27
28 If ovs-vswitchd(8) is in use, use ovs-vsctl(8) instead of ovs-dpctl.
29
30 Most ovs-dpctl commands that work with datapaths take an argument that
31 specifies the name of the datapath. Datapath names take the form
32 [type@]name, where name is the network device associated with the data‐
33 path's local port. If type is given, it specifies the datapath
34 provider of name, otherwise the default provider system is assumed.
35
36 The following commands manage datapaths. Do not use commands to add or
37 remove or modify datapaths if ovs-vswitchd is running because this in‐
38 terferes with ovs-vswitchd's own datapath management.
39
40 add-dp dp [netdev[,option]...]
41 Creates datapath dp, with a local port also named dp. This will
42 fail if a network device dp already exists.
43
44 If netdevs are specified, ovs-dpctl adds them to the new data‐
45 path, just as if add-if was specified.
46
47 del-dp dp
48 Deletes datapath dp. If dp is associated with any network de‐
49 vices, they are automatically removed.
50
51 add-if dp netdev[,option]...
52 Adds each netdev to the set of network devices datapath dp moni‐
53 tors, where dp is the name of an existing datapath, and netdev
54 is the name of one of the host's network devices, e.g. eth0.
55 Once a network device has been added to a datapath, the datapath
56 has complete ownership of the network device's traffic and the
57 network device appears silent to the rest of the system.
58
59 A netdev may be followed by a comma-separated list of options.
60 The following options are currently supported:
61
62 type=type
63 Specifies the type of port to add. The default type is
64 system.
65
66 port_no=port
67 Requests a specific port number within the datapath. If
68 this option is not specified then one will be automati‐
69 cally assigned.
70
71 key=value
72 Adds an arbitrary key-value option to the port's configu‐
73 ration.
74
75 ovs-vswitchd.conf.db(5) documents the available port types and
76 options.
77
78 set-if dp port[,option]...
79 Reconfigures each port in dp as specified. An option of the
80 form key=value adds the specified key-value option to the port
81 or overrides an existing key's value. An option of the form
82 key=, that is, without a value, deletes the key-value named key.
83 The type and port number of a port cannot be changed, so type
84 and port_no are only allowed if they match the existing configu‐
85 ration.
86
87 del-if dp netdev...
88 Removes each netdev from the list of network devices datapath dp
89 monitors.
90
91 dump-dps
92 Prints the name of each configured datapath on a separate line.
93
94 [-s | --statistics] show [dp...]
95 Prints a summary of configured datapaths, including their data‐
96 path numbers and a list of ports connected to each datapath.
97 (The local port is identified as port 0.) If -s or --statistics
98 is specified, then packet and byte counters are also printed for
99 each port.
100
101 The datapath numbers consists of flow stats and mega flow mask
102 stats.
103
104 The "lookups" row displays three stats related to flow lookup
105 triggered by processing incoming packets in the datapath. "hit"
106 displays number of packets matches existing flows. "missed" dis‐
107 plays the number of packets not matching any existing flow and
108 require user space processing. "lost" displays number of pack‐
109 ets destined for user space process but subsequently dropped be‐
110 fore reaching userspace. The sum of "hit" and "miss" equals to
111 the total number of packets datapath processed.
112
113 The "flows" row displays the number of flows in datapath.
114
115 The "masks" row displays the mega flow mask stats. This row is
116 omitted for datapath not implementing mega flow. "hit" displays
117 the total number of masks visited for matching incoming packets.
118 "total" displays number of masks in the datapath. "hit/pkt" dis‐
119 plays the average number of masks visited per packet; the ratio
120 between "hit" and total number of packets processed by the data‐
121 path.
122
123 If one or more datapaths are specified, information on only
124 those datapaths are displayed. Otherwise, ovs-dpctl displays
125 information about all configured datapaths.
126
127 DATAPATH FLOW TABLE DEBUGGING COMMANDS
128 The following commands are primarily useful for debugging Open vSwitch.
129 The flow table entries (both matches and actions) that they work with
130 are not OpenFlow flow entries. Instead, they are different and consid‐
131 erably simpler flows maintained by the Open vSwitch kernel module. Do
132 not use commands to add or remove or modify datapath flows if
133 ovs-vswitchd is running because it interferes with ovs-vswitchd's own
134 datapath flow management. Use ovs-ofctl(8), instead, to work with
135 OpenFlow flow entries.
136
137 The dp argument to each of these commands is optional when exactly one
138 datapath exists, in which case that datapath is the default. When mul‐
139 tiple datapaths exist, then a datapath name is required.
140
141 [-m | --more] [--names | --no-names] dump-flows [dp] [filter=filter]
142 [type=type] [pmd=pmd]
143 Prints to the console all flow entries in datapath dp's flow ta‐
144 ble. Without -m or --more, output omits match fields that a
145 flow wildcards entirely; with -m or --more, output includes all
146 wildcarded fields.
147
148 If filter=filter is specified, only displays the flows that
149 match the filter. filter is a flow in the form similar to that
150 accepted by ovs-ofctl(8)'s add-flow command. (This is not an
151 OpenFlow flow: besides other differences, it never contains
152 wildcards.) The filter is also useful to match wildcarded
153 fields in the datapath flow. As an example, fil‐
154 ter='tcp,tp_src=100' will match the datapath flow containing
155 'tcp(src=80/0xff00,dst=8080/0xff)'.
156
157 If pmd=pmd is specified, only displays flows of the specified
158 pmd. Using pmd=-1 will restrict the dump to flows from the main
159 thread. This option is only supported by the userspace data‐
160 path.
161
162 If type=type is specified, only displays flows of the specified
163 types. This option supported only for ovs-appctl
164 dpctl/dump-flows. type is a comma separated list, which can
165 contain any of the following:
166 ovs - displays flows handled in the ovs dp
167 tc - displays flows handled in the tc dp
168 dpdk - displays flows fully offloaded by dpdk
169 offloaded - displays flows offloaded to the HW
170 non-offloaded - displays flows not offloaded to the HW
171 partially-offloaded - displays flows where only part of their
172 proccessing is done in HW
173 all - displays all the types of flows
174
175 By default all the types of flows are displayed. ovs-dpctl al‐
176 ways acts as if the type was ovs.
177
178 add-flow [dp] flow actions
179
180 [--clear] [--may-create] [-s | --statistics] mod-flow [dp] flow actions
181 Adds or modifies a flow in dp's flow table that, when a packet
182 matching flow arrives, causes actions to be executed.
183
184 The add-flow command succeeds only if flow does not already ex‐
185 ist in dp. Contrariwise, mod-flow without --may-create only
186 modifies the actions for an existing flow. With --may-create,
187 mod-flow will add a new flow or modify an existing one.
188
189 If -s or --statistics is specified, then mod-flow prints the
190 modified flow's statistics. A flow's statistics are the number
191 of packets and bytes that have passed through the flow, the
192 elapsed time since the flow last processed a packet (if ever),
193 and (for TCP flows) the union of the TCP flags processed through
194 the flow.
195
196 With --clear, mod-flow zeros out the flow's statistics. The
197 statistics printed if -s or --statistics is also specified are
198 those from just before clearing the statistics.
199
200 NOTE: flow and actions do not match the syntax used with
201 ovs-ofctl(8)'s add-flow command.
202
203 Usage Examples
204
205 Forward ARP between ports 1 and 2 on datapath myDP:
206
207 ovs-dpctl add-flow myDP \
208 "in_port(1),eth(),eth_type(0x0806),arp()" 2
209
210 ovs-dpctl add-flow myDP \
211 "in_port(2),eth(),eth_type(0x0806),arp()" 1
212
213 Forward all IPv4 traffic between two addresses on ports 1 and 2:
214
215 ovs-dpctl add-flow myDP \
216 "in_port(1),eth(),eth_type(0x800),\
217 ipv4(src=172.31.110.4,dst=172.31.110.5)" 2
218
219 ovs-dpctl add-flow myDP \
220 "in_port(2),eth(),eth_type(0x800),\
221 ipv4(src=172.31.110.5,dst=172.31.110.4)" 1
222
223 add-flows [dp] file
224 mod-flows [dp] file
225 del-flows [dp] file
226 Reads flow entries from file (or stdin if file is -) and adds,
227 modifies, or deletes each entry to the datapath. Each flow
228 specification (e.g., each line in file) may start with add, mod‐
229 ify, or delete keyword to specify whether a flow is to be added,
230 modified, or deleted. A flow specification without one of these
231 keywords is treated based on the used command. All flow modifi‐
232 cations are executed as individual transactions in the order
233 specified.
234
235 [-s | --statistics] del-flow [dp] flow
236 Deletes the flow from dp's flow table that matches flow. If -s
237 or --statistics is specified, then del-flow prints the deleted
238 flow's statistics.
239
240 [-m | --more] [--names | --no-names] get-flow [dp] ufid:ufid
241 Fetches the flow from dp's flow table with unique identifier
242 ufid. ufid must be specified as a string of 32 hexadecimal
243 characters.
244
245 del-flows [dp]
246 Deletes all flow entries from datapath dp's flow table.
247
248 DATAPATH FLOW CACHE COMMANDS
249 The following commands are useful for debugging and configuring the
250 datapath flow cache settings.
251
252 cache-get-size [dp]
253 Prints the current cache sizes to the console.
254
255 cache-set-size dp cache size
256 Set the dp's specific cache to the given size. The cache name
257 can be found by using the cache-get-size command.
258
259 CONNECTION TRACKING TABLE COMMANDS
260 The following commands are useful for debugging and configuring the
261 connection tracking table in the datapath.
262
263 The dp argument to each of these commands is optional when exactly one
264 datapath exists, in which case that datapath is the default. When mul‐
265 tiple datapaths exist, then a datapath name is required.
266
267 N.B.(Linux specific): the system datapaths (i.e. the Linux kernel mod‐
268 ule Open vSwitch datapaths) share a single connection tracking table
269 (which is also used by other kernel subsystems, such as iptables, nfta‐
270 bles and the regular host stack). Therefore, the following commands do
271 not apply specifically to one datapath.
272
273 ipf-set-enabled [dp] v4|v6
274 ipf-set-disabled [dp] v4|v6
275 Enables or disables IP fragmentation handling for the userspace
276 connection tracker. Either v4 or v6 must be specified. Both
277 IPv4 and IPv6 fragment reassembly are enabled by default. Only
278 supported for the userspace datapath.
279
280 ipf-set-min-frag [dp] v4|v6 minfrag
281 Sets the minimum fragment size (L3 header and data) for non-fi‐
282 nal fragments to minfrag. Either v4 or v6 must be specified.
283 For enhanced DOS security, higher minimum fragment sizes can
284 usually be used. The default IPv4 value is 1200 and the clamped
285 minimum is 400. The default IPv6 value is 1280, with a clamped
286 minimum of 400, for testing flexibility. The maximum fragment
287 size is not clamped, however, setting this value too high might
288 result in valid fragments being dropped. Only supported for
289 userspace datapath.
290
291 ipf-set-max-nfrags [dp] maxfrags
292 Sets the maximum number of fragments tracked by the userspace
293 datapath connection tracker to maxfrags. The default value is
294 1000 and the clamped maximum is 5000. Note that packet buffers
295 can be held by the fragmentation module while fragments are in‐
296 complete, but will timeout after 15 seconds. Memory pool sizing
297 should be set accordingly when fragmentation is enabled. Only
298 supported for userspace datapath.
299
300 [-m | --more] ipf-get-status [dp]
301 Gets the configuration settings and fragment counters associated
302 with the fragmentation handling of the userspace datapath con‐
303 nection tracker. With -m or --more, also dumps the IP fragment
304 lists. Only supported for userspace datapath.
305
306 [-m | --more] [-s | --statistics] dump-conntrack [dp] [zone=zone]
307 Prints to the console all the connection entries in the tracker
308 used by dp. If zone=zone is specified, only shows the connec‐
309 tions in zone. With --more, some implementation specific de‐
310 tails are included. With --statistics timeouts and timestamps
311 are added to the output.
312
313 dump-conntrack-exp [dp] [zone=zone]
314 Prints to the console all the expectation entries in the tracker
315 used by dp. If zone=zone is specified, only shows the expecta‐
316 tions in zone. Only supported for userspace datapath.
317
318 flush-conntrack [dp] [zone=zone] [ct-origin-tuple [ct-reply-tuple]]
319 Flushes the connection entries in the tracker used by dp based
320 on zone and connection tracking tuple ct-origin-tuple. If ct-
321 tuple is not provided, flushes all the connection entries. If
322 zone=zone is specified, only flushes the connections in zone.
323
324 If ct-[orig|reply]-tuple is provided, flushes the connection en‐
325 try specified by ct-[orig|reply]-tuple in zone. The zone de‐
326 faults to 0 if it is not provided. The userspace connection
327 tracker requires flushing with the original pre-NATed tuple and
328 a warning log will be otherwise generated. The tuple can be
329 partial and will remove all connections that are matching on the
330 specified fields. In order to specify only ct-reply-tuple, pro‐
331 vide empty string as ct-origin-tuple.
332
333 Note: Currently there is a limitation for matching on ICMP, in
334 order to partially match on ICMP parameters the ct-[orig|re‐
335 ply]-tuple has to include either source or destination IP.
336
337 An example of an IPv4 ICMP ct-[orig|reply]-tuple:
338
339 "ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=1,icmp_type=8,icmp_code=0,icmp_id=10"
340
341 An example of an IPv6 TCP ct-[orig|reply]-tuple:
342
343 "ct_ipv6_src=fc00::1,ct_ipv6_dst=fc00::2,ct_nw_proto=6,ct_tp_src=1,ct_tp_dst=2"
344
345 [-m | --more] ct-stats-show [dp] [zone=zone]
346 Displays the number of connections grouped by protocol used by
347 dp. If zone=zone is specified, numbers refer to the connections
348 in zone. With --more, groups by connection state for each pro‐
349 tocol.
350
351 ct-bkts [dp] [gt=threshold]
352 For each conntrack bucket, displays the number of connections
353 used by dp. If gt=threshold is specified, bucket numbers are
354 displayed when the number of connections in a bucket is greater
355 than threshold.
356
357 ct-set-maxconns [dp] maxconns
358 Sets the maximum limit of connection tracker entries to maxconns
359 on dp. This can be used to reduce the processing load on the
360 system due to connection tracking or simply limiting connection
361 tracking. If the number of connections is already over the new
362 maximum limit request then the new maximum limit will be en‐
363 forced when the number of connections decreases to that limit,
364 which normally happens due to connection expiry. Only supported
365 for userspace datapath.
366
367 ct-get-maxconns [dp]
368 Prints the maximum limit of connection tracker entries on dp.
369 Only supported for userspace datapath.
370
371 ct-get-nconns [dp]
372 Prints the current number of connection tracker entries on dp.
373 Only supported for userspace datapath.
374
375 ct-enable-tcp-seq-chk [dp]
376 ct-disable-tcp-seq-chk [dp]
377 Enables or disables TCP sequence checking. When set to dis‐
378 abled, all sequence number verification is disabled, including
379 for TCP resets. This is similar, but not the same as 'be_lib‐
380 eral' mode, as in Netfilter. Disabling sequence number verifi‐
381 cation is not an optimization in itself, but is needed for some
382 hardware offload support which might offer some performance ad‐
383 vantage. Sequence number checking is enabled by default to en‐
384 force better security and should only be disabled if required
385 for hardware offload support. This command is only supported
386 for the userspace datapath.
387
388 ct-get-tcp-seq-chk [dp]
389 Prints whether TCP sequence checking is enabled or disabled on
390 dp. Only supported for the userspace datapath.
391
392 ct-set-sweep-interval [dp] ms
393 Sets the sweep interval. Only supported for the userspace data‐
394 path.
395
396 ct-get-sweep-interval [dp]
397 Prints the current sweep interval in ms. Only supported for the
398 userspace datapath.
399
400 ct-set-limits [dp] [default=default_limit] [zone=zone,limit=limit]...
401 Sets the maximum allowed number of connections in a connection
402 tracking zone. A specific zone may be set to limit, and multi‐
403 ple zones may be specified with a comma-separated list. If a
404 per-zone limit for a particular zone is not specified in the
405 datapath, it defaults to the default per-zone limit. A default
406 zone may be specified with the default=default_limit argument.
407 Initially, the default per-zone limit is unlimited. An unlim‐
408 ited number of entries may be set with 0 limit.
409
410 ct-del-limits [dp] zone=zone[,zone]...
411 Deletes the connection tracking limit for zone. Multiple zones
412 may be specified with a comma-separated list.
413
414 ct-get-limits [dp] [zone=zone[,zone]...]
415 Retrieves the maximum allowed number of connections and current
416 counts per-zone. If zone is given, only the specified zone(s)
417 are printed. If no zones are specified, all the zone limits and
418 counts are provided. The command always displays the default
419 zone limit.
420
422 -t
423 --timeout=secs
424 Limits ovs-dpctl runtime to approximately secs seconds. If the
425 timeout expires, ovs-dpctl will exit with a SIGALRM signal.
426
427 -v[spec]
428 --verbose=[spec]
429 Sets logging levels. Without any spec, sets the log level for
430 every module and destination to dbg. Otherwise, spec is a list
431 of words separated by spaces or commas or colons, up to one from
432 each category below:
433
434 • A valid module name, as displayed by the vlog/list com‐
435 mand on ovs-appctl(8), limits the log level change to the
436 specified module.
437
438 • syslog, console, or file, to limit the log level change
439 to only to the system log, to the console, or to a file,
440 respectively. (If --detach is specified, ovs-dpctl
441 closes its standard file descriptors, so logging to the
442 console will have no effect.)
443
444 On Windows platform, syslog is accepted as a word and is
445 only useful along with the --syslog-target option (the
446 word has no effect otherwise).
447
448 • off, emer, err, warn, info, or dbg, to control the log
449 level. Messages of the given severity or higher will be
450 logged, and messages of lower severity will be filtered
451 out. off filters out all messages. See ovs-appctl(8)
452 for a definition of each log level.
453
454 Case is not significant within spec.
455
456 Regardless of the log levels set for file, logging to a file
457 will not take place unless --log-file is also specified (see be‐
458 low).
459
460 For compatibility with older versions of OVS, any is accepted as
461 a word but has no effect.
462
463 -v
464 --verbose
465 Sets the maximum logging verbosity level, equivalent to --ver‐
466 bose=dbg.
467
468 -vPATTERN:destination:pattern
469 --verbose=PATTERN:destination:pattern
470 Sets the log pattern for destination to pattern. Refer to
471 ovs-appctl(8) for a description of the valid syntax for pattern.
472
473 -vFACILITY:facility
474 --verbose=FACILITY:facility
475 Sets the RFC5424 facility of the log message. facility can be
476 one of kern, user, mail, daemon, auth, syslog, lpr, news, uucp,
477 clock, ftp, ntp, audit, alert, clock2, local0, local1, local2,
478 local3, local4, local5, local6 or local7. If this option is not
479 specified, daemon is used as the default for the local system
480 syslog and local0 is used while sending a message to the target
481 provided via the --syslog-target option.
482
483 --log-file[=file]
484 Enables logging to a file. If file is specified, then it is
485 used as the exact name for the log file. The default log file
486 name used if file is omitted is /var/log/open‐
487 vswitch/ovs-dpctl.log.
488
489 --syslog-target=host:port
490 Send syslog messages to UDP port on host, in addition to the
491 system syslog. The host must be a numerical IP address, not a
492 hostname.
493
494 --syslog-method=method
495 Specify method how syslog messages should be sent to syslog dae‐
496 mon. Following forms are supported:
497
498 • libc, use libc syslog() function. Downside of using this
499 options is that libc adds fixed prefix to every message
500 before it is actually sent to the syslog daemon over
501 /dev/log UNIX domain socket.
502
503 • unix:file, use UNIX domain socket directly. It is possi‐
504 ble to specify arbitrary message format with this option.
505 However, rsyslogd 8.9 and older versions use hard coded
506 parser function anyway that limits UNIX domain socket
507 use. If you want to use arbitrary message format with
508 older rsyslogd versions, then use UDP socket to localhost
509 IP address instead.
510
511 • udp:ip:port, use UDP socket. With this method it is pos‐
512 sible to use arbitrary message format also with older
513 rsyslogd. When sending syslog messages over UDP socket
514 extra precaution needs to be taken into account, for ex‐
515 ample, syslog daemon needs to be configured to listen on
516 the specified UDP port, accidental iptables rules could
517 be interfering with local syslog traffic and there are
518 some security considerations that apply to UDP sockets,
519 but do not apply to UNIX domain sockets.
520
521 • null, discards all messages logged to syslog.
522
523 The default is taken from the OVS_SYSLOG_METHOD environment
524 variable; if it is unset, the default is libc.
525
526 -h
527 --help Prints a brief help message to the console.
528
529 -V
530 --version
531 Prints version information to the console.
532
534 ovs-appctl(8), ovs-vswitchd(8)
535
536
537
538Open vSwitch 3.2.0 ovs-dpctl(8)