How to Access a Web Server on Guest OS from Host OS in Virtualbox

I realized very nice tip! If we have webserver guest OS in Virtualbox, we can access it from host OS!
For example I have IIS on Windows XP runs Virtualbox. The host OS is Ubuntu and also Apache server running.

It is easy to access Apache server (Ubuntu) from guest OS (Windows XP), by typing the host OS IP address, like http://192.168.2.20/

But what about to access the IIS web server which is on guest OS (Windows XP)?
To achieve this, I'll show 2 ways.. 

Method 1: Port Forwarding

I opened settings window of the virtual machine in Virtualbox, than went to "Network" pane. When "Attach to: NAT",  I clicked to "Advanced" link, then "Port Forwarding" button shown.
I opened "Port Forwarding Rules" window and added a rule like below:

Host Port: 8080
Guest Port: 80

And now I can access the IIS web server on guest OS by using http://localhost:8080 or http://192.168.2.20:8080

Methot 2: Bridged Adapter

As another simple way, we can set "Attach to: Bridged Adapter" in "Network" pane of the virtual machine settings.. In this case, no need to do port forwarding in Virtualbox.
When connected to the internet, the virtual machine getting a new local IP, like 192.168.2.21. 
Then we can access to the web server guest OS from the host OS by its IP, like http://192.168.2.21

In addition, I forward the port 80 from ADSL modem settings to the 192.168.2.21, and the web server that on guest OS became accessed from the internet.
Great! :)
 

Sources:

Share Share Editor: editor | Posted: 2012/11/20 | Views: 27522

Comments

8 + 2 =
Home | Search | Contact | Terms
Editor
radyo dinle aşı takvimi podcast multimedia blog bedava dinle izle kongreler online müzik dinle selected videos nasheed music videos