Showing posts with label virtualization. Show all posts
Showing posts with label virtualization. Show all posts

Friday, January 6, 2012

Openvswitch with Virtualbox

This tutorial assume that you already configured openvswitch on virtualbox host machine.

Create the virtual switch on the host machine:
ovs-vsctl add-br lan0
Now we have a virtual switch called lan0 :)

Next we create tap devices on the host machine so we can bind them to the guests laters.
for tap in `seq 0 15`; do
        ip tuntap add mode tap lan0p$tap
done;
# check if the interfaces are there
ip tuntap list

Bring the tap interfaces up:
for tap in `seq 0 15`; do 
        ip link set lan0p$tap up
done;

# check if the interface are up
ip link

Now we use ovs-vsctl to "bind" the tap devices to "lan0" switch
for tap in `seq 0 15`; do
        ovs-vsctl add-port lan0 lan0p$tap
done;

# see that the tap devices are mapped to ports in lan0
ovs-vsctl list-ports lan0

Now we have 16 ports switch called lan0 with 16 tap interfaces binded to lan0 virtual switch.

Next thing is to connect virtualbox guests to it:

I assume you are using the GUI for this so under the network setting select in "Attached to" "Bridge Adapter" and in "Name" select "lan0p1" for port number 1 in the switch.

Repeat this action for each guest you want to connect to the switch.

Now your virtual machines has a virtual network ;)

Enjoy !

Golan