]>
Commit | Line | Data |
---|---|---|
889e567b SF |
1 | .. |
2 | Licensed under the Apache License, Version 2.0 (the "License"); you may | |
3 | not use this file except in compliance with the License. You may obtain | |
4 | a copy of the License at | |
5 | ||
6 | http://www.apache.org/licenses/LICENSE-2.0 | |
7 | ||
8 | Unless required by applicable law or agreed to in writing, software | |
9 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |
10 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |
11 | License for the specific language governing permissions and limitations | |
12 | under the License. | |
13 | ||
14 | Convention for heading levels in Open vSwitch documentation: | |
15 | ||
16 | ======= Heading 0 (reserved for the title in a document) | |
17 | ------- Heading 1 | |
18 | ~~~~~~~ Heading 2 | |
19 | +++++++ Heading 3 | |
20 | ''''''' Heading 4 | |
21 | ||
22 | Avoid deeper levels because they do not render well. | |
23 | ||
24 | ======================= | |
25 | Open vSwitch on Windows | |
26 | ======================= | |
27 | ||
28 | .. _windows-build-reqs: | |
29 | ||
30 | Build Requirements | |
31 | ------------------ | |
32 | ||
33 | Open vSwitch on Linux uses autoconf and automake for generating Makefiles. It | |
34 | will be useful to maintain the same build system while compiling on Windows | |
35 | too. One approach is to compile Open vSwitch in a MinGW environment that | |
36 | contains autoconf and automake utilities and then use Visual C++ as a compiler | |
37 | and linker. | |
38 | ||
39 | The following explains the steps in some detail. | |
40 | ||
41 | - Mingw | |
42 | ||
43 | Install Mingw on a Windows machine by following the instructions on | |
44 | `mingw.org <http://www.mingw.org/wiki/Getting_Started>`__. | |
45 | ||
46 | This should install mingw at ``C:\Mingw`` and msys at ``C:\Mingw\msys``. Add | |
47 | ``C:\MinGW\bin`` and ``C:\Mingw\msys\1.0\bin`` to PATH environment variable | |
48 | of Windows. | |
49 | ||
50 | You can either use the MinGW installer or the command line utility | |
51 | ``mingw-get`` to install both the base packages and additional packages like | |
52 | automake and autoconf(version 2.68). | |
53 | ||
54 | Also make sure that ``/mingw`` mount point exists. If its not, please | |
dc76953f | 55 | add/create the following entry in ``/etc/fstab``:: |
889e567b SF |
56 | |
57 | 'C:/MinGW /mingw'. | |
58 | ||
1ca0323e | 59 | - Python 3.4 or later. |
889e567b | 60 | |
1ca0323e | 61 | Install the latest Python 3.x from python.org and verify that its path is |
889e567b | 62 | part of Windows' PATH environment variable. |
0c4d144a TR |
63 | We require that you have pypiwin32 library installed. |
64 | The library can be installed via pip command: | |
9943fbcc | 65 | |
23cb93ff | 66 | :: |
9943fbcc | 67 | |
9943fbcc | 68 | $ pip install pypiwin32 |
889e567b SF |
69 | |
70 | - Visual Studio | |
71 | ||
72 | You will need at least Visual Studio 2013 (update 4) to compile userspace | |
73 | binaries. In addition to that, if you want to compile the kernel module you | |
74 | will also need to install Windows Driver Kit (WDK) 8.1 Update. | |
75 | ||
76 | It is important to get the Visual Studio related environment variables and to | |
77 | have the $PATH inside the bash to point to the proper compiler and linker. | |
78 | One easy way to achieve this for VS2013 is to get into the "VS2013 x86 Native | |
79 | Tools Command Prompt" (in a default installation of Visual Studio 2013 this | |
80 | can be found under the following location: ``C:\Program Files (x86)\Microsoft | |
81 | Visual Studio 12.0\Common7\Tools\Shortcuts``) and through it enter into the | |
82 | bash shell available from msys by typing ``bash --login``. | |
83 | ||
84 | There is support for generating 64 bit binaries too. To compile under x64, | |
85 | open the "VS2013 x64 Native Tools Command Prompt" (if your current running OS | |
86 | is 64 bit) or "VS2013 x64 Cross Tools Command Prompt" (if your current | |
87 | running OS is not 64 bit) instead of opening its x86 variant. This will | |
88 | point the compiler and the linker to their 64 bit equivalent. | |
89 | ||
90 | If after the above step, a ``which link`` inside MSYS's bash says, | |
91 | ``/bin/link.exe``, rename ``/bin/link.exe`` to something else so that the | |
92 | Visual studio's linker is used. You should also see a 'which sort' report | |
93 | ``/bin/sort.exe``. | |
94 | ||
95 | - pthreads-win32 | |
96 | ||
97 | For pthread support, install the library, dll and includes of pthreads-win32 | |
98 | project from `sourceware | |
99 | <ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release>`__ to a | |
100 | directory (e.g.: ``C:/pthread``). You should add the pthread-win32's dll path | |
101 | (e.g.: ``C:\pthread\dll\x86``) to the Windows' PATH environment variable. | |
102 | ||
b8d24cc8 | 103 | - OpenSSL |
889e567b SF |
104 | |
105 | To get SSL support for Open vSwitch on Windows, you will need to install | |
34aa9cf9 | 106 | `OpenSSL for Windows <https://wiki.openssl.org/index.php/Binaries>`__ |
889e567b SF |
107 | |
108 | Note down the directory where OpenSSL is installed (e.g.: | |
109 | ``C:/OpenSSL-Win32``) for later use. | |
110 | ||
b8d24cc8 SF |
111 | .. note:: |
112 | ||
113 | Commands prefixed by ``$`` must be run in the Bash shell provided by MinGW. | |
95f2f97c SF |
114 | Open vSwitch commands, such as ``ovs-dpctl`` are shown running under the DOS |
115 | shell (``cmd.exe``), as indicated by the ``>`` prefix, but will also run | |
116 | under Bash. The remainder, prefixed by ``>``, are PowerShell commands and | |
117 | must be run in PowerShell. | |
b8d24cc8 | 118 | |
889e567b SF |
119 | Install Requirements |
120 | -------------------- | |
121 | ||
122 | * Share network adaptors | |
123 | ||
124 | We require that you don't disable the "Allow management operating system to | |
125 | share this network adapter" under 'Virtual Switch Properties' > 'Connection | |
dfec5030 | 126 | type: External network', in the Hyper-V virtual network switch configuration. |
889e567b SF |
127 | |
128 | * Checksum Offloads | |
129 | ||
130 | While there is some support for checksum/segmentation offloads in software, | |
131 | this is still a work in progress. Till the support is complete we recommend | |
dfec5030 | 132 | disabling TX/RX offloads for both the VM's as well as the Hyper-V. |
889e567b SF |
133 | |
134 | Bootstrapping | |
135 | ------------- | |
136 | ||
137 | This step is not needed if you have downloaded a released tarball. If | |
138 | you pulled the sources directly from an Open vSwitch Git tree or got a | |
139 | Git tree snapshot, then run boot.sh in the top source directory to build | |
b8d24cc8 SF |
140 | the "configure" script: |
141 | ||
23cb93ff | 142 | :: |
889e567b | 143 | |
b8d24cc8 | 144 | $ ./boot.sh |
889e567b SF |
145 | |
146 | .. _windows-configuring: | |
147 | ||
148 | Configuring | |
149 | ----------- | |
150 | ||
151 | Configure the package by running the configure script. You should provide some | |
152 | configure options to choose the right compiler, linker, libraries, Open vSwitch | |
b8d24cc8 | 153 | component installation directories, etc. For example: |
889e567b | 154 | |
23cb93ff | 155 | :: |
b8d24cc8 SF |
156 | |
157 | $ ./configure CC=./build-aux/cccl LD="$(which link)" \ | |
4d8f04b3 | 158 | LIBS="-lws2_32 -lShlwapi -liphlpapi -lwbemuuid -lole32 -loleaut32" \ |
b8d24cc8 SF |
159 | --prefix="C:/openvswitch/usr" \ |
160 | --localstatedir="C:/openvswitch/var" \ | |
161 | --sysconfdir="C:/openvswitch/etc" \ | |
162 | --with-pthread="C:/pthread" | |
889e567b SF |
163 | |
164 | .. note:: | |
b8d24cc8 SF |
165 | |
166 | By default, the above enables compiler optimization for fast code. For | |
167 | default compiler optimization, pass the ``--with-debug`` configure option. | |
168 | ||
169 | To configure with SSL support, add the requisite additional options: | |
170 | ||
23cb93ff | 171 | :: |
b8d24cc8 SF |
172 | |
173 | $ ./configure CC=./build-aux/cccl LD="`which link`" \ | |
4d8f04b3 | 174 | LIBS="-lws2_32 -lShlwapi -liphlpapi -lwbemuuid -lole32 -loleaut32" \ |
b8d24cc8 SF |
175 | --prefix="C:/openvswitch/usr" \ |
176 | --localstatedir="C:/openvswitch/var" | |
177 | --sysconfdir="C:/openvswitch/etc" \ | |
178 | --with-pthread="C:/pthread" \ | |
179 | --enable-ssl --with-openssl="C:/OpenSSL-Win32" | |
180 | ||
181 | Finally, to the kernel module also: | |
182 | ||
23cb93ff | 183 | :: |
b8d24cc8 SF |
184 | |
185 | $ ./configure CC=./build-aux/cccl LD="`which link`" \ | |
4d8f04b3 | 186 | LIBS="-lws2_32 -lShlwapi -liphlpapi -lwbemuuid -lole32 -loleaut32" \ |
b8d24cc8 SF |
187 | --prefix="C:/openvswitch/usr" \ |
188 | --localstatedir="C:/openvswitch/var" \ | |
189 | --sysconfdir="C:/openvswitch/etc" \ | |
190 | --with-pthread="C:/pthread" \ | |
191 | --enable-ssl --with-openssl="C:/OpenSSL-Win32" \ | |
b1db9dd6 SR |
192 | --with-vstudiotarget="<target type>" \ |
193 | --with-vstudiotargetver="<target versions>" | |
889e567b SF |
194 | |
195 | Possible values for ``<target type>`` are: ``Debug`` and ``Release`` | |
b1db9dd6 SR |
196 | Possible values for ``<target versions>`` is a comma separated list |
197 | of target versions to compile among: ``Win8,Win8.1,Win10`` | |
889e567b SF |
198 | |
199 | .. note:: | |
b8d24cc8 SF |
200 | |
201 | You can directly use the Visual Studio 2013 IDE to compile the kernel | |
202 | datapath. Open the ovsext.sln file in the IDE and build the solution. | |
889e567b | 203 | |
795752a3 | 204 | Refer to :doc:`general` for information on additional configuration options. |
889e567b SF |
205 | |
206 | .. _windows-building: | |
207 | ||
208 | Building | |
209 | -------- | |
210 | ||
211 | Once correctly configured, building Open vSwitch on Windows is similar to | |
212 | building on Linux, FreeBSD, or NetBSD. | |
213 | ||
b8d24cc8 SF |
214 | #. Run make for the ported executables in the top source directory, e.g.: |
215 | ||
23cb93ff | 216 | :: |
889e567b | 217 | |
b8d24cc8 | 218 | $ make |
889e567b SF |
219 | |
220 | For faster compilation, you can pass the ``-j`` argument to make. For | |
221 | example, to run 4 jobs simultaneously, run ``make -j4``. | |
222 | ||
223 | .. note:: | |
224 | ||
b8d24cc8 SF |
225 | MSYS 1.0.18 has a bug that causes parallel make to hang. You can overcome |
226 | this by downgrading to MSYS 1.0.17. A simple way to downgrade is to exit | |
227 | all MinGW sessions and then run the below command from MSVC developers | |
228 | command prompt.: | |
229 | ||
23cb93ff | 230 | :: |
889e567b SF |
231 | |
232 | > mingw-get upgrade msys-core-bin=1.0.17-1 | |
233 | ||
b8d24cc8 SF |
234 | #. To run all the unit tests in Open vSwitch, one at a time: |
235 | ||
23cb93ff | 236 | :: |
889e567b | 237 | |
b8d24cc8 | 238 | $ make check |
889e567b | 239 | |
b8d24cc8 | 240 | To run all the unit tests in Open vSwitch, up to 8 in parallel: |
889e567b | 241 | |
23cb93ff | 242 | :: |
889e567b | 243 | |
b8d24cc8 | 244 | $ make check TESTSUITEFLAGS="-j8" |
889e567b | 245 | |
b8d24cc8 SF |
246 | #. To install all the compiled executables on the local machine, run: |
247 | ||
23cb93ff | 248 | :: |
b8d24cc8 SF |
249 | |
250 | $ make install | |
889e567b SF |
251 | |
252 | .. note:: | |
253 | ||
b8d24cc8 SF |
254 | This will install the Open vSwitch executables in ``C:/openvswitch``. You |
255 | can add ``C:\openvswitch\usr\bin`` and ``C:\openvswitch\usr\sbin`` to | |
256 | Windows' PATH environment variable for easy access. | |
889e567b SF |
257 | |
258 | The Kernel Module | |
259 | ~~~~~~~~~~~~~~~~~ | |
260 | ||
261 | If you are building the kernel module, you will need to copy the below files to | |
262 | the target Hyper-V machine. | |
263 | ||
264 | - ``./datapath-windows/x64/Win8.1Debug/package/ovsext.inf`` | |
265 | - ``./datapath-windows/x64/Win8.1Debug/package/OVSExt.sys`` | |
266 | - ``./datapath-windows/x64/Win8.1Debug/package/ovsext.cat`` | |
267 | - ``./datapath-windows/misc/install.cmd`` | |
268 | - ``./datapath-windows/misc/uninstall.cmd`` | |
269 | ||
270 | .. note:: | |
b8d24cc8 SF |
271 | |
272 | The above path assumes that the kernel module has been built using Windows | |
273 | DDK 8.1 in Debug mode. Change the path appropriately, if a different WDK has | |
274 | been used. | |
889e567b SF |
275 | |
276 | Now run ``./uninstall.cmd`` to remove the old extension. Once complete, run | |
277 | ``./install.cmd`` to insert the new one. For this to work you will have to | |
278 | turn on ``TESTSIGNING`` boot option or 'Disable Driver Signature | |
b8d24cc8 SF |
279 | Enforcement' during boot. The following commands can be used: |
280 | ||
23cb93ff | 281 | :: |
889e567b | 282 | |
95f2f97c SF |
283 | > bcdedit /set LOADOPTIONS DISABLE_INTEGRITY_CHECKS |
284 | > bcdedit /set TESTSIGNING ON | |
285 | > bcdedit /set nointegritychecks ON | |
889e567b SF |
286 | |
287 | .. note:: | |
b8d24cc8 | 288 | |
889e567b SF |
289 | You may have to restart the machine for the settings to take effect. |
290 | ||
291 | In the Virtual Switch Manager configuration you can enable the Open vSwitch | |
292 | Extension on an existing switch or create a new switch. If you are using an | |
293 | existing switch, make sure to enable the "Allow Management OS" option for VXLAN | |
294 | to work (covered later). | |
295 | ||
296 | The command to create a new switch named 'OVS-Extended-Switch' using a physical | |
b8d24cc8 SF |
297 | NIC named 'Ethernet 1' is: |
298 | ||
23cb93ff | 299 | :: |
889e567b | 300 | |
b8d24cc8 | 301 | PS > New-VMSwitch "OVS-Extended-Switch" -NetAdapterName "Ethernet 1" |
889e567b SF |
302 | |
303 | .. note:: | |
b8d24cc8 SF |
304 | |
305 | You can obtain the list of physical NICs on the host using 'Get-NetAdapter' | |
306 | command. | |
889e567b SF |
307 | |
308 | In the properties of any switch, you should should now see "Open vSwitch | |
309 | Extension" under 'Extensions'. Click the check box to enable the extension. | |
b8d24cc8 SF |
310 | An alternative way to do the same is to run the following command: |
311 | ||
23cb93ff | 312 | :: |
889e567b | 313 | |
b8d24cc8 | 314 | PS > Enable-VMSwitchExtension "Open vSwitch Extension" OVS-Extended-Switch |
889e567b SF |
315 | |
316 | .. note:: | |
b8d24cc8 SF |
317 | |
318 | If you enabled the extension using the command line, a delay of a few | |
319 | seconds has been observed for the change to be reflected in the UI. This is | |
320 | not a bug in Open vSwitch. | |
889e567b SF |
321 | |
322 | Starting | |
323 | -------- | |
324 | ||
325 | .. important:: | |
b8d24cc8 SF |
326 | |
327 | The following steps assume that you have installed the Open vSwitch | |
328 | utilities in the local machine via 'make install'. | |
889e567b SF |
329 | |
330 | Before starting ovs-vswitchd itself, you need to start its configuration | |
331 | database, ovsdb-server. Each machine on which Open vSwitch is installed should | |
332 | run its own copy of ovsdb-server. Before ovsdb-server itself can be started, | |
b8d24cc8 SF |
333 | configure a database that it can use: |
334 | ||
23cb93ff | 335 | :: |
889e567b | 336 | |
95f2f97c SF |
337 | > ovsdb-tool create C:\openvswitch\etc\openvswitch\conf.db \ |
338 | C:\openvswitch\usr\share\openvswitch\vswitch.ovsschema | |
889e567b SF |
339 | |
340 | Configure ovsdb-server to use database created above and to listen on a Unix | |
b8d24cc8 | 341 | domain socket: |
889e567b | 342 | |
23cb93ff | 343 | :: |
b8d24cc8 | 344 | |
95f2f97c SF |
345 | > ovsdb-server -vfile:info --remote=punix:db.sock --log-file \ |
346 | --pidfile --detach | |
889e567b SF |
347 | |
348 | .. note:: | |
b8d24cc8 SF |
349 | |
350 | The logfile is created at ``C:/openvswitch/var/log/openvswitch/`` | |
889e567b SF |
351 | |
352 | Initialize the database using ovs-vsctl. This is only necessary the first time | |
353 | after you create the database with ovsdb-tool, though running it at any time is | |
b8d24cc8 SF |
354 | harmless: |
355 | ||
23cb93ff | 356 | :: |
889e567b | 357 | |
95f2f97c | 358 | > ovs-vsctl --no-wait init |
889e567b SF |
359 | |
360 | .. tip:: | |
889e567b | 361 | |
b8d24cc8 SF |
362 | If you would later like to terminate the started ovsdb-server, run: |
363 | ||
23cb93ff | 364 | :: |
b8d24cc8 | 365 | |
95f2f97c | 366 | > ovs-appctl -t ovsdb-server exit |
889e567b SF |
367 | |
368 | Start the main Open vSwitch daemon, telling it to connect to the same Unix | |
b8d24cc8 | 369 | domain socket: |
889e567b | 370 | |
23cb93ff | 371 | :: |
b8d24cc8 | 372 | |
95f2f97c | 373 | > ovs-vswitchd -vfile:info --log-file --pidfile --detach |
889e567b SF |
374 | |
375 | .. tip:: | |
889e567b | 376 | |
b8d24cc8 SF |
377 | If you would like to terminate the started ovs-vswitchd, run: |
378 | ||
23cb93ff | 379 | :: |
b8d24cc8 | 380 | |
95f2f97c | 381 | > ovs-appctl exit |
889e567b SF |
382 | |
383 | .. note:: | |
b8d24cc8 SF |
384 | |
385 | The logfile is created at ``C:/openvswitch/var/log/openvswitch/`` | |
889e567b SF |
386 | |
387 | Validating | |
388 | ---------- | |
389 | ||
390 | At this point you can use ovs-vsctl to set up bridges and other Open vSwitch | |
391 | features. | |
392 | ||
393 | Add bridges | |
394 | ~~~~~~~~~~~ | |
395 | ||
396 | Let's start by creating an integration bridge, ``br-int`` and a PIF bridge, | |
b8d24cc8 | 397 | ``br-pif``: |
889e567b | 398 | |
23cb93ff | 399 | :: |
b8d24cc8 | 400 | |
95f2f97c SF |
401 | > ovs-vsctl add-br br-int |
402 | > ovs-vsctl add-br br-pif | |
889e567b SF |
403 | |
404 | .. note:: | |
889e567b | 405 | |
b8d24cc8 SF |
406 | There's a known bug that running the ovs-vsctl command does not terminate. |
407 | This is generally solved by having ovs-vswitchd running. If you face the | |
408 | issue despite that, hit Ctrl-C to terminate ovs-vsctl and check the output | |
409 | to see if your command succeeded. | |
889e567b | 410 | |
b8d24cc8 | 411 | Validate that ports are added by dumping from both ovs-dpctl and ovs-vsctl: |
889e567b | 412 | |
23cb93ff | 413 | :: |
b8d24cc8 | 414 | |
95f2f97c | 415 | > ovs-dpctl show |
b8d24cc8 SF |
416 | system@ovs-system: |
417 | lookups: hit:0 missed:0 lost:0 | |
418 | flows: 0 | |
419 | port 2: br-pif (internal) <<< internal port on 'br-pif' bridge | |
420 | port 1: br-int (internal) <<< internal port on 'br-int' bridge | |
421 | ||
95f2f97c | 422 | > ovs-vsctl show |
b8d24cc8 SF |
423 | a56ec7b5-5b1f-49ec-a795-79f6eb63228b |
424 | Bridge br-pif | |
425 | Port br-pif | |
426 | Interface br-pif | |
427 | type: internal | |
428 | Bridge br-int | |
429 | Port br-int | |
430 | Interface br-int | |
431 | type: internal | |
889e567b SF |
432 | |
433 | .. note:: | |
b8d24cc8 SF |
434 | |
435 | There's a known bug that the ports added to OVSDB via ovs-vsctl don't get to | |
436 | the kernel datapath immediately, ie. they don't show up in the output of | |
437 | ``ovs-dpctl show`` even though they show up in output of ``ovs-vsctl show``. | |
438 | In order to workaround this issue, restart ovs-vswitchd. (You can terminate | |
439 | ovs-vswitchd by running ``ovs-appctl exit``.) | |
889e567b SF |
440 | |
441 | Add physicals NICs (PIF) | |
442 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
443 | ||
444 | Now, let's add the physical NIC and the internal port to ``br-pif``. In OVS for | |
445 | Hyper-V, we use the name of the adapter on top of which the Hyper-V virtual | |
446 | switch was created, as a special name to refer to the physical NICs connected | |
447 | to the Hyper-V switch, e.g. if we created the Hyper-V virtual switch on top of | |
448 | the adapter named ``Ethernet0``, then in OVS we use that name (``Ethernet0``) | |
449 | as a special name to refer to that adapter. | |
450 | ||
451 | .. note:: | |
b8d24cc8 SF |
452 | |
453 | We assume that the OVS extension is enabled Hyper-V switch. | |
889e567b | 454 | |
a0c03adf AS |
455 | Internal ports are the virtual adapters created on the Hyper-V switch using the |
456 | ``ovs-vsctl add-br <bridge>`` command. By default they are created under the | |
457 | following rule "<name of bridge>" and the adapters are disabled. One needs to | |
458 | enable them and set the corresponding values to it to make them IP-able. | |
889e567b | 459 | |
b8d24cc8 SF |
460 | As a whole example, if we issue the following in a powershell console: |
461 | ||
23cb93ff | 462 | :: |
889e567b | 463 | |
b8d24cc8 | 464 | PS > Get-NetAdapter | select Name,InterfaceDescription |
a0c03adf AS |
465 | Name InterfaceDescription |
466 | ---- -------------------- | |
467 | Ethernet1 Intel(R) PRO/1000 MT Network Connection | |
468 | br-pif Hyper-V Virtual Ethernet Adapter #2 | |
469 | Ethernet0 Intel(R) PRO/1000 MT Network Connection #2 | |
470 | br-int Hyper-V Virtual Ethernet Adapter #3 | |
889e567b | 471 | |
b8d24cc8 | 472 | PS > Get-VMSwitch |
889e567b SF |
473 | Name SwitchType NetAdapterInterfaceDescription |
474 | ---- ---------- ------------------------------ | |
475 | external External Intel(R) PRO/1000 MT Network Connection #2 | |
476 | ||
477 | We can see that we have a switch(external) created upon adapter name | |
a0c03adf | 478 | 'Ethernet0' with the internal ports under name 'br-pif' and 'br-int'. Thus |
b8d24cc8 | 479 | resulting into the following ovs-vsctl commands: |
889e567b | 480 | |
23cb93ff | 481 | :: |
889e567b | 482 | |
95f2f97c | 483 | > ovs-vsctl add-port br-pif Ethernet0 |
889e567b | 484 | |
b8d24cc8 SF |
485 | Dumping the ports should show the additional ports that were just added: |
486 | ||
23cb93ff | 487 | :: |
b8d24cc8 | 488 | |
95f2f97c | 489 | > ovs-dpctl show |
b8d24cc8 SF |
490 | system@ovs-system: |
491 | lookups: hit:0 missed:0 lost:0 | |
492 | flows: 0 | |
493 | port 2: br-pif (internal) <<< internal port | |
494 | adapter on | |
495 | Hyper-V switch | |
496 | port 1: br-int (internal) <<< internal port | |
497 | adapter on | |
498 | Hyper-V switch | |
499 | port 3: Ethernet0 <<< Physical NIC | |
500 | ||
95f2f97c | 501 | > ovs-vsctl show |
b8d24cc8 SF |
502 | a56ec7b5-5b1f-49ec-a795-79f6eb63228b |
503 | Bridge br-pif | |
504 | Port br-pif | |
505 | Interface br-pif | |
506 | type: internal | |
507 | Port "Ethernet0" | |
508 | Interface "Ethernet0" | |
509 | Bridge br-int | |
510 | Port br-int | |
511 | Interface br-int | |
512 | type: internal | |
889e567b SF |
513 | |
514 | Add virtual interfaces (VIFs) | |
515 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
516 | ||
dfec5030 | 517 | Adding VIFs to Open vSwitch is a two step procedure. The first step is to |
889e567b SF |
518 | assign a 'OVS port name' which is a unique name across all VIFs on this |
519 | Hyper-V. The next step is to add the VIF to the ovsdb using its 'OVS port | |
520 | name' as key. | |
521 | ||
522 | First, assign a unique 'OVS port name' to the VIF. The VIF needs to have been | |
523 | disconnected from the Hyper-V switch before assigning a 'OVS port name' to it. | |
524 | In the example below, we assign a 'OVS port name' called ``ovs-port-a`` to a | |
525 | VIF on a VM ``VM1``. By using index 0 for ``$vnic``, the first VIF of the VM | |
526 | is being addressed. After assigning the name ``ovs-port-a``, the VIF is | |
527 | connected back to the Hyper-V switch with name ``OVS-HV-Switch``, which is | |
95f2f97c SF |
528 | assumed to be the Hyper-V switch with OVS extension enabled.: |
529 | ||
23cb93ff | 530 | :: |
95f2f97c SF |
531 | |
532 | PS > import-module .\datapath-windows\misc\OVS.psm1 | |
533 | PS > $vnic = Get-VMNetworkAdapter <Name of the VM> | |
534 | PS > Disconnect-VMNetworkAdapter -VMNetworkAdapter $vnic[0] | |
535 | PS > $vnic[0] | Set-VMNetworkAdapterOVSPort -OVSPortName ovs-port-a | |
536 | PS > Connect-VMNetworkAdapter -VMNetworkAdapter $vnic[0] \ | |
537 | -SwitchName OVS-Extended-Switch | |
538 | ||
539 | Next, add the VIFs to ``br-int``: | |
540 | ||
23cb93ff | 541 | :: |
95f2f97c SF |
542 | |
543 | > ovs-vsctl add-port br-int ovs-port-a | |
544 | ||
545 | Dumping the ports should show the additional ports that were just added: | |
546 | ||
23cb93ff | 547 | :: |
95f2f97c SF |
548 | |
549 | > ovs-dpctl show | |
550 | system@ovs-system: | |
551 | lookups: hit:0 missed:0 lost:0 | |
552 | flows: 0 | |
553 | port 4: ovs-port-a | |
554 | port 2: br-pif (internal) | |
555 | port 1: br-int (internal | |
556 | port 3: Ethernet0 | |
557 | ||
558 | > ovs-vsctl show | |
559 | 4cd86499-74df-48bd-a64d-8d115b12a9f2 | |
560 | Bridge br-pif | |
561 | Port "vEthernet (external)" | |
562 | Interface "vEthernet (external)" | |
563 | Port "Ethernet0" | |
564 | Interface "Ethernet0" | |
565 | Port br-pif | |
566 | Interface br-pif | |
567 | type: internal | |
568 | Bridge br-int | |
569 | Port br-int | |
570 | Interface br-int | |
571 | type: internal | |
572 | Port "ovs-port-a" | |
573 | Interface "ovs-port-a" | |
889e567b | 574 | |
a0c03adf AS |
575 | Add multiple NICs to be managed by OVS |
576 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
577 | ||
578 | To leverage support of multiple NICs into OVS, we will be using the MSFT | |
579 | cmdlets for forwarding team extension. More documentation about them can be | |
580 | found at technet_. | |
581 | ||
582 | .. _technet: https://technet.microsoft.com/en-us/library/jj553812%28v=wps.630%29.aspx | |
583 | ||
890ffc06 SF |
584 | For example, to set up a switch team combined from ``Ethernet0 2`` and |
585 | ``Ethernet1 2`` named ``external``: | |
586 | ||
23cb93ff | 587 | :: |
890ffc06 SF |
588 | |
589 | PS > Get-NetAdapter | |
590 | Name InterfaceDescription | |
591 | ---- -------------------- | |
592 | br-int Hyper-V Virtual Ethernet Adapter #3 | |
593 | br-pif Hyper-V Virtual Ethernet Adapter #2 | |
594 | Ethernet3 2 Intel(R) 82574L Gigabit Network Co...#3 | |
595 | Ethernet2 2 Intel(R) 82574L Gigabit Network Co...#4 | |
596 | Ethernet1 2 Intel(R) 82574L Gigabit Network Co...#2 | |
597 | Ethernet0 2 Intel(R) 82574L Gigabit Network Conn... | |
598 | ||
599 | PS > New-NetSwitchTeam -Name external -TeamMembers "Ethernet0 2","Ethernet1 2" | |
b8d24cc8 | 600 | |
890ffc06 SF |
601 | PS > Get-NetSwitchTeam |
602 | Name : external | |
603 | Members : {Ethernet1 2, Ethernet0 2} | |
604 | ||
605 | This will result in a new adapter bound to the host called ``external``: | |
606 | ||
23cb93ff | 607 | :: |
890ffc06 SF |
608 | |
609 | PS > Get-NetAdapter | |
890ffc06 SF |
610 | Name InterfaceDescription |
611 | ---- -------------------- | |
612 | br-test Hyper-V Virtual Ethernet Adapter #4 | |
613 | br-pif Hyper-V Virtual Ethernet Adapter #2 | |
614 | external Microsoft Network Adapter Multiplexo... | |
615 | Ethernet3 2 Intel(R) 82574L Gigabit Network Co...#3 | |
616 | Ethernet2 2 Intel(R) 82574L Gigabit Network Co...#4 | |
617 | Ethernet1 2 Intel(R) 82574L Gigabit Network Co...#2 | |
618 | Ethernet0 2 Intel(R) 82574L Gigabit Network Conn... | |
619 | ||
620 | Next we will set up the Hyper-V VMSwitch on the new adapter ``external``: | |
621 | ||
23cb93ff | 622 | :: |
890ffc06 SF |
623 | |
624 | PS > New-VMSwitch -Name external -NetAdapterName external \ | |
625 | -AllowManagementOS $false | |
a0c03adf AS |
626 | |
627 | Under OVS the adapters under the team ``external``, ``Ethernet0 2`` and | |
628 | ``Ethernet1 2``, can be added either under a bond device or separately. | |
629 | ||
890ffc06 SF |
630 | The following example shows how the bridges look with the NICs being |
631 | separated: | |
632 | ||
23cb93ff | 633 | :: |
890ffc06 | 634 | |
95f2f97c | 635 | > ovs-vsctl show |
890ffc06 SF |
636 | 6cd9481b-c249-4ee3-8692-97b399dd29d8 |
637 | Bridge br-test | |
638 | Port br-test | |
639 | Interface br-test | |
640 | type: internal | |
641 | Port "Ethernet1 2" | |
642 | Interface "Ethernet1 2" | |
643 | Bridge br-pif | |
644 | Port "Ethernet0 2" | |
645 | Interface "Ethernet0 2" | |
646 | Port br-pif | |
647 | Interface br-pif | |
648 | type: internal | |
a0c03adf | 649 | |
889e567b SF |
650 | Add patch ports and configure VLAN tagging |
651 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
652 | ||
653 | The Windows Open vSwitch implementation support VLAN tagging in the switch. | |
654 | Switch VLAN tagging along with patch ports between ``br-int`` and ``br-pif`` is | |
655 | used to configure VLAN tagging functionality between two VMs on different | |
b8d24cc8 SF |
656 | Hyper-Vs. To start, add a patch port from ``br-int`` to ``br-pif``: |
657 | ||
23cb93ff | 658 | :: |
b8d24cc8 | 659 | |
95f2f97c SF |
660 | > ovs-vsctl add-port br-int patch-to-pif |
661 | > ovs-vsctl set interface patch-to-pif type=patch \ | |
662 | options:peer=patch-to-int | |
889e567b | 663 | |
b8d24cc8 | 664 | Add a patch port from ``br-pif`` to ``br-int``: |
889e567b | 665 | |
23cb93ff | 666 | :: |
889e567b | 667 | |
95f2f97c SF |
668 | > ovs-vsctl add-port br-pif patch-to-int |
669 | > ovs-vsctl set interface patch-to-int type=patch \ | |
670 | options:peer=patch-to-pif | |
889e567b | 671 | |
b8d24cc8 | 672 | Re-Add the VIF ports with the VLAN tag: |
889e567b | 673 | |
23cb93ff | 674 | :: |
b8d24cc8 | 675 | |
95f2f97c SF |
676 | > ovs-vsctl add-port br-int ovs-port-a tag=900 |
677 | > ovs-vsctl add-port br-int ovs-port-b tag=900 | |
889e567b SF |
678 | |
679 | Add tunnels | |
680 | ~~~~~~~~~~~ | |
681 | ||
682 | The Windows Open vSwitch implementation support VXLAN and STT tunnels. To add | |
683 | tunnels. For example, first add the tunnel port between 172.168.201.101 <-> | |
b8d24cc8 SF |
684 | 172.168.201.102: |
685 | ||
23cb93ff | 686 | :: |
889e567b | 687 | |
95f2f97c SF |
688 | > ovs-vsctl add-port br-int tun-1 |
689 | > ovs-vsctl set Interface tun-1 type=<port-type> | |
690 | > ovs-vsctl set Interface tun-1 options:local_ip=172.168.201.101 | |
691 | > ovs-vsctl set Interface tun-1 options:remote_ip=172.168.201.102 | |
692 | > ovs-vsctl set Interface tun-1 options:in_key=flow | |
693 | > ovs-vsctl set Interface tun-1 options:out_key=flow | |
889e567b | 694 | |
b8d24cc8 | 695 | ...and the tunnel port between 172.168.201.101 <-> 172.168.201.105: |
889e567b | 696 | |
23cb93ff | 697 | :: |
b8d24cc8 | 698 | |
95f2f97c SF |
699 | > ovs-vsctl add-port br-int tun-2 |
700 | > ovs-vsctl set Interface tun-2 type=<port-type> | |
701 | > ovs-vsctl set Interface tun-2 options:local_ip=172.168.201.102 | |
702 | > ovs-vsctl set Interface tun-2 options:remote_ip=172.168.201.105 | |
703 | > ovs-vsctl set Interface tun-2 options:in_key=flow | |
704 | > ovs-vsctl set Interface tun-2 options:out_key=flow | |
889e567b SF |
705 | |
706 | Where ``<port-type>`` is one of: ``stt`` or ``vxlan`` | |
707 | ||
708 | .. note:: | |
b8d24cc8 SF |
709 | |
710 | Any patch ports created between br-int and br-pif MUST be be deleted prior | |
711 | to adding tunnels. | |
889e567b SF |
712 | |
713 | Windows Services | |
714 | ---------------- | |
715 | ||
716 | Open vSwitch daemons come with support to run as a Windows service. The | |
717 | instructions here assume that you have installed the Open vSwitch utilities and | |
718 | daemons via ``make install``. | |
719 | ||
b8d24cc8 | 720 | To start, create the database: |
889e567b | 721 | |
23cb93ff | 722 | :: |
b8d24cc8 | 723 | |
95f2f97c SF |
724 | > ovsdb-tool create C:/openvswitch/etc/openvswitch/conf.db \ |
725 | "C:/openvswitch/usr/share/openvswitch/vswitch.ovsschema" | |
889e567b | 726 | |
b8d24cc8 | 727 | Create the ovsdb-server service and start it: |
889e567b | 728 | |
23cb93ff | 729 | :: |
889e567b | 730 | |
95f2f97c SF |
731 | > sc create ovsdb-server \ |
732 | binpath="C:/openvswitch/usr/sbin/ovsdb-server.exe \ | |
733 | C:/openvswitch/etc/openvswitch/conf.db \ | |
734 | -vfile:info --log-file --pidfile \ | |
735 | --remote=punix:db.sock --service --service-monitor" | |
736 | > sc start ovsdb-server | |
889e567b SF |
737 | |
738 | .. tip:: | |
889e567b | 739 | |
b8d24cc8 SF |
740 | One of the common issues with creating a Windows service is with mungled |
741 | paths. You can make sure that the correct path has been registered with the | |
742 | Windows services manager by running: | |
743 | ||
23cb93ff | 744 | :: |
889e567b | 745 | |
95f2f97c | 746 | > sc qc ovsdb-server |
889e567b | 747 | |
b8d24cc8 | 748 | Check that the service is healthy by running: |
889e567b | 749 | |
23cb93ff | 750 | :: |
b8d24cc8 | 751 | |
95f2f97c | 752 | > sc query ovsdb-server |
889e567b | 753 | |
b8d24cc8 | 754 | Initialize the database: |
889e567b | 755 | |
23cb93ff | 756 | :: |
889e567b | 757 | |
95f2f97c | 758 | > ovs-vsctl --no-wait init |
889e567b | 759 | |
b8d24cc8 | 760 | Create the ovs-vswitchd service and start it: |
889e567b | 761 | |
23cb93ff | 762 | :: |
889e567b | 763 | |
95f2f97c SF |
764 | > sc create ovs-vswitchd \ |
765 | binpath="C:/openvswitch/usr/sbin/ovs-vswitchd.exe \ | |
766 | --pidfile -vfile:info --log-file --service --service-monitor" | |
767 | > sc start ovs-vswitchd | |
b8d24cc8 SF |
768 | |
769 | Check that the service is healthy by running: | |
770 | ||
23cb93ff | 771 | :: |
b8d24cc8 | 772 | |
95f2f97c | 773 | > sc query ovs-vswitchd |
b8d24cc8 SF |
774 | |
775 | To stop and delete the services, run: | |
776 | ||
23cb93ff | 777 | :: |
889e567b | 778 | |
95f2f97c SF |
779 | > sc stop ovs-vswitchd |
780 | > sc stop ovsdb-server | |
781 | > sc delete ovs-vswitchd | |
782 | > sc delete ovsdb-server | |
889e567b SF |
783 | |
784 | Windows CI Service | |
785 | ------------------ | |
786 | ||
787 | `AppVeyor <www.appveyor.com>`__ provides a free Windows autobuild service for | |
dfec5030 | 788 | open source projects. Open vSwitch has integration with AppVeyor for continuous |
889e567b SF |
789 | build. A developer can build test his changes for Windows by logging into |
790 | appveyor.com using a github account, creating a new project by linking it to | |
791 | his development repository in github and triggering a new build. | |
792 | ||
793 | TODO | |
794 | ---- | |
795 | ||
796 | * Investigate the working of sFlow on Windows and re-enable the unit tests. | |
797 | ||
798 | * Investigate and add the feature to provide QoS. | |
799 | ||
dfec5030 | 800 | * Sign the driver & create an MSI for installing the different Open vSwitch |
889e567b | 801 | components on Windows. |