Skip to content

Instantly share code, notes, and snippets.

@natyoliveira
Created March 7, 2013 14:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save natyoliveira/5108584 to your computer and use it in GitHub Desktop.
Save natyoliveira/5108584 to your computer and use it in GitHub Desktop.
Requirements
------------------
- The GNU C compiler. We generally test with version 4.1, 4.2, or
4.3.
- pkg-config. We test with version 0.22.
- libssl, from OpenSSL, is optional but recommended if you plan to
connect the Open vSwitch to an OpenFlow controller. libssl is
required to establish confidentiality and authenticity in the
connections from an Open vSwitch to an OpenFlow controller. If
libssl is installed, then Open vSwitch will automatically build
with support for it.
To compile the kernel module on Linux, you must also install a supported Linux kernel version.
Installation Requirements
-------------------------
The machine on which Open vSwitch is to be installed must have the
following software:
- libc compatible with the libc used for build.
- libssl compatible with the libssl used for build, if OpenSSL was
used for the build.
- On Linux, the same kernel version configured as part of the build.
Building and Installing
-----------------------
1. Download the most recent release of OVS http://openvswitch.org/download/
2. In the source directory, configure the package by running the
configure script. You can usually invoke configure without any
arguments:
% ./configure
To use a specific C compiler for compiling Open vSwitch user
programs, also specify it on the configure command line, like so:
% ./configure CC=gcc-4.2
Be aware if the gcc is the same version of the kernel. To check the gcc version installed:
% ls -l /user/bin/gcc*
To check the version instaled on kernel
% cat /proc/version
To build the Linux kernel module, so that you can run the
kernel-based switch, pass the location of the kernel build
directory on --with-linux. For example, to build for a running
instance of Linux:
% ./configure --with-linux=/lib/modules/`uname -r`/build
3. Run make in the top source directory:
% make
4. Run the testsuite below:
Open vSwitch includes a testsuite. Before you submit patches
upstream, we advise that you run the tests and ensure that they pass.
If you add new features to Open vSwitch, then adding tests for those
features will ensure your features don't break as developers modify
other areas of Open vSwitch.
To run all the unit tests in Open vSwitch, one at a time:
make check
This takes under 5 minutes on a modern desktop system.
To run all the unit tests in Open vSwitch, up to 8 in parallel:
make check TESTSUITEFLAGS=-j8
This takes under a minute on a modern 4-core desktop system.
To see a list of all the available tests, run:
make check TESTSUITEFLAGS=--list
To run only a subset of tests, e.g. test 123 and tests 477 through 484:
make check TESTSUITEFLAGS='123 477-484'
(Tests do not have inter-dependencies, so you may run any subset.)
To run tests matching a keyword, e.g. "ovsdb":
make check TESTSUITEFLAGS='-k ovsdb'
To see a complete list of test options:
make check TESTSUITEFLAGS=--help
5. Become root by running "su" or another program.
6. Run "make install" to install the executables and manpages into the
running system, by default under /usr/local.
7. If you built kernel modules, you may load them with "insmod", e.g.:
% insmod datapath/linux/openvswitch.ko
You may need to specify a full path to insmod, e.g. /sbin/insmod.
To verify that the modules have been loaded, run "/sbin/lsmod" and
check that openvswitch is listed.
If the "insmod" operation fails, look at the last few kernel log
messages (e.g. with "dmesg | tail"):
- The message "openvswitch: exports duplicate symbol
br_should_route_hook (owned by bridge)" means that the bridge
module is loaded. Run "/sbin/rmmod bridge" to remove it.
If "/sbin/rmmod bridge" fails with "ERROR: Module bridge does
not exist in /proc/modules", then the bridge is compiled into
the kernel, rather than as a module. Open vSwitch does not
support this configuration (see "Build Requirements", above).
- The message "openvswitch: exports duplicate symbol
dp_ioctl_hook (owned by ofdatapath)" means that the ofdatapath
module from the OpenFlow reference implementation is loaded.
Run "/sbin/rmmod ofdatapath" to remove it. (You might have to
delete any existing datapaths beforehand, using the "dpctl"
program included with the OpenFlow reference implementation.
"ovs-dpctl" will not work.)
- Otherwise, the most likely problem is that Open vSwitch was
built for a kernel different from the one into which you are
trying to load it. Run "modinfo" on openvswitch.ko and on
a module built for the running kernel, e.g.:
% /sbin/modinfo openvswitch.ko
% /sbin/modinfo /lib/modules/`uname -r`/kernel/net/bridge/bridge.ko
Compare the "vermagic" lines output by the two commands. If
they differ, then Open vSwitch was built for the wrong kernel.
- If you decide to report a bug or ask a question related to
module loading, please include the output from the "dmesg" and
"modinfo" commands mentioned above.
Once you verify that the kernel modules load properly, you should
install them:
% make modules_install
If you face the following error:
make: *** No rule to make target `modules_install'. Stop.
Do the following steps:
root@sdn-OptiPlex-790:/home/sdn/Desktop/openvswitch-1.7.3# find -name "*.ko" -print
./datapath/linux/brcompat.ko
./datapath/linux/openvswitch.ko
root@sdn-OptiPlex-790:/home/sdn/Desktop/openvswitch-1.7.3/datapath/linux# ls /lib/modules/`uname -r`
build modules.builtin.bin modules.inputmap modules.softdep
initrd modules.ccwmap modules.isapnpmap modules.symbols
kernel modules.dep modules.ofmap modules.symbols.bin
modules.alias modules.dep.bin modules.order modules.usbmap
modules.alias.bin modules.devname modules.pcimap updates
modules.builtin modules.ieee1394map modules.seriomap
root@sdn-OptiPlex-790:/home/sdn/Desktop/openvswitch-1.7.3/datapath/linux# cp *.ko /lib/modules/`uname -r`/kernel/net
8. Initialize the configuration database using ovsdb-tool, e.g.:
% mkdir -p /usr/local/etc/openvswitch
% ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment