]>
Commit | Line | Data |
---|---|---|
1c904eed SF |
1 | =================================== |
2 | Red Hat network scripts integration | |
3 | =================================== | |
4 | ||
5 | The RPM packages for Open vSwitch provide some integration with Red Hat's | |
6 | network scripts. Using this integration is optional. | |
7 | ||
8 | To use the integration for a Open vSwitch bridge or interface named ``<name>``, | |
9 | create or edit ``/etc/sysconfig/network-scripts/ifcfg-<name>``. This is a | |
10 | shell script that consists of a series of ``VARIABLE=VALUE`` assignments. The | |
11 | following OVS-specific variable names are supported: | |
12 | ||
13 | DEVICETYPE | |
14 | Always set to "ovs". | |
15 | ||
16 | TYPE | |
17 | If this is "OVSBridge", then this file represents an OVS bridge named <name>. | |
18 | Otherwise, it represents a port on an OVS bridge and TYPE must have one of | |
19 | the following values: | |
20 | ||
21 | * ``OVSPort``, if ``<name>`` is a physical port (e.g. eth0) or | |
22 | virtual port (e.g. vif1.0). | |
23 | ||
24 | * ``OVSIntPort``, if ``<name>`` is an internal port (e.g. a tagged | |
25 | VLAN). | |
26 | ||
27 | * ``OVSBond``, if ``<name>`` is an OVS bond. | |
28 | ||
29 | * ``OVSTunnel``, if ``<name>`` is an OVS tunnel. | |
30 | ||
31 | * ``OVSPatchPort``, if ``<name>`` is a patch port | |
32 | ||
33 | Additionally the following DPDK port types may be available, depends on OVS | |
34 | build- and runtime configuration: | |
35 | ||
36 | * ``OVSDPDKPort``, if ``<name>`` is a physical DPDK NIC port (name must start | |
37 | with ``dpdk`` and end with portid, eg ``dpdk0``) | |
38 | ||
1c904eed SF |
39 | * ``OVSDPDKVhostUserPort`` if ``<name>`` is a DPDK vhost-user port |
40 | ||
41 | * ``OVSDPDKBond`` if ``<name>`` is an OVS DPDK bond. | |
42 | ||
43 | OVS_BRIDGE | |
44 | If TYPE is anything other than "OVSBridge", set to the name of the OVS bridge | |
45 | to which the port should be attached. | |
46 | ||
47 | OVS_OPTIONS | |
48 | Optionally, extra options to set in the "Port" table when adding the port to | |
49 | the bridge, as a sequence of column[:key]=value options. For example, | |
50 | "tag=100" to make the port an access port for VLAN 100. See the | |
51 | documentation of "add-port" in ovs-vsctl(8) for syntax and the section on the | |
52 | Port table in ovs-vswitchd.conf.db(5) for available options. | |
53 | ||
54 | OVS_EXTRA | |
55 | Optionally, additional ovs-vsctl commands, separated by ``--`` (double dash). | |
56 | ||
57 | BOND_IFACES | |
58 | For "OVSBond" and "OVSDPDKBond" interfaces, a list of physical interfaces to | |
59 | bond together. | |
60 | ||
61 | OVS_TUNNEL_TYPE | |
62 | For "OVSTunnel" interfaces, the type of the tunnel. For example, "gre", | |
63 | "vxlan", etc. | |
64 | ||
65 | OVS_TUNNEL_OPTIONS | |
66 | For "OVSTunnel" interfaces, this field should be used to specify the tunnel | |
67 | options like remote_ip, key, etc. | |
68 | ||
69 | OVS_PATCH_PEER | |
70 | For "OVSPatchPort" devices, this field specifies the patch's peer on the | |
71 | other bridge. | |
72 | ||
d46b6037 AC |
73 | OVS_PORT_MODE |
74 | For "OVSDPDKVhostUserPort" devices, this field can be set to "client" which | |
75 | indicates that the port will be used in client mode. | |
76 | ||
77 | OVS_PORT_PATH | |
78 | For "OVSDPDKVhostUserPort" devices, this field specifies the path to the | |
79 | vhost-user server socket. It will only be used if OVS_PORT_MODE is set to | |
80 | "client". | |
81 | ||
1c904eed SF |
82 | Note |
83 | ---- | |
84 | ||
85 | * ``ifdown`` on a bridge will not bring individual ports on the bridge down. | |
86 | "ifup" on a bridge will not add ports to the bridge. This behavior should be | |
87 | compatible with standard bridges (with ``TYPE=Bridge``). | |
88 | ||
89 | * If ``ifup`` on an interface is called multiple times, one can see ``RTNETLINK | |
90 | answers: File exists`` printed on the console. This comes from ifup-eth | |
91 | trying to add zeroconf route multiple times and is harmless. | |
92 | ||
a348fd91 VDA |
93 | * ``ifup`` on OVSDPDKPort or OVSDPDKBond may result in change of bridge mac address. |
94 | Since OVS changes the device state to DOWN before changing its mac address this | |
95 | result in loss of bridge configuration (e.g. routes). ``ifup-ovs`` perform post-up | |
96 | operation on the bridge again to restore configuration. | |
97 | ||
1c904eed SF |
98 | Examples |
99 | -------- | |
100 | ||
101 | Standalone bridge: | |
102 | ||
103 | :: | |
104 | ||
105 | ==> ifcfg-ovsbridge0 <== | |
106 | DEVICE=ovsbridge0 | |
107 | ONBOOT=yes | |
108 | DEVICETYPE=ovs | |
109 | TYPE=OVSBridge | |
110 | BOOTPROTO=static | |
111 | IPADDR=A.B.C.D | |
112 | NETMASK=X.Y.Z.0 | |
113 | HOTPLUG=no | |
114 | ||
115 | Enable DHCP on the bridge: | |
116 | ||
117 | * Needs ``OVSBOOTPROTO`` instead of ``BOOTPROTO``. | |
118 | * All the interfaces that can reach the DHCP server as a space separated list | |
119 | in ``OVSDHCPINTERFACES``. | |
120 | ||
121 | :: | |
122 | ||
123 | DEVICE=ovsbridge0 | |
124 | ONBOOT=yes | |
125 | DEVICETYPE=ovs | |
126 | TYPE=OVSBridge | |
127 | OVSBOOTPROTO="dhcp" | |
128 | OVSDHCPINTERFACES="eth0" | |
129 | HOTPLUG=no | |
130 | ||
131 | ||
132 | Adding Internal Port to ovsbridge0: | |
133 | ||
134 | :: | |
135 | ||
136 | ==> ifcfg-intbr0 <== | |
137 | DEVICE=intbr0 | |
138 | ONBOOT=yes | |
139 | DEVICETYPE=ovs | |
140 | TYPE=OVSIntPort | |
141 | OVS_BRIDGE=ovsbridge0 | |
142 | HOTPLUG=no | |
143 | ||
144 | Internal Port with fixed IP address: | |
145 | ||
146 | :: | |
147 | ||
148 | DEVICE=intbr0 | |
149 | ONBOOT=yes | |
150 | DEVICETYPE=ovs | |
151 | TYPE=OVSIntPort | |
152 | OVS_BRIDGE=ovsbridge0 | |
153 | BOOTPROTO=static | |
154 | IPADDR=A.B.C.D | |
155 | NETMASK=X.Y.Z.0 | |
156 | HOTPLUG=no | |
157 | ||
158 | Internal Port with DHCP: | |
159 | ||
160 | * Needs ``OVSBOOTPROTO`` or ``BOOTPROTO``. | |
161 | * All the interfaces that can reach the DHCP server as a space separated list | |
162 | in ``OVSDHCPINTERFACES``. | |
163 | ||
164 | :: | |
165 | ||
166 | DEVICE=intbr0 | |
167 | ONBOOT=yes | |
168 | DEVICETYPE=ovs | |
169 | TYPE=OVSIntPort | |
170 | OVS_BRIDGE=ovsbridge0 | |
171 | OVSBOOTPROTO="dhcp" | |
172 | OVSDHCPINTERFACES="eth0" | |
173 | HOTPLUG=no | |
174 | ||
175 | Adding physical ``eth0`` to ``ovsbridge0`` described above: | |
176 | ||
177 | :: | |
178 | ||
179 | ==> ifcfg-eth0 <== | |
180 | DEVICE=eth0 | |
181 | ONBOOT=yes | |
182 | DEVICETYPE=ovs | |
183 | TYPE=OVSPort | |
184 | OVS_BRIDGE=ovsbridge0 | |
185 | BOOTPROTO=none | |
186 | HOTPLUG=no | |
187 | ||
188 | Tagged VLAN interface on top of ``ovsbridge0``: | |
189 | ||
190 | :: | |
191 | ||
192 | ==> ifcfg-vlan100 <== | |
193 | DEVICE=vlan100 | |
194 | ONBOOT=yes | |
195 | DEVICETYPE=ovs | |
196 | TYPE=OVSIntPort | |
197 | BOOTPROTO=static | |
198 | IPADDR=A.B.C.D | |
199 | NETMASK=X.Y.Z.0 | |
200 | OVS_BRIDGE=ovsbridge0 | |
201 | OVS_OPTIONS="tag=100" | |
202 | OVS_EXTRA="set Interface $DEVICE external-ids:iface-id=$(hostname -s)-$DEVICE-vif" | |
203 | HOTPLUG=no | |
204 | ||
205 | Bonding: | |
206 | ||
207 | :: | |
208 | ||
209 | ==> ifcfg-bond0 <== | |
210 | DEVICE=bond0 | |
211 | ONBOOT=yes | |
212 | DEVICETYPE=ovs | |
213 | TYPE=OVSBond | |
214 | OVS_BRIDGE=ovsbridge0 | |
215 | BOOTPROTO=none | |
216 | BOND_IFACES="gige-1b-0 gige-1b-1 gige-21-0 gige-21-1" | |
217 | OVS_OPTIONS="bond_mode=balance-tcp lacp=active" | |
218 | HOTPLUG=no | |
219 | ||
220 | :: | |
221 | ||
222 | ==> ifcfg-gige-* <== | |
223 | DEVICE=gige-* | |
224 | ONBOOT=yes | |
225 | HOTPLUG=no | |
226 | ||
227 | An Open vSwitch Tunnel: | |
228 | ||
229 | :: | |
230 | ||
231 | ==> ifcfg-gre0 <== | |
232 | DEVICE=ovs-gre0 | |
233 | ONBOOT=yes | |
234 | DEVICETYPE=ovs | |
235 | TYPE=OVSTunnel | |
236 | OVS_BRIDGE=ovsbridge0 | |
237 | OVS_TUNNEL_TYPE=gre | |
238 | OVS_TUNNEL_OPTIONS="options:remote_ip=A.B.C.D" | |
239 | ||
240 | Patch Ports: | |
241 | ||
242 | :: | |
243 | ||
244 | ==> ifcfg-patch-ovs-0 <== | |
245 | DEVICE=patch-ovs-0 | |
246 | ONBOOT=yes | |
247 | DEVICETYPE=ovs | |
248 | TYPE=OVSPatchPort | |
249 | OVS_BRIDGE=ovsbridge0 | |
250 | OVS_PATCH_PEER=patch-ovs-1 | |
251 | ||
252 | :: | |
253 | ||
254 | ==> ifcfg-patch-ovs-1 <== | |
255 | DEVICE=patch-ovs-1 | |
256 | ONBOOT=yes | |
257 | DEVICETYPE=ovs | |
258 | TYPE=OVSPatchPort | |
259 | OVS_BRIDGE=ovsbridge1 | |
260 | OVS_PATCH_PEER=patch-ovs-0 | |
261 | ||
262 | User bridge: | |
263 | ||
264 | :: | |
265 | ||
266 | ==> ifcfg-obr0 <== | |
267 | DEVICE=obr0 | |
268 | ONBOOT=yes | |
269 | DEVICETYPE=ovs | |
270 | TYPE=OVSUserBridge | |
271 | BOOTPROTO=static | |
272 | IPADDR=A.B.C.D | |
273 | NETMASK=X.Y.Z.0 | |
274 | HOTPLUG=no | |
275 | ||
276 | DPDK NIC port: | |
277 | ||
278 | :: | |
279 | ||
280 | ==> ifcfg-dpdk0 <== | |
281 | DPDK vhost-user port: | |
282 | DEVICE=dpdk0 | |
283 | ONBOOT=yes | |
284 | DEVICETYPE=ovs | |
285 | TYPE=OVSDPDKPort | |
286 | OVS_BRIDGE=obr0 | |
287 | ||
288 | :: | |
289 | ||
290 | ==> ifcfg-vhu0 <== | |
291 | DEVICE=vhu0 | |
292 | ONBOOT=yes | |
293 | DEVICETYPE=ovs | |
294 | TYPE=OVSDPDKVhostUserPort | |
295 | OVS_BRIDGE=obr0 | |
296 | ||
297 | :: | |
298 | ||
299 | ==> ifcfg-bond0 <== | |
300 | DEVICE=bond0 | |
301 | ONBOOT=yes | |
302 | DEVICETYPE=ovs | |
303 | TYPE=OVSDPDKBond | |
304 | OVS_BRIDGE=ovsbridge0 | |
305 | BOOTPROTO=none | |
306 | BOND_IFACES="dpdk0 dpdk1" | |
307 | OVS_OPTIONS="bond_mode=active-backup" | |
308 | HOTPLUG=no | |
309 | ||
090cc60c EC |
310 | |
311 | Red Hat systemd integration | |
312 | --------------------------- | |
313 | ||
314 | The RPM packages for Open vSwitch provide support for systemd integration. It's | |
315 | recommended to use the openvswitch.service to start and stop the Open vSwitch | |
316 | daemons. The below table shows systemd's behavior: | |
317 | ||
318 | =============================== ============== ============== ============== =============== =============== | |
c94d8154 | 319 | - Process Status systemctl <> status |
090cc60c EC |
320 | ------------------------------- ----------------------------- ---------------------------------------------- |
321 | Action ovs-vswitch ovsdb-server openvswitch ovs-vswitchd ovsdb-server | |
322 | =============================== ============== ============== ============== =============== =============== | |
323 | systemctl start openvswitch* started started active, exited active, running active, running | |
324 | crash of vswitchd crash, started re-started active, exited active, running active, running | |
325 | crash of ovsdb re-started crash, started active, exited active, running active, running | |
326 | systemctl restart openvswitch re-started re-started active, exited active, running active, running | |
327 | systemctl restart ovs-vswitchd re-started re-started active, exited active, running active, running | |
328 | systemctl restart ovsdb-server re-started re-started active, exited active, running active, running | |
329 | systemctl stop openvswitch stopped stopped inactive, dead inactive, dead inactive, dead | |
330 | systemctl stop ovs-vswitchd stopped stopped inactive, dead inactive, dead inactive, dead | |
331 | systemctl stop ovsdb-server stopped stopped inactive, dead inactive, dead inactive, dead | |
332 | systemctl start ovs-vswitchd* started started inactive, dead active, running active, running | |
333 | systemctl start ovsdb-server* not started started inactive, dead inactive, dead active, running | |
334 | =============================== ============== ============== ============== =============== =============== | |
335 | ||
336 | ||
337 | \* These commands where executed when no Open vSwitch related processes where | |
338 | running. All other commands where executed when Open vSwitch was successfully | |
339 | running. | |
340 | ||
341 | ||
e3e738a3 | 342 | Non-root User Support |
343 | ----------------------- | |
344 | Fedora and RHEL support running the Open vSwitch daemons as a non-root user. | |
345 | By default, a fresh installation will create an *openvswitch* user, along | |
346 | with any additional support groups needed (such as *hugetlbfs* for DPDK | |
347 | support). | |
348 | ||
349 | This is controlled by modifying the ``OVS_USER_ID`` option. Setting this | |
350 | to 'root:root', or commenting the variable out will revert this behavior. | |
351 | ||
352 | ||
1c904eed SF |
353 | Reporting Bugs |
354 | -------------- | |
355 | ||
356 | Please report problems to bugs@openvswitch.org. |