How To Install Openvswitch On Ubuntu
How to install and configure KVM and Open vSwitch on Ubuntu or Debian
Last updated on Baronial xxx, 2022 by Dan Nanni
In today's multi-tenant data centers, the concept of virtualization is being extended from hypervisor-driven server virtualization to network virtualization. In this environs, software-based virtual switches are beingness installed on servers forth with hypervisor, bridging traffic amid dissimilar virtual machines (VMs).
In this tutorial, I am going to demonstrate how to install and configure KVM and Open vSwitch (OVS) on Ubuntu or Debian. KVM and Open up vSwitch (OVS) are, respectively, the nearly pop open-source hypervisor and virtual switch used in today's data centers. Compared to unproblematic bridged networking which is limited to MAC-based Layer-two forwarding, OVS allows 1 to define highly customized forwarding and filtering policies for VMs.
Install Open up vSwitch on Ubuntu or Debian
While OVS comes as a packet on Ubuntu or Debian, here I am going to build it from the source, which volition take the latest features and bug fixes.
First, install dependencies for building OVS.
$ sudo apt-go install build-essential libssl-dev linux-headers-$(uname -r)
Build OVS from the source as follows. The steps beneath will build OVS user-infinite tools as well as its kernel module.
$ wget http://openvswitch.org/releases/openvswitch-1.9.3.tar.gz $ tar xvfvz openvswitch-1.ix.3.tar.gz $ cd openvswitch-1.9.3 $ ./configure --with-linux=/lib/modules/`uname -r`/build $ make
Go ahead and install OVS user-space components nether /usr/local/share/
$ sudo make install
The next step is to test the OVS kernel module (before installing it). For that, load the kernel module in the kernel start.
$ sudo insmod ./datapath/linux/openvswitch.ko
Verify that the OVS kernel module is loaded successfully.
$ lsmod | grep openvswitch
openvswitch 97934 0
Once you verify that openvswitch.ko
is successfully loaded in the kernel, go ahead and install the kernel module as follows.
$ sudo make modules_install
Configure and Start Open vSwitch
Create a skeleton OVS configuration database.
$ sudo mkdir /etc/openvswitch $ sudo ovsdb-tool create /etc/openvswitch/conf.db ./vswitchd/vswitch.ovsschema
Start OVS database server.
$ sudo ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock - remote=db:Open_vSwitch,manager_options --pidfile --detach
Initialize OVS configuration database.
$ sudo ovs-vsctl --no-wait init
Finally, start OVS daemon.
$ sudo ovs-vswitchd --pidfile --disassemble
Install KVM on Ubuntu or Debian
Install KVM and necessary user-infinite tools with apt-get
command.
$ sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
Add a not-root regular user (due east.grand., alice
) to libvirtd
group, and then that the user can launch VMs without root privilege.
$ sudo adduser alice libvirtd
Log out and log dorsum in equally the user to make the group membership change effective.
Run the following command. If you should see an empty list of VMs, that means KVM is set upward successfully.
$ virsh list
Id Name State ----------------------------------------------------
Configure Open vSwitch for KVM
Now information technology is fourth dimension to create OVS bridge startup scripts, so that OVS tin exist automatically configured when a VM is started or stopped.
Install dependencies (user-mode Linux utilities), which will be used to handle Linux bridging modes.
$ sudo apt-go install uml-utilities
Create span startup scripts as follows.
$ sudo half dozen /etc/openvswitch/ovs-ifup
#!/bin/sh switch='br0' /sbin/ifconfig $1 0.0.0.0 upward ovs-vsctl add together-port ${switch} $1
$ sudo half dozen /etc/openvswitch/ovs-ifdown
#!/bin/sh switch='br0' /sbin/ifconfig $1 0.0.0.0 downwards ovs-vsctl del-port ${switch} $one
$ sudo chmod +x /etc/openvswitch/ovs-if*
Then, create a default span br0
, and add together a physical network interface via which VMs volition communicate with external networks. In this tutorial, I presume such a network interface is eth5
.
$ sudo ovs-vsctl add together-br br0 $ sudo ovs-vsctl add-port br0 eth5
Launch a VM with KVM
At present y'all are ready to launch a guest VM.
I assume that you already prepared a guest VM image (due east.g., ubuntu-client.img
). Utilize the following control to launch a invitee VM.
$ sudo kvm -thou 1024 -net nic,macaddr=11:eleven:eleven:EE:EE:EE -internet tap,script=/etc/openvswitch/ovs-ifup,downscript=/etc/openvswitch/ovs-ifdown -vnc :one -drive file=/dwelling/dev/images/ubuntu-client.img,boot=on
This volition create and launch a guest VM whose virtual interface is automatically added to OVS bridge br0
upon launch.
You can verify the OVS condition by using ovs-vsctl
control equally follows.
This is the remote desktop session for the launched VM.
Source: https://www.xmodulo.com/install-configure-kvm-open-vswitch-ubuntu-debian.html
Posted by: downinghousle.blogspot.com
0 Response to "How To Install Openvswitch On Ubuntu"
Post a Comment