Sam
Sam

Reputation: 14586

accessing a website hosted in a virtualbox from host

I have Windows 2008 Server installed in a VirtualBox and I'd like to be able to access the default website (localhost) from the host OS (Windows 7).

In IIS, I have set a hostname for the default website, which I've named 'webserver'. THen I've added the following line to my hosts file (dns)

127.0.0.1 webserver

Now, if I browse to http://webserver in the guest OS, it works just fine.

But how do I access it from the host OS ?

Upvotes: 4

Views: 17044

Answers (4)

Mozart
Mozart

Reputation: 2302

As far as I know the default IP address for virtual box if using NAT is 10.0.2.15, but still you can verify that using ipconfig.

Nat enables you to access your virtual box guest OS even if your host OS is not connected to a router/access point.

You can map a port from your host OS to the guest OS as follows.

  • Got to your vbox guest OS's settings
  • Click on the network Tab
  • Make sure attached to is set to NAT
  • Click on advanced then port forwarding
  • Then you will see a screen where you can map host ports to guest ports

Virtual Box NAT port forwarding

Upvotes: 4

resle
resle

Reputation: 2364

Go your Virtual Machine's network settings in Virtualbox.

Set the network card not as attached through NAT, but through BRIDGED ADAPTER. If you have multiple adapters on your host machine, select the main one, the one you're using to obtain an IP from your router.

Now your guest virtual machine is on the same network as your host's.

Hence you can simply access the webserver through the Virtual Machine's computer name. Ex. http://virtserv
(Mind well: not the virtual machine's name in Virtualbox, but the COMPUTER NAME in the guest windows installation).

Upvotes: 2

P.Brian.Mackey
P.Brian.Mackey

Reputation: 44275

All you have to do is use the IP address of the host operating system. In the host operating system open the command prompt and type ipconfig. Find the IPv4 address: E.G.

IPv4Address........ : 10.1.1.100--If there are multiple then try them all

Go into the Virtual Machine OS and open a browser. Type the url:

http://10.1.1.100/optionalPathInfo

This will open the host IIS site from the VM browser.

Upvotes: 0

Frank Riccobono
Frank Riccobono

Reputation: 1063

If your virtual machine is connected to the internet, it's basically using your physical PC as a router. That is, the host OS is assigning some private address (e.g. 192.168.X.X).

You need to put that in your browser to access the virtual server from the host OS. I've never used Windows Server, but under Windows you'd find your IP by typing

ipconfig

at the command prompt.

Upvotes: 2

Related Questions