How to port forward to Virtual machine?

Caporegime
Joined
25 Jul 2005
Posts
28,851
Location
Canada
I have a couple of ports that need port forwarding to my virtualbox for them to work properly, can anyone tell me how to do this? I've looked online but am still confused.

I've found http://sk.c-wd.net/wp/2008/08/17/virtualbox-port-forwarding-with-windows-host/ that I think explains it however I'm a little confused.

Firstly the main machine runs Vista and is attached to the router (port 200 is forwarded to it and works), now I want to forward the same port to the VM (XP in this case) for a program to run properly on it.

Now following that I open cmd in vista and type

cd C:\"Program Files"\Sun\"xVM VirtualBox"\ (which is the location of the folder right) Then type in

VBoxManage.exe setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage.exe setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage.exe setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

all of that (changing the custom bits)? The name of the VM is I guess just "XP" in this case (name of the folder?)

Now the main confusion is the host port and the guest port. I assume the host port is the port Vista is attached to the router (and the router open for) and the guest port the port the program needs (? Again say port 200) Can I run the same port straight through (eg have router, host, guest and program all port 200) and if so will this affect the program on the host PC?

Sorry, long and convoluted post but i'm a bit confused.:p
 
I've tried that but haven't been successful. I got the IP address of the virtual OS using ipconfig on the host (Vista)

Ethernet Virtual adaptor IPv4 Address 192.168.56.1

and then sticking that ip and the port I want into the router. However the port isn't open, this is without the same port being forwarded to the host (Vista).
 
Yep, did that and it sorted it instantly :o

I got confused by VB's own network... Ports are now forwarding freely, thanks guys. :D
 
Bumpidy bump...

Gah! For some reason my Virtualbox install decided to play up yesterday, even going back to snapshots didn't work. Anyway everything was saved so I started a new one and reinstalled XP on it. All fine until I try and port forward again...

capturetf.png


Now can someone tell me why the VirtualBox host only network has no network access? The internet works on it, I just can't port forward to it... I've bridged the connection to the main Marvell Yukon connection but the connection isn't visible to my router. Am I missing something obvious?

Thanks
 
Back
Top Bottom