How to Access HTTP to a Virtual Machine

At my last work, I installed Postgrestats inside Ubuntu 12.04 LTS on VM. This web-based program, should be accessed by HTTP connection. It was successful when I tested it on localhost of my VM. But, I confused when I tried to access from my real OS (host computer of VM). I looked for the solution and ta da. It's work. What I did is explained step-by-step below. Note, I'm using Oracle VM Virtualbox.

Firstly, open Oracle VM Virtualbox. Choose your virtual machine and click Settings.
Figure1. Oracle VM Virtualbox
Dialog box will be opened and choose Network. Inside Adapter tab you'll find Advanced option. Choose it and click Port Forwarding.
Figure 2. Network Setting
Next window will show you rule of Port Forwarding. Click Insert new rule button and fill the columns as below.
1
2
3
4
5
Name: --you could type any name here--
Protocol: TCP
Host IP: 127.0.0.1
Host Port: --any port number, in my case I used 2222--
Guest IP: --your VM IP address, check your VM IP address first to fill this column--

Here my rule I've been created when I tested Postgrestats.
Figure 3. My Port Forwarding rule
Click OK and OK then try to run your VM. After login, open your browser in your real machine (Host OS) and start typing 127.0.0.1:2222 (in my case) it'll be forwarded to 10.0.2.15:80 (in my case, too) which is HTTP server on my VM.

Comments

Popular posts from this blog

Making SublimePythonIDE Works on Windows

How to Change Font Type in Sublime Text