6

There is a plethora of questions about VirtualBox port forwarding problems but none with my specific details. Details of setup:

I have a Windows 7 Professional 64bit install living in VirtualBox 4.1.2, hosted within Mac OS X 10.6.8. I’ve got several webservers running on localhost on different ports within the Windows install. I cannot for the life of me get port forwarding to work so I can access those webservers from Mac OS X.

My settings look like this; yes I have a NAT adapter:

enter image description here

And in my VirtualBox configuration file the relavent portion looks like this:

<NAT>
  <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
  <Alias logging="false" proxy-only="false" use-same-ports="false"/>
  <Forwarding name="RLPWeb" proto="1" hostport="7084" guestip="127.0.0.1" guestport="7084"/>
  <Forwarding name="UtilWeb" proto="1" hostport="4040" guestip="127.0.0.1" guestport="4040"/>
  <Forwarding name="WCARLP" proto="1" hostport="8084" guestip="127.0.0.1" guestport="8084"/>
  <Forwarding name="WCAUtil" proto="1" hostport="4848" guestip="127.0.0.1" guestport="4848"/>
</NAT>

I’ve turned off the Windows firewall to ensure it is not interfering, and I am not running a firewall on Mac OS X.

Anyway, when I attempt to go to for example http://127.0.0.1:4040/ on any of my Mac OS X browsers, it will eventually time out.

The log file for this VM shows that it is correctly reading the settings and implying it's doing the right thing here:

00:00:08.286 NAT: set redirect TCP host port 4848 => guest port 4848 @ 127.0.0.1
00:00:08.286 NAT: set redirect TCP host port 8084 => guest port 8084 @ 127.0.0.1
00:00:08.286 NAT: set redirect TCP host port 4040 => guest port 4040 @ 127.0.0.1
00:00:08.286 NAT: set redirect TCP host port 7084 => guest port 7084 @ 127.0.0.1
00:00:08.290 Changing the VM state from 'LOADING' to 'SUSPENDED'.
00:00:08.290 Changing the VM state from 'SUSPENDED' to 'RESUMING'.
00:00:08.290 Changing the VM state from 'RESUMING' to 'RUNNING'.
00:00:08.337 Display::handleDisplayResize(): uScreenId = 0, pvVRAM=000000012017d000 w=1834 h=929 bpp=32 cbLine=0x1CA8, flags=0x1
00:00:09.139 AIOMgr: Host limits number of active IO requests to 16. Expect a performance impact.
00:00:13.454 NAT: DHCP offered IP address 10.0.2.15

I’ve tried setting the Host IP to 127.0.0.1, and I’ve tried setting Guest IP blank and also 10.0.2.15. None of these seem to help.

What else can I look at to troubleshoot this issue?

2
  • I don't think you need to set the guest IP unless you have assigned a static IP to the guest so leaving it blank is probably right.
    – BJ292
    Mar 16, 2013 at 21:45
  • 1
    You should enter the actual IP of the guest machine - IIRC the NAT default is 10.0.2.5 - not 127.0.0.1.
    – ivanivan
    Dec 21, 2017 at 3:14

3 Answers 3

0

I have noticed problems with port forwards on macOS X VirtualBox host.

Using network adapter PCnet-Fast III (Am79C973) and Oracle Developer Day image as guest.

When ever I suspend the guest and resume it all port forwards are lost.

I am not certain if the problems are related to the network adapter or to the guest but I fail to see how the guest could be aware of the port forwards.

This is a long shot, but if you have anything in common with this case, try shutting down (complete power off of the guest) and starting up with the port forwards set. Immediately test if any of the port forwards work and only after positive results try suspending and resuming the guest.

3
  • I have tried exactly what you suggest, sadly there is no difference in behavior.
    – jlarson
    Feb 9, 2012 at 17:52
  • Have you tried adding 0.0.0.0 as the host ip in NAT settings?
    – PeteS
    Feb 10, 2012 at 10:45
  • Yes, I did try that.
    – jlarson
    Feb 10, 2012 at 14:56
0

Have you tried bridging the connection from the windows vm out to the Mac? Being under Network Address Translation NAT has proven to be a headache for me as well when inside a VM. Having a bridge provides the VM with an IP that the host can see. Given your port forwarding situation this shouldn't be an issue but I would try to forward ports from actual IPs rather than translated ones.

0

According to the VirtualBox official documentation, the preferred way to do this is with your network mode set to Host-Only or Bridged.

tl;dr: Use Bridged, not NAT.

src: https://www.virtualbox.org/manual/ch06.html

You must log in to answer this question.

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