3

I did the following:

  1. installed VirtualBox 3.1.6 OSE in ubuntu 10 desktop.
  2. installed ubuntu 10 server on a virtual machine in VirtualBox.
  3. select "LAMP server" and "OpenSSH server" options during the ubuntu server installation.
  4. leave network "adapter 1" of virtual machine as "NAT".
  5. use "VBoxManage" described in manual to setup port forwarding on the host (Protocol: TCP, GuestPort: 80, HostPort: 8080).
  6. verify "ExtraDataItem" have been added to "ubuntuServer1.xml" (my virtual machine name) correctly.
  7. run command "pgrep apache" in ubuntu server in virtual machine to ensure apache is running.

Everything went well. But, when I try to access the apache from the browser on the host with "http://localhost:8080/", it just continue fetching with no response.

Now, I'm struck! Please help!

Many many thanks in advance!

2
  • It's not the answer here, I suspect, but make sure firewall configuration on the guest permits incoming TCP port 80. You could also verify using netstat that port 8080 on the host is in fact attached to a listening process.
    – William
    Jul 8, 2010 at 4:41
  • Thank you, William! I did the following: 1. run command "netstat -anltp|grep :80" in the virtual guest server and it returns 1 line look like "tcp6 0 0 :::80 :::* LISTEN". So, guest server seems listening to port 80. 2. run command "netstat -anltp|grep :8080 in the host desktop and it returns 3 lines that looks like "tcp 0 0 0.0.0.0:8080 0.0.0.0:8 LISTEN 2714/VirtualBox", "tcp 0 0 127.0.0.1:33207 127.0.0.1:8080 ESTABLISHED 2487/google-chrome" & "tcp 403 0 127.0.0.1:8080 127.0.0.1:33207 ESTABLISHED 2714/VirtualBox". The host desktop seems listing to port 8080.
    – Francis L
    Jul 8, 2010 at 5:49

2 Answers 2

1

Are you going to localhost:8080 from the Host (Ubuntu 10 desktop) or from Ubuntu 10 server?

if you are trying from the host (ubuntu 10 desktop) then it won't work as its trying to see if something is running on port 8080 in ubuntu 10 desktop.

you will need to use the ip address of the guest VM, for example if your ubuntu 10 server has an ip of 192.160.0.5 then you need to use http://192.168.0.5:8080 from the host (ubuntu 10 desktop)

hope this helps.

Luma

1
  • With the network adapter set to "NAT", the host cannot access the virtual guest server no matter the guest has a static ip address or not. Based on the manual, if port forwarding is setup, VirtualBox will forward messages sent to port 8080 on the host to port 80 on the guest.
    – Francis L
    Jul 8, 2010 at 5:57
0

i use different approach. Install openSSH server to your main machine and from VM terminal connect

ssh -R 127.0.0.1:needed_port_from_vm:new_port_at_local_machine username@localhost

E.A.: ssh -R 127.0.0.1:80:8080 me@localhost open browser and go to localhost:8080

if this won't work then switch the ports. I'm writing from memory ;) What this does is direct port(80) from user(vm) to ssh server(local machine) port(8080). it works with any servers too, just IP's differ.

NOTE. Ports under 4 digits (or something like that) need root to create so use longer ones.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .