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

你离开我真会死。 提交于 2020-01-12 14:00:55

问题


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.


回答1:


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




回答2:


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.




回答3:


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.




回答4:


Type the following command on VM and then try.

sudo iptables -F



来源:https://stackoverflow.com/questions/1155487/access-tomcat-localhost8080-of-guest-virtualbox-vm-from-host-os

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!