Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 Jul 14 '11 at 2:40

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.

share|improve this answer
Doesn't work. As I said, this machine is directly connected to the internet, and clients connect from it. – Albert Jul 13 '11 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 ? – Iain Jul 14 '11 at 5:57

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.
share|improve this answer
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 Jul 14 '11 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 Jul 14 '11 at 15:23

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

share|improve this answer

Your Answer


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.