dpif-netlink: add GENEVE creation support
[cascardo/ovs.git] / utilities / ovs-ctl.8
1 .\" -*- nroff -*-
2 .de IQ
3 .  br
4 .  ns
5 .  IP "\\$1"
6 ..
7 .de ST
8 .  PP
9 .  RS -0.15in
10 .  I "\\$1"
11 .  RE
12 ..
13 .TH ovs\-ctl 8 "June 2011" "Open vSwitch" "Open vSwitch Manual"
14 .ds PN ovs\-ctl
15 .
16 .SH NAME
17 ovs\-ctl \- OVS startup helper script
18 .
19 .SH SYNOPSIS
20 \fBovs\-ctl\fR \fB\-\-system\-id=random\fR|\fIuuid\fR
21 [\fIoptions\fR] \fBstart
22 .br
23 \fBovs\-ctl stop
24 .br
25 \fBovs\-ctl\fR \fB\-\-system\-id=random\fR|\fIuuid\fR
26 [\fIoptions\fR] \fBrestart
27 .br
28 \fBovs\-ctl status
29 .br
30 \fBovs\-ctl version
31 .br
32 \fBovs\-ctl
33 [\fIoptions\fR]
34 \fBload\-kmod\fR
35 .br
36 \fBovs\-ctl
37 \fB\-\-system\-id=random\fR|\fIuuid\fR
38 [\fIoptions\fR]
39 \fBforce\-reload\-kmod\fR
40 .br
41 \fBovs\-ctl
42 \fR[\fB\-\-protocol=\fIprotocol\fR]
43 [\fB\-\-sport=\fIsport\fR]
44 [\fB\-\-dport=\fIdport\fR]
45 \fBenable\-protocol\fR
46 .br
47 \fBovs\-ctl help \fR| \fB\-h \fR| \fB\-\-help
48 .br
49 \fBovs\-ctl \-\-version
50 .
51 .SH DESCRIPTION
52 .
53 .PP
54 The \fBovs\-ctl\fR program starts, stops, and checks the status of
55 Open vSwitch daemons.  It is not meant to be invoked directly by
56 system administrators but to be called internally by system startup
57 scripts.
58 .
59 .PP
60 Each of \fBovs\-ctl\fR's commands is described separately below.
61 .
62 .SH "The ``start'' command"
63 .
64 .PP
65 The \fBstart\fR command starts Open vSwitch.  It performs the
66 following tasks:
67 .
68 .IP 1.
69 Loads the Open vSwitch kernel module.  If this fails, and the Linux
70 bridge module is loaded but no bridges exist, it tries to unload the
71 bridge module and tries loading the Open vSwitch kernel module again.
72 (This is because the Open vSwitch kernel module cannot coexist with
73 the Linux bridge module before 2.6.37.)
74 .
75 .PP
76 The \fBstart\fR command skips the following steps if
77 \fBovsdb\-server\fR is already running:
78 .IP 2.
79 If the Open vSwitch database file does not exist, it creates it.
80 If the database does exist, but it has an obsolete version, it
81 upgrades it to the latest schema.
82 .
83 .IP 3.
84 Starts \fBovsdb-server\fR, unless the \fB\-\-no\-ovsdb\-server\fR command
85 option is given.
86 .
87 .IP 4.
88 Initializes a few values inside the database.
89 .
90 .IP 5.
91 If the \fB\-\-delete\-bridges\fR option was used, deletes all of the
92 bridges from the database.
93 .
94 .IP 6.
95 If the \fB\-\-delete\-transient\-ports\fR option was used, deletes all ports
96 that have \fBother_config:transient\fR set to true.
97 .
98 .PP
99 The \fBstart\fR command skips the following step if
100 \fBovs\-vswitchd\fR is already running, or if the \fB\-\-no\-ovs\-vswitchd\fR
101 command option is given:
102 .IP 7.
103 Starts \fBovs\-vswitchd\fR.
104 .
105 .SS "Options"
106 .PP
107 Several command-line options influence the \fBstart\fR command's
108 behavior.  Some form of the following option should ordinarily be
109 specified:
110 .
111 .IP "\fB\-\-system\-id=\fIuuid\fR"
112 .IQ "\fB\-\-system\-id=random\fR"
113 This specifies a unique system identifier to store into
114 \fBexternal-ids:system-id\fR in the database's \fBOpen_vSwitch\fR
115 table.  Remote managers that talk to the Open vSwitch database server
116 over network protocols use this value to identify and distinguish Open
117 vSwitch instances, so it should be unique (at least) within OVS
118 instances that will connect to a single controller.
119 .IP
120 When \fBrandom\fR is specified, \fBovs\-ctl\fR will generate a random
121 ID that persists from one run to another (stored in a file).  When
122 another string is specified \fBovs\-ctl\fR uses it literally.
123 .
124 .PP
125 The following options should be specified if the defaults are not
126 suitable:
127 .
128 .IP "\fB\-\-system\-type=\fItype\fR"
129 .IQ "\fB\-\-system\-version=\fIversion\fR"
130 Sets the value to store in the \fBsystem-type\fR and
131 \fBsystem-version\fR columns, respectively, in the database's
132 \fBOpen_vSwitch\fR table.  Remote managers may use these values to
133 determine the kind of system to which they are connected (primarily
134 for display to human administrators).
135 .IP
136 When not specified, \fBovs\-ctl\fR uses values from the optional
137 \fBsystem\-type.conf\fR and \fBsystem\-version.conf\fR files(see section
138 \fBFILES\fR) or it uses the \fBlsb_release\fR program, if present, to
139 provide reasonable defaults.
140 .
141 .PP
142 The following options are also likely to be useful:
143 .
144 .IP "\fB\-\-external\-id=\(dq\fIname\fB=\fIvalue\fB\(dq"
145 Sets \fBexternal-ids:\fIname\fR to \fIvalue\fR in the database's
146 \fBOpen_vSwitch\fR table.  Specifying this option multiple times adds
147 multiple key-value pairs.
148 .
149 .IP "\fB\-\-delete\-bridges\fR"
150 Ordinarily Open vSwitch bridges persist from one system boot to the
151 next, as long as the database is preserved.  Some environments instead
152 expect to re-create all of the bridges and other configuration state
153 on every boot.  This option supports that, by deleting all Open
154 vSwitch bridges after starting \fBovsdb\-server\fR but before starting
155 \fBovs\-vswitchd\fR.
156 .
157 .IP "\fB\-\-delete\-transient\-ports\fR"
158 Deletes all ports that have the other_config:transient value set to true. This
159 is important on certain environments where some ports are going to be recreated
160 after reboot, but other ports need to be persisted in the database.
161 .
162 .PP
163 The following options are less important:
164 .
165 .IP "\fB\-\-daemon-cwd=\fIdirectory\fR"
166 Specifies the current working directory that the OVS daemons should
167 run from.  The default is \fB/\fR (the root directory) if this option
168 is not specified.  (This option is useful because most systems create
169 core files in a process's current working directory and because a file
170 system that is in use as a process's current working directory cannot
171 be unmounted.)
172 .
173 .IP "\fB\-\-no\-force\-corefiles\fR"
174 By default, \fBovs\-ctl\fR enables core dumps for the OVS daemons.
175 This option disables that behavior.
176 .
177 .IP "\fB\-\-no\-mlockall\fR"
178 By default \fBovs\-ctl\fR passes \fB\-\-mlockall\fR to
179 \fBovs\-vswitchd\fR, requesting that it lock all of its virtual
180 memory, preventing it from being paged to disk.  This option
181 suppresses that behavior.
182 .
183 .IP "\fB\-\-ovsdb\-server\-priority=\fIniceness\fR"
184 .IQ "\fB\-\-ovs\-vswitchd\-priority=\fIniceness\fR"
185 Sets the \fBnice\fR(1) level used for each daemon.  All of them
186 default to \fB\-10\fR.
187 .
188 .IP "\fB\-\-ovsdb\-server\-wrapper=\fIwrapper\fR"
189 .IQ "\fB\-\-ovs\-vswitchd\-wrapper=\fIwrapper\fR"
190 .
191 Configures the specified daemon to run under \fIwrapper\fR, which is
192 one of the following:
193 .
194 .RS
195 .IP "\fBvalgrind\fR"
196 Run the daemon under \fBvalgrind\fR(1), if it is installed, logging to
197 \fIdaemon\fB.valgrind.log.\fIpid\fR in the log directory.
198 .
199 .IP "\fBstrace\fR"
200 Run the daemon under \fBstrace\fR(1), if it is installed, logging to
201 \fIdaemon\fB.strace.log.\fIpid\fR in the log directory.
202 .
203 .IP "\fBglibc\fR"
204 Enable GNU C library features designed to find memory errors.
205 .RE
206 .
207 .IP
208 By default, no wrapper is used.
209 .
210 .IP
211 Each of the wrappers can expose bugs in Open vSwitch that lead to
212 incorrect operation, including crashes.  The \fBvalgrind\fR and
213 \fBstrace\fR wrappers greatly slow daemon operations so they should
214 not be used in production.  They also produce voluminous logs that can
215 quickly fill small disk partitions.  The \fBglibc\fR wrapper is less
216 resource-intensive but still somewhat slows the daemons.
217 .
218 .PP
219 The following options control file locations.  They should only be
220 used if the default locations cannot be used.  See \fBFILES\fR, below,
221 for more information.
222 .
223 .IP "\fB\-\-db\-file=\fIfile\fR"
224 Overrides the file name for the OVS database.
225 .
226 .IP "\fB\-\-db\-sock=\fIsocket\fR"
227 Overrides the file name for the Unix domain socket used to connect to
228 \fBovsdb\-server\fR.
229 .
230 .IP "\fB\-\-db\-schema=\fIschema\fR"
231 Overrides the file name for the OVS database schema.
232 .
233 .IP "\fB\-\-extra-dbs=\fIfile\fR"
234 Adds \fIfile\fR as an extra database for \fBovsdb\-server\fR to serve
235 out.  Multiple space-separated file names may also be specified.
236 \fIfile\fR should begin with \fB/\fR; if it does not, then it will be
237 taken as relative to \fIdbdir\fR.
238 .
239 .SH "The ``stop'' command"
240 .
241 .PP
242 The \fBstop\fR command does not unload the Open vSwitch kernel
243 modules. It can take the same \fB\-\-no\-ovsdb\-server\fR and
244 \fB\-\-no\-ovs\-vswitchd\fR options as that of the \fBstart\fR
245 command. 
246 .
247 .PP
248 This command does nothing and finishes successfully if the OVS daemons
249 aren't running.
250 .
251 .SH "The ``restart'' command"
252 .
253 .PP
254 The \fBrestart\fR command performs a \fBstop\fR followed by a \fBstart\fR
255 command.  The command can take the same options as that of the \fBstart\fR
256 command. In addition, it saves and restores OpenFlow flows for each
257 individual bridge.
258 .
259 .SH "The ``status'' command"
260 .
261 .PP
262 The \fBstatus\fR command checks whether the OVS daemons
263 \fBovs-vswitchd\fR and \fBovsdb\-server\fR are running and prints
264 messages with that information.  It exits with status 0 if
265 the daemons are running, 1 otherwise.
266 .
267 .SH "The ``version'' command"
268 .
269 .PP
270 The \fBversion\fR command runs \fBovsdb\-server \-\-version\fR and
271 \fBovs\-vswitchd \-\-version\fR.
272 .
273 .SH "The ``force\-reload\-kmod'' command"
274 .
275 .PP
276 The \fBforce\-reload\-kmod\fR command allows upgrading the Open
277 vSwitch kernel module without rebooting.  It performs the following
278 tasks:
279 .
280 .IP 1.
281 Gets a list of OVS ``internal'' interfaces, that is, network devices
282 implemented by Open vSwitch.  The most common examples of these are
283 bridge ``local ports''.
284 .
285 .IP 2.
286 Saves the OpenFlow flows of each bridge.
287 .
288 .IP 3.
289 Stops the Open vSwitch daemons, as if by a call to \fBovs\-ctl
290 stop\fR.
291 .
292 .IP 4.
293 Saves the kernel configuration state of the OVS internal interfaces
294 listed in step 1, including IP and IPv6 addresses and routing table
295 entries.
296 .
297 .IP 5.
298 Unloads the Open vSwitch kernel module (including the bridge
299 compatibility module if it is loaded).
300 .
301 .IP 6.
302 Starts OVS back up, as if by a call to \fBovs\-ctl start\fR.  This
303 reloads the kernel module, restarts the OVS daemons and finally
304 restores the saved OpenFlow flows.
305 .
306 .IP 7.
307 Restores the kernel configuration state that was saved in step 4.
308 .
309 .IP 8.
310 Checks for daemons that may need to be restarted because they have
311 packet sockets that are listening on old instances of Open vSwitch
312 kernel interfaces and, if it finds any, prints a warning on stdout.
313 DHCP is a common example: if the ISC DHCP client is running on an OVS
314 internal interface, then it will have to be restarted after completing
315 the above procedure.  (It would be nice if \fBovs\-ctl\fR could restart
316 daemons automatically, but the details are far too specific to a
317 particular distribution and installation.)
318 .
319 .PP
320 \fBforce\-kmod\-reload\fR internally stops and starts OVS, so it
321 accepts all of the options accepted by the \fBstart\fR command except
322 for the \fB\-\-no\-ovs\-vswitchd\fR option.
323 .
324 .SH "The ``load\-kmod'' command"
325 .
326 .PP
327 The \fBload\-kmod\fR command loads the openvswitch kernel modules if
328 they are not already loaded. This operation also occurs as part of
329 the \fBstart\fR command. The motivation for providing the \fBload\-kmod\fR
330 command is to allow errors when loading modules to be handled separatetly
331 from other errors that may occur when running the \fBstart\fR command.
332 .
333 .PP
334 By default the \fBload\-kmod\fR command attempts to load the
335 openvswitch kernel module.
336 .
337 .SH "The ``enable\-protocol'' command"
338 .
339 .PP
340 The \fBenable\-protocol\fR command checks for rules related to a
341 specified protocol in the system's \fBiptables\fR(8) configuration.  If there
342 are no rules specifically related to that protocol, then it inserts a
343 rule to accept the specified protocol.
344 .
345 .PP
346 More specifically:
347 .
348 .IP \(bu
349 If \fBiptables\fR is not installed or not enabled, this command does
350 nothing, assuming that lack of filtering means that the protocol is
351 enabled.
352 .
353 .IP \(bu
354 If the \fBINPUT\fR chain has a rule that matches the specified
355 protocol, then this command does nothing, assuming that whatever rule
356 is installed reflects the system administrator's decisions.
357 .
358 .IP \(bu
359 Otherwise, this command installs a rule that accepts traffic of the
360 specified protocol.
361 .
362 .PP
363 This command normally completes successfully, even if it does
364 nothing.  Only the failure of an attempt to insert a rule normally
365 causes it to return an exit code other than 0.
366 .
367 The following options control the protocol to be enabled:
368 .
369 .IP "\fB\-\-protocol=\fIprotocol\fR"
370 The name of the IP protocol to be enabled, such as \fBgre\fR or
371 \fBtcp\fR.  The default is \fBgre\fR.
372 .
373 .IP "\fB\-\-sport=\fIsport\fR"
374 .IQ "\fB\-\-dport=\fIdport\fR"
375 TCP or UDP source or destination port to match.  These are optional
376 and allowed only with \fB\-\-protocol=tcp\fR or
377 \fB\-\-protocol=udp\fR.
378 .
379 .SH "The ``help'' command"
380 .
381 Prints a usage message and exits successfully.
382 .
383 .SH "OPTIONS"
384 .PP
385 In addition to the options listed for each command above, these options
386 control the behavior of several of \fBovs\-ctl\fR's commands.
387 .
388 .PP
389 By default, \fBovs\-ctl\fR will control the \fBovsdb\-server\fR, and
390 the \fBovs\-vswitchd\fR daemons. The following options restrict that control
391 to exclude one or the other:
392 .
393 .IP "\fB\-\-no\-ovsdb-server\fR"
394 Specifies that the \fBovs\-ctl\fR commands \fBstart\fR, \fBstop\fR, and
395 \fBrestart\fR should not modify the running status of \fBovsdb\-server\fR.
396 .
397 .IP "\fB\-\-no\-ovs\-vswitchd\fR"
398 Specifies that the \fBovs\-ctl\fR commands \fBstart\fR, \fBstop\fR, and
399 \fBrestart\fR should not modify the running status of \fBovs\-vswitchd\fR.
400 It is an error to include this option with the \fBforce\-reload\-kmod\fR
401 command.
402 .
403 .SH "EXIT STATUS"
404 .
405 \fBovs\-ctl\fR exits with status 0 on success and nonzero on failure.
406 The \fBstart\fR command is considered to succeed if OVS is already
407 started; the \fBstop\fR command is considered to succeed if OVS is
408 already stopped.
409 .
410 .SH "ENVIRONMENT"
411 .
412 The following environment variables affect \fBovs\-ctl\fR:
413 .
414 .IP "\fBPATH\fR"
415 \fBovs\-ctl\fR does not hardcode the location of any of the programs
416 that it runs.  \fBovs\-ctl\fR will add the \fIsbindir\fR and
417 \fIbindir\fR that were specified at \fBconfigure\fR time to
418 \fBPATH\fR, if they are not already present.
419 .
420 .IP "\fBOVS_LOGDIR\fR"
421 .IQ "\fBOVS_RUNDIR\fR"
422 .IQ "\fBOVS_DBDIR\fR"
423 .IQ "\fBOVS_SYSCONFDIR\fR"
424 .IQ "\fBOVS_PKGDATADIR\fR"
425 .IQ "\fBOVS_BINDIR\fR"
426 .IQ "\fBOVS_SBINDIR\fR"
427 Setting one of these variables in the environment overrides the
428 respective \fBconfigure\fR option, both for \fBovs\-ctl\fR itself and
429 for the other Open vSwitch programs that it runs.
430 .
431 .SH "FILES"
432 .
433 \fBovs\-ctl\fR uses the following files:
434 .
435 .IP "\fBovs\-lib"
436 Shell function library used internally by \fBovs\-ctl\fR.  It must be
437 installed in the same directory as \fBovs\-ctl\fR.
438 .
439 .IP "\fIlogdir\fB/\fIdaemon\fB.log\fR"
440 Per-daemon logfiles.
441 .
442 .IP "\fIrundir\fB/\fIdaemon\fB.pid\fR"
443 Per-daemon pidfiles to track whether a daemon is running and with what
444 process ID.
445 .
446 .IP "\fIpkgdatadir\fB/vswitch.ovsschema\fR"
447 The OVS database schema used to initialize the database (use
448 \fB\-\-db\-schema to override this location).
449 .
450 .IP "\fIdbdir\fB/conf.db\fR"
451 The OVS database (use \fB\-\-db\-file\fR to override this location).
452 .
453 .IP "\fIrundir\fB/openvswitch/db.sock\fR"
454 The Unix domain socket used for local communication with
455 \fBovsdb\-server\fR (use \fB\-\-db\-sock\fR to override this
456 location).
457 .
458 .IP "\fIsysconfdir\fB/openvswitch/system-id.conf\fR"
459 The persistent system UUID created and read by
460 \fB\-\-system\-id=random\fR.
461 .
462 .IP "\fIsysconfdir\fB/openvswitch/system\-type.conf\fR"
463 .IQ "\fIsysconfdir\fB/openvswitch/system\-version.conf\fR"
464 The \fBsystem\-type\fR  and \fBsystem\-version\fR values stored in the database's
465 \fBOpen_vSwitch\fR table when not specified as a command-line option.
466 .
467 .SH "EXAMPLE"
468 .
469 .PP
470 The files \fBdebian/openvswitch\-switch.init\fR and
471 \fBxenserver/etc_init.d_openvswitch\fR in the Open vSwitch source
472 distribution are good examples of how to use \fBovs\-ctl\fR.
473 .
474 .SH "SEE ALSO"
475 .
476 \fBREADME.md\fR, \fBINSTALL.Linux.md\fR, \fBovsdb\-server\fR(8),
477 \fBovs\-vswitchd\fR(8).