Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Open vSwitch to create a switched network between virtualBox guest machines, and i want that the host OS (Ubuntu 12.04) join this network and to configure it as the gateway of this virtual network:

First, i created a vswitch and i added ports to tap devices (that virtual machines use them as bridged interfaces):

ovs-vsctl add-br sw0
ovs-vsctl add-port sw0 tap0

After that, i set statically the ip of Lubuntu 12.04 virtual machine :

ifconfig eth0 up
route add -net gw

In the host os side, i also set the ip address :

ifconfig sw0 up

At this time, i can ping from Lubunut to Ubunutu. I want now, in the host machine to use IP masquerade to forward traffic from network to my physical interace (connected to Internet) :

sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o eth1 -s -j MASQUERADE

So from Lubuntu (the virtual machine), i can ping the Ubuntu eth1 interface, but i cannot reach the real network (e.g: the gateway on real LAN), i have tried :

dig @
dig @

Network Topology

   Internet (real gw) ------ Host OS -------- vswitch -------- VBox Guest 1
    ip masquerade
                                                 ------------ VBox Guest 2
share|improve this question
Please add any progress if you had. I have the same problem. – Masood_mj Oct 9 '14 at 15:48

The answer is not really mine, but... Try following Open vSwitch on VirtualBox

There was also a brief text file from some Fedora people on similar subject: libvirt and OpenVSwitch in a form of text file... wasn't able to locate it though.

as per comment, here's short summary:

(1) Create vnet0 interface and br0 bridge:

ovs-vsctl add-br br0
ip tuntap add mode tap vnet0
ip link set vnet0 up
ovs-vsctl add-port br0 vnet0
ip link # (View the created interface)

(2) spin up VM that uses vnet0 interface (as a bridged adapter)

(3) connect bridge br0 to real network:

ovs-vsctl add-br br0 
ovs-vsctl add-port br0 eth0 
ovs-vsctl add-port br0 vnet0 
ifconfig eth0  0 && ifconfig br0 192.168.1.(X) netmask
route add default gw br0
route del default gw eth0
share|improve this answer
Since you are linking to an external article which may change, it is recommendable to summarize the solution in your answer and reference the article instead. – Esa Jokinen Apr 6 '15 at 6:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.