I'm using Virtualbox 4.0.10 on a Debian Squeeze box. I have a Windows 7 VM that I use to host a game server. After setting up NAT and port redirection, clients can connect to the VM, but the game server shows it's getting connections from the NAT gateway IP ( I need that the game server gets connections from the actual public internet client IP's, so I can set up an IP whitelist in the game server.

This Debian machine is directly connected to the internet. What can I do to make this work? Guess it's not VirtualBox problem and can solve that with a virtual network interface or so, but no idea how to do it. Guess it's not Virtualbox probmem and I can make it work with a bridge interface or so.

  • When you say that you setup NAT - did you do that on the Debian host or as part of the virtual machine configuration using the VirtualBox commands/GUI? A better diagram or description of your network setup would be very helpful.
    – Goyuix
    Commented Jul 14, 2011 at 2:40

3 Answers 3


Set the network adapter into bridged mode.

in VirtualBox go to the Windows 7 settings, select network then you should see that the Adaptor is set to NAT. Change this to Bridged adapter.

  • Doesn't work. As I said, this machine is directly connected to the internet, and clients connect from it.
    – Albert
    Commented Jul 13, 2011 at 22:32
  • Is your 'server' really connected directly to the internet or is there a device (modem/router/xyzzy) that does that ? Did you give the W7 machine a public routable IP address ?
    – user9517
    Commented Jul 14, 2011 at 5:57

This is possible without bridge mode! For some strange reason, the default NAT mode in VirtualBox rewrites original source.

What you want is to switch NAT to transparent mode with

VBoxManage modifyvm <your-vm name> --nataliasmode1 proxyonly

More info here


There may not be a way to change that behavior in VirtualBox.

Any one of the following could resolve your issue:

  1. Easiest and best approach: Just set up your whitelist using iptables on the Debian box instead of managing your whitelist on the VM.
  2. Use a different hypervisor that has more options to configure virtual networking and NAT behavior.
  3. Put the Debian box behind a physical firewall or router, configure your NAT rules there, and bridge the VM to your physical network adapter.
  4. Get a second public IP address from your ISP. Assign that IP address to the virtual machine and bridge it to your physical network adapter.
  • Using a different hypervisor wouldn't necessarily matter - the problem is with the choice of network not the choice of virtualization. The real answer is to use bridged mode if possible.
    – Goyuix
    Commented Jul 14, 2011 at 2:38
  • I suspect that he can't use bridged mode on the host because he does not have multiple public IP addresses. But, that's a solvable problem, so I've added it to the list.
    – Skyhawk
    Commented Jul 14, 2011 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .