Page 1 of 2

Port Forwarding Problems

Posted: 30. Oct 2008, 03:36
by simple112
Hey Guys,

I apologize if this has been asked and answered (I searched, but was unable to find a similar issue).

I've got virtualbox installed on windows XP and I've got a ubuntu VM set up, with Apache and ssh-d running.

I wanted to be able to access my Apache and SSH from other machines, so I set up port forwarding. I was successful with SSH but I've been stumped in getting Apache to work.

Code: Select all

C:\Program Files\Sun\xVM VirtualBox>VBoxManage.exe getextradata ubuntu enumerate

VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Key: GUI/LastCloseAction, Value: save
Key: GUI/LastWindowPostion, Value: 153,81,800,642
Key: GUI/Fullscreen, Value: off
Key: GUI/Seamless, Value: off
Key: GUI/AutoresizeGuest, Value: off
Key: GUI/SaveMountedAtRuntime, Value: yes
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort, Value: 22
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort, Value: 2222
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort, Value: 8080
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort, Value: 80
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol, Value: TCP
That looks right to me as far as I can tell (comparing to other examples around the web) - can anyone point to what I'm doing wrong there?

Checking taskmgr VirtualBox.exe is pid 1188.

checking netstat I see:

Code: Select all

C:\Program Files\Sun\xVM VirtualBox>netstat -o -a | grep 1188
  TCP    wellosimon:2222        wellosimon:0           LISTENING       118
  UDP    wellosimon:4958        *:*                                    118
So it looks like the ssh is working fine (which it is), but no dice on Apache.

Any ideas?

thanks

-Simon

Posted: 30. Oct 2008, 06:20
by TerryE
Welcome to our forum. You might want to take this opportunity to browse the Forum Posting Guide. This contains some useful tips on how to search for VBox knowledge and how to frame Qs.

We need to know more about how Apache is failing before we can give you an answer. Have you tried the basic "It works!" screen? What do the logs say? have you done the configs? Remember that you need to use site relative addressing in all of your references, and that any absolute ones will need to refer to host:8080 because these are turned around by the browser that is talking to the host:8080.

Posted: 30. Oct 2008, 17:37
by simple112
Hmm perhaps I wasn't clear - apache is not failing at all, the problem is port forwarding (per my subject).

Apache works fine on the guest VM in ubuntu on port 80. 8080 forwarding from the host OS (XP) to Linux is the problem.

thanks

-Simon

Posted: 30. Oct 2008, 19:15
by simple112
and reading this a little more - the problem is that the requests are not even getting to apache (ie checking the log files).

And:

Code: Select all

C:\Documents and Settings\Simon>telnet localhost 8080
Connecting To localhost...Could not open connection to the host, on port 8080: Connect failed
vs:

Code: Select all

simon-desktop:/home/simon% telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /
<html><body><h1>It works!</h1></body></html>
Connection closed by foreign host
First is the host OS (win xp), second guest OS (ubuntu).

thanks

-simon

Posted: 30. Oct 2008, 20:08
by TerryE
Is your host firewall allowing outbound connections to 8080?

Posted: 30. Oct 2008, 23:53
by simple112
pretty sure i don't have a firewall on the XP host - it doesn't come with one by default, right?

Posted: 31. Oct 2008, 00:29
by Sasquatch
simple112 wrote:pretty sure i don't have a firewall on the XP host - it doesn't come with one by default, right?
Actually, it does. Since SP2, there is an annoying firewall running by default. Anyway, it's a long shot, but you could try to enter the SetExtraData lines for Apache in the same order as SSH, so first protocol, then Guest Port, then Host Port. That's the only difference I see that might be the issue.

Posted: 3. Nov 2008, 22:26
by simple112
thanks, I checked the windows XP security center and it shows no firewall.

I re-jiggered the order:
C:\Program Files\Sun\xVM VirtualBox>VBoxManage.exe getextradata ubuntu enumerate

VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Key: GUI/LastCloseAction, Value: save
Key: GUI/LastWindowPostion, Value: 153,81,800,642
Key: GUI/Fullscreen, Value: off
Key: GUI/Seamless, Value: off
Key: GUI/AutoresizeGuest, Value: off
Key: GUI/SaveMountedAtRuntime, Value: yes
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort, Value: 22
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort, Value: 2222
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort, Value: 80
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort, Value: 8080

But unfortunately still no dice.

C:\Program Files\Sun\xVM VirtualBox>telnet localhost 8080
Connecting To localhost...Could not open connection to the host, on port 8080: Connect failed

Ah well. If anyone has any other ideas please let me know. Can you only have 1 port forwarding, perhaps?

thanks

-simon

Posted: 4. Nov 2008, 00:07
by Sasquatch
No, you can have as many ports forwarded as you want, as long as the Host still has ways to communicate to the outside world.

Ditto

Posted: 12. Dec 2008, 09:17
by brainclots
I've had the same problem described above, although neither ssh nor apache are forwarding ports. :cry:

Key: vboxinternal/Devices/pcnet/0/LUN#0/config/guestapache/GuestPort, Value: 80
Key: vboxinternal/Devices/pcnet/0/LUN#0/config/guestapache/HostPort, Value: 8080
Key: vboxinternal/Devices/pcnet/0/LUN#0/config/guestapache/Protocol, Value: TCP
Key: vboxinternal/Devices/pcnet/0/LUN#0/config/guestssh/Protocol, Value: TCP
Key: vboxinternal/Devices/pcnet/0/LUN#0/config/guestssh/HostPort, Value: 2222
Key: vboxinternal/Devices/pcnet/0/LUN#0/config/guestssh/GuestPort, Value: 22


According to all docs I've read, there should be nothing else to do, but I've re-started everything and checked the syntax character by character, but the host isn't accepting packets to the HostPort(s) as the docs say they should.

C:\Program Files\Sun\xVM VirtualBox>telnet localhost 8080
Connecting To localhost...Could not open connection to the host, on port 8080: Connect failed

C:\Program Files\Sun\xVM VirtualBox>telnet localhost 2222
Connecting To localhost...Could not open connection to the host, on port 2222: Connect failed

Posted: 12. Dec 2008, 15:08
by TerryE
Are your port redirections listed in your VBox.log CFGM section? If so then they should be working fine. If so its either a firewall issue or a listener issue on the guest. Does telnet localhost 80 work on the guest?

Details

Posted: 13. Dec 2008, 02:35
by brainclots
Yes, I can reach apache in the guest, but still havent gotten ports to forward from host.

The Vbox.log does NOT contain info about the port forwarding, but the vboxmanage enumerate output for that machine does show them, as posted above. Any ideas?

Posted: 13. Dec 2008, 03:05
by TerryE
Only windows is case insensitive, this match is case sensitive. config should read Config and vboxinternal should read VBoxInternal. The CFGM is looking for VBoxInternal keys and doesn't find them in the enumeration.

Wunderbar!

Posted: 13. Dec 2008, 03:40
by brainclots
Thank you TerryE! It was indeed the case sensitivity issue. Thanks for pointing that out, all is well!

Posted: 13. Dec 2008, 03:53
by TerryE
Don't worry, I missed it until you said the VBoxManage enumerate listed it off but the CFGM enumeration missed it. Maybe this is one that I should put in as a change request because most Windows users will fall down this pot hole!