My host OS is Windows 7
I'm running a (Django development) server on Ubuntu 10.04 in VirtualBox.
I want to connect to that server (through my browser) on my Windows host. How can I do that?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
This did the job for me:
From memory, if you have set up VirtualBox with NAT networking, I think you can access services running on the host from the guest OS. From the guest (WinXP), the host appears as 10.0.2.2. So if you point your WinXP web browser to that address, it should connect to your Ubuntu Apache server. (To the host, this appears to be a connection from localhost, I believe.)
For that you have to forward the port on your Virtual Machine.
Go to the command prompt and switch to your virtual box folder, there you can issue the following commands:
VBoxManage.exe setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort" 8888 VBoxManage.exe setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort" 80 VBoxManage.exe setextradata "name of vm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol" TCP
Switch "name of vm" with the name of your virtual machine, as well as the GuestPort with the port your web server is using, as it might use port 8080, or something different. After that you should be able to access the server via http://localhost:8888/ if I'm not mistaken.
Edit: P.S.: as far as I remember, you need to set your network adapter on "NAT" for that
Edit 2: The VirtualBox Manual which can be found here includes a section about port forwarding, done slightly different to the way described here. Read it in chapter 6.3.1. (For version 3.2.6)
My host and guest OS is Windows 7 and the only way to connect them is configure the network adapter on "NAT" mode and then use the IP 10.0.2.2 like @tm_lv wrote https://superuser.com/a/287323/314495
I tried to set the network adapter to "Brigde" mode. I disabled both firewalls and used the right IP but didn't work. I don't know why.