简体   繁体   English

从另一台计算机访问虚拟机上的Web服务器

[英]Accessing a web server on a Virtual Machine from another computer

I have setup a Virtualbox with a Linux environment running a web server. 我已经在运行Web服务器的Linux环境中设置了Virtualbox。 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. 主机正在运行Windows 7,我可以从主机的浏览器访问虚拟机中服务器所服务的网络。

However, I would like to be able to access this web server from another computer; 但是,我希望能够从另一台计算机访问此Web服务器。 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! 谢谢!

Well, despite downvotes without any kind of explanation why (thank you!), I have found a way of doing what I intended on Virtualbox settings: 好吧,尽管投票毫无理由(谢谢!),我还是找到了一种在Virtualbox设置中实现预期目标的方法:

On machine, right click, Settings > Network > Advanced > Port forwarding, and then, fill with corresponding data, ie: 在计算机上,右键单击“设置”>“网络”>“高级”>“端口转发”,然后填充相应的数据,即:

  • host ip could be 0.0.0.0, 主机IP可能是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 ip是VM ip,并且
  • guest port should be 80 if it is a web server typically). 来宾端口(通常为Web服务器)应为80)。

Thank you, hope this helps to the next one running into this! 谢谢您,希望这对下一个有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM