Page 1 of 1

Accessing Website Being Hosted on Virtual Machine

Posted: Thu Sep 02, 2010 2:30 am
by devarishi
Hi,


I want to access the Website / Web Pages being hosted on the Virtual Machine (Linux) created with Sun VirtualBox onmy Host OS (Windows XP).

The website is working fine on the VM. But I can't access it from the Host OS (Windows XP).

What settings to do I need to configure to accomplish it?

Besides, how can I access the website, being hosted on the Host OS, from within the VM?

What settings to do I need to configure to accomplish it too?

Thanks!

Re: Accessing Website Being Hosted on Virtual Machine

Posted: Thu Sep 02, 2010 11:05 am
by Doug G
One way, I set up a bridged network so the VM is just another IP on my existing network. I did this on a linux host but I imagine a windows host would be much the same.

Re: Accessing Website Being Hosted on Virtual Machine

Posted: Thu Sep 02, 2010 12:59 pm
by devarishi
Doug G wrote:One way, I set up a bridged network so the VM is just another IP on my existing network. I did this on a linux host but I imagine a windows host would be much the same.

I also setup a Bridged Network on Windows XP, the Host OS. I attached this Bridged Network to the VM so that I can ping it from the Windows box. I am able to ping and ssh the VM (Linux Box).

But I am not able to access the website running on the VM. Did you do any settings in some files on the Linux Box?

Re: Accessing Website Being Hosted on Virtual Machine

Posted: Thu Sep 02, 2010 3:30 pm
by Weirdan
You should be able to access it using ip in the url, like this: http://192.168.2.12
If you use apache virtual host (it's not the same as 'virtual machine', mind you), you may need to add the name for the host into c:\windows\system32\drivers\etc\hosts if you want to access web server running inside the virtual machine, and put a name into /etc/hosts if you want to access webserver running on the host from within a virtual machine.

Re: Accessing Website Being Hosted on Virtual Machine

Posted: Thu Sep 02, 2010 5:32 pm
by devarishi
Weirdan wrote:You should be able to access it using ip in the url, like this: http://192.168.2.12
If you use apache virtual host (it's not the same as 'virtual machine', mind you), you may need to add the name for the host into c:\windows\system32\drivers\etc\hosts if you want to access web server running inside the virtual machine, and put a name into /etc/hosts if you want to access webserver running on the host from within a virtual machine.
You have showed me a very interesting thing:

Code: Select all

c:\windows\system32\drivers\etc\hosts
I never knew that etc\hosts would be found under Windows also.

I was able to ping the VM using its IP but not by its host name. I made an entry in the above file and voila!

Well, I also enabled "Secure Web Server (HTTPS)", "Telnet", and "FTP" service in Firewall to flag them as a Trusted Services.

Now I can browse the website on the Host OS. :drunk:

Okay, I have done similar settings in Firewall on the Windows Box also. And now I can access the website running on IIS within the VM.

So, the problem of accessing website from VM on Host OS and vice versa is resolved!

Thanks! :drunk: