Changes between Version 4 and Version 5 of Documentation/fSDN/aSwitchImage


Ignore:
Timestamp:
Jul 10, 2012, 6:39:10 PM (12 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/fSDN/aSwitchImage

    v4 v5  
    77----
    88= I Installation = #install
    9 OVS can be installed either from source or from binaries. 
    10 
    11 For installation from source, the steps followed here are based on the contents of INSTALL.Linux, included with the OVS tarball and also found [http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.Linux;hb=HEAD here](also attached at the end of this page for your convenience). It should be found under the OVS root directory.     
     9OVS can be installed either from source or from binaries. Section 1.2 covers how to build from source, and section 1.3 covers install from binaries.   
    1210
    1311== 1.1 Prerequisites ==
     
    1513
    1614== 1.2 Method 1: from source ==
    17 == 1.2.1 Fetch source and dependencies ==
    18 1. If your Ubuntu install is still fresh, run 'apt-get update'. If this fails, repeat after replacing all instances of 'apt:9999' with 'us.archive.ubuntu.com' in /etc/apt/sources.list .
    19 
    20 2. Install packages for Open Vswitch:
    21 {{{
     15The steps followed in this section are based on the contents of INSTALL.Linux, included with the OVS tarball and also found [http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.Linux;hb=HEAD here](also attached at the end of this page for your convenience). It should be found under the OVS root directory.     
     16
     17== 1.2.1 Getting the source and dependencies ==
     18 1. If your Ubuntu install is still fresh, run 'apt-get update'. If this fails, repeat after replacing all instances of 'apt:9999' with 'us.archive.ubuntu.com' in /etc/apt/sources.list .
     19 1. Install dependencies:
     20    {{{
    2221apt-get install pkg-config autoconf automake linux-libc-dev libtool
    23 }}}
    24 
    25 3. Fetch OVS tarball and untar. the latest source can be found at http://openvswitch.org/download/ .
    26 {{{
     22    }}}
     23 1. Fetch the OVS tarball and untar. the latest source can be found at http://openvswitch.org/download/ .
     24    {{{
    2725cd ~/
    2826wget http://openvswitch.org/releases/openvswitch-1.6.1.tar.gz
    2927tar -xf openvswitch-1.1.1.tar.gz
    30 }}}
    31 
    32 4. Build. On Debian (and its variants), Open vSwitch must be built as a kernel module. If everything is sound, installing OVS should be little more than following the steps in INSTALL.Linux.
    33 {{{
     28    }}}
     29 1. Build. On Debian (and its variants), Open vSwitch must be built as a kernel module. If everything is sound, installing OVS should be little more than following the steps in INSTALL.Linux.
     30    {{{
    3431cd ~/openvswitch-1.1.1
    3532./boot.sh
     
    3734make
    3835make install
    39 }}}
    40 
    41 5. instantiate the kernel module:
    42 {{{
     36    }}}
     37 1. instantiate the kernel module:
     38    {{{
    4339insmod datapath/linux-2.6/openvswitch_mod.ko
    44 }}}
     40    }}}
    4541
    4642=== 1.2.2 Some Sanity Checks. ===
    4743If things don't go well, here are some things worth checking:
    4844
    49 1. Check /usr/src/linux-headers-!`uname -r`/.config for the following kernel configs:
    50 
    51  * CONFIG_BRIDGE as module (=m)
    52  * NET_CLS_ACT, NET_CLS_U32, NET_SCH_INGRESS as modules or built-in (=m or =y, respectively) if policing
    53  * CONFIG_TUN if you need tunneling
    54 
    55 Fix them as necessary.
    56 
    57 2. The bridge module should not be loaded (e.g. should not show up when you do `lsmod | grep bridge`); remove it if it is loaded. If it seems to be loaded at boot time, there may be an entry for it somewhere in /etc/modules.
    58 
    59 3. /lib/modules/$(uname -r)/build should be a link to the Linux kernel header directory:
    60 {{{
     45 * Check /usr/src/linux-headers-!`uname -r`/.config for the following kernel configs:
     46    * CONFIG_BRIDGE as module (=m)
     47    * NET_CLS_ACT, NET_CLS_U32, NET_SCH_INGRESS as modules or built-in (=m or =y, respectively) if policing
     48    * CONFIG_TUN if you need tunneling
     49    Fix them as necessary.
     50
     51 * The bridge module should not be loaded (e.g. should not show up when you do `lsmod | grep bridge`); remove it if it is loaded. If it seems to be loaded at boot time, there may be an entry for it somewhere in /etc/modules.
     52
     53 * /lib/modules/$(uname -r)/build should be a link to the Linux kernel header directory:
     54    {{{
    6155root@node1-1:~# ls -ald /lib/modules/$(uname -r)/build
    6256lrwxrwxrwx 1 root root 40 2011-07-26 13:41 /lib/modules/2.6.35-30-generic/build -> /usr/src/linux-headers-2.6.35-30-generic
    63 }}}
    64 This directory should contain (mostly) unbroken links. If not, repeat step 3 of the prerequisites with another kernel version, e.g. by upgrading the kernel as follows:
    65 
    66 {{{
     57    }}}
     58 
     59 This directory should contain (mostly) unbroken links. If not, repeat step 3 of the prerequisites with another kernel version, e.g. by upgrading the kernel as follows:
     60   {{{
    6761apt-get install linux-headers-2.6.35-30-generic linux-image-2.6.35-30-generic
    6862reboot
    6963apt-get install linux-source-2.6.35
    70 }}}
    71 When linux-image is installed, grub is updated so that the newest kernel is loaded automatically upon next reboot. Re-installing linux-source after reboot should install the proper version for the new kernel.
    72  
    73 4. Modules may not get loaded properly; look for Open vSwitch modules with `lsmod`:
    74 {{{
     64   }}}
     65
     66 When linux-image is installed, grub is updated so that the newest kernel is loaded automatically upon next reboot. Re-installing linux-source after reboot should install the proper version for the new kernel.
     67
     68 * Modules may not be loaded properly; look for the OVS module with `lsmod`:
     69    {{{
    7570root@node1-1:~/openvswitch-1.1.1# lsmod | grep open
    7671openvswitch_mod        68183  1
    77 }}}
    78 
    79 5. In general, `dmesg` can be used to check for various anomalies when things e.g. insmod fail silently. 
     72    }}}
     73
     74 * In general, `dmesg` can be used to check for various anomalies when things e.g. insmod fail silently. 
    8075
    8176== 1.3 Method 2: from binaries ==
     77Binaries are easier to set up, but lag in OVS version and support a narrower range of architectures and kernel versions.
     78 1. Install the openvswitch packages. Do not use the Ubuntu repositories since the install the incorrect versions of the package; Download the
     79    packages that match your kernel version from [http://openvswitch.org/releases/binaries/1.2.2.10448/natty_amd64/ here] [[BR]]
     80    For an x86_64 system, the following are needed (The package '''openvswitch-brcompat_1.2.2.10448_amd64.deb''' should be added if bridge compatibility is needed):
     81    {{{
     82openvswitch-datapath-module-2.6.38-8-server_1.2.2.10448_amd64.deb
     83openvswitch-common_1.2.2.10448_amd64.deb
     84openvswitch-switch_1.2.2.10448_amd64.deb
     85    }}}
     86    Install them in that order with "dpkg -i". It will recommend a restart.
     87 1. The module should be loaded automatically upon installation and system reboot. You should be able to query the module:
     88    {{{
     89root@external3:~# ovs-vsctl show
     90d03e1847-34f4-4129-8821-63fff3403553
     91ovs_version: "1.2.2.10448"
     92    }}}
     93    lsmod should also show the running openvswitch_mod.
    8294
    8395== 1.4 Section I References ==
     
    99111== 2.1 Initialization ==
    100112 1. Load openVswitch kernel module
    101 {{{
    102  cd datapath/linux/
    103  insmod openvswitch_mod.ko
    104 }}}
    105 Note, OVS and Linux bridging may not be used at the same time. This step will fail if the bridge module (bridge.ko) is loaded. You may need to reboot the node in order to unload bridge.ko.[[BR]]   
    106 If this is the first time OVS is being run, make am openvswitch directory in /usr/local/etc/ and run `ovsdb-tool` to create the database file:
    107 {{{
    108  mkdir -p /usr/local/etc/openvswitch
    109  ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
    110 }}}
    111  2. Start ovs-db:
     113    {{{
     114cd datapath/linux/
     115insmod openvswitch_mod.ko
     116    }}}
     117 Note, OVS and Linux bridging may not be used at the same time. This step will fail if the bridge module (bridge.ko) is loaded. You may need to reboot the node in order to unload bridge.ko.[[BR]]   
     118 If this is the first time OVS is being run, make am openvswitch directory in /usr/local/etc/ and run `ovsdb-tool` to create the database file:
     119  {{{
     120mkdir -p /usr/local/etc/openvswitch
     121ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
     122  }}}
     123 1. Start ovs-db:
    112124{{{
    113125 ovsdb/ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
     
    115127        --pidfile --detach
    116128}}}
    117  3. Initialize the database:
    118 {{{
    119  utilities/ovs-vsctl --no-wait init
    120 }}}
    121 the `--no-wait` allows the database to be initialized before ovs-vswitchd is invoked.
    122  4. Start ovs-vswitchd:
    123 {{{
    124  vswitchd/ovs-vswitchd unix:/usr/local/var/run/openvswitch/db.sock --pidfile --detach
    125 }}}
    126 The 'unix:...db.sock' specifies that the process attach to the socket opened by `ovsdb`. 
     129 1. Initialize the database:
     130    {{{
     131utilities/ovs-vsctl --no-wait init
     132    }}}
     133 the `--no-wait` allows the database to be initialized before ovs-vswitchd is invoked.
     134 1. Start ovs-vswitchd:
     135    {{{
     136vswitchd/ovs-vswitchd unix:/usr/local/var/run/openvswitch/db.sock --pidfile --detach
     137    }}}
     138 The 'unix:...db.sock' specifies that the process attach to the socket opened by `ovsdb`. 
    127139
    128140== 2.2 Configuring OVS ==
     
    145157}}}
    146158=== 2.2.2 Network configuration ===
    147 The bridge interface can be configured like any other *nic interface. Its configurations may be stored in /etc/network/interfaces for persistence.
    148 
    149 == 2.3 OVS with !OpenFlow ==
     159For an OVS switch to behave as a plain vanilla switch, both bridge interface and associated network interfaces must be up and configured with IP layer information. The bridge interface can be configured with tools such as `ifconfig` (or even DHCP) like any other *nic interface. Its configurations may even be stored in /etc/network/interfaces for persistence:
     160 {{{
     161#static bridge interface configs
     162auto br0
     163iface br0 inet static
     164        address 192.168.1.10
     165        netmask 255.255.255.0
     166        network 192.168.1.0
     167        broadcast 192.168.1.255
     168        gateway 192.168.1.1
     169#bridges can use dynamic configuration as well
     170auto br1
     171iface br1 inet dhcp
     172 }}}
     173
     174== 2.3 OVS with KVM ==
     175OVS can be used with KVM. The instructions for setting this up can be found [http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.KVM;hb=HEAD here], or in the root directory of the source as INSTALL.KVM. A use case is documented in this separate [http://orbit-lab.org/wiki/Internal/VMHostSetup wiki entry].     
     176
     177== 2.4 OVS with !OpenFlow ==
    150178OVS switches may be run as !OpenFlow switches. The following steps describe how to run OVS in !OpenFlow mode.
    151179