Page 1 of 1

port forwarding partial success

Posted: 25. Nov 2009, 04:39
by djk121
I followed the example in the user guide for forwarding 2222 on the host to 22 on a guest, and I can now ssh to the guest just fine. I'm not able to get other ports forwarding properly, though:

new-host-2:centos dan$ VBoxManage getextradata centos enumerate | grep guesthttp
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort, Value: 80
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort, Value: 8080

I have apache running in the guest on 80, and it's definitely running/listening - I can telnet to 80 from inside the guest, and I can verify that it's listening via netstat, lsof, etc. I've restarted the VM (i.e., all VirtualBox apps on the host) a couple of times, but that doesn't appear to change anything.

Oddly, the VirtualBox apps do appear to be listening on 8080 on the host:

new-host-2:centos dan$ lsof -P | grep Virtual | grep LISTEN | grep 8080
VirtualBo 73773 dan 39u IPv4 0x8a9a66c 0t0 TCP *:8080 (LISTEN)

But when I connect to them and try to push some data across, I get nothing back. tcpdump shows the data being consumed by the VirtualBox process, but nothing makes it through to the guest.

I've tried this with other ports and simple netcats on the guest/host, but I get the same results that I get with the apache setup described above.

The host is running VirtualBox 3.0.12, Mac OS X 10.5.8, and the guest is CentOS 5.4.

Any ideas what I'm doing wrong?

TIA,

Dan

Re: port forwarding partial success

Posted: 25. Nov 2009, 22:14
by Sasquatch
You connect to localhost from the Host, right? Just open http://localhost:8080 in your browser, should open the Guest.

Re: port forwarding partial success

Posted: 26. Nov 2009, 01:12
by MarkCranness
Does your guest have IP 10.0.2.15, or some other static IP assigned? (Your SSH experience says it must be the default 10.0.2.15). Is Apache in the guest listening on 10.0.2.15:80, or *:80, or some other IP?

If the answer is 'some other IP', then either change that IP to * or 10.0.2.15, or also use this (undocumented) port forward setting:
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestIP, Value: some.other.i.p

Re: port forwarding partial success

Posted: 27. Nov 2009, 18:13
by djk121
MarkCranness wrote:Does your guest have IP 10.0.2.15, or some other static IP assigned? (Your SSH experience says it must be the default 10.0.2.15). Is Apache in the guest listening on 10.0.2.15:80, or *:80, or some other IP?

If the answer is 'some other IP', then either change that IP to * or 10.0.2.15, or also use this (undocumented) port forward setting:
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestIP, Value: some.other.i.p
Sadly, I'm just an idiot. The default server install of CentOS 5.4 (and probably earlier versions) has iptables configured to drop most everything. Once I turned iptables off, everything worked fine.

Sorry for the noise, and thanks for the help.

Dan