Nat – virtualbox on linux nat configuration

debian-wheezynat;virtualbox

I am trying to set up Network Address Translation on Virtualbox. The host is Debian wheezy and so is the virtualized server.

On virtual server side, no configuration has been made;

On physical server, internet access is through eth0:

    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

On virtualbox GUI, I have configured my virtual server network to: Adapter 1, Enable Network Adapter, Attached to NAT, cable connected.

on virtual server, no way to ping the gateway (eth0:1), and reciprocally.

This works by setting Bridged Adapter instead of NAT, but is it the normal way to set up NAT in Virtualbox?

Thanks for your help

Best Answer

VirtualBox handles NAT networking internally -- you don't need to configure any iptables rules. Remove your iptables configuration, and then test that the VM has outgoing connectivity. In order to create incoming connections to the VM you'll need to setup port forwarding.

Related Topic