Open vSwitch

From Proxmox VE
Revision as of 18:44, 13 October 2014 by Brad House (talk | contribs) (Created page with "== Installation == * Install the Open vSwitch packages <nowiki> apt-get install openvswitch-switch </nowiki> === Startup Workaround === * There appears to be a bug in the cu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installation

  • Install the Open vSwitch packages
apt-get install openvswitch-switch

Startup Workaround

  • There appears to be a bug in the current openvswitch package. It expects /run/network/ifstate to exist, but that file is created by the network scripts and openvswitch starts before network. So we need to ensure that file exists prior to starting openvswitch. That can be done by cut and pasting the below into your terminal which will append this check to /etc/default/openvswitch-switch:
cat >> /etc/default/openvswitch-switch << 'EOF'
RUN_DIR="/run/network"
IFSTATE="$RUN_DIR/ifstate"

check_ifstate() {
    if [ ! -d "$RUN_DIR" ] ; then
        if ! mkdir -p "$RUN_DIR" ; then
            log_failure_msg "can't create $RUN_DIR"
            exit 1
        fi
    fi
    if [ ! -r "$IFSTATE" ] ; then
        if ! :> "$IFSTATE" ; then
            log_failure_msg "can't initialise $IFSTATE"
            exit 1
        fi
    fi
}

check_ifstate
EOF

Configuration

Based off information found in http://git.openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob;f=debian/openvswitch-switch.README.Debian;hb=HEAD

Overview

Open vSwitch and Linux bonding and bridging or vlans MUST NOT be mixed. For instance, do not attempt to add a vlan to an OVS Bond, or add a Linux Bond to an OVSBridge or vice-versa. Open vSwitch is specifically tailored to function within virtualized environments, there is no reason to use the native linux functionality.

Bridges

A bridge is another term for a Switch. It directs traffic to the appropriate interface based on mac address. Open vSwitch bridges should be bridged to raw ethernet devices (or OVS Bonded interfaces). These switches can carry multiple vlans, and be broken out into 'internal' ports if the host needs interfaces available on the network.

When configuring a bridge, in /etc/network/interfaces, prefix the bridge interface definition with allow-ovs $iface. For instance, a simple bridge containing a single interface would look like:

auto vmbr0
allow-ovs vmbr0
iface vmbr0 inet manual
  ovs_type OVSBridge
  ovs_ports eth0
  mtu 9000

You do not need to explicitly have definitions for physical interfaces such as eth0 in the configuration, they will be automatically brought up.

NOTE: All interfaces must be listed under ovs_ports that are part of the bridge even if you have a port definition (e.g. OVSIntPort) that cross-references the bridge!!!

Bonds

Bonds are used to join multiple network interfaces together to act as single unit.