I'm running an Open VSwitch on a VirtualBox VM, i want to connect 2 VMs that are running on VirtualBox into OpenVswitch. i did these things:
1)first i made an VM running ubuntu (lubuntu), and installed ovs using the following command
sudo apt-get install openvswitch-switch
2)after that i defined 2 adapter on vm and determine them as Internal Network cause vms want to connect to these machine internally from virtual box
but how can i connect 2 virtualbox's VMs that are running on separate subnets (10.1.1.1 and 10.1.2.1) using this OVS?
the diagram is as follow:
http://www.gliffy.com/go/publish/image/10986491/L.png
I don't think you need to use OVS in this case, though you can achieve this by providing gateway ip.

Say suppose you have create internal network with subnet 192.170.10.0/24 as internal1 and other internal2 with subnet 192.170.20.0/24
Configuration on VM1:
auto eth0
iface eth0 inet static
address 192.170.10.10
network 192.170.10.0
netmask 255.255.255.0
broadcast 192.170.10.255
gateway 192.170.10.20
Configuration on VM2:
auto eth0
iface eth0 inet static
address 192.170.20.10
network 192.170.20.0
netmask 255.255.255.0
broadcast 192.170.20.255
gateway 192.170.20.20
Configuration on OVS:
auto eth0
iface eth0 inet static
address 192.170.10.20
network 192.170.10.0
netmask 255.255.255.0
broadcast 192.170.10.255
gateway 192.170.10.20
auto eth1
iface eth1 inet static
address 192.170.20.20
network 192.170.20.0
netmask 255.255.255.0
broadcast 192.170.20.255
gateway 192.170.20.20
Using above configuration you can ping between VMs on different subnet
However if you still want to use OVS, here is way to configure.
Configuration on VM1:
auto eth0
iface eth0 inet static
address 192.170.10.10
network 192.170.10.0
netmask 255.255.255.0
broadcast 192.170.10.255
Configuration on VM2:
auto eth0
iface eth0 inet static
address 192.170.20.10
network 192.170.20.0
netmask 255.255.255.0
broadcast 192.170.20.255
Configuration on OVS:
Set interface to load to manual in /etc/network/interfaces
auto eth0
iface eth0 inet manual
auto eth1
iface eth1 inet manual
Create Two bridges
sudo ovs-vsctl add-br vm1-br
sudo ovs-vsctl add-br vm2-br
Add respective ports.
sudo ovs-vsctl add-port vm1-br eth0
sudo ovs-vsctl add-port vm2-br eth1
Bridge the bridges using patch interface
sudo ovs-vsctl add-port vm1-br patch1
sudo ovs-vsctl set interface patch1 type=patch
sudo ovs-vsctl set interface patch1 options:peer=patch2
sudo ovs-vsctl add-port vm1-br patch2
sudo ovs-vsctl set interface patch2 type=patch
sudo ovs-vsctl set interface patch2 options:peer=patch1
Bring up the bridges
sudo ifconfig vm1-br up
sudo ifconfig vm-br up
Set the IP Address
sudo ifconfig vm1-br 192.170.10.20/24
sudo ifconfig vm2-br 192.170.20.20/24
Now you can ping between VMs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With