]>
Commit | Line | Data |
---|---|---|
c483d489 BP |
1 | Frequently Asked Questions |
2 | ========================== | |
3 | ||
542cc9bb TG |
4 | Open vSwitch <http://openvswitch.org> |
5 | ||
fb5b3c22 BB |
6 | ## Contents |
7 | ||
8 | - [General](#general) | |
9 | - [Releases](#releases) | |
10 | - [Terminology](#terminology) | |
11 | - [Basic configuration](#basic-configuration) | |
12 | - [Implementation Details](#implementation-details) | |
13 | - [Performance](#performance) | |
14 | - [Configuration Problems](#configuration-problems) | |
15 | - [QOS](#qos) | |
16 | - [VLANs](#vlans) | |
17 | - [VXLANs](#vxlans) | |
18 | - [Using OpenFlow](#using-openflow) | |
19 | - [Development](#development) | |
20 | ||
21 | ## General | |
3fc7dc18 | 22 | |
542cc9bb | 23 | ### Q: What is Open vSwitch? |
3fc7dc18 JP |
24 | |
25 | A: Open vSwitch is a production quality open source software switch | |
29089a54 RL |
26 | designed to be used as a vswitch in virtualized server |
27 | environments. A vswitch forwards traffic between different VMs on | |
28 | the same physical host and also forwards traffic between VMs and | |
29 | the physical network. Open vSwitch supports standard management | |
30 | interfaces (e.g. sFlow, NetFlow, IPFIX, RSPAN, CLI), and is open to | |
31 | programmatic extension and control using OpenFlow and the OVSDB | |
32 | management protocol. | |
3fc7dc18 JP |
33 | |
34 | Open vSwitch as designed to be compatible with modern switching | |
35 | chipsets. This means that it can be ported to existing high-fanout | |
36 | switches allowing the same flexible control of the physical | |
37 | infrastructure as the virtual infrastructure. It also means that | |
38 | Open vSwitch will be able to take advantage of on-NIC switching | |
39 | chipsets as their functionality matures. | |
40 | ||
542cc9bb | 41 | ### Q: What virtualization platforms can use Open vSwitch? |
3fc7dc18 JP |
42 | |
43 | A: Open vSwitch can currently run on any Linux-based virtualization | |
8063e095 | 44 | platform (kernel 3.10 and newer), including: KVM, VirtualBox, Xen, |
3fc7dc18 JP |
45 | Xen Cloud Platform, XenServer. As of Linux 3.3 it is part of the |
46 | mainline kernel. The bulk of the code is written in platform- | |
47 | independent C and is easily ported to other environments. We welcome | |
48 | inquires about integrating Open vSwitch with other virtualization | |
49 | platforms. | |
50 | ||
542cc9bb | 51 | ### Q: How can I try Open vSwitch? |
3fc7dc18 | 52 | |
7b287e99 JP |
53 | A: The Open vSwitch source code can be built on a Linux system. You can |
54 | build and experiment with Open vSwitch on any Linux machine. | |
55 | Packages for various Linux distributions are available on many | |
56 | platforms, including: Debian, Ubuntu, Fedora. | |
3fc7dc18 JP |
57 | |
58 | You may also download and run a virtualization platform that already | |
7b287e99 JP |
59 | has Open vSwitch integrated. For example, download a recent ISO for |
60 | XenServer or Xen Cloud Platform. Be aware that the version | |
61 | integrated with a particular platform may not be the most recent Open | |
62 | vSwitch release. | |
63 | ||
542cc9bb | 64 | ### Q: Does Open vSwitch only work on Linux? |
7b287e99 JP |
65 | |
66 | A: No, Open vSwitch has been ported to a number of different operating | |
67 | systems and hardware platforms. Most of the development work occurs | |
68 | on Linux, but the code should be portable to any POSIX system. We've | |
69 | seen Open vSwitch ported to a number of different platforms, | |
70 | including FreeBSD, Windows, and even non-POSIX embedded systems. | |
71 | ||
72 | By definition, the Open vSwitch Linux kernel module only works on | |
73 | Linux and will provide the highest performance. However, a userspace | |
74 | datapath is available that should be very portable. | |
75 | ||
542cc9bb | 76 | ### Q: What's involved with porting Open vSwitch to a new platform or switching ASIC? |
7b287e99 | 77 | |
9feb1017 | 78 | A: The [PORTING.md] document describes how one would go about |
542cc9bb | 79 | porting Open vSwitch to a new operating system or hardware platform. |
3fc7dc18 | 80 | |
542cc9bb | 81 | ### Q: Why would I use Open vSwitch instead of the Linux bridge? |
3fc7dc18 JP |
82 | |
83 | A: Open vSwitch is specially designed to make it easier to manage VM | |
7b287e99 | 84 | network configuration and monitor state spread across many physical |
542cc9bb | 85 | hosts in dynamic virtualized environments. Please see |
9feb1017 TG |
86 | [WHY-OVS.md] for a more detailed description of how Open vSwitch |
87 | relates to the Linux Bridge. | |
3fc7dc18 | 88 | |
542cc9bb | 89 | ### Q: How is Open vSwitch related to distributed virtual switches like the VMware vNetwork distributed switch or the Cisco Nexus 1000V? |
3fc7dc18 JP |
90 | |
91 | A: Distributed vswitch applications (e.g., VMware vNetwork distributed | |
92 | switch, Cisco Nexus 1000V) provide a centralized way to configure and | |
93 | monitor the network state of VMs that are spread across many physical | |
94 | hosts. Open vSwitch is not a distributed vswitch itself, rather it | |
95 | runs on each physical host and supports remote management in a way | |
96 | that makes it easier for developers of virtualization/cloud | |
97 | management platforms to offer distributed vswitch capabilities. | |
98 | ||
99 | To aid in distribution, Open vSwitch provides two open protocols that | |
100 | are specially designed for remote management in virtualized network | |
101 | environments: OpenFlow, which exposes flow-based forwarding state, | |
102 | and the OVSDB management protocol, which exposes switch port state. | |
103 | In addition to the switch implementation itself, Open vSwitch | |
1d5aaa61 BP |
104 | includes tools (ovs-ofctl, ovs-vsctl) that developers can script and |
105 | extend to provide distributed vswitch capabilities that are closely | |
106 | integrated with their virtualization management platform. | |
3fc7dc18 | 107 | |
542cc9bb | 108 | ### Q: Why doesn't Open vSwitch support distribution? |
3fc7dc18 JP |
109 | |
110 | A: Open vSwitch is intended to be a useful component for building | |
111 | flexible network infrastructure. There are many different approaches | |
112 | to distribution which balance trade-offs between simplicity, | |
113 | scalability, hardware compatibility, convergence times, logical | |
114 | forwarding model, etc. The goal of Open vSwitch is to be able to | |
115 | support all as a primitive building block rather than choose a | |
116 | particular point in the distributed design space. | |
117 | ||
542cc9bb | 118 | ### Q: How can I contribute to the Open vSwitch Community? |
3fc7dc18 JP |
119 | |
120 | A: You can start by joining the mailing lists and helping to answer | |
7b287e99 JP |
121 | questions. You can also suggest improvements to documentation. If |
122 | you have a feature or bug you would like to work on, send a mail to | |
123 | one of the mailing lists: | |
124 | ||
542cc9bb | 125 | http://openvswitch.org/mlists/ |
7b287e99 | 126 | |
5fd5a65c | 127 | ### Q: Why can I no longer connect to my OpenFlow controller or OVSDB manager? |
d4763d1d JP |
128 | |
129 | A: Starting in OVS 2.4, we switched the default ports to the | |
130 | IANA-specified port numbers for OpenFlow (6633->6653) and OVSDB | |
131 | (6632->6640). We recommend using these port numbers, but if you | |
132 | cannot, all the programs allow overriding the default port. See the | |
133 | appropriate man page. | |
134 | ||
fb5b3c22 | 135 | ## Releases |
7b287e99 | 136 | |
542cc9bb | 137 | ### Q: What does it mean for an Open vSwitch release to be LTS (long-term support)? |
3fc7dc18 | 138 | |
7b287e99 | 139 | A: All official releases have been through a comprehensive testing |
1a807b41 BP |
140 | process and are suitable for production use. Planned releases |
141 | occur twice a year. If a significant bug is identified in an | |
7b287e99 JP |
142 | LTS release, we will provide an updated release that includes the |
143 | fix. Releases that are not LTS may not be fixed and may just be | |
144 | supplanted by the next major release. The current LTS release is | |
49b507d9 | 145 | 2.3.x. |
7b287e99 | 146 | |
1a807b41 BP |
147 | For more information on the Open vSwitch release process, please |
148 | see [release-process.md]. | |
149 | ||
542cc9bb | 150 | ### Q: What Linux kernel versions does each Open vSwitch release work with? |
314e60e1 BP |
151 | |
152 | A: The following table lists the Linux kernel versions against which the | |
153 | given versions of the Open vSwitch kernel module will successfully | |
154 | build. The Linux kernel versions are upstream kernel versions, so | |
a01b5c51 BP |
155 | Linux kernels modified from the upstream sources may not build in |
156 | some cases even if they are based on a supported version. This is | |
157 | most notably true of Red Hat Enterprise Linux (RHEL) kernels, which | |
158 | are extensively modified from upstream. | |
314e60e1 | 159 | |
542cc9bb TG |
160 | | Open vSwitch | Linux kernel |
161 | |:------------:|:-------------: | |
162 | | 1.4.x | 2.6.18 to 3.2 | |
163 | | 1.5.x | 2.6.18 to 3.2 | |
164 | | 1.6.x | 2.6.18 to 3.2 | |
165 | | 1.7.x | 2.6.18 to 3.3 | |
166 | | 1.8.x | 2.6.18 to 3.4 | |
167 | | 1.9.x | 2.6.18 to 3.8 | |
168 | | 1.10.x | 2.6.18 to 3.8 | |
169 | | 1.11.x | 2.6.18 to 3.8 | |
170 | | 2.0.x | 2.6.32 to 3.10 | |
171 | | 2.1.x | 2.6.32 to 3.11 | |
172 | | 2.3.x | 2.6.32 to 3.14 | |
3afcde43 | 173 | | 2.4.x | 2.6.32 to 4.0 |
e23775f2 | 174 | | 2.5.x | 2.6.32 to 4.3 |
763f638b | 175 | | 2.6.x | 3.10 to 4.6 |
314e60e1 BP |
176 | |
177 | Open vSwitch userspace should also work with the Linux kernel module | |
178 | built into Linux 3.3 and later. | |
179 | ||
180 | Open vSwitch userspace is not sensitive to the Linux kernel version. | |
37418c86 | 181 | It should build against almost any kernel, certainly against 2.6.32 |
314e60e1 BP |
182 | and later. |
183 | ||
d05293af DDP |
184 | ### Q: Are all features available with all datapaths? |
185 | ||
186 | A: Open vSwitch supports different datapaths on different platforms. Each | |
187 | datapath has a different feature set: the following tables try to summarize | |
188 | the status. | |
189 | ||
190 | Supported datapaths: | |
191 | ||
192 | * *Linux upstream*: The datapath implemented by the kernel module shipped | |
193 | with Linux upstream. Since features have been gradually | |
194 | introduced into the kernel, the table mentions the first | |
195 | Linux release whose OVS module supports the feature. | |
196 | ||
197 | * *Linux OVS tree*: The datapath implemented by the Linux kernel module | |
6792e407 | 198 | distributed with the OVS source tree. |
d05293af DDP |
199 | |
200 | * *Userspace*: Also known as DPDK, dpif-netdev or dummy datapath. It is the | |
6792e407 | 201 | only datapath that works on NetBSD, FreeBSD and Mac OSX. |
d05293af DDP |
202 | |
203 | * *Hyper-V*: Also known as the Windows datapath. | |
204 | ||
205 | The following table lists the datapath supported features from | |
206 | an Open vSwitch user's perspective. | |
207 | ||
208 | Feature | Linux upstream | Linux OVS tree | Userspace | Hyper-V | | |
209 | ----------------------|:--------------:|:--------------:|:---------:|:-------:| | |
ca65a3b1 | 210 | NAT | 4.6 | YES | NO | NO | |
5cf3edb3 | 211 | Connection tracking | 4.3 | YES | PARTIAL | PARTIAL | |
d05293af | 212 | Tunnel - LISP | NO | YES | NO | NO | |
6792e407 | 213 | Tunnel - STT | NO | YES | NO | YES | |
85571a3d | 214 | Tunnel - GRE | 3.11 | YES | YES | YES | |
d05293af | 215 | Tunnel - VXLAN | 3.12 | YES | YES | YES | |
ca65a3b1 | 216 | Tunnel - Geneve | 3.18 | YES | YES | YES | |
8a2d4905 PS |
217 | Tunnel - GRE-IPv6 | NO | NO | YES | NO | |
218 | Tunnel - VXLAN-IPv6 | 4.3 | YES | YES | NO | | |
219 | Tunnel - Geneve-IPv6 | 4.4 | YES | YES | NO | | |
d05293af DDP |
220 | QoS - Policing | YES | YES | NO | NO | |
221 | QoS - Shaping | YES | YES | NO | NO | | |
222 | sFlow | YES | YES | YES | NO | | |
6f0f1657 | 223 | IPFIX | 3.10 | YES | YES | NO | |
d05293af DDP |
224 | Set action | YES | YES | YES | PARTIAL | |
225 | NIC Bonding | YES | YES | YES | NO | | |
226 | Multiple VTEPs | YES | YES | YES | NO | | |
227 | ||
228 | **Notes:** | |
229 | * Only a limited set of flow fields is modifiable via the set action by the | |
230 | Hyper-V datapath. | |
231 | * The Hyper-V datapath only supports one physical NIC per datapath. This is | |
232 | why bonding is not supported. | |
233 | * The Hyper-V datapath can have at most one IP address configured as a | |
234 | tunnel endpoint. | |
235 | ||
236 | The following table lists features that do not *directly* impact an | |
237 | Open vSwitch user, e.g. because their absence can be hidden by the ofproto | |
238 | layer (usually this comes with a performance penalty). | |
239 | ||
240 | Feature | Linux upstream | Linux OVS tree | Userspace | Hyper-V | | |
241 | ----------------------|:--------------:|:--------------:|:---------:|:-------:| | |
242 | SCTP flows | 3.12 | YES | YES | YES | | |
06954237 | 243 | MPLS | 3.19 | YES | YES | YES | |
d05293af DDP |
244 | UFID | 4.0 | YES | YES | NO | |
245 | Megaflows | 3.12 | YES | YES | NO | | |
246 | Masked set action | 4.0 | YES | YES | NO | | |
2eb5deea | 247 | Recirculation | 3.19 | YES | YES | YES | |
d05293af DDP |
248 | TCP flags matching | 3.13 | YES | YES | NO | |
249 | Validate flow actions | YES | YES | N/A | NO | | |
250 | Multiple datapaths | YES | YES | YES | NO | | |
251 | Tunnel TSO - STT | N/A | YES | NO | YES | | |
47fe8a1d | 252 | |
5d246083 KT |
253 | ### Q: What DPDK version does each Open vSwitch release work with? |
254 | ||
255 | A: The following table lists the DPDK version against which the | |
256 | given versions of Open vSwitch will successfully build. | |
257 | ||
258 | | Open vSwitch | DPDK | |
259 | |:------------:|:-----: | |
260 | | 2.2.x | 1.6 | |
261 | | 2.3.x | 1.6 | |
262 | | 2.4.x | 2.0 | |
263 | | 2.5.x | 2.2 | |
264 | | 2.6.x | 16.04 | |
265 | ||
542cc9bb | 266 | ### Q: I get an error like this when I configure Open vSwitch: |
29089a54 | 267 | |
a7ae9380 BP |
268 | configure: error: Linux kernel in <dir> is version <x>, but |
269 | version newer than <y> is not supported (please refer to the | |
270 | FAQ for advice) | |
29089a54 | 271 | |
a7ae9380 | 272 | What should I do? |
33cec590 | 273 | |
fcc369bc BP |
274 | A: You have the following options: |
275 | ||
276 | - Use the Linux kernel module supplied with the kernel that you are | |
277 | using. (See also the following FAQ.) | |
278 | ||
279 | - If there is a newer released version of Open vSwitch, consider | |
280 | building that one, because it may support the kernel that you are | |
281 | building against. (To find out, consult the table in the | |
282 | previous FAQ.) | |
283 | ||
284 | - The Open vSwitch "master" branch may support the kernel that you | |
285 | are using, so consider building the kernel module from "master". | |
286 | ||
287 | All versions of Open vSwitch userspace are compatible with all | |
288 | versions of the Open vSwitch kernel module, so you do not have to | |
289 | use the kernel module from one source along with the userspace | |
290 | programs from the same source. | |
33cec590 | 291 | |
542cc9bb | 292 | ### Q: What features are not available in the Open vSwitch kernel datapath that ships as part of the upstream Linux kernel? |
7b287e99 | 293 | |
9c333bff JG |
294 | A: The kernel module in upstream Linux does not include support for |
295 | LISP. Work is in progress to add support for LISP to the upstream | |
296 | Linux version of the Open vSwitch kernel module. For now, if you | |
297 | need this feature, use the kernel module from the Open vSwitch | |
0a740f48 EJ |
298 | distribution instead of the upstream Linux kernel module. |
299 | ||
9c333bff JG |
300 | Certain features require kernel support to function or to have |
301 | reasonable performance. If the ovs-vswitchd log file indicates that | |
302 | a feature is not supported, consider upgrading to a newer upstream | |
303 | Linux release or using the kernel module paired with the userspace | |
304 | distribution. | |
6302c641 | 305 | |
542cc9bb | 306 | ### Q: Why do tunnels not work when using a kernel module other than the one packaged with Open vSwitch? |
6814c630 JG |
307 | |
308 | A: Support for tunnels was added to the upstream Linux kernel module | |
309 | after the rest of Open vSwitch. As a result, some kernels may contain | |
310 | support for Open vSwitch but not tunnels. The minimum kernel version | |
311 | that supports each tunnel protocol is: | |
312 | ||
542cc9bb TG |
313 | | Protocol | Linux Kernel |
314 | |:--------:|:-------------: | |
315 | | GRE | 3.11 | |
316 | | VXLAN | 3.12 | |
4752cc0c | 317 | | Geneve | 3.18 |
542cc9bb | 318 | | LISP | <not upstream> |
4237026e | 319 | | STT | <not upstream> |
6814c630 JG |
320 | |
321 | If you are using a version of the kernel that is older than the one | |
322 | listed above, it is still possible to use that tunnel protocol. However, | |
323 | you must compile and install the kernel module included with the Open | |
324 | vSwitch distribution rather than the one on your machine. If problems | |
325 | persist after doing this, check to make sure that the module that is | |
326 | loaded is the one you expect. | |
327 | ||
4752cc0c JG |
328 | ### Q: Why are UDP tunnel checksums not computed for VXLAN or Geneve? |
329 | ||
330 | A: Generating outer UDP checksums requires kernel support that was not | |
331 | part of the initial implementation of these protocols. If using the | |
332 | upstream Linux Open vSwitch module, you must use kernel 4.0 or | |
333 | newer. The out-of-tree modules from Open vSwitch release 2.4 and later | |
334 | support UDP checksums. | |
335 | ||
542cc9bb | 336 | ### Q: What features are not available when using the userspace datapath? |
7b287e99 | 337 | |
0a740f48 | 338 | A: Tunnel virtual ports are not supported, as described in the |
7b287e99 JP |
339 | previous answer. It is also not possible to use queue-related |
340 | actions. On Linux kernels before 2.6.39, maximum-sized VLAN packets | |
341 | may not be transmitted. | |
3fc7dc18 | 342 | |
542cc9bb | 343 | ### Q: Should userspace or kernel be upgraded first to minimize downtime? |
a7ae9380 BP |
344 | |
345 | In general, the Open vSwitch userspace should be used with the | |
346 | kernel version included in the same release or with the version | |
347 | from upstream Linux. However, when upgrading between two releases | |
348 | of Open vSwitch it is best to migrate userspace first to reduce | |
349 | the possibility of incompatibilities. | |
350 | ||
542cc9bb | 351 | ### Q: What happened to the bridge compatibility feature? |
900dc97c BP |
352 | |
353 | A: Bridge compatibility was a feature of Open vSwitch 1.9 and earlier. | |
354 | When it was enabled, Open vSwitch imitated the interface of the | |
355 | Linux kernel "bridge" module. This allowed users to drop Open | |
356 | vSwitch into environments designed to use the Linux kernel bridge | |
357 | module without adapting the environment to use Open vSwitch. | |
358 | ||
359 | Open vSwitch 1.10 and later do not support bridge compatibility. | |
360 | The feature was dropped because version 1.10 adopted a new internal | |
361 | architecture that made bridge compatibility difficult to maintain. | |
362 | Now that many environments use OVS directly, it would be rarely | |
363 | useful in any case. | |
364 | ||
365 | To use bridge compatibility, install OVS 1.9 or earlier, including | |
366 | the accompanying kernel modules (both the main and bridge | |
367 | compatibility modules), following the instructions that come with | |
368 | the release. Be sure to start the ovs-brcompatd daemon. | |
369 | ||
3fc7dc18 | 370 | |
fb5b3c22 | 371 | ## Terminology |
79aa9fd0 | 372 | |
542cc9bb | 373 | ### Q: I thought Open vSwitch was a virtual Ethernet switch, but the documentation keeps talking about bridges. What's a bridge? |
79aa9fd0 BP |
374 | |
375 | A: In networking, the terms "bridge" and "switch" are synonyms. Open | |
376 | vSwitch implements an Ethernet switch, which means that it is also | |
377 | an Ethernet bridge. | |
378 | ||
542cc9bb | 379 | ### Q: What's a VLAN? |
79aa9fd0 BP |
380 | |
381 | A: See the "VLAN" section below. | |
382 | ||
fb5b3c22 | 383 | ## Basic configuration |
717e7c8d | 384 | |
542cc9bb | 385 | ### Q: How do I configure a port as an access port? |
717e7c8d BP |
386 | |
387 | A: Add "tag=VLAN" to your "ovs-vsctl add-port" command. For example, | |
388 | the following commands configure br0 with eth0 as a trunk port (the | |
389 | default) and tap0 as an access port for VLAN 9: | |
390 | ||
391 | ovs-vsctl add-br br0 | |
392 | ovs-vsctl add-port br0 eth0 | |
393 | ovs-vsctl add-port br0 tap0 tag=9 | |
394 | ||
395 | If you want to configure an already added port as an access port, | |
396 | use "ovs-vsctl set", e.g.: | |
397 | ||
398 | ovs-vsctl set port tap0 tag=9 | |
399 | ||
542cc9bb | 400 | ### Q: How do I configure a port as a SPAN port, that is, enable mirroring of all traffic to that port? |
717e7c8d BP |
401 | |
402 | A: The following commands configure br0 with eth0 and tap0 as trunk | |
403 | ports. All traffic coming in or going out on eth0 or tap0 is also | |
404 | mirrored to tap1; any traffic arriving on tap1 is dropped: | |
405 | ||
406 | ovs-vsctl add-br br0 | |
407 | ovs-vsctl add-port br0 eth0 | |
408 | ovs-vsctl add-port br0 tap0 | |
409 | ovs-vsctl add-port br0 tap1 \ | |
410 | -- --id=@p get port tap1 \ | |
0dc8b8c2 YT |
411 | -- --id=@m create mirror name=m0 select-all=true output-port=@p \ |
412 | -- set bridge br0 mirrors=@m | |
717e7c8d BP |
413 | |
414 | To later disable mirroring, run: | |
415 | ||
416 | ovs-vsctl clear bridge br0 mirrors | |
417 | ||
542cc9bb | 418 | ### Q: Does Open vSwitch support configuring a port in promiscuous mode? |
e253f732 BP |
419 | |
420 | A: Yes. How you configure it depends on what you mean by "promiscuous | |
421 | mode": | |
422 | ||
542cc9bb TG |
423 | - Conventionally, "promiscuous mode" is a feature of a network |
424 | interface card. Ordinarily, a NIC passes to the CPU only the | |
425 | packets actually destined to its host machine. It discards | |
426 | the rest to avoid wasting memory and CPU cycles. When | |
427 | promiscuous mode is enabled, however, it passes every packet | |
428 | to the CPU. On an old-style shared-media or hub-based | |
429 | network, this allows the host to spy on all packets on the | |
430 | network. But in the switched networks that are almost | |
431 | everywhere these days, promiscuous mode doesn't have much | |
432 | effect, because few packets not destined to a host are | |
433 | delivered to the host's NIC. | |
434 | ||
435 | This form of promiscuous mode is configured in the guest OS of | |
436 | the VMs on your bridge, e.g. with "ifconfig". | |
437 | ||
438 | - The VMware vSwitch uses a different definition of "promiscuous | |
439 | mode". When you configure promiscuous mode on a VMware vNIC, | |
440 | the vSwitch sends a copy of every packet received by the | |
441 | vSwitch to that vNIC. That has a much bigger effect than just | |
442 | enabling promiscuous mode in a guest OS. Rather than getting | |
443 | a few stray packets for which the switch does not yet know the | |
444 | correct destination, the vNIC gets every packet. The effect | |
445 | is similar to replacing the vSwitch by a virtual hub. | |
446 | ||
447 | This "promiscuous mode" is what switches normally call "port | |
448 | mirroring" or "SPAN". For information on how to configure | |
449 | SPAN, see "How do I configure a port as a SPAN port, that is, | |
450 | enable mirroring of all traffic to that port?" | |
451 | ||
77c180ce BM |
452 | ### Q: How do I configure a DPDK port as an access port? |
453 | ||
454 | A: Firstly, you must have a DPDK-enabled version of Open vSwitch. | |
455 | ||
bab69409 AC |
456 | If your version is DPDK-enabled it will support the other-config:dpdk-init |
457 | configuration in the database and will display lines with "EAL:..." | |
458 | during startup when other_config:dpdk-init is set to 'true'. | |
77c180ce BM |
459 | |
460 | Secondly, when adding a DPDK port, unlike a system port, the | |
461 | type for the interface must be specified. For example; | |
462 | ||
463 | ovs-vsctl add-br br0 | |
464 | ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk | |
465 | ||
466 | Finally, it is required that DPDK port names begin with 'dpdk'. | |
467 | ||
468 | See [INSTALL.DPDK.md] for more information on enabling and using DPDK with | |
469 | Open vSwitch. | |
470 | ||
542cc9bb | 471 | ### Q: How do I configure a VLAN as an RSPAN VLAN, that is, enable mirroring of all traffic to that VLAN? |
717e7c8d BP |
472 | |
473 | A: The following commands configure br0 with eth0 as a trunk port and | |
474 | tap0 as an access port for VLAN 10. All traffic coming in or going | |
475 | out on tap0, as well as traffic coming in or going out on eth0 in | |
476 | VLAN 10, is also mirrored to VLAN 15 on eth0. The original tag for | |
477 | VLAN 10, in cases where one is present, is dropped as part of | |
478 | mirroring: | |
479 | ||
480 | ovs-vsctl add-br br0 | |
481 | ovs-vsctl add-port br0 eth0 | |
482 | ovs-vsctl add-port br0 tap0 tag=10 | |
483 | ovs-vsctl \ | |
0dc8b8c2 | 484 | -- --id=@m create mirror name=m0 select-all=true select-vlan=10 \ |
717e7c8d | 485 | output-vlan=15 \ |
0dc8b8c2 | 486 | -- set bridge br0 mirrors=@m |
717e7c8d BP |
487 | |
488 | To later disable mirroring, run: | |
489 | ||
490 | ovs-vsctl clear bridge br0 mirrors | |
491 | ||
492 | Mirroring to a VLAN can disrupt a network that contains unmanaged | |
493 | switches. See ovs-vswitchd.conf.db(5) for details. Mirroring to a | |
494 | GRE tunnel has fewer caveats than mirroring to a VLAN and should | |
495 | generally be preferred. | |
496 | ||
542cc9bb | 497 | ### Q: Can I mirror more than one input VLAN to an RSPAN VLAN? |
717e7c8d BP |
498 | |
499 | A: Yes, but mirroring to a VLAN strips the original VLAN tag in favor | |
500 | of the specified output-vlan. This loss of information may make | |
501 | the mirrored traffic too hard to interpret. | |
502 | ||
503 | To mirror multiple VLANs, use the commands above, but specify a | |
504 | comma-separated list of VLANs as the value for select-vlan. To | |
505 | mirror every VLAN, use the commands above, but omit select-vlan and | |
506 | its value entirely. | |
507 | ||
508 | When a packet arrives on a VLAN that is used as a mirror output | |
509 | VLAN, the mirror is disregarded. Instead, in standalone mode, OVS | |
510 | floods the packet across all the ports for which the mirror output | |
511 | VLAN is configured. (If an OpenFlow controller is in use, then it | |
512 | can override this behavior through the flow table.) If OVS is used | |
513 | as an intermediate switch, rather than an edge switch, this ensures | |
514 | that the RSPAN traffic is distributed through the network. | |
515 | ||
516 | Mirroring to a VLAN can disrupt a network that contains unmanaged | |
517 | switches. See ovs-vswitchd.conf.db(5) for details. Mirroring to a | |
518 | GRE tunnel has fewer caveats than mirroring to a VLAN and should | |
519 | generally be preferred. | |
520 | ||
542cc9bb | 521 | ### Q: How do I configure mirroring of all traffic to a GRE tunnel? |
717e7c8d BP |
522 | |
523 | A: The following commands configure br0 with eth0 and tap0 as trunk | |
524 | ports. All traffic coming in or going out on eth0 or tap0 is also | |
525 | mirrored to gre0, a GRE tunnel to the remote host 192.168.1.10; any | |
526 | traffic arriving on gre0 is dropped: | |
527 | ||
528 | ovs-vsctl add-br br0 | |
529 | ovs-vsctl add-port br0 eth0 | |
530 | ovs-vsctl add-port br0 tap0 | |
531 | ovs-vsctl add-port br0 gre0 \ | |
532 | -- set interface gre0 type=gre options:remote_ip=192.168.1.10 \ | |
533 | -- --id=@p get port gre0 \ | |
0dc8b8c2 YT |
534 | -- --id=@m create mirror name=m0 select-all=true output-port=@p \ |
535 | -- set bridge br0 mirrors=@m | |
717e7c8d BP |
536 | |
537 | To later disable mirroring and destroy the GRE tunnel: | |
538 | ||
539 | ovs-vsctl clear bridge br0 mirrors | |
1e759125 | 540 | ovs-vsctl del-port br0 gre0 |
717e7c8d | 541 | |
542cc9bb | 542 | ### Q: Does Open vSwitch support ERSPAN? |
717e7c8d BP |
543 | |
544 | A: No. ERSPAN is an undocumented proprietary protocol. As an | |
545 | alternative, Open vSwitch supports mirroring to a GRE tunnel (see | |
546 | above). | |
547 | ||
542cc9bb | 548 | ### Q: How do I connect two bridges? |
1ab9712b BP |
549 | |
550 | A: First, why do you want to do this? Two connected bridges are not | |
551 | much different from a single bridge, so you might as well just have | |
552 | a single bridge with all your ports on it. | |
553 | ||
554 | If you still want to connect two bridges, you can use a pair of | |
555 | patch ports. The following example creates bridges br0 and br1, | |
556 | adds eth0 and tap0 to br0, adds tap1 to br1, and then connects br0 | |
557 | and br1 with a pair of patch ports. | |
558 | ||
559 | ovs-vsctl add-br br0 | |
560 | ovs-vsctl add-port br0 eth0 | |
561 | ovs-vsctl add-port br0 tap0 | |
562 | ovs-vsctl add-br br1 | |
563 | ovs-vsctl add-port br1 tap1 | |
564 | ovs-vsctl \ | |
565 | -- add-port br0 patch0 \ | |
566 | -- set interface patch0 type=patch options:peer=patch1 \ | |
567 | -- add-port br1 patch1 \ | |
568 | -- set interface patch1 type=patch options:peer=patch0 | |
569 | ||
570 | Bridges connected with patch ports are much like a single bridge. | |
571 | For instance, if the example above also added eth1 to br1, and both | |
572 | eth0 and eth1 happened to be connected to the same next-hop switch, | |
573 | then you could loop your network just as you would if you added | |
574 | eth0 and eth1 to the same bridge (see the "Configuration Problems" | |
575 | section below for more information). | |
576 | ||
577 | If you are using Open vSwitch 1.9 or an earlier version, then you | |
578 | need to be using the kernel module bundled with Open vSwitch rather | |
579 | than the one that is integrated into Linux 3.3 and later, because | |
580 | Open vSwitch 1.9 and earlier versions need kernel support for patch | |
581 | ports. This also means that in Open vSwitch 1.9 and earlier, patch | |
582 | ports will not work with the userspace datapath, only with the | |
583 | kernel module. | |
584 | ||
542cc9bb | 585 | ### Q: How do I configure a bridge without an OpenFlow local port? (Local port in the sense of OFPP_LOCAL) |
5c9c1105 YT |
586 | |
587 | A: Open vSwitch does not support such a configuration. | |
588 | Bridges always have their local ports. | |
589 | ||
fb5b3c22 | 590 | ## Implementation Details |
1a274bfe | 591 | |
542cc9bb | 592 | ### Q: I hear OVS has a couple of kinds of flows. Can you tell me about them? |
a70fc0cf JP |
593 | |
594 | A: Open vSwitch uses different kinds of flows for different purposes: | |
595 | ||
542cc9bb TG |
596 | - OpenFlow flows are the most important kind of flow. OpenFlow |
597 | controllers use these flows to define a switch's policy. | |
598 | OpenFlow flows support wildcards, priorities, and multiple | |
599 | tables. | |
600 | ||
601 | When in-band control is in use, Open vSwitch sets up a few | |
602 | "hidden" flows, with priority higher than a controller or the | |
603 | user can configure, that are not visible via OpenFlow. (See | |
604 | the "Controller" section of the FAQ for more information | |
605 | about hidden flows.) | |
606 | ||
607 | - The Open vSwitch software switch implementation uses a second | |
608 | kind of flow internally. These flows, called "datapath" or | |
609 | "kernel" flows, do not support priorities and comprise only a | |
610 | single table, which makes them suitable for caching. (Like | |
611 | OpenFlow flows, datapath flows do support wildcarding, in Open | |
612 | vSwitch 1.11 and later.) OpenFlow flows and datapath flows | |
613 | also support different actions and number ports differently. | |
614 | ||
615 | Datapath flows are an implementation detail that is subject to | |
616 | change in future versions of Open vSwitch. Even with the | |
617 | current version of Open vSwitch, hardware switch | |
618 | implementations do not necessarily use this architecture. | |
a70fc0cf | 619 | |
1a274bfe BP |
620 | Users and controllers directly control only the OpenFlow flow |
621 | table. Open vSwitch manages the datapath flow table itself, so | |
622 | users should not normally be concerned with it. | |
623 | ||
542cc9bb | 624 | ### Q: Why are there so many different ways to dump flows? |
1a274bfe BP |
625 | |
626 | A: Open vSwitch has two kinds of flows (see the previous question), so | |
627 | it has commands with different purposes for dumping each kind of | |
628 | flow: | |
a70fc0cf | 629 | |
542cc9bb TG |
630 | - `ovs-ofctl dump-flows <br>` dumps OpenFlow flows, excluding |
631 | hidden flows. This is the most commonly useful form of flow | |
632 | dump. (Unlike the other commands, this should work with any | |
633 | OpenFlow switch, not just Open vSwitch.) | |
a70fc0cf | 634 | |
542cc9bb TG |
635 | - `ovs-appctl bridge/dump-flows <br>` dumps OpenFlow flows, |
636 | including hidden flows. This is occasionally useful for | |
637 | troubleshooting suspected issues with in-band control. | |
a70fc0cf | 638 | |
542cc9bb TG |
639 | - `ovs-dpctl dump-flows [dp]` dumps the datapath flow table |
640 | entries for a Linux kernel-based datapath. In Open vSwitch | |
641 | 1.10 and later, ovs-vswitchd merges multiple switches into a | |
642 | single datapath, so it will show all the flows on all your | |
643 | kernel-based switches. This command can occasionally be | |
644 | useful for debugging. | |
a70fc0cf | 645 | |
542cc9bb TG |
646 | - `ovs-appctl dpif/dump-flows <br>`, new in Open vSwitch 1.10, |
647 | dumps datapath flows for only the specified bridge, regardless | |
648 | of the type. | |
a70fc0cf | 649 | |
542cc9bb | 650 | ### Q: How does multicast snooping works with VLANs? |
c81f359b FL |
651 | |
652 | A: Open vSwitch maintains snooping tables for each VLAN. | |
653 | ||
d25cb282 BP |
654 | ### Q: Can OVS populate the kernel flow table in advance instead of in reaction to packets? |
655 | ||
656 | A: No. There are several reasons: | |
657 | ||
658 | - Kernel flows are not as sophisticated as OpenFlow flows, which | |
659 | means that some OpenFlow policies could require a large number of | |
660 | kernel flows. The "conjunctive match" feature is an extreme | |
661 | example: the number of kernel flows it requires is the product of | |
662 | the number of flows in each dimension. | |
663 | ||
664 | - With multiple OpenFlow flow tables and simple sets of actions, the | |
665 | number of kernel flows required can be as large as the product of | |
666 | the number of flows in each dimension. With more sophisticated | |
667 | actions, the number of kernel flows could be even larger. | |
668 | ||
669 | - Open vSwitch is designed so that any version of OVS userspace | |
670 | interoperates with any version of the OVS kernel module. This | |
671 | forward and backward compatibility requires that userspace observe | |
672 | how the kernel module parses received packets. This is only | |
673 | possible in a straightforward way when userspace adds kernel flows | |
674 | in reaction to received packets. | |
675 | ||
676 | For more relevant information on the architecture of Open vSwitch, | |
677 | please read "The Design and Implementation of Open vSwitch", | |
678 | published in USENIX NSDI 2015. | |
679 | ||
fb5b3c22 | 680 | ## Performance |
bcb8bde4 | 681 | |
542cc9bb | 682 | ### Q: I just upgraded and I see a performance drop. Why? |
bcb8bde4 JR |
683 | |
684 | A: The OVS kernel datapath may have been updated to a newer version than | |
685 | the OVS userspace components. Sometimes new versions of OVS kernel | |
686 | module add functionality that is backwards compatible with older | |
687 | userspace components but may cause a drop in performance with them. | |
688 | Especially, if a kernel module from OVS 2.1 or newer is paired with | |
689 | OVS userspace 1.10 or older, there will be a performance drop for | |
690 | TCP traffic. | |
691 | ||
692 | Updating the OVS userspace components to the latest released | |
693 | version should fix the performance degradation. | |
694 | ||
695 | To get the best possible performance and functionality, it is | |
696 | recommended to pair the same versions of the kernel module and OVS | |
697 | userspace. | |
698 | ||
699 | ||
fb5b3c22 | 700 | ## Configuration Problems |
c483d489 | 701 | |
542cc9bb | 702 | ### Q: I created a bridge and added my Ethernet port to it, using commands |
c483d489 BP |
703 | like these: |
704 | ||
705 | ovs-vsctl add-br br0 | |
706 | ovs-vsctl add-port br0 eth0 | |
707 | ||
708 | and as soon as I ran the "add-port" command I lost all connectivity | |
709 | through eth0. Help! | |
710 | ||
711 | A: A physical Ethernet device that is part of an Open vSwitch bridge | |
712 | should not have an IP address. If one does, then that IP address | |
713 | will not be fully functional. | |
714 | ||
715 | You can restore functionality by moving the IP address to an Open | |
716 | vSwitch "internal" device, such as the network device named after | |
717 | the bridge itself. For example, assuming that eth0's IP address is | |
718 | 192.168.128.5, you could run the commands below to fix up the | |
719 | situation: | |
720 | ||
721 | ifconfig eth0 0.0.0.0 | |
722 | ifconfig br0 192.168.128.5 | |
723 | ||
724 | (If your only connection to the machine running OVS is through the | |
725 | IP address in question, then you would want to run all of these | |
726 | commands on a single command line, or put them into a script.) If | |
727 | there were any additional routes assigned to eth0, then you would | |
728 | also want to use commands to adjust these routes to go through br0. | |
729 | ||
730 | If you use DHCP to obtain an IP address, then you should kill the | |
731 | DHCP client that was listening on the physical Ethernet interface | |
732 | (e.g. eth0) and start one listening on the internal interface | |
733 | (e.g. br0). You might still need to manually clear the IP address | |
734 | from the physical interface (e.g. with "ifconfig eth0 0.0.0.0"). | |
735 | ||
736 | There is no compelling reason why Open vSwitch must work this way. | |
737 | However, this is the way that the Linux kernel bridge module has | |
738 | always worked, so it's a model that those accustomed to Linux | |
739 | bridging are already used to. Also, the model that most people | |
740 | expect is not implementable without kernel changes on all the | |
741 | versions of Linux that Open vSwitch supports. | |
742 | ||
743 | By the way, this issue is not specific to physical Ethernet | |
c7b0cfd3 | 744 | devices. It applies to all network devices except Open vSwitch |
c483d489 BP |
745 | "internal" devices. |
746 | ||
542cc9bb TG |
747 | ### Q: I created a bridge and added a couple of Ethernet ports to it, |
748 | ### using commands like these: | |
c483d489 BP |
749 | |
750 | ovs-vsctl add-br br0 | |
751 | ovs-vsctl add-port br0 eth0 | |
752 | ovs-vsctl add-port br0 eth1 | |
753 | ||
754 | and now my network seems to have melted: connectivity is unreliable | |
755 | (even connectivity that doesn't go through Open vSwitch), all the | |
629a6b48 BP |
756 | LEDs on my physical switches are blinking, wireshark shows |
757 | duplicated packets, and CPU usage is very high. | |
c483d489 BP |
758 | |
759 | A: More than likely, you've looped your network. Probably, eth0 and | |
760 | eth1 are connected to the same physical Ethernet switch. This | |
761 | yields a scenario where OVS receives a broadcast packet on eth0 and | |
762 | sends it out on eth1, then the physical switch connected to eth1 | |
763 | sends the packet back on eth0, and so on forever. More complicated | |
764 | scenarios, involving a loop through multiple switches, are possible | |
765 | too. | |
766 | ||
767 | The solution depends on what you are trying to do: | |
768 | ||
542cc9bb TG |
769 | - If you added eth0 and eth1 to get higher bandwidth or higher |
770 | reliability between OVS and your physical Ethernet switch, | |
771 | use a bond. The following commands create br0 and then add | |
772 | eth0 and eth1 as a bond: | |
c483d489 | 773 | |
542cc9bb TG |
774 | ovs-vsctl add-br br0 |
775 | ovs-vsctl add-bond br0 bond0 eth0 eth1 | |
c483d489 | 776 | |
542cc9bb TG |
777 | Bonds have tons of configuration options. Please read the |
778 | documentation on the Port table in ovs-vswitchd.conf.db(5) | |
779 | for all the details. | |
c483d489 | 780 | |
77c180ce BM |
781 | Configuration for DPDK-enabled interfaces is slightly less |
782 | straightforward: see [INSTALL.DPDK.md]. | |
783 | ||
542cc9bb TG |
784 | - Perhaps you don't actually need eth0 and eth1 to be on the |
785 | same bridge. For example, if you simply want to be able to | |
786 | connect each of them to virtual machines, then you can put | |
787 | each of them on a bridge of its own: | |
c483d489 | 788 | |
542cc9bb TG |
789 | ovs-vsctl add-br br0 |
790 | ovs-vsctl add-port br0 eth0 | |
c483d489 | 791 | |
542cc9bb TG |
792 | ovs-vsctl add-br br1 |
793 | ovs-vsctl add-port br1 eth1 | |
c483d489 | 794 | |
542cc9bb TG |
795 | and then connect VMs to br0 and br1. (A potential |
796 | disadvantage is that traffic cannot directly pass between br0 | |
797 | and br1. Instead, it will go out eth0 and come back in eth1, | |
798 | or vice versa.) | |
c483d489 | 799 | |
542cc9bb TG |
800 | - If you have a redundant or complex network topology and you |
801 | want to prevent loops, turn on spanning tree protocol (STP). | |
802 | The following commands create br0, enable STP, and add eth0 | |
803 | and eth1 to the bridge. The order is important because you | |
804 | don't want have to have a loop in your network even | |
805 | transiently: | |
c483d489 | 806 | |
542cc9bb TG |
807 | ovs-vsctl add-br br0 |
808 | ovs-vsctl set bridge br0 stp_enable=true | |
809 | ovs-vsctl add-port br0 eth0 | |
810 | ovs-vsctl add-port br0 eth1 | |
c483d489 | 811 | |
542cc9bb TG |
812 | The Open vSwitch implementation of STP is not well tested. |
813 | Please report any bugs you observe, but if you'd rather avoid | |
814 | acting as a beta tester then another option might be your | |
815 | best shot. | |
c483d489 | 816 | |
542cc9bb | 817 | ### Q: I can't seem to use Open vSwitch in a wireless network. |
c483d489 BP |
818 | |
819 | A: Wireless base stations generally only allow packets with the source | |
820 | MAC address of NIC that completed the initial handshake. | |
821 | Therefore, without MAC rewriting, only a single device can | |
822 | communicate over a single wireless link. | |
823 | ||
824 | This isn't specific to Open vSwitch, it's enforced by the access | |
825 | point, so the same problems will show up with the Linux bridge or | |
826 | any other way to do bridging. | |
827 | ||
542cc9bb | 828 | ### Q: I can't seem to add my PPP interface to an Open vSwitch bridge. |
8748ec7b BP |
829 | |
830 | A: PPP most commonly carries IP packets, but Open vSwitch works only | |
831 | with Ethernet frames. The correct way to interface PPP to an | |
832 | Ethernet network is usually to use routing instead of switching. | |
833 | ||
542cc9bb | 834 | ### Q: Is there any documentation on the database tables and fields? |
5aa75474 BP |
835 | |
836 | A: Yes. ovs-vswitchd.conf.db(5) is a comprehensive reference. | |
837 | ||
542cc9bb | 838 | ### Q: When I run ovs-dpctl I no longer see the bridges I created. Instead, |
acf60855 JP |
839 | I only see a datapath called "ovs-system". How can I see datapath |
840 | information about a particular bridge? | |
841 | ||
842 | A: In version 1.9.0, OVS switched to using a single datapath that is | |
843 | shared by all bridges of that type. The "ovs-appctl dpif/*" | |
844 | commands provide similar functionality that is scoped by the bridge. | |
845 | ||
542cc9bb | 846 | ### Q: I created a GRE port using ovs-vsctl so why can't I send traffic or |
004a6249 JG |
847 | see the port in the datapath? |
848 | ||
849 | A: On Linux kernels before 3.11, the OVS GRE module and Linux GRE module | |
850 | cannot be loaded at the same time. It is likely that on your system the | |
851 | Linux GRE module is already loaded and blocking OVS (to confirm, check | |
852 | dmesg for errors regarding GRE registration). To fix this, unload all | |
853 | GRE modules that appear in lsmod as well as the OVS kernel module. You | |
542cc9bb | 854 | can then reload the OVS module following the directions in |
9feb1017 | 855 | [INSTALL.md], which will ensure that dependencies are satisfied. |
004a6249 | 856 | |
542cc9bb | 857 | ### Q: Open vSwitch does not seem to obey my packet filter rules. |
c6bbc394 YT |
858 | |
859 | A: It depends on mechanisms and configurations you want to use. | |
860 | ||
861 | You cannot usefully use typical packet filters, like iptables, on | |
862 | physical Ethernet ports that you add to an Open vSwitch bridge. | |
863 | This is because Open vSwitch captures packets from the interface at | |
864 | a layer lower below where typical packet-filter implementations | |
865 | install their hooks. (This actually applies to any interface of | |
866 | type "system" that you might add to an Open vSwitch bridge.) | |
867 | ||
868 | You can usefully use typical packet filters on Open vSwitch | |
869 | internal ports as they are mostly ordinary interfaces from the point | |
870 | of view of packet filters. | |
871 | ||
872 | For example, suppose you create a bridge br0 and add Ethernet port | |
873 | eth0 to it. Then you can usefully add iptables rules to affect the | |
874 | internal interface br0, but not the physical interface eth0. (br0 | |
875 | is also where you would add an IP address, as discussed elsewhere | |
876 | in the FAQ.) | |
877 | ||
878 | For simple filtering rules, it might be possible to achieve similar | |
879 | results by installing appropriate OpenFlow flows instead. | |
880 | ||
881 | If the use of a particular packet filter setup is essential, Open | |
882 | vSwitch might not be the best choice for you. On Linux, you might | |
883 | want to consider using the Linux Bridge. (This is the only choice if | |
884 | you want to use ebtables rules.) On NetBSD, you might want to | |
885 | consider using the bridge(4) with BRIDGE_IPF option. | |
886 | ||
542cc9bb | 887 | ### Q: It seems that Open vSwitch does nothing when I removed a port and |
dd63a57e YT |
888 | then immediately put it back. For example, consider that p1 is |
889 | a port of type=internal: | |
890 | ||
891 | ovs-vsctl del-port br0 p1 -- \ | |
892 | add-port br0 p1 -- \ | |
893 | set interface p1 type=internal | |
894 | ||
895 | A: It's an expected behaviour. | |
896 | ||
7494dca8 YT |
897 | If del-port and add-port happen in a single OVSDB transaction as |
898 | your example, Open vSwitch always "skips" the intermediate steps. | |
dd63a57e YT |
899 | Even if they are done in multiple transactions, it's still allowed |
900 | for Open vSwitch to skip the intermediate steps and just implement | |
901 | the overall effect. In both cases, your example would be turned | |
902 | into a no-op. | |
903 | ||
904 | If you want to make Open vSwitch actually destroy and then re-create | |
905 | the port for some side effects like resetting kernel setting for the | |
906 | corresponding interface, you need to separate operations into multiple | |
907 | OVSDB transactions and ensure that at least the first one does not have | |
908 | --no-wait. In the following example, the first ovs-vsctl will block | |
909 | until Open vSwitch reloads the new configuration and removes the port: | |
910 | ||
911 | ovs-vsctl del-port br0 p1 | |
912 | ovs-vsctl add-port br0 p1 -- \ | |
913 | set interface p1 type=internal | |
c483d489 | 914 | |
ed5c5110 BP |
915 | ### Q: I want to add thousands of ports to an Open vSwitch bridge, but |
916 | it takes too long (minutes or hours) to do it with ovs-vsctl. How | |
917 | can I do it faster? | |
918 | ||
919 | A: If you add them one at a time with ovs-vsctl, it can take a long | |
920 | time to add thousands of ports to an Open vSwitch bridge. This is | |
921 | because every invocation of ovs-vsctl first reads the current | |
922 | configuration from OVSDB. As the number of ports grows, this | |
923 | starts to take an appreciable amount of time, and when it is | |
924 | repeated thousands of times the total time becomes significant. | |
925 | ||
926 | The solution is to add the ports in one invocation of ovs-vsctl (or | |
927 | a small number of them). For example, using bash: | |
928 | ||
929 | ovs-vsctl add-br br0 | |
930 | cmds=; for i in {1..5000}; do cmds+=" -- add-port br0 p$i"; done | |
931 | ovs-vsctl $cmds | |
932 | ||
933 | takes seconds, not minutes or hours, in the OVS sandbox environment. | |
934 | ||
bb50a697 BP |
935 | ### Q: I created a bridge named br0. My bridge shows up in "ovs-vsctl |
936 | show", but "ovs-ofctl show br0" just prints "br0 is not a bridge | |
937 | or a socket". | |
938 | ||
939 | A: Open vSwitch wasn't able to create the bridge. Check the | |
940 | ovs-vswitchd log for details (Debian and Red Hat packaging for Open | |
941 | vSwitch put it in /var/log/openvswitch/ovs-vswitchd.log). | |
942 | ||
943 | In general, the Open vSwitch database reflects the desired | |
944 | configuration state. ovs-vswitchd monitors the database and, when | |
945 | it changes, reconfigures the system to reflect the new desired | |
946 | state. This normally happens very quickly. Thus, a discrepancy | |
947 | between the database and the actual state indicates that | |
948 | ovs-vswitchd could not implement the configuration, and so one | |
949 | should check the log to find out why. (Another possible cause is | |
950 | that ovs-vswitchd is not running. This will make "ovs-vsctl" | |
951 | commands hang, if they change the configuration, unless one | |
952 | specifies "--no-wait".) | |
953 | ||
954 | ### Q: I have a bridge br0. I added a new port vif1.0, and it shows | |
955 | up in "ovs-vsctl show", but "ovs-vsctl list port" says that it has | |
956 | OpenFlow port ("ofport") -1, and "ovs-ofctl show br0" doesn't show | |
957 | vif1.0 at all. | |
958 | ||
959 | A: Open vSwitch wasn't able to create the port. Check the | |
960 | ovs-vswitchd log for details (Debian and Red Hat packaging for Open | |
961 | vSwitch put it in /var/log/openvswitch/ovs-vswitchd.log). Please | |
962 | see the previous question for more information. | |
963 | ||
964 | You may want to upgrade to Open vSwitch 2.3 (or later), in which | |
965 | ovs-vsctl will immediately report when there is an issue creating a | |
966 | port. | |
967 | ||
1c98db0d BP |
968 | ### Q: I created a tap device tap0, configured an IP address on it, and |
969 | added it to a bridge, like this: | |
970 | ||
971 | tunctl -t tap0 | |
972 | ifconfig tap0 192.168.0.123 | |
973 | ovs-vsctl add-br br0 | |
974 | ovs-vsctl add-port br0 tap0 | |
975 | ||
976 | I expected that I could then use this IP address to contact other | |
977 | hosts on the network, but it doesn't work. Why not? | |
978 | ||
979 | A: The short answer is that this is a misuse of a "tap" device. Use | |
980 | an "internal" device implemented by Open vSwitch, which works | |
981 | differently and is designed for this use. To solve this problem | |
982 | with an internal device, instead run: | |
983 | ||
984 | ovs-vsctl add-br br0 | |
985 | ovs-vsctl add-port br0 int0 -- set Interface int0 type=internal | |
986 | ifconfig int0 192.168.0.123 | |
987 | ||
988 | Even more simply, you can take advantage of the internal port that | |
989 | every bridge has under the name of the bridge: | |
990 | ||
991 | ovs-vsctl add-br br0 | |
992 | ifconfig br0 192.168.0.123 | |
993 | ||
994 | In more detail, a "tap" device is an interface between the Linux | |
995 | (or *BSD) network stack and a user program that opens it as a | |
996 | socket. When the "tap" device transmits a packet, it appears in | |
997 | the socket opened by the userspace program. Conversely, when the | |
998 | userspace program writes to the "tap" socket, the kernel TCP/IP | |
999 | stack processes the packet as if it had been received by the "tap" | |
1000 | device. | |
1001 | ||
1002 | Consider the configuration above. Given this configuration, if you | |
1003 | "ping" an IP address in the 192.168.0.x subnet, the Linux kernel | |
1004 | routing stack will transmit an ARP on the tap0 device. Open | |
1005 | vSwitch userspace treats "tap" devices just like any other network | |
1006 | device; that is, it doesn't open them as "tap" sockets. That means | |
1007 | that the ARP packet will simply get dropped. | |
1008 | ||
1009 | You might wonder why the Open vSwitch kernel module doesn't | |
1010 | intercept the ARP packet and bridge it. After all, Open vSwitch | |
1011 | intercepts packets on other devices. The answer is that Open | |
1012 | vSwitch only intercepts *received* packets, but this is a packet | |
1013 | being transmitted. The same thing happens for all other types of | |
1014 | network devices, except for Open vSwitch "internal" ports. If you, | |
1015 | for example, add a physical Ethernet port to an OVS bridge, | |
1016 | configure an IP address on a physical Ethernet port, and then issue | |
1017 | a "ping" to an address in that subnet, the same thing happens: an | |
1018 | ARP gets transmitted on the physical Ethernet port and Open vSwitch | |
1019 | never sees it. (You should not do that, as documented at the | |
1020 | beginning of this section.) | |
1021 | ||
1022 | It can make sense to add a "tap" device to an Open vSwitch bridge, | |
1023 | if some userspace program (other than Open vSwitch) has opened the | |
1024 | tap socket. This is the case, for example, if the "tap" device was | |
1025 | created by KVM (or QEMU) to simulate a virtual NIC. In such a | |
1026 | case, when OVS bridges a packet to the "tap" device, the kernel | |
1027 | forwards that packet to KVM in userspace, which passes it along to | |
1028 | the VM, and in the other direction, when the VM sends a packet, KVM | |
1029 | writes it to the "tap" socket, which causes OVS to receive it and | |
1030 | bridge it to the other OVS ports. Please note that in such a case | |
1031 | no IP address is configured on the "tap" device (there is normally | |
1032 | an IP address configured in the virtual NIC inside the VM, but this | |
1033 | is not visible to the host Linux kernel or to Open vSwitch). | |
1034 | ||
1035 | There is one special case in which Open vSwitch does directly read | |
1036 | and write "tap" sockets. This is an implementation detail of the | |
1037 | Open vSwitch userspace switch, which implements its "internal" | |
1038 | ports as Linux (or *BSD) "tap" sockets. In such a userspace | |
1039 | switch, OVS receives packets sent on the "tap" device used to | |
1040 | implement an "internal" port by reading the associated "tap" | |
1041 | socket, and bridges them to the rest of the switch. In the other | |
1042 | direction, OVS transmits packets bridged to the "internal" port by | |
1043 | writing them to the "tap" socket, causing them to be processed by | |
1044 | the kernel TCP/IP stack as if they had been received on the "tap" | |
1045 | device. Users should not need to be concerned with this | |
1046 | implementation detail. | |
1047 | ||
1048 | Open vSwitch has a network device type called "tap". This is | |
1049 | intended only for implementing "internal" ports in the OVS | |
1050 | userspace switch and should not be used otherwise. In particular, | |
1051 | users should not configure KVM "tap" devices as type "tap" (use | |
1052 | type "system", the default, instead). | |
1053 | ||
bb50a697 | 1054 | |
fb5b3c22 | 1055 | ## QOS |
bceafb63 | 1056 | |
b814e503 JP |
1057 | ### Q: Does OVS support Quality of Service (QoS)? |
1058 | ||
1059 | A: Yes. For traffic that egresses from a switch, OVS supports traffic | |
1060 | shaping; for traffic that ingresses into a switch, OVS support | |
1061 | policing. Policing is a simple form of quality-of-service that | |
1062 | simply drops packets received in excess of the configured rate. Due | |
1063 | to its simplicity, policing is usually less accurate and less | |
1064 | effective than egress traffic shaping, which queues packets. | |
1065 | ||
1066 | Keep in mind that ingress and egress are from the perspective of the | |
1067 | switch. That means that egress shaping limits the rate at which | |
c47cb7e6 | 1068 | traffic is allowed to transmit from a physical interface, but not the |
b814e503 JP |
1069 | rate at which traffic will be received on a virtual machine's VIF. |
1070 | For ingress policing, the behavior is the opposite. | |
1071 | ||
1072 | ### Q: How do I configure egress traffic shaping? | |
bceafb63 BP |
1073 | |
1074 | A: Suppose that you want to set up bridge br0 connected to physical | |
1075 | Ethernet port eth0 (a 1 Gbps device) and virtual machine interfaces | |
1076 | vif1.0 and vif2.0, and that you want to limit traffic from vif1.0 | |
1077 | to eth0 to 10 Mbps and from vif2.0 to eth0 to 20 Mbps. Then, you | |
1078 | could configure the bridge this way: | |
1079 | ||
1080 | ovs-vsctl -- \ | |
1081 | add-br br0 -- \ | |
0dc8b8c2 YT |
1082 | add-port br0 eth0 -- \ |
1083 | add-port br0 vif1.0 -- set interface vif1.0 ofport_request=5 -- \ | |
1084 | add-port br0 vif2.0 -- set interface vif2.0 ofport_request=6 -- \ | |
1085 | set port eth0 qos=@newqos -- \ | |
1086 | --id=@newqos create qos type=linux-htb \ | |
bceafb63 | 1087 | other-config:max-rate=1000000000 \ |
0dc8b8c2 YT |
1088 | queues:123=@vif10queue \ |
1089 | queues:234=@vif20queue -- \ | |
bceafb63 BP |
1090 | --id=@vif10queue create queue other-config:max-rate=10000000 -- \ |
1091 | --id=@vif20queue create queue other-config:max-rate=20000000 | |
1092 | ||
1093 | At this point, bridge br0 is configured with the ports and eth0 is | |
1094 | configured with the queues that you need for QoS, but nothing is | |
1095 | actually directing packets from vif1.0 or vif2.0 to the queues that | |
1096 | we have set up for them. That means that all of the packets to | |
1097 | eth0 are going to the "default queue", which is not what we want. | |
1098 | ||
1099 | We use OpenFlow to direct packets from vif1.0 and vif2.0 to the | |
1100 | queues reserved for them: | |
1101 | ||
1102 | ovs-ofctl add-flow br0 in_port=5,actions=set_queue:123,normal | |
1103 | ovs-ofctl add-flow br0 in_port=6,actions=set_queue:234,normal | |
1104 | ||
1105 | Each of the above flows matches on the input port, sets up the | |
1106 | appropriate queue (123 for vif1.0, 234 for vif2.0), and then | |
1107 | executes the "normal" action, which performs the same switching | |
1108 | that Open vSwitch would have done without any OpenFlow flows being | |
1109 | present. (We know that vif1.0 and vif2.0 have OpenFlow port | |
1110 | numbers 5 and 6, respectively, because we set their ofport_request | |
1111 | columns above. If we had not done that, then we would have needed | |
1112 | to find out their port numbers before setting up these flows.) | |
1113 | ||
1114 | Now traffic going from vif1.0 or vif2.0 to eth0 should be | |
1115 | rate-limited. | |
1116 | ||
1117 | By the way, if you delete the bridge created by the above commands, | |
1118 | with: | |
1119 | ||
1120 | ovs-vsctl del-br br0 | |
1121 | ||
1122 | then that will leave one unreferenced QoS record and two | |
1123 | unreferenced Queue records in the Open vSwich database. One way to | |
1124 | clear them out, assuming you don't have other QoS or Queue records | |
1125 | that you want to keep, is: | |
1126 | ||
1127 | ovs-vsctl -- --all destroy QoS -- --all destroy Queue | |
1128 | ||
7839bb41 BP |
1129 | If you do want to keep some QoS or Queue records, or the Open |
1130 | vSwitch you are using is older than version 1.8 (which added the | |
1131 | --all option), then you will have to destroy QoS and Queue records | |
1132 | individually. | |
1133 | ||
b814e503 JP |
1134 | ### Q: How do I configure ingress policing? |
1135 | ||
1136 | A: A policing policy can be configured on an interface to drop packets | |
1137 | that arrive at a higher rate than the configured value. For example, | |
1138 | the following commands will rate-limit traffic that vif1.0 may | |
1139 | generate to 10Mbps: | |
1140 | ||
1141 | ovs-vsctl set interface vif1.0 ingress_policing_rate=10000 | |
79abacc8 | 1142 | ovs-vsctl set interface vif1.0 ingress_policing_burst=8000 |
b814e503 JP |
1143 | |
1144 | Traffic policing can interact poorly with some network protocols and | |
1145 | can have surprising results. The "Ingress Policing" section of | |
1146 | ovs-vswitchd.conf.db(5) discusses the issues in greater detail. | |
1147 | ||
542cc9bb | 1148 | ### Q: I configured Quality of Service (QoS) in my OpenFlow network by |
bceafb63 BP |
1149 | adding records to the QoS and Queue table, but the results aren't |
1150 | what I expect. | |
1151 | ||
1152 | A: Did you install OpenFlow flows that use your queues? This is the | |
1153 | primary way to tell Open vSwitch which queues you want to use. If | |
1154 | you don't do this, then the default queue will be used, which will | |
1155 | probably not have the effect you want. | |
1156 | ||
1157 | Refer to the previous question for an example. | |
1158 | ||
542cc9bb | 1159 | ### Q: I'd like to take advantage of some QoS feature that Open vSwitch |
e6d29aa7 BP |
1160 | doesn't yet support. How do I do that? |
1161 | ||
1162 | A: Open vSwitch does not implement QoS itself. Instead, it can | |
1163 | configure some, but not all, of the QoS features built into the | |
1164 | Linux kernel. If you need some QoS feature that OVS cannot | |
1165 | configure itself, then the first step is to figure out whether | |
1166 | Linux QoS supports that feature. If it does, then you can submit a | |
1167 | patch to support Open vSwitch configuration for that feature, or | |
1168 | you can use "tc" directly to configure the feature in Linux. (If | |
1169 | Linux QoS doesn't support the feature you want, then first you have | |
1170 | to add that support to Linux.) | |
1171 | ||
542cc9bb | 1172 | ### Q: I configured QoS, correctly, but my measurements show that it isn't |
bceafb63 BP |
1173 | working as well as I expect. |
1174 | ||
1175 | A: With the Linux kernel, the Open vSwitch implementation of QoS has | |
1176 | two aspects: | |
1177 | ||
542cc9bb TG |
1178 | - Open vSwitch configures a subset of Linux kernel QoS |
1179 | features, according to what is in OVSDB. It is possible that | |
1180 | this code has bugs. If you believe that this is so, then you | |
1181 | can configure the Linux traffic control (QoS) stack directly | |
1182 | with the "tc" program. If you get better results that way, | |
1183 | you can send a detailed bug report to bugs@openvswitch.org. | |
bceafb63 | 1184 | |
542cc9bb TG |
1185 | It is certain that Open vSwitch cannot configure every Linux |
1186 | kernel QoS feature. If you need some feature that OVS cannot | |
1187 | configure, then you can also use "tc" directly (or add that | |
1188 | feature to OVS). | |
bceafb63 | 1189 | |
542cc9bb TG |
1190 | - The Open vSwitch implementation of OpenFlow allows flows to |
1191 | be directed to particular queues. This is pretty simple and | |
1192 | unlikely to have serious bugs at this point. | |
bceafb63 BP |
1193 | |
1194 | However, most problems with QoS on Linux are not bugs in Open | |
1195 | vSwitch at all. They tend to be either configuration errors | |
1196 | (please see the earlier questions in this section) or issues with | |
1197 | the traffic control (QoS) stack in Linux. The Open vSwitch | |
1198 | developers are not experts on Linux traffic control. We suggest | |
1199 | that, if you believe you are encountering a problem with Linux | |
1200 | traffic control, that you consult the tc manpages (e.g. tc(8), | |
1201 | tc-htb(8), tc-hfsc(8)), web resources (e.g. http://lartc.org/), or | |
1202 | mailing lists (e.g. http://vger.kernel.org/vger-lists.html#netdev). | |
1203 | ||
542cc9bb | 1204 | ### Q: Does Open vSwitch support OpenFlow meters? |
733fd270 BP |
1205 | |
1206 | A: Since version 2.0, Open vSwitch has OpenFlow protocol support for | |
1207 | OpenFlow meters. There is no implementation of meters in the Open | |
1208 | vSwitch software switch (neither the kernel-based nor userspace | |
1209 | switches). | |
1210 | ||
fb5b3c22 | 1211 | ## VLANs |
c483d489 | 1212 | |
542cc9bb | 1213 | ### Q: What's a VLAN? |
14481051 BP |
1214 | |
1215 | A: At the simplest level, a VLAN (short for "virtual LAN") is a way to | |
1216 | partition a single switch into multiple switches. Suppose, for | |
1217 | example, that you have two groups of machines, group A and group B. | |
1218 | You want the machines in group A to be able to talk to each other, | |
1219 | and you want the machine in group B to be able to talk to each | |
1220 | other, but you don't want the machines in group A to be able to | |
1221 | talk to the machines in group B. You can do this with two | |
1222 | switches, by plugging the machines in group A into one switch and | |
1223 | the machines in group B into the other switch. | |
1224 | ||
1225 | If you only have one switch, then you can use VLANs to do the same | |
1226 | thing, by configuring the ports for machines in group A as VLAN | |
1227 | "access ports" for one VLAN and the ports for group B as "access | |
1228 | ports" for a different VLAN. The switch will only forward packets | |
1229 | between ports that are assigned to the same VLAN, so this | |
1230 | effectively subdivides your single switch into two independent | |
1231 | switches, one for each group of machines. | |
1232 | ||
1233 | So far we haven't said anything about VLAN headers. With access | |
1234 | ports, like we've described so far, no VLAN header is present in | |
1235 | the Ethernet frame. This means that the machines (or switches) | |
1236 | connected to access ports need not be aware that VLANs are | |
1237 | involved, just like in the case where we use two different physical | |
1238 | switches. | |
1239 | ||
1240 | Now suppose that you have a whole bunch of switches in your | |
1241 | network, instead of just one, and that some machines in group A are | |
1242 | connected directly to both switches 1 and 2. To allow these | |
1243 | machines to talk to each other, you could add an access port for | |
1244 | group A's VLAN to switch 1 and another to switch 2, and then | |
1245 | connect an Ethernet cable between those ports. That works fine, | |
1246 | but it doesn't scale well as the number of switches and the number | |
1247 | of VLANs increases, because you use up a lot of valuable switch | |
1248 | ports just connecting together your VLANs. | |
1249 | ||
1250 | This is where VLAN headers come in. Instead of using one cable and | |
1251 | two ports per VLAN to connect a pair of switches, we configure a | |
1252 | port on each switch as a VLAN "trunk port". Packets sent and | |
1253 | received on a trunk port carry a VLAN header that says what VLAN | |
1254 | the packet belongs to, so that only two ports total are required to | |
1255 | connect the switches, regardless of the number of VLANs in use. | |
1256 | Normally, only switches (either physical or virtual) are connected | |
1257 | to a trunk port, not individual hosts, because individual hosts | |
1258 | don't expect to see a VLAN header in the traffic that they receive. | |
1259 | ||
1260 | None of the above discussion says anything about particular VLAN | |
1261 | numbers. This is because VLAN numbers are completely arbitrary. | |
1262 | One must only ensure that a given VLAN is numbered consistently | |
1263 | throughout a network and that different VLANs are given different | |
1264 | numbers. (That said, VLAN 0 is usually synonymous with a packet | |
1265 | that has no VLAN header, and VLAN 4095 is reserved.) | |
1266 | ||
542cc9bb | 1267 | ### Q: VLANs don't work. |
c483d489 BP |
1268 | |
1269 | A: Many drivers in Linux kernels before version 3.3 had VLAN-related | |
1270 | bugs. If you are having problems with VLANs that you suspect to be | |
1271 | driver related, then you have several options: | |
1272 | ||
542cc9bb | 1273 | - Upgrade to Linux 3.3 or later. |
c483d489 | 1274 | |
542cc9bb TG |
1275 | - Build and install a fixed version of the particular driver |
1276 | that is causing trouble, if one is available. | |
c483d489 | 1277 | |
542cc9bb | 1278 | - Use a NIC whose driver does not have VLAN problems. |
c483d489 | 1279 | |
42deb67d | 1280 | - Use "VLAN splinters", a feature in Open vSwitch 1.4 upto 2.5 |
542cc9bb TG |
1281 | that works around bugs in kernel drivers. To enable VLAN |
1282 | splinters on interface eth0, use the command: | |
c483d489 | 1283 | |
542cc9bb | 1284 | ovs-vsctl set interface eth0 other-config:enable-vlan-splinters=true |
c483d489 | 1285 | |
542cc9bb TG |
1286 | For VLAN splinters to be effective, Open vSwitch must know |
1287 | which VLANs are in use. See the "VLAN splinters" section in | |
1288 | the Interface table in ovs-vswitchd.conf.db(5) for details on | |
1289 | how Open vSwitch infers in-use VLANs. | |
c483d489 | 1290 | |
542cc9bb TG |
1291 | VLAN splinters increase memory use and reduce performance, so |
1292 | use them only if needed. | |
c483d489 | 1293 | |
542cc9bb TG |
1294 | - Apply the "vlan workaround" patch from the XenServer kernel |
1295 | patch queue, build Open vSwitch against this patched kernel, | |
1296 | and then use ovs-vlan-bug-workaround(8) to enable the VLAN | |
1297 | workaround for each interface whose driver is buggy. | |
c483d489 | 1298 | |
542cc9bb TG |
1299 | (This is a nontrivial exercise, so this option is included |
1300 | only for completeness.) | |
c483d489 BP |
1301 | |
1302 | It is not always easy to tell whether a Linux kernel driver has | |
1303 | buggy VLAN support. The ovs-vlan-test(8) and ovs-test(8) utilities | |
1304 | can help you test. See their manpages for details. Of the two | |
1305 | utilities, ovs-test(8) is newer and more thorough, but | |
1306 | ovs-vlan-test(8) may be easier to use. | |
1307 | ||
542cc9bb | 1308 | ### Q: VLANs still don't work. I've tested the driver so I know that it's OK. |
c483d489 BP |
1309 | |
1310 | A: Do you have VLANs enabled on the physical switch that OVS is | |
1311 | attached to? Make sure that the port is configured to trunk the | |
1312 | VLAN or VLANs that you are using with OVS. | |
1313 | ||
542cc9bb | 1314 | ### Q: Outgoing VLAN-tagged traffic goes through OVS to my physical switch |
c483d489 BP |
1315 | and to its destination host, but OVS seems to drop incoming return |
1316 | traffic. | |
1317 | ||
1318 | A: It's possible that you have the VLAN configured on your physical | |
1319 | switch as the "native" VLAN. In this mode, the switch treats | |
1320 | incoming packets either tagged with the native VLAN or untagged as | |
1321 | part of the native VLAN. It may also send outgoing packets in the | |
1322 | native VLAN without a VLAN tag. | |
1323 | ||
1324 | If this is the case, you have two choices: | |
1325 | ||
542cc9bb TG |
1326 | - Change the physical switch port configuration to tag packets |
1327 | it forwards to OVS with the native VLAN instead of forwarding | |
1328 | them untagged. | |
c483d489 | 1329 | |
542cc9bb TG |
1330 | - Change the OVS configuration for the physical port to a |
1331 | native VLAN mode. For example, the following sets up a | |
1332 | bridge with port eth0 in "native-tagged" mode in VLAN 9: | |
c483d489 | 1333 | |
542cc9bb TG |
1334 | ovs-vsctl add-br br0 |
1335 | ovs-vsctl add-port br0 eth0 tag=9 vlan_mode=native-tagged | |
c483d489 | 1336 | |
542cc9bb TG |
1337 | In this situation, "native-untagged" mode will probably work |
1338 | equally well. Refer to the documentation for the Port table | |
1339 | in ovs-vswitchd.conf.db(5) for more information. | |
c483d489 | 1340 | |
542cc9bb | 1341 | ### Q: I added a pair of VMs on different VLANs, like this: |
8d45e938 BP |
1342 | |
1343 | ovs-vsctl add-br br0 | |
1344 | ovs-vsctl add-port br0 eth0 | |
1345 | ovs-vsctl add-port br0 tap0 tag=9 | |
1346 | ovs-vsctl add-port br0 tap1 tag=10 | |
1347 | ||
1348 | but the VMs can't access each other, the external network, or the | |
1349 | Internet. | |
1350 | ||
1351 | A: It is to be expected that the VMs can't access each other. VLANs | |
1352 | are a means to partition a network. When you configured tap0 and | |
1353 | tap1 as access ports for different VLANs, you indicated that they | |
1354 | should be isolated from each other. | |
1355 | ||
1356 | As for the external network and the Internet, it seems likely that | |
1357 | the machines you are trying to access are not on VLAN 9 (or 10) and | |
1358 | that the Internet is not available on VLAN 9 (or 10). | |
1359 | ||
542cc9bb | 1360 | ### Q: I added a pair of VMs on the same VLAN, like this: |
3c8399a2 BP |
1361 | |
1362 | ovs-vsctl add-br br0 | |
1363 | ovs-vsctl add-port br0 eth0 | |
1364 | ovs-vsctl add-port br0 tap0 tag=9 | |
1365 | ovs-vsctl add-port br0 tap1 tag=9 | |
1366 | ||
1367 | The VMs can access each other, but not the external network or the | |
1368 | Internet. | |
1369 | ||
1370 | A: It seems likely that the machines you are trying to access in the | |
1371 | external network are not on VLAN 9 and that the Internet is not | |
1372 | available on VLAN 9. Also, ensure VLAN 9 is set up as an allowed | |
1373 | trunk VLAN on the upstream switch port to which eth0 is connected. | |
1374 | ||
542cc9bb | 1375 | ### Q: Can I configure an IP address on a VLAN? |
c483d489 BP |
1376 | |
1377 | A: Yes. Use an "internal port" configured as an access port. For | |
1378 | example, the following configures IP address 192.168.0.7 on VLAN 9. | |
1379 | That is, OVS will forward packets from eth0 to 192.168.0.7 only if | |
1380 | they have an 802.1Q header with VLAN 9. Conversely, traffic | |
1381 | forwarded from 192.168.0.7 to eth0 will be tagged with an 802.1Q | |
1382 | header with VLAN 9: | |
1383 | ||
1384 | ovs-vsctl add-br br0 | |
1385 | ovs-vsctl add-port br0 eth0 | |
1386 | ovs-vsctl add-port br0 vlan9 tag=9 -- set interface vlan9 type=internal | |
1387 | ifconfig vlan9 192.168.0.7 | |
1388 | ||
8dc54921 BP |
1389 | See also the following question. |
1390 | ||
542cc9bb | 1391 | ### Q: I configured one IP address on VLAN 0 and another on VLAN 9, like |
8dc54921 BP |
1392 | this: |
1393 | ||
1394 | ovs-vsctl add-br br0 | |
1395 | ovs-vsctl add-port br0 eth0 | |
1396 | ifconfig br0 192.168.0.5 | |
1397 | ovs-vsctl add-port br0 vlan9 tag=9 -- set interface vlan9 type=internal | |
1398 | ifconfig vlan9 192.168.0.9 | |
1399 | ||
1400 | but other hosts that are only on VLAN 0 can reach the IP address | |
1401 | configured on VLAN 9. What's going on? | |
1402 | ||
1403 | A: RFC 1122 section 3.3.4.2 "Multihoming Requirements" describes two | |
1404 | approaches to IP address handling in Internet hosts: | |
1405 | ||
542cc9bb TG |
1406 | - In the "Strong ES Model", where an ES is a host ("End |
1407 | System"), an IP address is primarily associated with a | |
1408 | particular interface. The host discards packets that arrive | |
1409 | on interface A if they are destined for an IP address that is | |
1410 | configured on interface B. The host never sends packets from | |
1411 | interface A using a source address configured on interface B. | |
1412 | ||
1413 | - In the "Weak ES Model", an IP address is primarily associated | |
1414 | with a host. The host accepts packets that arrive on any | |
1415 | interface if they are destined for any of the host's IP | |
1416 | addresses, even if the address is configured on some | |
1417 | interface other than the one on which it arrived. The host | |
1418 | does not restrict itself to sending packets from an IP | |
1419 | address associated with the originating interface. | |
8dc54921 BP |
1420 | |
1421 | Linux uses the weak ES model. That means that when packets | |
1422 | destined to the VLAN 9 IP address arrive on eth0 and are bridged to | |
1423 | br0, the kernel IP stack accepts them there for the VLAN 9 IP | |
1424 | address, even though they were not received on vlan9, the network | |
1425 | device for vlan9. | |
1426 | ||
1427 | To simulate the strong ES model on Linux, one may add iptables rule | |
1428 | to filter packets based on source and destination address and | |
1429 | adjust ARP configuration with sysctls. | |
1430 | ||
1431 | BSD uses the strong ES model. | |
1432 | ||
542cc9bb | 1433 | ### Q: My OpenFlow controller doesn't see the VLANs that I expect. |
c483d489 BP |
1434 | |
1435 | A: The configuration for VLANs in the Open vSwitch database (e.g. via | |
1436 | ovs-vsctl) only affects traffic that goes through Open vSwitch's | |
1437 | implementation of the OpenFlow "normal switching" action. By | |
1438 | default, when Open vSwitch isn't connected to a controller and | |
1439 | nothing has been manually configured in the flow table, all traffic | |
1440 | goes through the "normal switching" action. But, if you set up | |
1441 | OpenFlow flows on your own, through a controller or using ovs-ofctl | |
1442 | or through other means, then you have to implement VLAN handling | |
1443 | yourself. | |
1444 | ||
1445 | You can use "normal switching" as a component of your OpenFlow | |
1446 | actions, e.g. by putting "normal" into the lists of actions on | |
1447 | ovs-ofctl or by outputting to OFPP_NORMAL from an OpenFlow | |
241241f5 BP |
1448 | controller. In situations where this is not suitable, you can |
1449 | implement VLAN handling yourself, e.g.: | |
1450 | ||
542cc9bb TG |
1451 | - If a packet comes in on an access port, and the flow table |
1452 | needs to send it out on a trunk port, then the flow can add | |
1453 | the appropriate VLAN tag with the "mod_vlan_vid" action. | |
241241f5 | 1454 | |
542cc9bb TG |
1455 | - If a packet comes in on a trunk port, and the flow table |
1456 | needs to send it out on an access port, then the flow can | |
1457 | strip the VLAN tag with the "strip_vlan" action. | |
c483d489 | 1458 | |
542cc9bb | 1459 | ### Q: I configured ports on a bridge as access ports with different VLAN |
f0a0c1a6 BP |
1460 | tags, like this: |
1461 | ||
1462 | ovs-vsctl add-br br0 | |
d4763d1d | 1463 | ovs-vsctl set-controller br0 tcp:192.168.0.10:6653 |
f0a0c1a6 BP |
1464 | ovs-vsctl add-port br0 eth0 |
1465 | ovs-vsctl add-port br0 tap0 tag=9 | |
1466 | ovs-vsctl add-port br0 tap1 tag=10 | |
1467 | ||
1468 | but the VMs running behind tap0 and tap1 can still communicate, | |
1469 | that is, they are not isolated from each other even though they are | |
1470 | on different VLANs. | |
1471 | ||
1472 | A: Do you have a controller configured on br0 (as the commands above | |
1473 | do)? If so, then this is a variant on the previous question, "My | |
1474 | OpenFlow controller doesn't see the VLANs that I expect," and you | |
1475 | can refer to the answer there for more information. | |
1476 | ||
542cc9bb | 1477 | ### Q: How MAC learning works with VLANs? |
f8003b53 YT |
1478 | |
1479 | A: Open vSwitch implements Independent VLAN Learning (IVL) for | |
1480 | OFPP_NORMAL action. I.e. it logically has separate learning tables | |
1481 | for each VLANs. | |
1482 | ||
c483d489 | 1483 | |
fb5b3c22 | 1484 | ## VXLANs |
0edbe3fb | 1485 | |
542cc9bb | 1486 | ### Q: What's a VXLAN? |
0edbe3fb KM |
1487 | |
1488 | A: VXLAN stands for Virtual eXtensible Local Area Network, and is a means | |
1489 | to solve the scaling challenges of VLAN networks in a multi-tenant | |
1490 | environment. VXLAN is an overlay network which transports an L2 network | |
1491 | over an existing L3 network. For more information on VXLAN, please see | |
bedd6854 | 1492 | RFC 7348: |
0edbe3fb | 1493 | |
bedd6854 | 1494 | http://tools.ietf.org/html/rfc7348 |
0edbe3fb | 1495 | |
542cc9bb | 1496 | ### Q: How much of the VXLAN protocol does Open vSwitch currently support? |
0edbe3fb KM |
1497 | |
1498 | A: Open vSwitch currently supports the framing format for packets on the | |
1499 | wire. There is currently no support for the multicast aspects of VXLAN. | |
1500 | To get around the lack of multicast support, it is possible to | |
1501 | pre-provision MAC to IP address mappings either manually or from a | |
1502 | controller. | |
1503 | ||
542cc9bb | 1504 | ### Q: What destination UDP port does the VXLAN implementation in Open vSwitch |
0edbe3fb KM |
1505 | use? |
1506 | ||
1507 | A: By default, Open vSwitch will use the assigned IANA port for VXLAN, which | |
1508 | is 4789. However, it is possible to configure the destination UDP port | |
1509 | manually on a per-VXLAN tunnel basis. An example of this configuration is | |
1510 | provided below. | |
1511 | ||
b770275d RÃ…A |
1512 | ovs-vsctl add-br br0 |
1513 | ovs-vsctl add-port br0 vxlan1 -- set interface vxlan1 | |
0edbe3fb KM |
1514 | type=vxlan options:remote_ip=192.168.1.2 options:key=flow |
1515 | options:dst_port=8472 | |
1516 | ||
1517 | ||
fb5b3c22 | 1518 | ## Using OpenFlow |
c483d489 | 1519 | |
542cc9bb | 1520 | ### Q: What versions of OpenFlow does Open vSwitch support? |
7b287e99 | 1521 | |
c37c0382 AC |
1522 | A: The following table lists the versions of OpenFlow supported by |
1523 | each version of Open vSwitch: | |
7b287e99 | 1524 | |
b79d45a1 BP |
1525 | Open vSwitch OF1.0 OF1.1 OF1.2 OF1.3 OF1.4 OF1.5 OF1.6 |
1526 | ###============ ===== ===== ===== ===== ===== ===== ===== | |
1527 | 1.9 and earlier yes --- --- --- --- --- --- | |
1528 | 1.10 yes --- [*] [*] --- --- --- | |
1529 | 1.11 yes --- [*] [*] --- --- --- | |
1530 | 2.0 yes [*] [*] [*] --- --- --- | |
1531 | 2.1 yes [*] [*] [*] --- --- --- | |
1532 | 2.2 yes [*] [*] [*] [%] [*] --- | |
1533 | 2.3 yes yes yes yes [*] [*] --- | |
1534 | 2.4 yes yes yes yes [*] [*] --- | |
1535 | 2.5 yes yes yes yes [*] [*] [*] | |
8e70e196 | 1536 | |
c37c0382 | 1537 | [*] Supported, with one or more missing features. |
aa233d57 | 1538 | [%] Experimental, unsafe implementation. |
8e70e196 | 1539 | |
6dc53744 BP |
1540 | Open vSwitch 2.3 enables OpenFlow 1.0, 1.1, 1.2, and 1.3 by default |
1541 | in ovs-vswitchd. In Open vSwitch 1.10 through 2.2, OpenFlow 1.1, | |
b79d45a1 BP |
1542 | 1.2, and 1.3 must be enabled manually in ovs-vswitchd. |
1543 | ||
1544 | Some versions of OpenFlow are supported with missing features and | |
1545 | therefore not enabled by default: OpenFlow 1.4 and 1.5, in Open | |
1546 | vSwitch 2.3 and later, as well as OpenFlow 1.6 in Open vSwitch 2.5 | |
1547 | and later. Also, the OpenFlow 1.6 specification is still under | |
1548 | development and thus subject to change. | |
1549 | ||
1550 | In any case, the user may override the default: | |
75fa58f8 | 1551 | |
542cc9bb | 1552 | - To enable OpenFlow 1.0, 1.1, 1.2, and 1.3 on bridge br0: |
75fa58f8 | 1553 | |
542cc9bb | 1554 | ovs-vsctl set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13 |
6dc53744 | 1555 | |
542cc9bb | 1556 | - To enable OpenFlow 1.0, 1.1, 1.2, 1.3, 1.4, and 1.5 on bridge br0: |
aa233d57 | 1557 | |
542cc9bb | 1558 | ovs-vsctl set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15 |
aa233d57 | 1559 | |
542cc9bb | 1560 | - To enable only OpenFlow 1.0 on bridge br0: |
6dc53744 | 1561 | |
542cc9bb | 1562 | ovs-vsctl set bridge br0 protocols=OpenFlow10 |
6dc53744 BP |
1563 | |
1564 | All current versions of ovs-ofctl enable only OpenFlow 1.0 by | |
1565 | default. Use the -O option to enable support for later versions of | |
1566 | OpenFlow in ovs-ofctl. For example: | |
ac12b4cb BP |
1567 | |
1568 | ovs-ofctl -O OpenFlow13 dump-flows br0 | |
1569 | ||
aa233d57 BP |
1570 | (Open vSwitch 2.2 had an experimental implementation of OpenFlow |
1571 | 1.4 that could cause crashes. We don't recommend enabling it.) | |
ecb229be | 1572 | |
9feb1017 | 1573 | [OPENFLOW-1.1+.md] in the Open vSwitch source tree tracks support for |
42dccab5 BP |
1574 | OpenFlow 1.1 and later features. When support for OpenFlow 1.4 and |
1575 | 1.5 is solidly implemented, Open vSwitch will enable those version | |
8c0de36e | 1576 | by default. |
7b287e99 | 1577 | |
542cc9bb | 1578 | ### Q: Does Open vSwitch support MPLS? |
c78a9ead BP |
1579 | |
1580 | A: Before version 1.11, Open vSwitch did not support MPLS. That is, | |
1581 | these versions can match on MPLS Ethernet types, but they cannot | |
1582 | match, push, or pop MPLS labels, nor can they look past MPLS labels | |
1583 | into the encapsulated packet. | |
1584 | ||
1585 | Open vSwitch versions 1.11, 2.0, and 2.1 have very minimal support | |
1586 | for MPLS. With the userspace datapath only, these versions can | |
1587 | match, push, or pop a single MPLS label, but they still cannot look | |
1588 | past MPLS labels (even after popping them) into the encapsulated | |
7e6410d2 BP |
1589 | packet. Kernel datapath support is unchanged from earlier |
1590 | versions. | |
c78a9ead | 1591 | |
b6fe204d BP |
1592 | Open vSwitch version 2.3 can match, push, or pop a single MPLS |
1593 | label and look past the MPLS label into the encapsulated packet. | |
1594 | Both userspace and kernel datapaths will be supported, but MPLS | |
1595 | processing always happens in userspace either way, so kernel | |
1596 | datapath performance will be disappointing. | |
1597 | ||
1598 | Open vSwitch version 2.4 can match, push, or pop up to 3 MPLS | |
1599 | labels and look past the MPLS label into the encapsulated packet. | |
1600 | It will have kernel support for MPLS, yielding improved | |
1601 | performance. | |
c78a9ead | 1602 | |
542cc9bb | 1603 | ### Q: I'm getting "error type 45250 code 0". What's that? |
c483d489 BP |
1604 | |
1605 | A: This is a Open vSwitch extension to OpenFlow error codes. Open | |
1606 | vSwitch uses this extension when it must report an error to an | |
1607 | OpenFlow controller but no standard OpenFlow error code is | |
1608 | suitable. | |
1609 | ||
1610 | Open vSwitch logs the errors that it sends to controllers, so the | |
1611 | easiest thing to do is probably to look at the ovs-vswitchd log to | |
1612 | find out what the error was. | |
1613 | ||
1614 | If you want to dissect the extended error message yourself, the | |
1615 | format is documented in include/openflow/nicira-ext.h in the Open | |
1616 | vSwitch source distribution. The extended error codes are | |
e03c096d | 1617 | documented in include/openvswitch/ofp-errors.h. |
c483d489 BP |
1618 | |
1619 | Q1: Some of the traffic that I'd expect my OpenFlow controller to see | |
1620 | doesn't actually appear through the OpenFlow connection, even | |
1621 | though I know that it's going through. | |
1622 | Q2: Some of the OpenFlow flows that my controller sets up don't seem | |
1623 | to apply to certain traffic, especially traffic between OVS and | |
1624 | the controller itself. | |
1625 | ||
1626 | A: By default, Open vSwitch assumes that OpenFlow controllers are | |
1627 | connected "in-band", that is, that the controllers are actually | |
1628 | part of the network that is being controlled. In in-band mode, | |
1629 | Open vSwitch sets up special "hidden" flows to make sure that | |
1630 | traffic can make it back and forth between OVS and the controllers. | |
1631 | These hidden flows are higher priority than any flows that can be | |
1632 | set up through OpenFlow, and they are not visible through normal | |
1633 | OpenFlow flow table dumps. | |
1634 | ||
1635 | Usually, the hidden flows are desirable and helpful, but | |
1636 | occasionally they can cause unexpected behavior. You can view the | |
1637 | full OpenFlow flow table, including hidden flows, on bridge br0 | |
1638 | with the command: | |
1639 | ||
1640 | ovs-appctl bridge/dump-flows br0 | |
1641 | ||
1642 | to help you debug. The hidden flows are those with priorities | |
1643 | greater than 65535 (the maximum priority that can be set with | |
1644 | OpenFlow). | |
1645 | ||
1646 | The DESIGN file at the top level of the Open vSwitch source | |
1647 | distribution describes the in-band model in detail. | |
1648 | ||
1649 | If your controllers are not actually in-band (e.g. they are on | |
1650 | localhost via 127.0.0.1, or on a separate network), then you should | |
1651 | configure your controllers in "out-of-band" mode. If you have one | |
1652 | controller on bridge br0, then you can configure out-of-band mode | |
1653 | on it with: | |
1654 | ||
1655 | ovs-vsctl set controller br0 connection-mode=out-of-band | |
1656 | ||
542cc9bb | 1657 | ### Q: I configured all my controllers for out-of-band control mode but |
c483d489 BP |
1658 | "ovs-appctl bridge/dump-flows" still shows some hidden flows. |
1659 | ||
1660 | A: You probably have a remote manager configured (e.g. with "ovs-vsctl | |
1661 | set-manager"). By default, Open vSwitch assumes that managers need | |
1662 | in-band rules set up on every bridge. You can disable these rules | |
1663 | on bridge br0 with: | |
1664 | ||
1665 | ovs-vsctl set bridge br0 other-config:disable-in-band=true | |
1666 | ||
1667 | This actually disables in-band control entirely for the bridge, as | |
1668 | if all the bridge's controllers were configured for out-of-band | |
1669 | control. | |
1670 | ||
542cc9bb | 1671 | ### Q: My OpenFlow controller doesn't see the VLANs that I expect. |
c483d489 BP |
1672 | |
1673 | A: See answer under "VLANs", above. | |
1674 | ||
542cc9bb | 1675 | ### Q: I ran "ovs-ofctl add-flow br0 nw_dst=192.168.0.1,actions=drop" |
5cb2356b BP |
1676 | but I got a funny message like this: |
1677 | ||
1678 | ofp_util|INFO|normalization changed ofp_match, details: | |
1679 | ofp_util|INFO| pre: nw_dst=192.168.0.1 | |
1680 | ofp_util|INFO|post: | |
1681 | ||
1682 | and when I ran "ovs-ofctl dump-flows br0" I saw that my nw_dst | |
1683 | match had disappeared, so that the flow ends up matching every | |
1684 | packet. | |
1685 | ||
1686 | A: The term "normalization" in the log message means that a flow | |
1687 | cannot match on an L3 field without saying what L3 protocol is in | |
1688 | use. The "ovs-ofctl" command above didn't specify an L3 protocol, | |
1689 | so the L3 field match was dropped. | |
1690 | ||
1691 | In this case, the L3 protocol could be IP or ARP. A correct | |
1692 | command for each possibility is, respectively: | |
1693 | ||
1694 | ovs-ofctl add-flow br0 ip,nw_dst=192.168.0.1,actions=drop | |
1695 | ||
1696 | and | |
1697 | ||
1698 | ovs-ofctl add-flow br0 arp,nw_dst=192.168.0.1,actions=drop | |
1699 | ||
1700 | Similarly, a flow cannot match on an L4 field without saying what | |
1701 | L4 protocol is in use. For example, the flow match "tp_src=1234" | |
1702 | is, by itself, meaningless and will be ignored. Instead, to match | |
1703 | TCP source port 1234, write "tcp,tp_src=1234", or to match UDP | |
1704 | source port 1234, write "udp,tp_src=1234". | |
1705 | ||
542cc9bb | 1706 | ### Q: How can I figure out the OpenFlow port number for a given port? |
c5b25863 BP |
1707 | |
1708 | A: The OFPT_FEATURES_REQUEST message requests an OpenFlow switch to | |
1709 | respond with an OFPT_FEATURES_REPLY that, among other information, | |
1710 | includes a mapping between OpenFlow port names and numbers. From a | |
1711 | command prompt, "ovs-ofctl show br0" makes such a request and | |
1712 | prints the response for switch br0. | |
1713 | ||
1714 | The Interface table in the Open vSwitch database also maps OpenFlow | |
1715 | port names to numbers. To print the OpenFlow port number | |
1716 | associated with interface eth0, run: | |
1717 | ||
1718 | ovs-vsctl get Interface eth0 ofport | |
1719 | ||
1720 | You can print the entire mapping with: | |
1721 | ||
1722 | ovs-vsctl -- --columns=name,ofport list Interface | |
1723 | ||
1724 | but the output mixes together interfaces from all bridges in the | |
1725 | database, so it may be confusing if more than one bridge exists. | |
1726 | ||
1727 | In the Open vSwitch database, ofport value -1 means that the | |
1728 | interface could not be created due to an error. (The Open vSwitch | |
1729 | log should indicate the reason.) ofport value [] (the empty set) | |
1730 | means that the interface hasn't been created yet. The latter is | |
1731 | normally an intermittent condition (unless ovs-vswitchd is not | |
1732 | running). | |
7b287e99 | 1733 | |
542cc9bb | 1734 | ### Q: I added some flows with my controller or with ovs-ofctl, but when I |
af1ac4b9 BP |
1735 | run "ovs-dpctl dump-flows" I don't see them. |
1736 | ||
1737 | A: ovs-dpctl queries a kernel datapath, not an OpenFlow switch. It | |
1738 | won't display the information that you want. You want to use | |
1739 | "ovs-ofctl dump-flows" instead. | |
1740 | ||
542cc9bb | 1741 | ### Q: It looks like each of the interfaces in my bonded port shows up |
15d63ed3 BP |
1742 | as an individual OpenFlow port. Is that right? |
1743 | ||
1744 | A: Yes, Open vSwitch makes individual bond interfaces visible as | |
1745 | OpenFlow ports, rather than the bond as a whole. The interfaces | |
1746 | are treated together as a bond for only a few purposes: | |
1747 | ||
542cc9bb TG |
1748 | - Sending a packet to the OFPP_NORMAL port. (When an OpenFlow |
1749 | controller is not configured, this happens implicitly to | |
1750 | every packet.) | |
15d63ed3 | 1751 | |
542cc9bb | 1752 | - Mirrors configured for output to a bonded port. |
15d63ed3 BP |
1753 | |
1754 | It would make a lot of sense for Open vSwitch to present a bond as | |
1755 | a single OpenFlow port. If you want to contribute an | |
1756 | implementation of such a feature, please bring it up on the Open | |
1757 | vSwitch development mailing list at dev@openvswitch.org. | |
1758 | ||
542cc9bb | 1759 | ### Q: I have a sophisticated network setup involving Open vSwitch, VMs or |
bb955418 BP |
1760 | multiple hosts, and other components. The behavior isn't what I |
1761 | expect. Help! | |
1762 | ||
1763 | A: To debug network behavior problems, trace the path of a packet, | |
1764 | hop-by-hop, from its origin in one host to a remote host. If | |
1765 | that's correct, then trace the path of the response packet back to | |
1766 | the origin. | |
1767 | ||
8e3cdf37 FL |
1768 | The open source tool called "plotnetcfg" can help to understand the |
1769 | relationship between the networking devices on a single host. | |
1770 | ||
bb955418 BP |
1771 | Usually a simple ICMP echo request and reply ("ping") packet is |
1772 | good enough. Start by initiating an ongoing "ping" from the origin | |
1773 | host to a remote host. If you are tracking down a connectivity | |
1774 | problem, the "ping" will not display any successful output, but | |
1775 | packets are still being sent. (In this case the packets being sent | |
1776 | are likely ARP rather than ICMP.) | |
1777 | ||
1778 | Tools available for tracing include the following: | |
1779 | ||
542cc9bb TG |
1780 | - "tcpdump" and "wireshark" for observing hops across network |
1781 | devices, such as Open vSwitch internal devices and physical | |
1782 | wires. | |
bb955418 | 1783 | |
542cc9bb TG |
1784 | - "ovs-appctl dpif/dump-flows <br>" in Open vSwitch 1.10 and |
1785 | later or "ovs-dpctl dump-flows <br>" in earlier versions. | |
1786 | These tools allow one to observe the actions being taken on | |
1787 | packets in ongoing flows. | |
bb955418 | 1788 | |
542cc9bb TG |
1789 | See ovs-vswitchd(8) for "ovs-appctl dpif/dump-flows" |
1790 | documentation, ovs-dpctl(8) for "ovs-dpctl dump-flows" | |
1791 | documentation, and "Why are there so many different ways to | |
1792 | dump flows?" above for some background. | |
bb955418 | 1793 | |
542cc9bb TG |
1794 | - "ovs-appctl ofproto/trace" to observe the logic behind how |
1795 | ovs-vswitchd treats packets. See ovs-vswitchd(8) for | |
1796 | documentation. You can out more details about a given flow | |
1797 | that "ovs-dpctl dump-flows" displays, by cutting and pasting | |
1798 | a flow from the output into an "ovs-appctl ofproto/trace" | |
1799 | command. | |
bb955418 | 1800 | |
542cc9bb TG |
1801 | - SPAN, RSPAN, and ERSPAN features of physical switches, to |
1802 | observe what goes on at these physical hops. | |
bb955418 BP |
1803 | |
1804 | Starting at the origin of a given packet, observe the packet at | |
1805 | each hop in turn. For example, in one plausible scenario, you | |
1806 | might: | |
1807 | ||
542cc9bb TG |
1808 | 1. "tcpdump" the "eth" interface through which an ARP egresses |
1809 | a VM, from inside the VM. | |
bb955418 | 1810 | |
542cc9bb TG |
1811 | 2. "tcpdump" the "vif" or "tap" interface through which the ARP |
1812 | ingresses the host machine. | |
bb955418 | 1813 | |
542cc9bb TG |
1814 | 3. Use "ovs-dpctl dump-flows" to spot the ARP flow and observe |
1815 | the host interface through which the ARP egresses the | |
1816 | physical machine. You may need to use "ovs-dpctl show" to | |
1817 | interpret the port numbers. If the output seems surprising, | |
1818 | you can use "ovs-appctl ofproto/trace" to observe details of | |
1819 | how ovs-vswitchd determined the actions in the "ovs-dpctl | |
1820 | dump-flows" output. | |
bb955418 | 1821 | |
542cc9bb TG |
1822 | 4. "tcpdump" the "eth" interface through which the ARP egresses |
1823 | the physical machine. | |
bb955418 | 1824 | |
542cc9bb TG |
1825 | 5. "tcpdump" the "eth" interface through which the ARP |
1826 | ingresses the physical machine, at the remote host that | |
1827 | receives the ARP. | |
bb955418 | 1828 | |
542cc9bb TG |
1829 | 6. Use "ovs-dpctl dump-flows" to spot the ARP flow on the |
1830 | remote host that receives the ARP and observe the VM "vif" | |
1831 | or "tap" interface to which the flow is directed. Again, | |
1832 | "ovs-dpctl show" and "ovs-appctl ofproto/trace" might help. | |
bb955418 | 1833 | |
542cc9bb TG |
1834 | 7. "tcpdump" the "vif" or "tap" interface to which the ARP is |
1835 | directed. | |
bb955418 | 1836 | |
542cc9bb TG |
1837 | 8. "tcpdump" the "eth" interface through which the ARP |
1838 | ingresses a VM, from inside the VM. | |
bb955418 BP |
1839 | |
1840 | It is likely that during one of these steps you will figure out the | |
1841 | problem. If not, then follow the ARP reply back to the origin, in | |
1842 | reverse. | |
1843 | ||
542cc9bb | 1844 | ### Q: How do I make a flow drop packets? |
0f5edef0 | 1845 | |
e5f1da19 BP |
1846 | A: To drop a packet is to receive it without forwarding it. OpenFlow |
1847 | explicitly specifies forwarding actions. Thus, a flow with an | |
1848 | empty set of actions does not forward packets anywhere, causing | |
1849 | them to be dropped. You can specify an empty set of actions with | |
1850 | "actions=" on the ovs-ofctl command line. For example: | |
0f5edef0 BP |
1851 | |
1852 | ovs-ofctl add-flow br0 priority=65535,actions= | |
1853 | ||
1854 | would cause every packet entering switch br0 to be dropped. | |
1855 | ||
1856 | You can write "drop" explicitly if you like. The effect is the | |
1857 | same. Thus, the following command also causes every packet | |
1858 | entering switch br0 to be dropped: | |
1859 | ||
1860 | ovs-ofctl add-flow br0 priority=65535,actions=drop | |
1861 | ||
e5f1da19 BP |
1862 | "drop" is not an action, either in OpenFlow or Open vSwitch. |
1863 | Rather, it is only a way to say that there are no actions. | |
1864 | ||
542cc9bb | 1865 | ### Q: I added a flow to send packets out the ingress port, like this: |
2fafc091 BP |
1866 | |
1867 | ovs-ofctl add-flow br0 in_port=2,actions=2 | |
1868 | ||
1869 | but OVS drops the packets instead. | |
1870 | ||
1871 | A: Yes, OpenFlow requires a switch to ignore attempts to send a packet | |
1872 | out its ingress port. The rationale is that dropping these packets | |
1873 | makes it harder to loop the network. Sometimes this behavior can | |
1874 | even be convenient, e.g. it is often the desired behavior in a flow | |
1875 | that forwards a packet to several ports ("floods" the packet). | |
1876 | ||
6620f928 JS |
1877 | Sometimes one really needs to send a packet out its ingress port |
1878 | ("hairpin"). In this case, output to OFPP_IN_PORT, which in | |
1879 | ovs-ofctl syntax is expressed as just "in_port", e.g.: | |
2fafc091 BP |
1880 | |
1881 | ovs-ofctl add-flow br0 in_port=2,actions=in_port | |
1882 | ||
1883 | This also works in some circumstances where the flow doesn't match | |
1884 | on the input port. For example, if you know that your switch has | |
1885 | five ports numbered 2 through 6, then the following will send every | |
1886 | received packet out every port, even its ingress port: | |
1887 | ||
1888 | ovs-ofctl add-flow br0 actions=2,3,4,5,6,in_port | |
1889 | ||
1890 | or, equivalently: | |
1891 | ||
1892 | ovs-ofctl add-flow br0 actions=all,in_port | |
1893 | ||
1894 | Sometimes, in complicated flow tables with multiple levels of | |
1895 | "resubmit" actions, a flow needs to output to a particular port | |
1896 | that may or may not be the ingress port. It's difficult to take | |
1897 | advantage of OFPP_IN_PORT in this situation. To help, Open vSwitch | |
1898 | provides, as an OpenFlow extension, the ability to modify the | |
1899 | in_port field. Whatever value is currently in the in_port field is | |
1900 | the port to which outputs will be dropped, as well as the | |
1901 | destination for OFPP_IN_PORT. This means that the following will | |
1902 | reliably output to port 2 or to ports 2 through 6, respectively: | |
1903 | ||
1904 | ovs-ofctl add-flow br0 in_port=2,actions=load:0->NXM_OF_IN_PORT[],2 | |
1905 | ovs-ofctl add-flow br0 actions=load:0->NXM_OF_IN_PORT[],2,3,4,5,6 | |
1906 | ||
1907 | If the input port is important, then one may save and restore it on | |
1908 | the stack: | |
1909 | ||
1910 | ovs-ofctl add-flow br0 actions=push:NXM_OF_IN_PORT[],\ | |
1911 | load:0->NXM_OF_IN_PORT[],\ | |
1912 | 2,3,4,5,6,\ | |
1913 | pop:NXM_OF_IN_PORT[] | |
1914 | ||
542cc9bb | 1915 | ### Q: My bridge br0 has host 192.168.0.1 on port 1 and host 192.168.0.2 |
d4ee72b4 BP |
1916 | on port 2. I set up flows to forward only traffic destined to the |
1917 | other host and drop other traffic, like this: | |
1918 | ||
1919 | priority=5,in_port=1,ip,nw_dst=192.168.0.2,actions=2 | |
1920 | priority=5,in_port=2,ip,nw_dst=192.168.0.1,actions=1 | |
1921 | priority=0,actions=drop | |
1922 | ||
1923 | But it doesn't work--I don't get any connectivity when I do this. | |
1924 | Why? | |
1925 | ||
1926 | A: These flows drop the ARP packets that IP hosts use to establish IP | |
1927 | connectivity over Ethernet. To solve the problem, add flows to | |
1928 | allow ARP to pass between the hosts: | |
1929 | ||
1930 | priority=5,in_port=1,arp,actions=2 | |
1931 | priority=5,in_port=2,arp,actions=1 | |
1932 | ||
1933 | This issue can manifest other ways, too. The following flows that | |
1934 | match on Ethernet addresses instead of IP addresses will also drop | |
1935 | ARP packets, because ARP requests are broadcast instead of being | |
1936 | directed to a specific host: | |
1937 | ||
1938 | priority=5,in_port=1,dl_dst=54:00:00:00:00:02,actions=2 | |
1939 | priority=5,in_port=2,dl_dst=54:00:00:00:00:01,actions=1 | |
1940 | priority=0,actions=drop | |
1941 | ||
1942 | The solution already described above will also work in this case. | |
1943 | It may be better to add flows to allow all multicast and broadcast | |
1944 | traffic: | |
1945 | ||
1946 | priority=5,in_port=1,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00,actions=2 | |
1947 | priority=5,in_port=2,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00,actions=1 | |
0f5edef0 | 1948 | |
542cc9bb | 1949 | ### Q: My bridge disconnects from my controller on add-port/del-port. |
9a7a9154 YT |
1950 | |
1951 | A: Reconfiguring your bridge can change your bridge's datapath-id because | |
1952 | Open vSwitch generates datapath-id from the MAC address of one of its ports. | |
1953 | In that case, Open vSwitch disconnects from controllers because there's | |
1954 | no graceful way to notify controllers about the change of datapath-id. | |
1955 | ||
1956 | To avoid the behaviour, you can configure datapath-id manually. | |
1957 | ||
1958 | ovs-vsctl set bridge br0 other-config:datapath-id=0123456789abcdef | |
1959 | ||
ae99ee45 BP |
1960 | ### Q: My controller is getting errors about "buffers". What's going on? |
1961 | ||
1962 | A: When a switch sends a packet to an OpenFlow controller using a | |
1963 | "packet-in" message, it can also keep a copy of that packet in a | |
1964 | "buffer", identified by a 32-bit integer "buffer_id". There are | |
1965 | two advantages to buffering. First, when the controller wants to | |
1966 | tell the switch to do something with the buffered packet (with a | |
1967 | "packet-out" OpenFlow request), it does not need to send another | |
1968 | copy of the packet back across the OpenFlow connection, which | |
1969 | reduces the bandwidth cost of the connection and improves latency. | |
1970 | This enables the second advantage: the switch can optionally send | |
1971 | only the first part of the packet to the controller (assuming that | |
1972 | the switch only needs to look at the first few bytes of the | |
1973 | packet), further reducing bandwidth and improving latency. | |
1974 | ||
1975 | However, buffering introduces some issues of its own. First, any | |
1976 | switch has limited resources, so if the controller does not use a | |
1977 | buffered packet, the switch has to decide how long to keep it | |
1978 | buffered. When many packets are sent to a controller and buffered, | |
1979 | Open vSwitch can discard buffered packets that the controller has | |
1980 | not used after as little as 5 seconds. This means that | |
1981 | controllers, if they make use of packet buffering, should use the | |
1982 | buffered packets promptly. (This includes sending a "packet-out" | |
1983 | with no actions if the controller does not want to do anything with | |
1984 | a buffered packet, to clear the packet buffer and effectively | |
1985 | "drop" its packet.) | |
1986 | ||
1987 | Second, packet buffers are one-time-use, meaning that a controller | |
1988 | cannot use a single packet buffer in two or more "packet-out" | |
1989 | commands. Open vSwitch will respond with an error to the second | |
1990 | and subsequent "packet-out"s in such a case. | |
1991 | ||
1992 | Finally, a common error early in controller development is to try | |
1993 | to use buffer_id 0 in a "packet-out" message as if 0 represented | |
1994 | "no buffered packet". This is incorrect usage: the buffer_id with | |
1995 | this meaning is actually 0xffffffff. | |
1996 | ||
1997 | ovs-vswitchd(8) describes some details of Open vSwitch packet | |
1998 | buffering that the OpenFlow specification requires implementations | |
1999 | to document. | |
2000 | ||
363b34f0 BP |
2001 | ### Q: How does OVS divide flows among buckets in an OpenFlow "select" group? |
2002 | ||
2003 | A: In Open vSwitch 2.3 and earlier, Open vSwitch used the destination | |
2004 | Ethernet address to choose a bucket in a select group. | |
2005 | ||
2006 | Open vSwitch 2.4 and later by default hashes the source and | |
2007 | destination Ethernet address, VLAN ID, Ethernet type, IPv4/v6 | |
2008 | source and destination address and protocol, and for TCP and SCTP | |
2009 | only, the source and destination ports. The hash is "symmetric", | |
2010 | meaning that exchanging source and destination addresses does not | |
2011 | change the bucket selection. | |
2012 | ||
2013 | Select groups in Open vSwitch 2.4 and later can be configured to | |
2014 | use a different hash function, using a Netronome extension to the | |
2015 | OpenFlow 1.5+ group_mod message. For more information, see | |
2016 | Documentation/group-selection-method-property.txt in the Open | |
2017 | vSwitch source tree. (OpenFlow 1.5 support in Open vSwitch is still | |
2018 | experimental.) | |
2019 | ||
b5936d52 BP |
2020 | ### Q: I added a flow to accept packets on VLAN 123 and output them on |
2021 | VLAN 456, like so: | |
2022 | ||
2023 | ovs-ofctl add-flow br0 dl_vlan=123,actions=output:1,mod_vlan_vid:456 | |
2024 | ||
2025 | but the packets are actually being output in VLAN 123. Why? | |
2026 | ||
2027 | A: OpenFlow actions are executed in the order specified. Thus, the | |
2028 | actions above first output the packet, then change its VLAN. Since | |
2029 | the output occurs before changing the VLAN, the change in VLAN will | |
2030 | have no visible effect. | |
2031 | ||
2032 | To solve this and similar problems, order actions so that changes | |
2033 | to headers happen before output, e.g.: | |
2034 | ||
2035 | ovs-ofctl add-flow br0 dl_vlan=123,actions=mod_vlan_vid:456,output:1 | |
2036 | ||
676caaf7 BP |
2037 | ### Q: The "learn" action can't learn the action I want, can you improve it? |
2038 | ||
2039 | A: By itself, the "learn" action can only put two kinds of actions | |
2040 | into the flows that it creates: "load" and "output" actions. If | |
2041 | "learn" is used in isolation, these are severe limits. | |
2042 | ||
2043 | However, "learn" is not meant to be used in isolation. It is a | |
2044 | primitive meant to be used together with other Open vSwitch | |
2045 | features to accomplish a task. Its existing features are enough to | |
2046 | accomplish most tasks. | |
2047 | ||
2048 | Here is an outline of a typical pipeline structure that allows for | |
2049 | versatile behavior using "learn": | |
2050 | ||
2051 | - Flows in table A contain a "learn" action, that populates flows | |
2052 | in table L, that use a "load" action to populate register R | |
2053 | with information about what was learned. | |
2054 | ||
2055 | - Flows in table B contain two sequential resubmit actions: one | |
2056 | to table L and another one to table B+1. | |
2057 | ||
2058 | - Flows in table B+1 match on register R and act differently | |
2059 | depending on what the flows in table L loaded into it. | |
2060 | ||
2061 | This approach can be used to implement many "learn"-based features. | |
2062 | For example: | |
2063 | ||
2064 | - Resubmit to a table selected based on learned information, e.g. see: | |
2065 | http://openvswitch.org/pipermail/discuss/2016-June/021694.html | |
2066 | ||
2067 | - MAC learning in the middle of a pipeline, as described in | |
2068 | [Tutorial.md]. | |
2069 | ||
2070 | - TCP state based firewalling, by learning outgoing connections | |
2071 | based on SYN packets and matching them up with incoming | |
2072 | packets. | |
2073 | ||
2074 | - At least some of the features described in T. A. Hoff, | |
2075 | "Extending Open vSwitch to Facilitate Creation of Stateful SDN | |
2076 | Applications". | |
2077 | ||
66679738 | 2078 | |
fb5b3c22 | 2079 | ## Development |
66679738 | 2080 | |
542cc9bb | 2081 | ### Q: How do I implement a new OpenFlow message? |
66679738 BP |
2082 | |
2083 | A: Add your new message to "enum ofpraw" and "enum ofptype" in | |
2084 | lib/ofp-msgs.h, following the existing pattern. Then recompile and | |
2085 | fix all of the new warnings, implementing new functionality for the | |
2086 | new message as needed. (If you configure with --enable-Werror, as | |
9feb1017 | 2087 | described in [INSTALL.md], then it is impossible to miss any warnings.) |
66679738 BP |
2088 | |
2089 | If you need to add an OpenFlow vendor extension message for a | |
2090 | vendor that doesn't yet have any extension messages, then you will | |
2091 | also need to edit build-aux/extract-ofp-msgs. | |
2092 | ||
fe540ca9 BP |
2093 | ### Q: How do I add support for a new field or header? |
2094 | ||
2095 | A: Add new members for your field to "struct flow" in lib/flow.h, and | |
2096 | add new enumerations for your new field to "enum mf_field_id" in | |
f58df860 BP |
2097 | lib/meta-flow.h, following the existing pattern. Also, add support |
2098 | to miniflow_extract() in lib/flow.c for extracting your new field | |
936ed399 BP |
2099 | from a packet into struct miniflow, and to nx_put_raw() in |
2100 | lib/nx-match.c to output your new field in OXM matches. Then | |
2101 | recompile and fix all of the new warnings, implementing new | |
2102 | functionality for the new field or header as needed. (If you | |
2103 | configure with --enable-Werror, as described in [INSTALL.md], then | |
2104 | it is impossible to miss any warnings.) | |
f58df860 BP |
2105 | |
2106 | If you want kernel datapath support for your new field, you also | |
2107 | need to modify the kernel module for the operating systems you are | |
2108 | interested in. This isn't mandatory, since fields understood only | |
2109 | by userspace work too (with a performance penalty), so it's | |
2110 | reasonable to start development without it. If you implement | |
2111 | kernel module support for Linux, then the Linux kernel "netdev" | |
2112 | mailing list is the place to submit that support first; please read | |
2113 | up on the Linux kernel development process separately. The Windows | |
2114 | datapath kernel module support, on the other hand, is maintained | |
2115 | within the OVS tree, so patches for that can go directly to | |
2116 | ovs-dev. | |
fe540ca9 BP |
2117 | |
2118 | ### Q: How do I add support for a new OpenFlow action? | |
2119 | ||
2120 | A: Add your new action to "enum ofp_raw_action_type" in | |
2121 | lib/ofp-actions.c, following the existing pattern. Then recompile | |
2122 | and fix all of the new warnings, implementing new functionality for | |
2123 | the new action as needed. (If you configure with --enable-Werror, | |
2124 | as described in [INSTALL.md], then it is impossible to miss any | |
2125 | warnings.) | |
2126 | ||
2127 | If you need to add an OpenFlow vendor extension action for a vendor | |
2128 | that doesn't yet have any extension actions, then you will also | |
2129 | need to edit build-aux/extract-ofp-actions. | |
2130 | ||
66679738 | 2131 | |
c483d489 BP |
2132 | Contact |
2133 | ------- | |
2134 | ||
2135 | bugs@openvswitch.org | |
2136 | http://openvswitch.org/ | |
9feb1017 TG |
2137 | |
2138 | [PORTING.md]:PORTING.md | |
2139 | [WHY-OVS.md]:WHY-OVS.md | |
2140 | [INSTALL.md]:INSTALL.md | |
2141 | [OPENFLOW-1.1+.md]:OPENFLOW-1.1+.md | |
77c180ce | 2142 | [INSTALL.DPDK.md]:INSTALL.DPDK.md |
676caaf7 | 2143 | [Tutorial.md]:tutorial/Tutorial.md |
1a807b41 | 2144 | [release-process.md]:Documentation/release-process.md |