1ea80b79ae284829d2b0ab662af5468ba74161dc
[sliver-openvswitch.git] / utilities / ovs-vsctl.8.in
1 .\" -*- nroff -*-
2 .de IQ
3 .  br
4 .  ns
5 .  IP "\\$1"
6 ..
7 .TH ovs\-vsctl 8 "November 2009" "Open vSwitch" "Open vSwitch Manual"
8 .ds PN ovs\-vsctl
9 .
10 .SH NAME
11 ovs\-vsctl \- utility for querying and configuring \fBovs\-vswitchd\fR
12 .
13 .SH SYNOPSIS
14 \fBovs\-vsctl\fR [\fIoptions\fR] [\fB\-\-\fR] \fIcommand \fR[\fIargs\fR\&...]
15 [\fB\-\-\fR \fIcommand \fR[\fIargs\fR\&...]]
16 .
17 .SH DESCRIPTION
18 The \fBovs\-vsctl\fR program configures \fBovs\-vswitchd\fR(8) by
19 providing a high\-level interface to editing its configuration
20 database.  This program is mainly intended for use when
21 \fBovs\-vswitchd\fR is running.  If it is used when
22 \fBovs\-vswitchd\fR is not running, then \fB\-\-no\-wait\fR should be
23 specified and configuration changes will only take effect when
24 \fBovs\-vswitchd\fR is started.
25 .PP
26 By default, each time \fBovs\-vsctl\fR runs, it connects to an
27 \fBovsdb\-server\fR process that maintains an Open vSwitch
28 configuration database.  Using this connection, it queries and
29 possibly applies changes to the database, depending on the supplied
30 commands.  Then, if it applied any changes, it waits until
31 \fBovs\-vswitchd\fR has finished reconfiguring itself before it exits.
32 .PP
33 \fBovs\-vsctl\fR can perform any number of commands in a single run,
34 implemented as a single atomic transaction against the database.
35 Commands are separated on the command line by \fB\-\-\fR arguments.
36 .
37 .SS "Linux VLAN Bridging Compatibility"
38 The \fBovs\-vsctl\fR program supports the model of a bridge
39 implemented by Open vSwitch, in which a single bridge supports ports
40 on multiple VLANs.  In this model, each port on a bridge is either a
41 trunk port that potentially passes packets tagged with 802.1Q headers
42 that designate VLANs or it is assigned a single implicit VLAN that is
43 never tagged with an 802.1Q header.
44 .PP
45 For compatibility with software designed for the Linux bridge,
46 \fBovs\-vsctl\fR also supports a model in which traffic associated
47 with a given 802.1Q VLAN is segregated into a separate bridge.  A
48 special form of the \fBadd\-br\fR command (see below) creates a ``fake
49 bridge'' within an Open vSwitch bridge to simulate this behavior.
50 When such a ``fake bridge'' is active, \fBovs\-vsctl\fR will treat it
51 much like a bridge separate from its ``parent bridge,'' but the actual
52 implementation in Open vSwitch uses only a single bridge, with ports on
53 the fake bridge assigned the implicit VLAN of the fake bridge of which
54 they are members.
55 .
56 .SH OPTIONS
57 .
58 The following options affect the behavior \fBovs\-vsctl\fR as a whole.
59 Some individual commands also accept their own options, which are
60 given just before the command name.  If the first command on the
61 command line has options, then those options must be separated from
62 the global options by \fB\-\-\fR.
63 .
64 .IP "\fB\-\-db=\fIserver\fR"
65 Sets \fIserver\fR as the database server that \fBovs\-vsctl\fR
66 contacts to query or modify configuration.  The default is
67 \fBunix:@RUNDIR@/ovsdb\-server\fR.  \fIserver\fR must take one of the
68 following forms:
69 .RS
70 .IP "\fBtcp:\fIip\fB:\fIport\fR"
71 Connect to the given TCP \fIport\fR on \fIip\fR.
72 .IP "\fBunix:\fIfile\fR"
73 Connect to the Unix domain server socket named \fIfile\fR.
74 .RE
75 .IP "\fB\-\-no\-wait\fR"
76 Prevents \fBovs\-vsctl\fR from waiting for \fBovs\-vswitchd\fR to
77 reconfigure itself according to the the modified database.  This
78 option should be used if \fBovs\-vswitchd\fR is not running;
79 otherwise, \fBovs-vsctl\fR will not exit until \fBovs-vswitchd\fR
80 starts.
81 .IP
82 This option has no effect if the commands specified do not change the
83 database.
84 .
85 .IP "\fB\-\-no\-syslog\fR"
86 By default, \fBovs\-vsctl\fR logs its arguments and the details of any
87 changes that it makes to the system log.  This option disables this
88 logging.
89 .IP
90 This option is equivalent to \fB\-\-verbose=vvsctl:syslog:warn\fR.
91 .
92 .IP "\fB\-\-oneline\fR"
93 Modifies the output format so that the output for each command is printed
94 on a single line.  New-line characters that would otherwise separate
95 lines are printed as \fB\\n\fR, and any instances of \fB\\\fR that
96 would otherwise appear in the output are doubled.
97 Prints a blank line for each command that has no output.
98 .
99 .IP "\fB\-\-dry\-run\fR"
100 Prevents \fBovs\-vsctl\fR from actually modifying the database.
101 .
102 .so lib/vlog.man
103 .
104 .SH COMMANDS
105 The commands implemented by \fBovs\-vsctl\fR are described in the
106 sections below.
107 .SS "Open vSwitch Commands"
108 These commands work with an Open vSwitch as a whole.
109 .
110 .IP "\fBinit\fR"
111 Initializes the Open vSwitch database, if it is empty.  If the
112 database has already been initialized, this command has no effect.
113 .IP
114 Any successful \fBovs\-vsctl\fR command automatically initializes the
115 Open vSwitch database if it is empty.  This command is provided to
116 initialize the database without executing any other command.
117 .
118 .SS "Bridge Commands"
119 These commands examine and manipulate Open vSwitch bridges.
120 .
121 .IP "\fBadd\-br \fIbridge\fR"
122 Creates a new bridge named \fIbridge\fR.  Initially the bridge will
123 have no ports (other than \fIbridge\fR itself).
124 .
125 .IP "\fBadd\-br \fIbridge parent vlan\fR"
126 Creates a ``fake bridge'' named \fIbridge\fR within the existing Open
127 vSwitch bridge \fIparent\fR, which must already exist and must not
128 itself be a fake bridge.  The new fake bridge will be on 802.1Q VLAN
129 \fIvlan\fR, which must be an integer between 1 and 4095.  Initially
130 \fIbridge\fR will have no ports (other than \fIbridge\fR itself).
131 .
132 .IP "[\fB\-\-if\-exists\fR] \fBdel\-br \fIbridge\fR"
133 Deletes \fIbridge\fR and all of its ports.  If \fIbridge\fR is a real
134 bridge, this command also deletes any fake bridges that were created
135 with \fIbridge\fR as parent, including all of their ports.
136 .IP
137 Without \fB\-\-if\-exists\fR, attempting to delete a bridge that does
138 not exist is an error.  With \fB\-\-if\-exists\fR, attempting to
139 delete a bridge that does not exist has no effect.
140 .
141 .IP "\fBlist\-br\fR"
142 Lists all existing real and fake bridges on standard output, one per
143 line.
144 .
145 .IP "\fBbr\-exists \fIbridge\fR"
146 Tests whether \fIbridge\fR exists as a real or fake bridge.  If so,
147 \fBovs\-vsctl\fR exits successfully with exit code 0.  If not,
148 \fBovs\-vsctl\fR exits unsuccessfully with exit code 2.
149 .
150 .IP "\fBbr\-to\-vlan \fIbridge\fR"
151 If \fIbridge\fR is a fake bridge, prints the bridge's 802.1Q VLAN as a
152 decimal integer.  If \fIbridge\fR is a real bridge, prints 0.
153 .
154 .IP "\fBbr\-to\-parent \fIbridge\fR"
155 If \fIbridge\fR is a fake bridge, prints the name of its parent
156 bridge.  If \fIbridge\fR is a real bridge, print \fIbridge\fR.
157 .
158 .IP "\fBbr\-set\-external\-id \fIbridge key\fR [\fIvalue\fR]"
159 Sets or clears an ``external ID'' value on \fIbridge\fR.  These values
160 are intended to identify entities external to Open vSwitch with which
161 \fIbridge\fR is associated, e.g. the bridge's identifier in a
162 virtualization management platform.  The Open vSwitch database schema
163 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
164 are otherwise arbitrary strings.
165 .IP
166 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
167 \fIbridge\fR, overwriting any previous value.  If \fIvalue\fR is
168 omitted, then \fIkey\fR is removed from \fIbridge\fR's set of external
169 IDs (if it was present).
170 .
171 .IP "\fBbr\-get\-external\-id \fIbridge\fR [\fIkey\fR]"
172 Queries the external IDs on \fIbridge\fR.  If \fIkey\fR is specified,
173 the output is the value for that \fIkey\fR or the empty string if
174 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
175 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
176 .
177 .SS "Port Commands"
178 .
179 These commands examine and manipulate Open vSwitch ports.  These
180 commands treat a bonded port as a single entity.
181 .
182 .IP "\fBlist\-ports \fIbridge\fR"
183 Lists all of the ports within \fIbridge\fR on standard output, one per
184 line.  The local port \fIbridge\fR is not included in the list.
185 .
186 .IP "\fBadd\-port \fIbridge port\fR"
187 Creates on \fIbridge\fR a new port named \fIport\fR from the network
188 device of the same name.
189 .
190 .IP "\fBadd\-bond \fIbridge port iface\fR\&..."
191 Creates on \fIbridge\fR a new port named \fIport\fR that bonds
192 together the network devices given as each \fIiface\fR.  At least two
193 interfaces must be named.
194 .
195 .IP "[\fB\-\-if\-exists\fR] \fBdel\-port \fR[\fIbridge\fR] \fIport\fR"
196 Deletes \fIport\fR.  If \fIbridge\fR is omitted, \fIport\fR is removed
197 from whatever bridge contains it; if \fIbridge\fR is specified, it
198 must be the real or fake bridge that contains \fIport\fR.
199 .IP
200 Without \fB\-\-if\-exists\fR, attempting to delete a port that does
201 not exist is an error.  With \fB\-\-if\-exists\fR, attempting to
202 delete a port that does not exist has no effect.
203 .
204 .IP "\fBport\-to\-br \fIport\fR"
205 Prints the name of the bridge that contains \fIport\fR on standard
206 output.
207 .
208 .IP "\fBport\-set\-external\-id \fIport key\fR [\fIvalue\fR]"
209 Sets or clears an ``external ID'' value on \fIport\fR.  These value
210 are intended to identify entities external to Open vSwitch with which
211 \fIport\fR is associated, e.g. the port's identifier in a
212 virtualization management platform.  The Open vSwitch database schema
213 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
214 are otherwise arbitrary strings.
215 .IP
216 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
217 \fIport\fR, overwriting any previous value.  If \fIvalue\fR is
218 omitted, then \fIkey\fR is removed from \fIport\fR's set of external
219 IDs (if it was present).
220 .
221 .IP "\fBbr\-get\-external\-id \fIport\fR [\fIkey\fR]"
222 Queries the external IDs on \fIport\fR.  If \fIkey\fR is specified,
223 the output is the value for that \fIkey\fR or the empty string if
224 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
225 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
226 .
227 .SS "Interface Commands"
228 .
229 These commands examine the interfaces attached to an Open vSwitch
230 bridge.  These commands treat a bonded port as a collection of two or
231 more interfaces, rather than as a single port.
232 .
233 .IP "\fBlist\-ifaces \fIbridge\fR"
234 Lists all of the interfaces within \fIbridge\fR on standard output,
235 one per line.  The local port \fIbridge\fR is not included in the
236 list.
237 .
238 .IP "\fBiface\-to\-br \fIiface\fR"
239 Prints the name of the bridge that contains \fIiface\fR on standard
240 output.
241 .
242 .IP "\fBiface\-set\-external\-id \fIiface key\fR [\fIvalue\fR]"
243 Sets or clears an ``external ID'' value on \fIiface\fR.  These value
244 are intended to identify entities external to Open vSwitch with which
245 \fIiface\fR is associated, e.g. the interface's identifier in a
246 virtualization management platform.  The Open vSwitch database schema
247 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
248 are otherwise arbitrary strings.
249 .IP
250 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
251 \fIiface\fR, overwriting any previous value.  If \fIvalue\fR is
252 omitted, then \fIkey\fR is removed from \fIiface\fR's set of external
253 IDs (if it was present).
254 .
255 .IP "\fBbr\-get\-external\-id \fIiface\fR [\fIkey\fR]"
256 Queries the external IDs on \fIiface\fR.  If \fIkey\fR is specified,
257 the output is the value for that \fIkey\fR or the empty string if
258 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
259 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
260 .
261 .SH "EXAMPLES"
262 Create a new bridge named br0 and add port eth0 to it:
263 .IP
264 .B "ovs-vsctl add\-br br0"
265 .br
266 .B "ovs-vsctl add\-port br0 eth0"
267 .PP
268 Alternatively, perform both operations in a single atomic transaction:
269 .IP 
270 .B "ovs-vsctl add\-br br0 \-\- add\-port br0 eth0"
271 .PP
272 Delete bridge \fBbr0\fR, reporting an error if it does not exist:
273 .IP
274 .B "ovs\-vsctl del\-br br0"
275 .PP
276 Delete bridge \fBbr0\fR if it exists (the \fB\-\-\fR is required to
277 separate \fBdel\-br\fR's options from the global options):
278 .IP
279 .B "ovs\-vsctl \-\- \-\-if\-exists del\-br br0"
280 .
281 .SH "EXIT STATUS"
282 .IP "0"
283 Successful program execution.
284 .IP "1"
285 Usage, syntax, or configuration file error.
286 .IP "2"
287 The \fIbridge\fR argument to \fBbr\-exists\fR specified the name of a
288 bridge that does not exist.
289 .SH "SEE ALSO"
290 .
291 .BR ovsdb\-server (1),
292 .BR ovs\-vswitchd (8).