Page 1 of 1

[Solved] Access Guest machine via ssh works; http doesn't

Posted: 28. Aug 2009, 20:05
by dca
Hello,

I'm new to VirtualBox and I'm having some problems connecting to my guest HTTP server

I'm running the following:

Host: Windows XP Pro
VirtualBox: 3.0.4
Guest: Fedora 11
Linux Guest Additions
Networking: PCNet (Attached to NAT)
Apache is working (serves pages in VirtualBox;)

Code: Select all

C:\Program Files\Sun\xVM VirtualBox>VBoxManage getextradata Fedora11 enumerate
VirtualBox Command Line Management Interface Version 3.0.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Key: GUI/SaveMountedAtRuntime, Value: yes
Key: GUI/ShowMiniToolBar, Value: yes
Key: GUI/MiniToolBarAlignment, Value: bottom
Key: GUI/LastCloseAction, Value: powerOff,discardCurState
Key: GUI/LastWindowPostion, Value: 651,58,720,442
Key: GUI/Fullscreen, Value: off
Key: GUI/Seamless, Value: off
Key: GUI/AutoresizeGuest, Value: on
Key: GUI/MiniToolBarAutoHide, Value: on
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/HostPort, Value: 8888
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/GuestPort, Value: 80
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort, Value: 2222
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort, Value: 22
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol, Value: TCP
I can connect to the guest ssh using putty (Host Name: localhost, port 2222)

Doing a port scan on localhost shows ports 2222 and 8888 are open.

When I try to use Firefox to go to http://localhost:8888/ it won't connect.

Any help would be greatly appreciated

Re: Access Guest machine via ssh works; http doesn't

Posted: 28. Aug 2009, 20:49
by vbox4me2
Is apache configured to listen on all interfaces?

Re: Access Guest machine via ssh works; http doesn't

Posted: 28. Aug 2009, 21:27
by dca
I believe so.
httpd.conf shows:
Listen 80

Re: Access Guest machine via ssh works; http doesn't

Posted: 28. Aug 2009, 21:52
by vbox4me2
Then try wget and see if the apache logfiles show any access.

Re: Access Guest machine via ssh works; http doesn't

Posted: 28. Aug 2009, 22:19
by dca
The apache log files don't show any access for wget, just the tests I've done from within VirtualBox

When I run wget from my host this is the result:

Code: Select all

--2009-08-28 14:13:52--  (try: 1)  http://localhost:8888/
Connecting to localhost|127.0.0.1|:8888... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in
 headers.

Re: Access Guest machine via ssh works; http doesn't

Posted: 28. Aug 2009, 23:20
by Sasquatch
Set a second NIC for the Guest, and attach it to Host-Only. Then, in the main VB preferences, configure the interface and enable the DHCP server. Start the VM, check it's Host-Only IP address and connect to there from the Host. What do you get then?

Re: Access Guest machine via ssh works; http doesn't

Posted: 29. Aug 2009, 00:13
by dca
I can't connect at all to the IP

I don't think I configured it right. How do I configure it properly?

Re: Access Guest machine via ssh works; http doesn't

Posted: 29. Aug 2009, 00:35
by Sasquatch
Using something like this as the config in the VB prefs, then use DHCP on the Guest to obtain an IP address which you can use to access the webserver from the Host. You can use any IP range you like, the default VB presents you will do (192.168.56.1, netmask 255.255.255.0).

Re: Access Guest machine via ssh works; http doesn't

Posted: 31. Aug 2009, 19:38
by dca
I *think* I might have figured out what was happening.

The firewall in Fedora wasn't configured to allow HTTP traffic. So I ran system-config-firewall and enabled it.

I can now view pages served from the Guest on the Host.

Thanks for the help!