Difference between revisions of "Installing openvswitch and initial configuration"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>Openvswitch|Openvswitch</yambe:breadcrumb> =Installing openvswitch and initial configuration= ==Installation== Steps work perfectly for kernel 2.6.32-358....")
 
m
 
Line 1: Line 1:
<yambe:breadcrumb>Openvswitch|Openvswitch</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Virtualization tools]] > [[Openvswitch]] > [[Installing openvswitch and initial configuration]]
=Installing openvswitch and initial configuration=




Line 104: Line 103:




<yambe:breadcrumb>Openvswitch|Openvswitch</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Virtualization tools]] > [[Openvswitch]] > [[Installing openvswitch and initial configuration]]

Latest revision as of 13:05, 24 August 2022

Home > CentOS > CentOS 6.x > Virtualization tools > Openvswitch > 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:

  1. yum install gcc make python-devel openssl-devel kernel-devel kernel-debug-devel
  2. Download latest release from http://openvswitch.org/releases/
  3. Extract, configure, make and make install
  4. Check for bridge module using 'lsmod | grep bridge'. If present remove using 'rmmod bridge'.
  5. Install openvswitch module using 'modprobe openvswitch'


Initialization

Steps are:

  1. Login as root
  2. Go to compiled openvswitch source folder
  3. 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:

  1. 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
  2. Optionally, add more specific routes
    route add -net <network> netmask <netmask> gw <gateway>
  3. 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



Home > CentOS > CentOS 6.x > Virtualization tools > Openvswitch > Installing openvswitch and initial configuration