Open vSwitch: Difference between revisions
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...") |
Brad House (talk | contribs) No edit summary |
||
Line 51: | Line 51: | ||
</nowiki> | </nowiki> | ||
You do not need to explicitly have definitions for physical interfaces such as eth0 in the configuration, they will be automatically brought up. | You do not need to explicitly have definitions for physical interfaces such as eth0 in the configuration, they will be automatically brought up. However, any virtual interfaces (OVSBonds or OVSIntPorts) should have their definitions prefixed with allow-$brname $iface, e.g. allow-vmbr0 bond0 | ||
'''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!!! | '''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 ==== | ||
Bonds are used to join multiple network interfaces together to act as single unit. | Bonds are used to join multiple network interfaces together to act as single unit. Bonds must refer to raw ethernet devices (e.g. eth0, eth1). | ||
When configuring a bond, it is recommended to use LACP (aka 802.3ad) for link aggregation. This requires switch support on the other end. A simple bond using eth0 and eth1 that will be part of the vmbr0 bridge might look like this. | |||
<nowiki> | |||
allow-vmbr0 bond0 | |||
iface ovsbond inet manual | |||
ovs_bridge vmbr0 | |||
ovs_type OVSBond | |||
ovs_bonds eth0 eth1 | |||
ovs_options bond_mode=balance-tcp lacp=active other_config:lacp-time=fast | |||
</nowiki> |
Revision as of 16:49, 13 October 2014
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. However, any virtual interfaces (OVSBonds or OVSIntPorts) should have their definitions prefixed with allow-$brname $iface, e.g. allow-vmbr0 bond0
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. Bonds must refer to raw ethernet devices (e.g. eth0, eth1).
When configuring a bond, it is recommended to use LACP (aka 802.3ad) for link aggregation. This requires switch support on the other end. A simple bond using eth0 and eth1 that will be part of the vmbr0 bridge might look like this.
allow-vmbr0 bond0 iface ovsbond inet manual ovs_bridge vmbr0 ovs_type OVSBond ovs_bonds eth0 eth1 ovs_options bond_mode=balance-tcp lacp=active other_config:lacp-time=fast