Installing openvswitch and initial configuration
From Notes_Wiki
<yambe:breadcrumb>Openvswitch|Openvswitch</yambe:breadcrumb>
Installing openvswitch and initial configuration
Installation
Steps work perfectly for kernel 2.6.32-358.0.1.el6.x86_64 with openvswitch source version 1.9.0.
Steps are:
- yum install gcc make python-devel openssl-devel kernel-devel kernel-debug-devel
- Download latest release from http://openvswitch.org/releases/
- Extract, configure, make and make install
- Check for bridge module using 'lsmod | grep bridge'. If present remove using 'rmmod bridge'.
- Install openvswitch module using 'modprobe openvswitch'
Initialization
Steps are:
- Login as root
- Go to compiled openvswitch source folder
- Use
insmod datapath/linux/openvswitch.ko touch /usr/local/etc/ovs-vswitchd.conf mkdir -p /usr/local/etc/openvswitch ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
Starting openvswitch
Steps for starting openvswitch are:
ovsdb-server /usr/local/etc/openvswitch/conf.db \ --remote=punix:/usr/local/var/run/openvswitch/db.sock \ --remote=db:Open_vSwitch,manager_options \ --private-key=db:SSL,private_key \ --certificate=db:SSL,certificate \ --bootstrap-ca-cert=db:SSL,ca_cert --pidfile --detach --log-file ovs-vsctl --no-wait init ovs-vswitchd --pidfile --detach ovs-vsctl show
Basic initial configuration
After starting openvswitch one can create bridge and add base machines physical interfaces to it using:
- Use following commands to create brdige br0, remove IP configuration from eth0 and add eth0 to br0. Further, assign IP address to br0 and set default gateway to use br0 interface.
- ovs-vsctl add-br br0
- ifconfig eth0 0
- ovs-vsctl add-port br0 eth0
- ifconfig br0 <IP> netmask <Mask>
- route add default gw <Gateway> br0
- Optionally, add more specific routes
- route add -net <network> netmask <netmask> gw <gateway>
- Check connectivity by pinging various machines on various routes.
Base machine startup configuration
In order for base machine to boot with proper running openvswitch following commands, with appropriate replacement for IP addresses and netmasks, should run on startup:
/sbin/rmmod bridge /sbin/modprobe openvswitch /usr/local/sbin/ovsdb-server /usr/local/etc/openvswitch/conf.db \ --remote=punix:/usr/local/var/run/openvswitch/db.sock \ --remote=db:Open_vSwitch,manager_options \ --private-key=db:SSL,private_key \ --certificate=db:SSL,certificate \ --bootstrap-ca-cert=db:SSL,ca_cert --pidfile --detach --log-file /usr/local/bin/ovs-vsctl --no-wait init /usr/local/sbin/ovs-vswitchd --pidfile --detach /usr/local/bin/ovs-vsctl show /sbin/ifconfig br0 10.4.15.4 netmask 255.255.252.0 /sbin/route add default gw 10.4.12.155 /sbin/route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.4.12.1 /sbin/route add -net 172.16.0.0 netmask 255.240.0.0 gw 10.4.12.1 /sbin/route add -net 192.168.0.0 netmask 255.255.0.0 gw 10.4.12.1 /sbin/ifconfig eth0 0 echo "nameserver 10.4.12.157" > /etc/resolv.conf
References
Steps learned from
- http://networkstatic.net/open-vswitch-red-hat-installation/
- http://n40lab.wordpress.com/2012/09/19/installing-openvswitch-in-centos-6-3/
- http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.RHEL;hb=HEAD
- http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL;hb=HEAD
- http://openvswitch.org/support/
<yambe:breadcrumb>Openvswitch|Openvswitch</yambe:breadcrumb>