Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Tomcat localhost:8080 of guest VirtualBox VM from Host OS

I have an XP laptop on which I am running an Ubuntu distro inside VirtualBox which is running a website via Tomcat. When I am in the VM I can access the site with localhost:8080/

What I really need to do, though, is to access the VM localhost from XP. vm-computer-name:8080/ isn't recognized.

Any help is much appreciated.

like image 392
Duncan Avatar asked Jul 20 '09 19:07

Duncan


People also ask

How do I access a Web server on a VirtualBox from the host machine?

Go your Virtual Machine's network settings in Virtualbox. Set the network card not as attached through NAT, but through BRIDGED ADAPTER. If you have multiple adapters on your host machine, select the main one, the one you're using to obtain an IP from your router.

How do I access Tomcat locally?

Use a browser to check whether Tomcat is running on URL http://localhost:8080 , where 8080 is the Tomcat port specified in conf/server. xml. If Tomcat is running properly and you specified the correct port, the browser displays the Tomcat homepage.


3 Answers

Setup your VM to run a host-only network, then reboot or restart networking to update DHCP. The IP address on the guest will now be accessible from the host.

You can also use bridged network mode, but that won't work when the host is disconnected from the network.

like image 56
Kiran Jonnalagadda Avatar answered Sep 21 '22 17:09

Kiran Jonnalagadda


Get the IP Address of your guest OS and access it via that.

like image 22
Nick Avatar answered Sep 19 '22 17:09

Nick


The following helped me after a new VM and tomcat installation.

Get the IP address of the Guest OS and the port number on which tomcat was started. Then you can access it via:

IP:Port/

In case you are not able to access it still or if you get no response, try

sudo iptables -F

This would flush the tables and would reflect the new mapping. You would need to do this only once though.

like image 25
user1587865 Avatar answered Sep 17 '22 17:09

user1587865