Page 1 of 1
can't make NAT work
Posted: 15. Jan 2014, 09:15
by bhomass
I have a virtual box running on OS X host. The guest OS is Ubuntu. I want to set up the VM to use NAT. The VM setting part was easy. adapter 1 is set to NAT.
in the host, I entered VBoxManage modifyvm "myvm-name" --natpf1 "guesthttp,tcp,,80,,80"
the command went thru fine, no errors. Then I start the VM and try typing localhost into a browser on the host. no response on it. I verified that apache is running on the guest. so, the port forwarding is failing.
If all works as I wanted, I would like to have all port 80 request on the host to be forwarded to the VM.
Any one can tell what I am doing wrong?
Re: can't make NAT work
Posted: 15. Jan 2014, 09:34
by socratis
bhomass wrote:Any one can tell what I am doing wrong?
Yes, the user's manual,
Chapter 6.3.3, NAT limitations:
Chapter 6.3.3 wrote:Forwarding host ports < 1024 impossible:
On Unix-based hosts (e.g. Linux, Solaris,
Mac OS X) it is
not possible to bind to ports
below 1024 from applications that are not run by root. As a result, if you try to configure such a port forwarding, the VM will refuse to start.
BTW, you posted in neither "Mac OS X Hosts" nor "Linux Guests" forum, but on "Linux Hosts"

Re: can't make NAT work
Posted: 16. Jan 2014, 02:28
by bhomass
sorry about wrong subforum. I am first time poster.
so, are you saying I need to run my apache as root, then forwarding of port 80 would work?
or does it mean the browser requesting localhost:80 (on Mac) needs to be launched by root? normally, the req will be coming from outside the host, so I don't understand this limitation. just who needs to be root?
Re: can't make NAT work
Posted: 16. Jan 2014, 02:38
by Perryg
Never run anything as root. What you can do is use host-only and access the guest from the host or if you simply want to use NAT then use a port that is higher than 1024 Forward something like 8080 and then configure the server to handle requests on 8080.
Re: can't make NAT work
Posted: 16. Jan 2014, 08:45
by bhomass
reconfigured apache on guest to port 8011
on the host, VBoxManage modifyvm "myvm-name" --natpf1 "guesthttp,tcp,,80,,8011"
still no response when I enter
http://localhost on host's browser.
Re: can't make NAT work
Posted: 16. Jan 2014, 11:14
by mpack
Moved to OS X hosts.
Re: can't make NAT work
Posted: 17. Jan 2014, 08:04
by bhomass
I got it now. the 8011 needs to be on the host side, not the guest side.
This really puts me in a bind. The whole idea is that the host will server up a web site from the guest when it receives an external web request. Of course, that request will be in port 80. It would be useless to change that input port request to 8011.
The only option then would be making the request come from root. But how would I do that? the request comes from an external source. It is not an app that is running on the host.