OpenVSwitch: Difference between revisions
m (→Installing OVS) |
|||
Line 42: | Line 42: | ||
=== Helper scripts === | === Helper scripts === | ||
ovs-ifup-lan | |||
<pre> | |||
#!/bin/sh | |||
switch="lan" | |||
/sbin/ifconfig $1 0.0.0.0 up | |||
ovs-vsctl add-port ${switch} $1 | |||
logger "qemu: $1 added to ${switch} at startup of VM" | |||
</pre> | |||
ovs-ifdown-lan | |||
<pre> | |||
#!/bin/sh | |||
switch="lan" | |||
/sbin/ifconfig $1 0.0.0.0 down | |||
ovs-vsctl del-port ${switch} $1 | |||
logger "qemu: $1 removed from ${switch} at shutdown of VM" | |||
</pre> | |||
== OVS and LXC == | == OVS and LXC == |
Revision as of 11:56, 17 April 2015
This document describes how to configure an OpenVSwitch in Alpine Linux.
Installing OVS
apk add openvswitch rc-update add ovs-modules rc-update add ovsdb-server rc-update add ovs-vswitchd rc-service ovs-modules start rc-service ovsdb-server start rc-service ovs-vswitchd start
Using ovs-vsctl
Open VSwithes are manually managed with the ovs-vsctl command.
To manually create a switch named "lan":
ovs-vsctl add-br lan
To add interface eth0 to the switch "lan":
ovs-vsctl add-port lan eth0
Note that you need to set the link status to up on the added interfaces.
ip link set dev eth0 up
Configuration file
configured in /etc/network/interfaces
auto eth0 lan iface eth0 inet manual up ifconfig eth0 0.0.0.0 up down ifconfig eth0 down iface lan inet dhcp
OVS and qemu
Helper scripts
ovs-ifup-lan
#!/bin/sh switch="lan" /sbin/ifconfig $1 0.0.0.0 up ovs-vsctl add-port ${switch} $1 logger "qemu: $1 added to ${switch} at startup of VM"
ovs-ifdown-lan
#!/bin/sh switch="lan" /sbin/ifconfig $1 0.0.0.0 down ovs-vsctl del-port ${switch} $1 logger "qemu: $1 removed from ${switch} at shutdown of VM"
OVS and LXC
Helper scripts
Caveats
Beware to have OVS package files available with no hassle at next reboot! this ca be a problem when running from ram with no cache...