]> git.proxmox.com Git - ovs.git/blame - INSTALL.Windows.md
netdev-windows: Add ARP lookup and next hop functionality.
[ovs.git] / INSTALL.Windows.md
CommitLineData
542cc9bb
TG
1How to Build the Kernel module & userspace daemons for Windows
2==============================================================
c803536e
SS
3
4Autoconf, Automake and Visual C++:
5---------------------------------
6Open vSwitch on Linux uses autoconf and automake for generating Makefiles.
7It will be useful to maintain the same build system while compiling on Windows
8too. One approach is to compile Open vSwitch in a MinGW environment that
9contains autoconf and automake utilities and then use Visual C++ as a compiler
10and linker.
11
12The following explains the steps in some detail.
13
14* Install Mingw on a Windows machine by following the instructions at:
15http://www.mingw.org/wiki/Getting_Started
16
17This should install mingw at C:\Mingw and msys at C:\Mingw\msys.
18Add "C:\MinGW\bin" and "C:\Mingw\msys\1.0\bin" to PATH environment variable
19of Windows.
20
21You can either use the MinGW installer or the command line utility 'mingw-get'
22to install both the base packages and additional packages like automake and
23autoconf(version 2.68).
24
25Also make sure that /mingw mount point exists. If its not, please add/create
26the following entry in /etc/fstab - 'C:/MinGW /mingw'.
27
28* Install the latest Python 2.x from python.org and verify that its path is
29part of Windows' PATH environment variable.
30
31* You will need at least Visual Studio 2013 to compile userspace binaries. In
32addition to that, if you want to compile the kernel module you will also need to
33install Windows Driver Kit (WDK) 8.1 Update.
34
35It is important to get the Visual Studio related environment variables and to
36have the $PATH inside the bash to point to the proper compiler and linker. One
37easy way to achieve this is to get into the "Developer Command prompt for visual
38b01df6
GS
38studio" and through it enter into the bash shell available from msys by typing
39'bash --login'.
c803536e
SS
40
41If after the above step, a 'which link' inside MSYS's bash says,
42"/bin/link.exe", rename /bin/link.exe to something else so that the
38b01df6
GS
43Visual studio's linker is used. You should also see a 'which sort' report
44"/bin/sort.exe".
c803536e
SS
45
46* For pthread support, install the library, dll and includes of pthreads-win32
47project from
48ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release to a
d0d808fd
GS
49directory (e.g.: C:/pthread). You should add the pthread-win32's dll
50path (e.g.: C:\pthread\dll\x86) to the Windows' PATH environment variable.
c803536e
SS
51
52* Get the Open vSwitch sources from either cloning the repo using git
53or from a distribution tar ball.
54
55* If you pulled the sources directly from an Open vSwitch Git tree,
56 run boot.sh in the top source directory:
57
542cc9bb 58 % ./boot.sh
c803536e
SS
59
60* In the top source directory, configure the package by running the
61 configure script. You should provide some configure options to choose
62 the right compiler, linker, libraries, Open vSwitch component installation
63 directories, etc. For example,
64
694ebbc8
AS
65 % ./configure CC=./build-aux/cccl LD="`which link`" \
66 LIBS="-lws2_32 -liphlpapi" --prefix="C:/openvswitch/usr" \
67 --localstatedir="C:/openvswitch/var" --sysconfdir="C:/openvswitch/etc" \
68 --with-pthread="C:/pthread"
c803536e 69
b0e1bce5
GS
70 By default, the above enables compiler optimization for fast code.
71 For default compiler optimization, pass the "--with-debug" configure
72 option.
73
c803536e
SS
74* Run make for the ported executables in the top source directory, e.g.:
75
542cc9bb 76 % make
d9d8dbc8 77
d0d808fd
GS
78 For faster compilation, you can pass the '-j' argument to make. For
79 example, to run 4 jobs simultaneously, run 'make -j4'.
80
81 Note: MSYS 1.0.18 has a bug that causes parallel make to hang. You
82 can overcome this by downgrading to MSYS 1.0.17. A simple way to
83 downgrade is to exit all MinGW sessions and then run the command
84 'mingw-get upgrade msys-core-bin=1.0.17-1' from MSVC developers command
85 prompt.
86
87* To run all the unit tests in Open vSwitch, one at a time:
d9d8dbc8 88
542cc9bb 89 % make check
c803536e 90
d0d808fd
GS
91 To run all the unit tests in Open vSwitch, up to 8 in parallel:
92
93 % make check TESTSUITEFLAGS="-j8"
94
95* To install all the compiled executables on the local machine, run:
96
97 % make install
98
99 The above command will install the Open vSwitch executables in
100 C:/openvswitch. You can add 'C:\openvswitch\usr\bin' and
101 'C:\openvswitch\usr\sbin' to Windows' PATH environment variable
102 for easy access.
103
c803536e
SS
104OpenSSL, Open vSwitch and Visual C++
105------------------------------------
106To get SSL support for Open vSwitch on Windows, do the following:
107
108* Install OpenSSL for Windows as suggested at
109http://www.openssl.org/related/binaries.html.
110The link as of this writing suggests to download it from
bb996e5b 111http://slproweb.com/products/Win32OpenSSL.html
c803536e
SS
112
113Note down the directory where OpenSSL is installed (e.g.: C:/OpenSSL-Win32).
114
115* While configuring the package, specify the OpenSSL directory path.
116For example,
117
694ebbc8
AS
118 % ./configure CC=./build-aux/cccl LD="`which link`" \
119 LIBS="-lws2_32 -liphlpapi" --prefix="C:/openvswitch/usr" \
120 --localstatedir="C:/openvswitch/var" --sysconfdir="C:/openvswitch/etc" \
121 --with-pthread="C:/pthread" --enable-ssl --with-openssl="C:/OpenSSL-Win32"
c803536e
SS
122
123* Run make for the ported executables.
124
978ce0e9
NR
125Building the Kernel datapath module
126-----------------------------------
127* We directly use the Visual Studio 2013 IDE to compile the kernel datapath.
128You can open the extensions.sln file in the IDE and build the solution.
129
130* The kernel datapath can be compiled from command line as well. The top
131level 'make' will invoke building the kernel datapath, if the
132'--with-vstudioddk' argument is specified while configuring the package.
133For example,
134
694ebbc8
AS
135 % ./configure CC=./build-aux/cccl LD="`which link`" \
136 LIBS="-lws2_32 -liphlpapi" --prefix="C:/openvswitch/usr" \
137 --localstatedir="C:/openvswitch/var" --sysconfdir="C:/openvswitch/etc" \
138 --with-pthread="C:/pthread" --enable-ssl \
139 --with-openssl="C:/OpenSSL-Win32" --with-vstudioddk="<WDK to use>"
978ce0e9
NR
140
141 Possible values for "<WDK to use>" are:
142 "Win8.1 Debug", "Win8.1 Release", "Win8 Debug" and "Win8 Release".
c803536e
SS
143
144Installing the Kernel module
145----------------------------
146Once you have built the solution, you can copy the following files to the
978ce0e9 147target Hyper-V machines.
c803536e
SS
148
149 ./datapath-windows/x64/Win8.1Debug/package/ovsext.inf
150 ./datapath-windows/x64/Win8.1Debug/package/OVSExt.sys
151 ./datapath-windows/x64/Win8.1Debug/package/ovsext.cat
152 ./datapath-windows/misc/install.cmd
153 ./datapath-windows/misc/uninstall.cmd
154
978ce0e9
NR
155The above path assumes that the kernel module has been built using Windows
156DDK 8.1 in Debug mode. Change the path appropriately, if a different WDK
157has been used.
158
c803536e
SS
159Steps to install the module
160---------------------------
161
16201> Run ./uninstall.cmd to remove the old extension.
0a46bca7
NR
163
16402> Run ./install.cmd to insert the new one. For this to work you will have to
c803536e 165turn on TESTSIGNING boot option or 'Disable Driver Signature Enforcement'
64d15689
NR
166during boot. The following commands can be used:
167 % bcdedit /set LOADOPTIONS DISABLE_INTEGRITY_CHECKS
168 % bcdedit /set TESTSIGNING ON
169 % bcdedit /set nointegritychecks ON
170
171Note: you may have to restart the machine for the settings to take effect.
0a46bca7
NR
172
17303> In the Virtual Switch Manager configuration you can enable the Open vSwitch
174Extension on an existing switch or create a new switch. If you are using an
175existing switch, make sure to enable the "Allow Management OS" option for VXLAN
176to work (covered later).
177
178The command to create a new switch named 'OVS-Extended-Switch' using a physical
179NIC named 'Ethernet 1' is:
180 % New-VMSwitch "OVS-Extended-Switch" -AllowManagementOS $true \
181 -NetAdapterName "Ethernet 1"
182
183Note: you can obtain the list of physical NICs on the host using
184'Get-NetAdapter' command.
185
18604> In the properties of any switch, you should should now see "Open
187vSwitch Extension" under 'Extensions'. Click the check box to enable the
188extension. An alternative way to do the same is to run the following command:
189 % Enable-VMSwitchExtension "Open vSwitch Extension" OVS-Extended-Switch
190
191Note: If you enabled the extension using the command line, a delay of a few
192seconds has been observed for the change to be reflected in the UI. This is
193not a bug in Open vSwitch.
194
195Steps to run the user processes & configure ports
196-------------------------------------------------
d0d808fd
GS
197The following steps assume that you have installed the Open vSwitch
198utilities in the local machine via 'make install'.
199
20001> Create the database.
201 % ovsdb-tool create C:\openvswitch\etc\openvswitch\conf.db \
202 C:\openvswitch\usr\share\openvswitch\vswitch.ovsschema
203
20402> Start the ovsdb-server and initialize the database.
205 % ovsdb-server -vfile:info --remote=punix:db.sock --log-file --pidfile \
206 --detach
207 % ovs-vsctl --no-wait init
208
209 If you would like to terminate the started ovsdb-server, run:
210 % ovs-appctl -t ovsdb-server exit
211
212 (Note that the logfile is created at C:/openvswitch/var/log/openvswitch/)
0a46bca7 213
d0d808fd
GS
21403> Start ovs-vswitchd.
215 % ovs-vswitchd -vfile:info --log-file --pidfile --detach
0a46bca7 216
d0d808fd
GS
217 If you would like to terminate the started ovs-vswitchd, run:
218 % ovs-appctl exit
0a46bca7 219
d0d808fd 220 (Note that the logfile is created at C:/openvswitch/var/log/openvswitch/)
0a46bca7
NR
221
22204> Create integration bridge & pif bridge
d0d808fd
GS
223 % ovs-vsctl add-br br-int
224 % ovs-vsctl add-br br-pif
0a46bca7 225
d0d808fd
GS
226NOTE: There's a known bug that running the ovs-vsctl command does not
227terminate. This is generally solved by having ovs-vswitchd running. If
228you face the issue despite that, hit Ctrl-C to terminate ovs-vsctl and
0a46bca7
NR
229check the output to see if your command succeeded.
230
d0d808fd
GS
231NOTE: There's a known bug that the ports added to OVSDB via ovs-vsctl don't
232get to the kernel datapath immediately, ie. they don't show up in the output of
233"ovs-dpctl show" even though they show up in output of "ovs-vsctl show".
234In order to workaround this issue, restart ovs-vswitchd. (You can terminate
235ovs-vswitchd by running 'ovs-appctl exit'.)
0a46bca7
NR
236
23705> Dump the ports in the kernel datapath
d0d808fd 238 % ovs-dpctl show
0a46bca7
NR
239
240* Sample output is as follows:
241
d0d808fd 242 % ovs-dpctl show
0a46bca7
NR
243 system@ovs-system:
244 lookups: hit:0 missed:0 lost:0
245 flows: 0
246 port 2: br-pif (internal) <<< internal port on 'br-pif' bridge
247 port 1: br-int (internal) <<< internal port on 'br-int' bridge
248
24906> Dump the ports in the OVSDB
d0d808fd 250 % ovs-vsctl show
0a46bca7
NR
251
252* Sample output is as follows:
d0d808fd 253 % ovs-vsctl show
0a46bca7
NR
254 a56ec7b5-5b1f-49ec-a795-79f6eb63228b
255 Bridge br-pif
256 Port br-pif
257 Interface br-pif
258 type: internal
259 Bridge br-int
260 Port br-int
261 Interface br-int
262 type: internal
263
26407> Add the physical NIC and the internal port to br-pif.
265
266In OVS for Hyper-V, we use 'external' as a special name to refer to the
267physical NICs connected to the Hyper-V switch. An index is added to this
268special name to refer to the particular physical NIC. Eg. 'external.1' refers
269to the first physical NIC on the Hyper-V switch.
270
271Note: Currently, we assume that the Hyper-V switch on which OVS extension is
272enabled has a single physical NIC connected to it.
273
274Interal port is the virtual adapter created on the Hyper-V switch using the
275'AllowManagementOS' setting. This has already been setup while creating the
276switch using the instructions above. In OVS for Hyper-V, we use a 'internal'
277as a special name to refer to that adapter.
278
d0d808fd
GS
279 % ovs-vsctl add-port br-pif external.1
280 % ovs-vsctl add-port br-pif internal
0a46bca7
NR
281
282* Dumping the ports should show the additional ports that were just added.
283 Sample output shows up as follows:
284
d0d808fd 285 % ovs-dpctl show
0a46bca7
NR
286 system@ovs-system:
287 lookups: hit:0 missed:0 lost:0
288 flows: 0
289 port 4: internal (internal) <<< 'AllowManagementOS' adapter on
290 Hyper-V switch
291 port 2: br-pif (internal)
292 port 1: br-int (internal
293 port 3: external.1 <<< Physical NIC
294
d0d808fd 295 % ovs-vsctl show
0a46bca7
NR
296 a56ec7b5-5b1f-49ec-a795-79f6eb63228b
297 Bridge br-pif
298 Port internal
299 Interface internal
300 Port br-pif
301 Interface br-pif
302 type: internal
0a46bca7
NR
303 Port "external.1"
304 Interface "external.1"
df4d9ec3 305 Bridge br-int
0a46bca7
NR
306 Port br-int
307 Interface br-int
308 type: internal
309
31008> Add the VIFs to br-int
311
312Adding VIFs to openvswitch is a two step procedure. The first step is to
313assign a 'OVS port name' which is a unique name across all VIFs on this
314Hyper-V. The next step is to add the VIF to the ovsdb using its 'OVS port
315name' as key.
316
31708a> Assign a unique 'OVS port name' to the VIF
318
319Note that the VIF needs to have been disconnected from the Hyper-V switch
320before assigning a 'OVS port name' to it. In the example below, we assign a
321'OVS port name' called 'ovs-port-a' to a VIF on a VM by name 'VM1'. By using
322index 0 for '$vnic', the first VIF of the VM is being addressed. After
323assigning the name 'ovs-port-a', the VIF is connected back to the Hyper-V
324switch with name 'OVS-HV-Switch', which is assumed to be the Hyper-V switch
325with OVS extension enabled.
326
327 Eg:
328 % import-module .\datapath-windows\misc\OVS.psm1
329 % $vnic = Get-VMNetworkAdapter <Name of the VM>
330 % Disconnect-VMNetworkAdapter -VMNetworkAdapter $vnic[0]
331 % $vnic[0] | Set-VMNetworkAdapterOVSPort -OVSPortName ovs-port-a
332 % Connect-VMNetworkAdapter -VMNetworkAdapter $vnic[0] \
333 -SwitchName OVS-Extended-Switch
334
33508b> Add the VIFs to br-int in ovsdb
336
337 Eg:
d0d808fd 338 % ovs-vsctl add-port br-int ovs-port-a
0a46bca7
NR
339
34009> Verify the status
d0d808fd 341 % ovs-dpctl show
0a46bca7
NR
342 system@ovs-system:
343 lookups: hit:0 missed:0 lost:0
344 flows: 0
345 port 4: internal (internal)
346 port 5: ovs-port-a
347 port 2: br-pif (internal)
348 port 1: br-int (internal
349 port 3: external.1
350
d0d808fd 351 % ovs-vsctl show
0a46bca7
NR
352 4cd86499-74df-48bd-a64d-8d115b12a9f2
353 Bridge br-pif
354 Port internal
355 Interface internal
356 Port "external.1"
357 Interface "external.1"
358 Port br-pif
359 Interface br-pif
360 type: internal
361 Bridge br-int
362 Port br-int
363 Interface br-int
364 type: internal
365 Port "ovs-port-a"
366 Interface "ovs-port-a"
367
368Steps to configure patch ports and switch VLAN tagging
369------------------------------------------------------
370The Windows Open vSwitch implementation support VLAN tagging in the switch.
371Switch VLAN tagging along with patch ports between 'br-int' and 'br-pif' is
372used to configure VLAN tagging functionality between two VMs on different
373Hyper-Vs. The following examples demonstrate how it can be done:
374
37501> Add a patch port from br-int to br-pif
d0d808fd
GS
376 % ovs-vsctl add-port br-int patch-to-pif
377 % ovs-vsctl set interface patch-to-pif type=patch \
0a46bca7
NR
378 options:peer=patch-to-int
379
38002> Add a patch port from br-pif to br-int
d0d808fd
GS
381 % ovs-vsctl add-port br-pif patch-to-int
382 % ovs-vsctl set interface patch-to-int type=patch \
0a46bca7
NR
383 options:peer=patch-to-pif
384
38503> Re-Add the VIF ports with the VLAN tag
d0d808fd
GS
386 % ovs-vsctl add-port br-int ovs-port-a tag=900
387 % ovs-vsctl add-port br-int ovs-port-b tag=900
0a46bca7
NR
388
389Steps to add VXLAN tunnels
390--------------------------
391The Windows Open vSwitch implementation support VXLAN tunnels. To add VXLAN
392tunnels, the following steps serve as examples.
393
394Note that, any patch ports created between br-int and br-pif MUST be beleted
395prior to adding VXLAN tunnels.
396
39701> Add the vxlan port between 172.168.201.101 <-> 172.168.201.102
d0d808fd
GS
398 % ovs-vsctl add-port br-int vxlan-1
399 % ovs-vsctl set Interface vxlan-1 type=vxlan
400 % ovs-vsctl set Interface vxlan-1 options:local_ip=172.168.201.101
401 % ovs-vsctl set Interface vxlan-1 options:remote_ip=172.168.201.102
402 % ovs-vsctl set Interface vxlan-1 options:in_key=flow
403 % ovs-vsctl set Interface vxlan-1 options:out_key=flow
0a46bca7
NR
404
40502> Add the vxlan port between 172.168.201.101 <-> 172.168.201.105
d0d808fd
GS
406 % ovs-vsctl add-port br-int vxlan-2
407 % ovs-vsctl set Interface vxlan-2 type=vxlan
408 % ovs-vsctl set Interface vxlan-2 options:local_ip=172.168.201.102
409 % ovs-vsctl set Interface vxlan-2 options:remote_ip=172.168.201.105
410 % ovs-vsctl set Interface vxlan-2 options:in_key=flow
411 % ovs-vsctl set Interface vxlan-2 options:out_key=flow
d9d8dbc8
NR
412
413
c803536e
SS
414Requirements
415------------
c803536e
SS
416* We require that you don't disable the "Allow management operating system to
417share this network adapter" under 'Virtual Switch Properties' > 'Connection
418type: External network', in the HyperV virtual network switch configuration.
419
420* Checksum Offloads
421 While there is some support for checksum/segmentation offloads in software,
422this is still a work in progress. Till the support is complete we recommend
423disabling TX/RX offloads for both the VM's as well as the HyperV.
424
0be55e38
GS
425Windows Services
426----------------
427Open vSwitch daemons come with support to run as a Windows service. The
428instructions here assume that you have installed the Open vSwitch utilities
429and daemons via 'make install'. The commands shown here can be run from
430MSYS bash or Windows command prompt.
431
432* Create the database.
433
434 % ovsdb-tool create C:/openvswitch/etc/openvswitch/conf.db \
435 "C:/openvswitch/usr/share/openvswitch/vswitch.ovsschema"
436
437* Create the ovsdb-server service and start it.
438
aeef025a 439 % sc create ovsdb-server binpath="C:/openvswitch/usr/sbin/ovsdb-server.exe C:/openvswitch/etc/openvswitch/conf.db -vfile:info --log-file --pidfile --remote=punix:db.sock --service --service-monitor"
0be55e38
GS
440
441 One of the common issues with creating a Windows service is with mungled
442 paths. You can make sure that the correct path has been registered with
443 the Windows services manager by running:
444
445 % sc qc ovsdb-server
446
447 Start the service.
448
449 % sc start ovsdb-server
450
451 Check that the service is healthy by running:
452
453 % sc query ovsdb-server
454
455* Initialize the database.
456
457 % ovs-vsctl --no-wait init
458
459* Create the ovs-vswitchd service and start it.
460
aeef025a 461 % sc create ovs-vswitchd binpath="C:/openvswitch/usr/sbin/ovs-vswitchd.exe --pidfile -vfile:info --log-file --service --service-monitor"
0be55e38
GS
462
463 % sc start ovs-vswitchd
464
465 Check that the service is healthy by running:
466
467 % sc query ovs-vswitchd
468
469* To stop and delete the services, run:
470
471 % sc stop ovs-vswitchd
472 % sc stop ovsdb-server
473 % sc delete ovs-vswitchd
474 % sc delete ovsdb-server
475
d8a24927
GS
476Windows autobuild service
477-------------------------
d8a24927
GS
478AppVeyor (appveyor.com) provides a free Windows autobuild service for
479opensource projects. Open vSwitch has integration with AppVeyor for
480continuous build. A developer can build test his changes for Windows by
481logging into appveyor.com using a github account, creating a new project
482by linking it to his development repository in github and triggering
483a new build.
c803536e 484
d9d8dbc8 485TODO
c803536e
SS
486----
487
c803536e
SS
488* Investigate the working of sFlow on Windows and re-enable the unit tests.
489
abe6d620
GS
490* Investigate and add the feature to provide QOS.
491
c803536e
SS
492* Sign the driver & create an MSI for installing the different OpenvSwitch
493components on windows.