1 Installation Instructions for OpenFlow Reference Release
3 This document describes how to build, install, and execute the
4 reference implementation of OpenFlow. Please send any comments to:
6 <info@openflowswitch.org>
11 To compile the userspace programs in the OpenFlow reference
12 distribution, you will need the following software:
14 - A make program, e.g. GNU make
15 (http://www.gnu.org/software/make/). BSD make should also work.
17 - The GNU C compiler (http://gcc.gnu.org/). We generally test
18 with version 4.1 or 4.2.
20 - libssl, from OpenSSL (http://www.openssl.org/), is optional but
21 recommended. libssl is required to establish confidentiality
22 and authenticity in the connections among OpenFlow switches and
25 If you are working from a Git tree or snapshot (instead of from a
26 distribution tarball), or if you modify the OpenFlow build system, you
27 will also need the following software:
29 - Autoconf version 2.59 or later (http://www.gnu.org/software/autoconf).
31 - Automake version 1.10 or later (http://www.gnu.org/software/automake).
33 - pkg-config (http://pkg-config.freedesktop.org/wiki/). We test
36 The optional Linux module has additional prerequisites, described
37 later in the section "Building and Testing the Linux Kernel-Based
40 Building Userspace Programs
41 ---------------------------
43 The OpenFlow distribution includes two implementations of the switch:
44 one entirely in userspace, for portability and ease of installation,
45 and another with a Linux kernel module component that is more
46 difficult to install but should also yield better performance. These
47 instructions describe how to build the userspace components of the
48 OpenFlow distribution. Refer to "Building and Testing the Linux
49 Kernel-Based Switch", below, for additional instructions on how to
50 build the optional Linux kernel module.
52 1. In the top source directory, configure the package by running the
53 configure script. You can usually invoke configure without any
58 To use a specific C compiler for compiling OpenFlow user programs,
59 also specify it on the configure command line, like so:
61 % ./configure CC=gcc-4.2
63 The configure script accepts a number of other options and honors
64 additional environment variables. For a full list, invoke
65 configure with the --help option.
67 2. Run make in the top source directory:
71 The following binaries will be built:
73 - Switch executable: switch/switch. This executable is built
74 only if the configure script detects a supported interface to
75 network devices. Refer to README for a list of OSes whose
76 network device interfaces are supported.
78 - Secure channel executable: secchan/secchan.
80 - Controller executable: controller/controller.
82 - Datapath administration utility: utilities/dpctl.
84 - Runtime logging configuration utility: utilities/vlogconf.
86 3. (Optional) Run "make install" to install the executables and
87 manpages into the running system, by default under /usr/local.
89 Testing Userspace Programs
90 --------------------------
92 0. The commands below must run as root, so log in as root, or use a
93 program such as "su" to become root temporarily.
95 1. Start the OpenFlow controller running in the background, by running
96 the "controller" program with a command like the following:
100 This command causes the controller to bind to port 975 (the
101 default) awaiting connections from OpenFlow switches. See
102 controller(8) for details.
104 2. On the same machine, use the "switch" program to start an OpenFlow
105 switch, specifying network devices to use as switch ports on the -i
106 option as a comma-separated list, like so:
108 # switch tcp:127.0.0.1 -i eth1,eth2
110 The network devices that you specify should not have configured IP
113 3. The controller causes each switch that connects to it to act like a
114 learning Ethernet switch. Thus, devices plugged into the specified
115 network ports should now be able to send packets to each other, as
116 if they were plugged into ports on a conventional Ethernet switch.
118 Troubleshooting: if the commands above do not work, try using the -v
119 or --verbose option on the controller or switch commands, which will
120 cause a large amount of debug output from each program.
122 Remote switches: These instructions assume that the controller and the
123 switch are running on the same machine. This is an easy configuration
124 for testing, but a more conventional setup would run a controller on
125 one machine and one or more switches on different machines. To do so,
126 simply specify the IP address of the controller as the first argument
127 to the switch program (in place of 127.0.0.1). (Note: The current
128 version of the switch and controller requires that they be connected
129 through a "control network" that is physically separate from the one
130 that they are controlling. Future releases will support in-band
131 control communication.)
133 Secure operation over SSL
134 -------------------------
136 The instructions above set up OpenFlow for operation over a plaintext
137 TCP connection. Production use of OpenFlow should use SSL[*] to
138 ensure confidentiality and authenticity of traffic among switches and
141 To use SSL with OpenFlow, you must set up a public-key infrastructure
142 (PKI) including a pair of certificate authorities (CAs), one for
143 controllers and one for switches. If you have an established PKI,
144 OpenFlow can use it directly. Otherwise, refer to "Establishing a
145 Public Key Infrastructure" below.
147 To configure the controller to listen for SSL connections on port 976
148 (the default), invoke it as follows:
150 # controller -v pssl: --private-key=PRIVKEY --certificate=CERT \
153 where PRIVKEY is a file containing the controller's private key, CERT
154 is a file containing the controller CA's certificate for the
155 controller's public key, and CACERT is a file containing the root
156 certificate for the switch CA. If, for example, your PKI was created
157 with the instructions below, then the invocation would look like:
159 # controller -v pssl: --private-key=ctl-privkey.pem \
160 --certificate=ctl-cert.pem --ca-cert=pki/switchca/cacert.pem
162 To configure a switch to connect to a controller running on port 976
163 (the default) on host 192.168.1.2 over SSL, invoke it as follows:
165 # switch -v ssl:192.168.1.2 -i INTERFACES --private-key=PRIVKEY \
166 --certificate=CERT --ca-cert=CACERT
168 where INTERFACES is the command-separated list of network device
169 interfaces, PRIVKEY is a file containing the switch's private key,
170 CERT is a file containing the switch CA's certificate for the switch's
171 public key, and CACERT is a file containing the root certificate for
172 the controller CA. If, for example, your PKI was created with the
173 instructions below, then the invocation would look like:
175 # secchan -v -i INTERFACES ssl:192.168.1.2 --private-key=sc-privkey.pem \
176 --certificate=sc-cert.pem --ca-cert=pki/controllerca/cacert.pem
178 [*] To be specific, OpenFlow uses TLS version 1.0 or later (TLSv1), as
179 specified by RFC 2246, which is very similar to SSL version 3.0.
180 TLSv1 was released in January 1999, so all current software and
181 hardware should implement it.
183 Establishing a Public Key Infrastructure
184 ----------------------------------------
186 If you do not have a PKI, the ofp-pki script included with OpenFlow
187 can help. To create an initial PKI structure, invoke it as:
189 which will create and populate a new directory named "pki" under the
192 The pki directory contains two important subdirectories. The
193 controllerca subdirectory contains controller certificate authority
194 related files, including the following:
196 - cacert.pem: Root certificate for the controller certificate
197 authority. This file must be provided to the switch or secchan
198 program with the --ca-cert option to enable it to authenticate
201 - private/cakey.pem: Private signing key for the controller
202 certificate authority. This file must be kept secret. There is
203 no need for switches or controllers to have a copy of it.
205 The switchca subdirectory contains switch certificate authority
206 related files, analogous to those in the controllerca subdirectory:
208 - cacert.pem: Root certificate for the switch certificate
209 authority. This file must be provided to the controller program
210 with the --ca-cert option to enable it to authenticate valid
213 - private/cakey.pem: Private signing key for the switch
214 certificate authority. This file must be kept secret. There is
215 no need for switches or controllers to have a copy of it.
217 After you create the initial structure, you can create keys and
218 certificates for switches and controllers with ofp-pki. To create a
219 controller private key and certificate in files named ctl-privkey.pem
220 and ctl-cert.pem, for example, you could run:
221 % ofp-pki req+sign ctl controller
222 ctl-privkey.pem and ctl-cert.pem would need to be copied to the
223 controller for its use at runtime (they could then be deleted from
224 their original locations). The --private-key and --certificate
225 options of controller, respectively, would point to these files.
227 Analogously, to create a switch private key and certificate in files
228 named sc-privkey.pem and sc-cert.pem, for example, you could run:
229 % ofp-pki req+sign sc switch
230 sc-privkey.pem and sc-cert.pem would need to be copied to the switch
231 for its use at runtime (they could then be deleted from their original
232 locations). The --private-key and --certificate options,
233 respectively, of switch and secchan would point to these files.
235 Building and Testing the Linux Kernel-Based Switch
236 --------------------------------------------------
238 The OpenFlow distribution also includes a Linux kernel module that can
239 be used to achieve higher switching performance at a cost in
240 portability and ease of installation. Compiling the kernel module has
241 the following prerequisites in addition to those listed in the
242 "Prerequisites" section above:
244 - A supported Linux kernel version. Please refer to README for a
245 list of supported versions.
247 The OpenFlow datapath requires bridging support (CONFIG_BRIDGE)
248 to be built as a kernel module. (This is common in kernels
249 provided by Linux distributions.) The bridge module must not be
250 loaded or in use. If the bridge module is running (check with
251 "lsmod | grep bridge"), you must remove it ("rmmod bridge")
252 before starting the datapath.
254 - The correct version of GCC for the kernel that you are building
257 * To build a kernel module for a Linux 2.6 kernel, you need
258 the same version of GCC that was used to build that kernel
259 (usually version 4.0 or later).
261 * To build a kernel module for a Linux 2.4 kernel, you need an
262 earlier version of GCC, typically GCC 2.95, 3.3, or 3.4.
264 - A kernel build directory corresponding to the Linux kernel image
265 the module is to run on. Under Debian and Ubuntu, for example,
266 each linux-image package containing a kernel binary has a
267 corresponding linux-headers package with the required build
270 To build the kernel module, follow the build process described under
271 "Building Userspace Programs" above, but pass the location of the
272 kernel build directory as an additional argument to the configure
273 script, as described under step 1 in that section. Specify the
274 location on --with-l26 for Linux 2.6, --with-l24 for Linux 2.4. For
275 example, to build for a running instance of Linux 2.6:
277 % ./configure --with-l26=/lib/modules/`uname -r`/build
279 To build for a running instance of Linux 2.4:
281 % ./configure --with-l24=/lib/modules/`uname -r`/build
283 In addition to the binaries listed under step 2 in "Building Userspace
284 Programs" above, "make" will build the following kernel modules:
286 datapath/linux-2.6/openflow_mod.ko (if --with-l26 was specified)
287 datapath/linux-2.4/openflow_mod.o (if --with-l24 was specified)
289 Once you have built the kernel modules, activating them requires only
290 running "insmod", e.g.:
293 % insmod datapath/linux-2.6/openflow_mod.ko
296 % insmod datapath/linux-2.4/compat24_mod.o
297 % insmod datapath/linux-2.4/openflow_mod.o
299 The insmod program must be run as root. You may need to specify a
300 full path to insmod, which is usually in the /sbin directory. To
301 verify that the modules have been loaded, run "lsmod" (also in /sbin)
302 and check that openflow_mod appears in the result.
304 Testing the Kernel-Based Implementation
305 ---------------------------------------
307 The OpenFlow kernel module must be loaded, as described in the
308 previous section, before it may be tested.
310 0. The commands below must run as root, so log in as root, or use a
311 program such as "su" to become root temporarily.
313 1. Create a datapath instance. The command below creates a datapath with
314 ID 0 (see dpctl(8) for more detailed usage information).
318 (In principle, openflow_mod supports multiple datapaths within the
319 same host, but this is rarely useful in practice.)
321 2. Use dpctl to attach the datapath to physical interfaces on the
322 machine. Say, for example, you want to create a trivial 2-port
323 switch using interfaces eth1 and eth2, you would issue the following
329 You can verify that the interfaces were successfully added by asking
330 dpctl to print the current status of datapath 0:
334 3. (Optional) You can manually add flows to the datapath to test using
335 dpctl add-flows and view them using dpctl dump-flows. See dpctl(8)
338 4. The simplest way to test the datapath is to run the provided sample
339 controller on the host machine to manage the datapath directly using
344 Once the controller is running, the datapath should operate like a
345 learning Ethernet switch. You may monitor the flows in the datapath
346 flow table using "dpctl dump-flows" command.
348 The preceding instructions assume that the controller and the switch
349 are running on the same machine. This is an easy configuration for
350 testing, but a more conventional setup would run a controller on one
351 machine and one or more switches on different machines. Use the
352 following instructions to set up remote switches:
354 1. Start the datapath and attach it to two or more physical ports as
355 described in the previous section.
357 Note: The current version of the switch and controller requires
358 that they be connected through a "control network" that is
359 physically separate from the one that they are controlling. Future
360 releases will support in-band control communication.
362 2. Run the controller in passive tcp mode on the host which will act as
363 the controller. In the example below, the controller will bind to
364 port 975 (the default) awaiting connections from secure channels.
366 # controller -v ptcp:
368 (See controller(8) for more details)
370 Make sure the machine hosting the controller is reachable by the switch.
372 3. Run secchan on the datapath host to start the secure channel
373 connecting the datapath to a remote controller. (See secchan(8)
374 for usage details). The channel should be configured to connect to
375 the controller's IP address on the port configured in step 2.
377 If the controller is running on host 192.168.1.2 port 975 (the
378 default port) and the datapath ID is 0, the secchan invocation
381 # secchan -v nl:0 tcp:192.168.1.2
386 Please report problems to:
387 info@openflowswitch.org