Port Forwarding Problems

Discussions related to using VirtualBox on Windows hosts.
simple112
Posts: 5
Joined: 30. Oct 2008, 03:23

Port Forwarding Problems

Post 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
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post 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.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
simple112
Posts: 5
Joined: 30. Oct 2008, 03:23

Post 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
simple112
Posts: 5
Joined: 30. Oct 2008, 03:23

Post 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
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

Is your host firewall allowing outbound connections to 8080?
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
simple112
Posts: 5
Joined: 30. Oct 2008, 03:23

Post by simple112 »

pretty sure i don't have a firewall on the XP host - it doesn't come with one by default, right?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
simple112
Posts: 5
Joined: 30. Oct 2008, 03:23

Post 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
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
brainclots
Posts: 9
Joined: 12. Dec 2008, 08:57
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Server 2008, Win 7, Fedora, Win 8

Ditto

Post 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
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post 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?
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
brainclots
Posts: 9
Joined: 12. Dec 2008, 08:57
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Server 2008, Win 7, Fedora, Win 8

Details

Post 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?
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post 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.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
brainclots
Posts: 9
Joined: 12. Dec 2008, 08:57
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Server 2008, Win 7, Fedora, Win 8

Wunderbar!

Post by brainclots »

Thank you TerryE! It was indeed the case sensitivity issue. Thanks for pointing that out, all is well!
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post 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!
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Post Reply