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