0

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

aef
  • 1,745
  • 4
  • 25
  • 43
philippe
  • 2,303
  • 4
  • 32
  • 53
  • No, this is not the normal way. What's eth0:1? Why do you have VLANs configured? – Dima Chubarov May 29 '12 at 15:56
  • eth0 is the interface directly connected to the Internet and eth0:1 is the virtual interface created on debian to which I'am trying to connect my virtual machines. There is no vlans configured anywhere, I guess? Thanks for your answer – philippe May 29 '12 at 21:08

1 Answers1

1

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.

mgorven
  • 30,615
  • 7
  • 79
  • 122
  • Oki, many thanks for the links to the documentation you have provided. I have just thought I need to configure network on physical node and set up virtual servers with NAT option. – philippe May 29 '12 at 21:11