Port forwarding from guest to host

This is for discussing general topics about how to use VirtualBox.
Locked
Emile
Posts: 12
Joined: 8. Nov 2013, 23:33

Port forwarding from guest to host

Post by Emile »

Hello everyone,

I’m trying to forward standard port 80 from my guest OS (Windows XP) to port 80 on my host running Apache server (OSX 10.6) so that I can have seamless transition between domains and project settings.
I’ve read on NAT port forwarding and tried to use that technique but to no avail.

When I try to use standard IP address 10.0.2.2 it works as it should, but what I’m trying to emulate is 127.0.0.1 entered from guest to access 127.0.0.1 on host.

Is this possible? Is this something related to hosts file not having proper rules (I only have localhost rule in hosts file on guest machine)?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Port forwarding from guest to host

Post by mpack »

There's no VirtualBox feature which does this AFAIK.

If you use NAT then the guest is using the networking capabilities of the host OS - i.e. the host will send and receive everything as if the VM was a host app using normal networking APIs. The guest naturally can't filter what the host sees since the host sees it first.

There may be something else you can do, but it would be a standard networking solution (a software router, or switch or proxy - who knows), as between any two PCs, and not a specific VirtualBox solution.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Port forwarding from guest to host

Post by BillG »

I doubt that you will ever manage to do that, not because of anything to do with VirtualBox but simply because of the IP address. I doubt that it would work with physical machines.

127.0.0.x are loopback addresses. They signify to the networking software that the packet is already at its destination and should not be forwarded anywhere under any circumstances.
Bill
Emile
Posts: 12
Joined: 8. Nov 2013, 23:33

Re: Port forwarding from guest to host

Post by Emile »

Yeah, I thought as much. Thanks on elaboration!
Locked