]> git.proxmox.com Git - mirror_ovs.git/blame - lib/dpctl.man
cirrus: Use FreeBSD 12.2.
[mirror_ovs.git] / lib / dpctl.man
CommitLineData
f4b72cb4
BP
1Do not use commands to add or remove or modify datapaths if
2\fBovs\-vswitchd\fR is running because this interferes with
3\fBovs\-vswitchd\fR's own datapath management.
fceef209
DDP
4.TP
5\*(DX\fBadd\-dp \fIdp\fR [\fInetdev\fR[\fB,\fIoption\fR]...]
6Creates datapath \fIdp\fR, with a local port also named \fIdp\fR.
7This will fail if a network device \fIdp\fR already exists.
8.IP
9If \fInetdev\fRs are specified, \fB\*(PN\fR adds them to the
10new datapath, just as if \fBadd\-if\fR was specified.
11.
12.TP
13\*(DX\fBdel\-dp \fIdp\fR
14Deletes datapath \fIdp\fR. If \fIdp\fR is associated with any network
15devices, they are automatically removed.
16.
17.TP
18\*(DX\fBadd\-if \fIdp netdev\fR[\fB,\fIoption\fR]...
19Adds each \fInetdev\fR to the set of network devices datapath
20\fIdp\fR monitors, where \fIdp\fR is the name of an existing
21datapath, and \fInetdev\fR is the name of one of the host's
22network devices, e.g. \fBeth0\fR. Once a network device has been added
23to a datapath, the datapath has complete ownership of the network device's
24traffic and the network device appears silent to the rest of the
25system.
26.IP
27A \fInetdev\fR may be followed by a comma-separated list of options.
28The following options are currently supported:
29.
30.RS
31.IP "\fBtype=\fItype\fR"
32Specifies the type of port to add. The default type is \fBsystem\fR.
33.IP "\fBport_no=\fIport\fR"
34Requests a specific port number within the datapath. If this option is
35not specified then one will be automatically assigned.
36.IP "\fIkey\fB=\fIvalue\fR"
37Adds an arbitrary key-value option to the port's configuration.
38.RE
39.IP
40\fBovs\-vswitchd.conf.db\fR(5) documents the available port types and
41options.
42.
43.IP "\*(DX\fBset\-if \fIdp port\fR[\fB,\fIoption\fR]..."
44Reconfigures each \fIport\fR in \fIdp\fR as specified. An
45\fIoption\fR of the form \fIkey\fB=\fIvalue\fR adds the specified
46key-value option to the port or overrides an existing key's value. An
47\fIoption\fR of the form \fIkey\fB=\fR, that is, without a value,
48deletes the key-value named \fIkey\fR. The type and port number of a
49port cannot be changed, so \fBtype\fR and \fBport_no\fR are only allowed if
50they match the existing configuration.
51.TP
52\*(DX\fBdel\-if \fIdp netdev\fR...
53Removes each \fInetdev\fR from the list of network devices datapath
54\fIdp\fR monitors.
55.
56.TP
57\*(DX\fBdump\-dps\fR
58Prints the name of each configured datapath on a separate line.
59.
60.TP
61.DO "[\fB\-s\fR | \fB\-\-statistics\fR]" "\*(DX\fBshow" "\fR[\fIdp\fR...]"
62Prints a summary of configured datapaths, including their datapath
63numbers and a list of ports connected to each datapath. (The local
64port is identified as port 0.) If \fB\-s\fR or \fB\-\-statistics\fR
65is specified, then packet and byte counters are also printed for each
66port.
67.IP
68The datapath numbers consists of flow stats and mega flow mask stats.
69.IP
70The "lookups" row displays three stats related to flow lookup triggered
71by processing incoming packets in the datapath. "hit" displays number
72of packets matches existing flows. "missed" displays the number of
73packets not matching any existing flow and require user space processing.
74"lost" displays number of packets destined for user space process but
75subsequently dropped before reaching userspace. The sum of "hit" and "miss"
76equals to the total number of packets datapath processed.
77.IP
78The "flows" row displays the number of flows in datapath.
79.IP
80The "masks" row displays the mega flow mask stats. This row is omitted
81for datapath not implementing mega flow. "hit" displays the total number
82of masks visited for matching incoming packets. "total" displays number of
83masks in the datapath. "hit/pkt" displays the average number of masks
84visited per packet; the ratio between "hit" and total number of
d1fd1ea9 85packets processed by the datapath.
fceef209
DDP
86.IP
87If one or more datapaths are specified, information on only those
88datapaths are displayed. Otherwise, \fB\*(PN\fR displays information
89about all configured datapaths.
90.SS "DATAPATH FLOW TABLE DEBUGGING COMMANDS"
91The following commands are primarily useful for debugging Open
92vSwitch. The flow table entries (both matches and actions) that they
93work with are not OpenFlow flow entries. Instead, they are different
94and considerably simpler flows maintained by the Open vSwitch kernel
f4b72cb4
BP
95module. Do not use commands to add or remove or modify datapath flows
96if \fBovs\-vswitchd\fR is running because it interferes with
97\fBovs\-vswitchd\fR's own datapath flow management. Use
98\fBovs\-ofctl\fR(8), instead, to work with OpenFlow flow entries.
fceef209
DDP
99.
100.PP
101The \fIdp\fR argument to each of these commands is optional when
102exactly one datapath exists, in which case that datapath is the
103default. When multiple datapaths exist, then a datapath name is
104required.
105.
106.TP
2fe34c03 107.DO "[\fB\-m \fR| \fB\-\-more\fR] [\fB\-\-names \fR| \fB\-\-no\-names\fR]" \*(DX\fBdump\-flows\fR "[\fIdp\fR] [\fBfilter=\fIfilter\fR] [\fBtype=\fItype\fR] [\fBpmd=\fIpmd\fR]"
fceef209
DDP
108Prints to the console all flow entries in datapath \fIdp\fR's flow
109table. Without \fB\-m\fR or \fB\-\-more\fR, output omits match fields
110that a flow wildcards entirely; with \fB\-m\fR or \fB\-\-more\fR,
111output includes all wildcarded fields.
112.IP
113If \fBfilter=\fIfilter\fR is specified, only displays the flows
114that match the \fIfilter\fR. \fIfilter\fR is a flow in the form similiar
115to that accepted by \fBovs\-ofctl\fR(8)'s \fBadd\-flow\fR command. (This is
116not an OpenFlow flow: besides other differences, it never contains wildcards.)
117The \fIfilter\fR is also useful to match wildcarded fields in the datapath
118flow. As an example, \fBfilter='tcp,tp_src=100'\fR will match the
119datapath flow containing '\fBtcp(src=80/0xff00,dst=8080/0xff)\fR'.
7e8b7199 120.IP
2fe34c03
TZ
121If \fBpmd=\fIpmd\fR is specified, only displays flows of the specified pmd.
122Using \fBpmd=\fI-1\fR will restrict the dump to flows from the main thread.
123This option is only supported by the \fBuserspace datapath\fR.
124.IP
a692410a 125If \fBtype=\fItype\fR is specified, only displays flows of the specified types.
d74ca226 126This option supported only for \fBovs\-appctl dpctl/dump\-flows\fR.
a692410a
GT
127\fItype\fR is a comma separated list, which can contain any of the following:
128.
129 \fBovs\fR - displays flows handled in the ovs dp
130 \fBtc\fR - displays flows handled in the tc dp
80944cb4 131 \fBdpdk\fR - displays flows fully offloaded by dpdk
a692410a
GT
132 \fBoffloaded\fR - displays flows offloaded to the HW
133 \fBnon-offloaded\fR - displays flows not offloaded to the HW
80944cb4 134 \fBpartially-offloaded\fR - displays flows where only part of their proccessing is done in HW
a692410a
GT
135 \fBall\fR - displays all the types of flows
136.IP
137By default all the types of flows are displayed.
d74ca226 138\fBovs\-dpctl\fR always acts as if the \fBtype\fR was \fIovs\fR.
fceef209
DDP
139.
140.IP "\*(DX\fBadd\-flow\fR [\fIdp\fR] \fIflow actions\fR"
141.TP
142.DO "[\fB\-\-clear\fR] [\fB\-\-may-create\fR] [\fB\-s\fR | \fB\-\-statistics\fR]" "\*(DX\fBmod\-flow\fR" "[\fIdp\fR] \fIflow actions\fR"
143Adds or modifies a flow in \fIdp\fR's flow table that, when a packet
144matching \fIflow\fR arrives, causes \fIactions\fR to be executed.
145.IP
146The \fBadd\-flow\fR command succeeds only if \fIflow\fR does not
147already exist in \fIdp\fR. Contrariwise, \fBmod\-flow\fR without
148\fB\-\-may\-create\fR only modifies the actions for an existing flow.
149With \fB\-\-may\-create\fR, \fBmod\-flow\fR will add a new flow or
150modify an existing one.
151.IP
152If \fB\-s\fR or \fB\-\-statistics\fR is specified, then
d0c4f1dc 153\fBmod\-flow\fR prints the modified flow's statistics. A flow's
fceef209
DDP
154statistics are the number of packets and bytes that have passed
155through the flow, the elapsed time since the flow last processed a
156packet (if ever), and (for TCP flows) the union of the TCP flags
157processed through the flow.
158.IP
d0c4f1dc 159With \fB\-\-clear\fR, \fBmod\-flow\fR zeros out the flow's
fceef209
DDP
160statistics. The statistics printed if \fB\-s\fR or
161\fB\-\-statistics\fR is also specified are those from just before
162clearing the statistics.
07e0337b
AC
163.IP
164NOTE:
165\fIflow\fR and \fIactions\fR do not match the syntax used with
166\fBovs\-ofctl\fR(8)'s \fBadd\-flow\fR command.
167.
168.IP
169\fBUsage Examples\fR
170.
171.RS
172.PP
173Forward ARP between ports 1 and 2 on datapath myDP:
174.IP
175ovs-dpctl add-flow myDP \\
176.
177 "in_port(1),eth(),eth_type(0x0806),arp()" 2
178.
179.IP
180ovs-dpctl add-flow myDP \\
fceef209 181.
07e0337b
AC
182 "in_port(2),eth(),eth_type(0x0806),arp()" 1
183.
184.PP
185Forward all IPv4 traffic between two addresses on ports 1 and 2:
186.
187.IP
188ovs-dpctl add-flow myDP \\
189.
190 "in_port(1),eth(),eth_type(0x800),\\
191 ipv4(src=172.31.110.4,dst=172.31.110.5)" 2
192.
193.IP
194ovs-dpctl add-flow myDP \\
195.
196 "in_port(2),eth(),eth_type(0x800),\\
197 ipv4(src=172.31.110.5,dst=172.31.110.4)" 1
198.
199.RE
fceef209 200.TP
bf8812cd
EC
201\*(DX\fBadd\-flows\fR [\fIdp\fR] \fIfile\fR
202.TQ
203\*(DX\fBmod\-flows\fR [\fIdp\fR] \fIfile\fR
204.TQ
205\*(DX\fBdel\-flows\fR [\fIdp\fR] \fIfile\fR
206Reads flow entries from \fIfile\fR (or \fBstdin\fR if \fIfile\fR is
207\fB\-\fR) and adds, modifies, or deletes each entry to the datapath.
208.
209Each flow specification (e.g., each line in \fIfile\fR) may start with
210\fBadd\fR, \fBmodify\fR, or \fBdelete\fR keyword to specify whether a
211flow is to be added, modified, or deleted. A flow specification without
212one of these keywords is treated based on the used command. All flow
213modifications are executed as individual transactions in the order
214specified.
215.
216.TP
fceef209
DDP
217.DO "[\fB\-s\fR | \fB\-\-statistics\fR]" "\*(DX\fBdel\-flow\fR" "[\fIdp\fR] \fIflow\fR"
218Deletes the flow from \fIdp\fR's flow table that matches \fIflow\fR.
219If \fB\-s\fR or \fB\-\-statistics\fR is specified, then
d0c4f1dc 220\fBdel\-flow\fR prints the deleted flow's statistics.
fceef209 221.
d1fd1ea9
BP
222.TP
223.DO "[\fB\-m \fR| \fB\-\-more\fR] [\fB\-\-names \fR| \fB\-\-no\-names\fR]" "\*(DX\fBget\-flow\fR [\fIdp\fR] ufid:\fIufid\fR"
818650e6
JS
224Fetches the flow from \fIdp\fR's flow table with unique identifier \fIufid\fR.
225\fIufid\fR must be specified as a string of 32 hexadecimal characters.
226.
fceef209
DDP
227.IP "\*(DX\fBdel\-flows\fR [\fIdp\fR]"
228Deletes all flow entries from datapath \fIdp\fR's flow table.
4eeec031
YHW
229.SS "CONNECTION TRACKING TABLE COMMANDS"
230The following commands are useful for debugging and configuring
231the connection tracking table in the datapath.
dffae65f
DDP
232.
233.PP
234The \fIdp\fR argument to each of these commands is optional when
235exactly one datapath exists, in which case that datapath is the
236default. When multiple datapaths exist, then a datapath name is
237required.
238.
239.PP
240\fBN.B.\fR(Linux specific): the \fIsystem\fR datapaths (i.e. the Linux
241kernel module Open vSwitch datapaths) share a single connection tracking
242table (which is also used by other kernel subsystems, such as iptables,
243nftables and the regular host stack). Therefore, the following commands
244do not apply specifically to one datapath.
245.
246.TP
4ea96698
DB
247\*(DX\fBipf\-set\-enabled\fR [\fIdp\fR] \fBv4\fR|\fBv6\fR
248.TQ
249\*(DX\fBipf\-set\-disabled\fR [\fIdp\fR] \fBv4\fR|\fBv6\fR
250Enables or disables IP fragmentation handling for the userspace
251connection tracker. Either \fBv4\fR or \fBv6\fR must be specified.
252Both IPv4 and IPv6 fragment reassembly are enabled by default. Only
253supported for the userspace datapath.
254.
255.TP
256\*(DX\fBipf\-set\-min\-frag\fR [\fIdp\fR] \fBv4\fR|\fBv6\fR \fIminfrag\fR
9b5136c3 257Sets the minimum fragment size (L3 header and data) for non-final fragments to
4ea96698
DB
258\fIminfrag\fR. Either \fBv4\fR or \fBv6\fR must be specified. For
259enhanced DOS security, higher minimum fragment sizes can usually be used.
260The default IPv4 value is 1200 and the clamped minimum is 400. The default
261IPv6 value is 1280, with a clamped minimum of 400, for testing
262flexibility. The maximum fragment size is not clamped, however, setting
263this value too high might result in valid fragments being dropped. Only
264supported for userspace datapath.
265.
266.TP
267\*(DX\fBipf\-set\-max\-nfrags\fR [\fIdp\fR] \fImaxfrags\fR
268Sets the maximum number of fragments tracked by the userspace datapath
269connection tracker to \fImaxfrags\fR. The default value is 1000 and the
270clamped maximum is 5000. Note that packet buffers can be held by the
271fragmentation module while fragments are incomplete, but will timeout
272after 15 seconds. Memory pool sizing should be set accordingly when
273fragmentation is enabled. Only supported for userspace datapath.
274.
275.TP
276.DO "[\fB\-m\fR | \fB\-\-more\fR]" "\*(DX\fBipf\-get\-status\fR [\fIdp\fR]"
277Gets the configuration settings and fragment counters associated with the
278fragmentation handling of the userspace datapath connection tracker.
279With \fB\-m\fR or \fB\-\-more\fR, also dumps the IP fragment lists.
280Only supported for userspace datapath.
281.
282.TP
dffae65f
DDP
283.DO "[\fB\-m\fR | \fB\-\-more\fR] [\fB\-s\fR | \fB\-\-statistics\fR]" "\*(DX\fBdump\-conntrack\fR" "[\fIdp\fR] [\fBzone=\fIzone\fR]"
284Prints to the console all the connection entries in the tracker used by
285\fIdp\fR. If \fBzone=\fIzone\fR is specified, only shows the connections
3987180f 286in \fIzone\fR. With \fB\-\-more\fR, some implementation specific details
dffae65f
DDP
287are included. With \fB\-\-statistics\fR timeouts and timestamps are
288added to the output.
7f278d1f
DDP
289.
290.TP
c43a1331
YHW
291\*(DX\fBflush\-conntrack\fR [\fIdp\fR] [\fBzone=\fIzone\fR] [\fIct-tuple\fR]
292Flushes the connection entries in the tracker used by \fIdp\fR based on
293\fIzone\fR and connection tracking tuple \fIct-tuple\fR.
294If \fIct-tuple\fR is not provided, flushes all the connection entries.
295If \fBzone\fR=\fIzone\fR is specified, only flushes the connections in
296\fIzone\fR.
297.IP
298If \fIct-tuple\fR is provided, flushes the connection entry specified by
299\fIct-tuple\fR in \fIzone\fR. The zone defaults to 0 if it is not provided.
a1d5eeff
DB
300The userspace connection tracker requires flushing with the original pre-NATed
301tuple and a warning log will be otherwise generated.
c43a1331
YHW
302An example of an IPv4 ICMP \fIct-tuple\fR:
303.IP
304"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"
305.IP
306An example of an IPv6 TCP \fIct-tuple\fR:
307.IP
308"ct_ipv6_src=fc00::1,ct_ipv6_dst=fc00::2,ct_nw_proto=6,ct_tp_src=1,ct_tp_dst=2"
8a0d9d85
FA
309.
310.TP
16b361ef 311.DO "[\fB\-m\fR | \fB\-\-more\fR]" "\*(DX\fBct\-stats\-show\fR [\fIdp\fR] [\fBzone=\fIzone\fR]"
8a0d9d85
FA
312Displays the number of connections grouped by protocol used by \fIdp\fR.
313If \fBzone=\fIzone\fR is specified, numbers refer to the connections in
3987180f 314\fIzone\fR. With \fB\-\-more\fR, groups by connection state for each
16b361ef 315protocol.
ded30c74
FA
316.
317.TP
3987180f
JP
318\*(DX\fBct\-bkts\fR [\fIdp\fR] [\fBgt=\fIthreshold\fR]
319For each conntrack bucket, displays the number of connections used
ded30c74 320by \fIdp\fR.
3987180f
JP
321If \fBgt=\fIthreshold\fR is specified, bucket numbers are displayed when
322the number of connections in a bucket is greater than \fIthreshold\fR.
c92339ad
DB
323.
324.TP
3987180f
JP
325\*(DX\fBct\-set\-maxconns\fR [\fIdp\fR] \fImaxconns\fR
326Sets the maximum limit of connection tracker entries to \fImaxconns\fR
327on \fIdp\fR. This can be used to reduce the processing load on the
328system due to connection tracking or simply limiting connection
329tracking. If the number of connections is already over the new maximum
330limit request then the new maximum limit will be enforced when the
331number of connections decreases to that limit, which normally happens
332due to connection expiry. Only supported for userspace datapath.
c92339ad
DB
333.
334.TP
335\*(DX\fBct\-get\-maxconns\fR [\fIdp\fR]
3987180f 336Prints the maximum limit of connection tracker entries on \fIdp\fR.
c92339ad 337Only supported for userspace datapath.
875075b3
DB
338.
339.TP
340\*(DX\fBct\-get\-nconns\fR [\fIdp\fR]
3987180f 341Prints the current number of connection tracker entries on \fIdp\fR.
875075b3 342Only supported for userspace datapath.
4eeec031
YHW
343.
344.TP
64207120
DB
345\*(DX\fBct\-enable\-tcp\-seq\-chk\fR [\fIdp\fR]
346.TQ
347\*(DX\fBct\-disable\-tcp\-seq\-chk\fR [\fIdp\fR]
348Enables or disables TCP sequence checking. When set to disabled, all sequence
349number verification is disabled, including for TCP resets. This is
350similar, but not the same as 'be_liberal' mode, as in Netfilter. Disabling
351sequence number verification is not an optimization in itself, but is needed
352for some hardware offload support which might offer some performance
353advantage. Sequence number checking is enabled by default to enforce better
354security and should only be disabled if required for hardware offload support.
355This command is only supported for the userspace datapath.
356.
357.TP
358\*(DX\fBct\-get\-tcp\-seq\-chk\fR [\fIdp\fR]
359Prints whether TCP sequence checking is enabled or disabled on \fIdp\fR. Only
360supported for the userspace datapath.
361.
362.TP
4eeec031
YHW
363\*(DX\fBct\-set\-limits\fR [\fIdp\fR] [\fBdefault=\fIdefault_limit\fR] [\fBzone=\fIzone\fR,\fBlimit=\fIlimit\fR]...
364Sets the maximum allowed number of connections in a connection tracking
365zone. A specific \fIzone\fR may be set to \fIlimit\fR, and multiple zones
366may be specified with a comma-separated list. If a per-zone limit for a
367particular zone is not specified in the datapath, it defaults to the
368default per-zone limit. A default zone may be specified with the
369\fBdefault=\fIdefault_limit\fR argument. Initially, the default
370per-zone limit is unlimited. An unlimited number of entries may be set
a7f33fdb 371with \fB0\fR limit.
4eeec031
YHW
372.
373.TP
374\*(DX\fBct\-del\-limits\fR [\fIdp\fR] \fBzone=\fIzone[,zone]\fR...
375Deletes the connection tracking limit for \fIzone\fR. Multiple zones may
a7f33fdb 376be specified with a comma-separated list.
4eeec031
YHW
377.
378.TP
379\*(DX\fBct\-get\-limits\fR [\fIdp\fR] [\fBzone=\fIzone\fR[\fB,\fIzone\fR]...]
380Retrieves the maximum allowed number of connections and current
381counts per-zone. If \fIzone\fR is given, only the specified zone(s) are
382printed. If no zones are specified, all the zone limits and counts are
a7f33fdb 383provided. The command always displays the default zone limit.