Open vSwitch on VirtualBox

Open vSwitch on VirtualBox

Open Vswitch Lab

Open vSwitch on VirtualBox

Here is a quick tutorial for installing Open vSwitch on VirtualBox. VirtualBox is an open source virtualization project from Oracle. It is supported on Windows, Mac, BSD and Linux to name a few. It has a nice GUI for VM management out of the box. Open vSwitch is an open source vSwitch from Martin Casado, Ben Pfaff and a whole crew of awesome. If you are here, OVS probably doesn’t require anymore explanation, learn it, love it.

Install VirtualBox

Install VirtualBox from the VirtualBox repository.

Install Open vSwitch from repo

Install Open vSwitch from Package. This is easiest for those not familiar with compiling from source or just need basic functionality rather than the latest features.

Open vSwitch Install from Source

Install dependencies and install from source on Ubuntu Linux.

Create Open vSwitch bridge and interfaces

To setup the virtual interfaces use Tuntap. Tuntap sets up a emulates an L2 interface. That interface will show up in the interface as a physical interface.

Open vSwitch VirtualBox

Spin up VirtualBox instances with Open vSwitch Interfaces

For testing Open vSwitch or any other hypervisor testing, I highly recommend this Linux image linux-0.2.img. It only takes a couple of MB of memory. It is perfect for nested hypervisor testing.

Open vSwitch VM

Connect the Open vSwitch bridge to the physical network

You can put the following into a text file and give it execute permissions with “chmod +x filename” and then run it “./filename”. If your network settings are right it should flip the IP to the bridge and not cut you off. Keyword “should” so have a way to get to the box if you cut yourself off. What is happening here is you are placing both the virtual interface “vnet0” and the physical Nic “eth0” into the same bridge “br0”. You can think of a bridge as a logical grouping of virtual and physical interface much like a locally significant VLAN without the 0x8100 Ethertype framing and tag.

Download your test image. If using the Linux-0.2.img it needs to be converted to vdi first using the VBoxManage utility included with the VirtualBox binary.

  • Create a new Virtualbox instance. Choose the linux-0.2.vdi (must duplicate the VDI or else all meta-data is the same and Vbox wont load the IMG). Do this as a regular user or else you will get permissions error.
  • Choose “use existing virtual HD”
  • Ignore “failed to get USB blah”.
  • If you get “dpif_linux|ERR|Generic Netlink family ‘ovs_datapath’ does not exist. The Open vSwitch kernel module is probably not loaded.” Make sure you are adding the Open vSwitch kernel module e.g insmod datapath/linux/openvswitch.ko.
  • Under interfaces set to “bridged interface” and choose the port on the appropriate bridge. E.g Bridge1-p2, br-head-p1 etc. Make sure it is a port and not a bridge.
  • You can go really low on memory, I tend to just use 32mb but you can go less.

Thanks for stopping by.

About the Author

Brent SalisburyI have over 15 years of experience wearing various hats from, network engineer, architect, devops and software engineer. I currently have the pleasure of working at the company that develops my favorite software I have ever used, Docker. My comments here are my personal thoughts and opinions. More at Brent's BioView all posts by Brent Salisbury →

1 year 8 months ago

Hi Brent,

Good write up and very accessible.
I have a question on how to connect two guest VMs to a single OVS instance and allow both to ping ?
At any one time I can only manage to allow one VM to ping out, am I missing something here ?

VM1 –> Tap1 —>
——-> |———————-|
——> | Ovsbr0 |
VM2–> Tap2—>| | [eth0] |——>

— i’ve blanked out eth0, ifconfig eth0 0, likewise ovsbr0 has no ip
— they are all on the same subnet which has public IP (VM1 & VM2 have public IP)

1 year 8 months ago


1 year 8 months ago

Hi Brent,

Thanks for the tutorial. I’ve been trying to set up some host VMs for my network and I came across a problem with the linux-0.2.vdi
When I try to generate a new VM with this image, I get the following error:

VFS:Cannot open root device “300” or unknown-block(3,0)
Please append a correct “root=” boot option
Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(3,0) Time: tsc clocksource has been installed.

Have you ever come across something like this?
Thank you very much.
All the best,

1 year 9 months ago

Nice, article and I had tried it.
Do you have any idea for setup the VM (Xen Server) to use with external OVS such as Pica8, Cumulus for example.

I’m looking for any solution like a VMWare with Cisco Nexus 1000v


Anu M
1 year 11 months ago

Hi Brent!

Your articles are very interesting, I am hooked to your blogs most of the time:-)

I have a doubt regarding bringing up each of the Virtual Box instances. should they necessarily be in “use existing virtual HD” ? I have created the VBox instances using new HD spaces, and now I am having the issue of not being able to ping between each of the machines.

The structure of my network: I have one OVS switch connected to Controller in the host. I have an OVS switch in two of my virtual Box instances (each of them have Ubuntu spun on them). I am unable to ping from the host to either of the virtual machines.

Shashikant Nigam
2 years 18 hours ago

Hello Brent,
Nice informaton, I have a request that can you please give me information about installation of openvswitch-1.11.0 on suse 11 sp 2 running on virtual box.

Dmitri Ch.
2 years 1 month ago

Thanks for the useful post.
For OVS to work in a VM, do you need to allow promisc mode on the interface in VM’s settings (in VBox, Network->[Adapter]->Advanced->Promisc mode ) ?

2 years 1 month ago

Hallo Brent,
I have 5 VMs on the Virtual box, one Floodlight controller, 2 Openvswitches and 2 host.
the network is as follows:

the 2 switches connected together and connected to the controller and each switch is connected to one Host. the interfaces using for every VM is -internal interface- type. The openvswitches are connected together with the hosts and the controller. There is no problem in that. The problem is here that when I ping from one host to other, there is no pinging. So What is the problem ?

Thank you in advance for your support.