Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing a web server on a Virtual Machine from another computer

I have setup a Virtualbox with a Linux environment running a web server. The host is running Windows 7, and I can access the web served by the server in the virtual machine from the host's browser.

However, I would like to be able to access this web server from another computer; say, a colleague on the same network that the host is in. Is there a way of doing so?

Summary:

 Host (win7) interfaces:

  - 172.16.1.15 (internet facing)
  - 192.168.55.1 (VM facing)

Guest (linux with web server running) interface:

  - 192.168.55.2

Web server is reachable from Host (through 192.168.55.1 - 192.168.55.2 interface)

Web server is NOT reachable from other computer on 172.16.1.X network.

Can you guys help me out on what I may be able to do in order to achieve this?

Thank you!

like image 339
ggonmar Avatar asked Dec 21 '17 16:12

ggonmar


People also ask

How do I access a virtual server on another computer?

First your computer IP and port, then the IP of your virtual machine attached to your NATNETWORK and the port. In my case used 192.168. 1.102:8069 for the host and 10.0. 2.7:8069 for the guest.


1 Answers

Well, despite downvotes without any kind of explanation why (thank you!), I have found a way of doing what I intended on Virtualbox settings:

On machine, right click, Settings > Network > Advanced > Port forwarding, and then, fill with corresponding data, i.e.:

  • host ip could be 0.0.0.0,
  • host port should be the port other users will use to access your computer (and thus the VM),
  • guest ip is the VM ip, and
  • guest port should be 80 if it is a web server typically).

Thank you, hope this helps to the next one running into this!

like image 73
ggonmar Avatar answered Nov 04 '22 10:11

ggonmar