VirtualBox Port Forwarding on Windows 7 not Working

Sparm picture Sparm · Apr 20, 2015 · Viewed 7.9k times · Source

VirtualBox Port Forwarding on Windows 7 not Working

Im trying to ssh onto my VirtualBox from my Windows 7 host via port forwarding, but VirtualBox wont open the port for listening. I can connect to it by turning on the VirtualBox GUI and navigating via that terminal, but I cannot connect via a standard ssh client from my host. I want to be able to ssh on port 2222 on my host to the guest.

Here's my setup:

Host: Window 7 SP1
Guest: Ubunto Ubuntu 12.04
VirutalBox: 4.3.26
Host Processor: Intel Core i7 920

The guest machine is configured as a NAT and port forwarding is enabled for 127.0.0.1 for host port 2222 to guest port 22.

The output from ifconfig on the guest:

eth0    inet addr:10.0.2.15 Bcast:10.0.2.255 Mask: 255.255.255.0

The output from ps -ef | grep sshd on the guest:

root    625 1   0   12:27   ?   00:00:00    /usr/sbin/sshd -D

The output from netstat -ant | grep 22 on the guest:

tcp     0   0   0.0.0.0:22  0.0.0.0:*
tcp6    0   0   :::22       :::*

But on the host, netstat -ant | grep 2222 doesnt show anything.

In the VBox.log however I have this:

00:00:03.413790 NAT: set redirect TCP host 127.0.0.1:2222 => guest 10.0.2.15:22
00:00:03.424301 supR3HardenedErrorV: supR3HardenedScreenImage/LdrLoadDll: rc=VERR_LDRVI_UNSUPPORTED_ARCH fImage=1 fProtect=0x0 fAccess=0x0 \Device\HarddiskVolume2\Windows\mfnspstd64.dll: WinVerifyTrust failed with hrc=Unknown Status 0x800B0101 on '\Device\HarddiskVolume2\Windows\mfnspstd64.dll'
00:00:03.424422 supR3HardenedErrorV: supR3HardenedMonitor_LdrLoadDll: rejecting 'C:\Windows\mfnspstd64.dll' (C:\Windows\mfnspstd64.dll): rcNt=0xc0000190
00:00:03.424476 NAT: failed to redirect TCP 127.0.0.1:2222 => 10.0.2.15:22

The last line looks like the suspect but there's no clue as to why it fails to redirect. I've tried all of the following from various other posts and forums but cant get it to listen on any port on the host:

  • Turned off the firewall
  • Changed the port
  • Enabled VT-X on BIOS
  • Disabled Hyper-V
  • Tried numerous different builds of VirtualBox

Any help would be much appreciated. Works fine on my Mac Book with OS-X.

Answer

Crowlex picture Crowlex · Apr 20, 2015

Did you set forwarding in machine settings ?

  1. To forward ports in VirtualBox, first open a virtual machine’s settings window by selecting the Settings option in the menu.

  2. Select the Network pane in the virtual machine’s configuration window, expand the Advanced section, and click the Port Forwarding button. Note that this button is only active if you’re using a NAT network type – you only need to forward ports if you’re using a NAT.

  3. Use VirtualBox’s Port Forwarding Rules window to forward ports. You don’t have to specify any IP addresses – those two fields are optional.

Also here: http://www.howtogeek.com/122641/how-to-forward-ports-to-a-virtual-machine-and-use-it-as-a-server/