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 | | {{{ |
| 15 | The 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 | {{{ |
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 | {{{ |
| 77 | Binaries 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 | {{{ |
| 82 | openvswitch-datapath-module-2.6.38-8-server_1.2.2.10448_amd64.deb |
| 83 | openvswitch-common_1.2.2.10448_amd64.deb |
| 84 | openvswitch-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 | {{{ |
| 89 | root@external3:~# ovs-vsctl show |
| 90 | d03e1847-34f4-4129-8821-63fff3403553 |
| 91 | ovs_version: "1.2.2.10448" |
| 92 | }}} |
| 93 | lsmod should also show the running openvswitch_mod. |
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 | {{{ |
| 114 | cd datapath/linux/ |
| 115 | insmod 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 | {{{ |
| 120 | mkdir -p /usr/local/etc/openvswitch |
| 121 | ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema |
| 122 | }}} |
| 123 | 1. Start ovs-db: |
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 | {{{ |
| 131 | utilities/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 | {{{ |
| 136 | vswitchd/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`. |
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 == |
| 159 | For 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 |
| 162 | auto br0 |
| 163 | iface 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 |
| 170 | auto br1 |
| 171 | iface br1 inet dhcp |
| 172 | }}} |
| 173 | |
| 174 | == 2.3 OVS with KVM == |
| 175 | OVS 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 == |