Addressing localhost port from a virtualbox

I have a local server, listening to port 8000,

I'm working on Mac Mountain Lion, so to test the page on IE 8 etc I run a virtual machine [win xp] using virtual box;

In my real machine, I open the website simply using the URL

http://localhost:8000

,how do I address this port from the virtual machine as

http://10.0.2.2/

is showing me the localhost on VM but not working as

http://10.0.2.2:8000/

. I tried to create port forwarding also but that did not worked or i may be missing something. So, i request if it is related to port forwarding please share steps very clearly.


You will want to change the network adapter in the VM settings from a NAT connection to a Host Only connection. This creates a virtual network that includes the host machine and the virtual machine.

You will notice that when you have changed the network adapter type, the VM will get a new IP address. The default for this will be something along the lines of 192.168.56.101. Verify that your host machine also has an IP address on the same .56 network using the ifconfig command at the Terminal. Once you have it set up, you should be able to connect to the host machine at the .56 address it lists in ifconfig .

More information on Host-Only Networking in VirtualBox can be found at https://www.virtualbox.org/manual/ch06.html#network_hostonly .

If you have difficulty getting this to work, switch the network adapter type to Bridged, which will give your virtual machine an IP on your real network. This has the advantage of simplicity, but is not as secure. Then you can use your host's existing IP address in Network Settings or ifconfig to connect to your running application.

链接地址: http://www.djcxy.com/p/18224.html

上一篇: 从虚拟机测试盒应用程序

下一篇: 从virtualbox寻址localhost端口