Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 192.168.1.3/24 up
route add -net 0.0.0.0/0 gw 192.168.1.1

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

ifconfig sw0 192.168.1.1/24 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 192.168.1.0/24 to my physical interace (connected to Internet) :

sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.1.0/24 -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 :

nslookup google.com
dig @8.8.8.8 yahoo.com
dig @192.168.30.1 google.com

Network Topology

   Internet (real gw) ------ Host OS -------- vswitch -------- VBox Guest 1
           192.168.30.1   ip masquerade    192.168.1.0/24
                                                |
                                                 ------------ VBox Guest 2
share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.