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 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

share|improve this question
    
No, this is not the normal way. What's eth0:1? Why do you have VLANs configured? –  Dmitri 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 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

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.