Portforwarding with VirtualBox with NAT networking

VirtualBox with NAT networking works by sending data from your virtual machine to the VirtualBox NAT engine witch in turn sends data to the internet through the hosts network connection. Your virtual machine will get an ip witch won’t be on the same subnet as your host machine, so you can’t reach it without setting up port forwarding.

For example, to set up SSH with a linux guest OS, we need to open Cmd and navigate to the VirtualBox directory. Here we need to run this command. Replace VM name with the name of your virtual machine.
VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"
VBoxManage is the executable file running the command, modifyvm is a parameter passed to VBoxManage to tell it what to do. –natpf1 explains witch network interface on the guest machine we will be connecting on, guestssh is just the name of the rule.

This would probably look something like this:

After you’ve run this command, you can effectively connect to localhost on port 22 with an ssh client.

The same procedure would be used to e.g. set up a webserver. You would probably use port 80 for this, and it should look something like:
VBoxManage modifyvm "VM name" --natpf1 "guestweb,tcp,,80,,80"

Virtualbox with Atheros AR9285 as network adapter

Today I once again desided to try a few Linux distributions, mostly to use as a testing server.

The VirtualBox setup screen
I landed on VirtualBox as ny virtualization solution, and got down to it. Installation went great, and I got everything running. I set up the network solution as a bridged connection with the wireless network card on the host as the connection point with my hom erouter.

Now, everything works jolly for a variable amount of minutes, and the wireless card in Windows7 starts searching for my SSID. If I’m lucky it connects again, and everything works for a few minutes, then the same procedure again. And if I’m not lucky, I end up with a “spinning” connection, constantly connected but not connected.

I can’t really wrap my head around what’s causing this, cause in my mind the wireless should have stopped working imidiately, and not after a couple of minutes?

Now, this is when I’m using it as a bridged connection. So I tried to switch it over to NAT… And now it worked for 30 minutes without a single hickup… The conclution is, I guess, that in the end I myself is the only one to blame. NAT was the default option, and I just had to go and change it…

But still, it doesn’t work with a bridged connection. That’s something that’s still a grudge in my book!