问题
I'm running Ubuntu 10.10 in VirtualBox with Windows 7 as host. I have a java Web Service which I deploy onto a Glassfish3 server in Ubuntu and I want to be able to reach it from the host, according to the VBox documentation I should port forward port 8080 which is the port that my client application connects to on my host. To do this I do the following command in Windows VBoxManage modifyvm Ubuntu --natpf1 glassfish,tcp,,8080,,8080
which should forward my hosts 8080 port to my VM's 8080 port, but it doesn't seem to work when I try to reach it. Any ideas?
回答1:
Ensure 8080 is not already used by some other process in Windows. Install Guest Additions from the ISO inside Ubuntu. Ensure you are using NAT as the option for networking. Ensure the firewall in Ubuntu does not block incoming requests.
来源:https://stackoverflow.com/questions/4832712/connecting-to-web-service-in-vm-from-client-in-host