VMWare来宾网络服务器无法从主机访问 [英] VMWare guest web-server not reachable from host
问题描述
访客:Ubuntu Server 9.04(也适用于Ubuntu Desktop 9.04 ,用于验证问题)
VMWare网络:桥接
路由器:Apple TimeCapsule,最新固件
问题:
在客户端成功安装Django 1.1之后,启动Django的内置Web服务器(在127.0.0.1:8000上侦听),我通过wget 127.0.0.1:8000进行了验证(还通过Firefox on Ubuntu Desktop 9.04)确实是服务器工作。
但是,我无法从主机连接到Django服务器。
具体来说:
在桥接模式下,客户操作系统具有IP 172.16.1.6(由TimeCapsule通过DHCP分配),主机操作系统具有IP 172.16.1.2(通过TimeCapsule通过DHCP分配)。我可以从主机成功ping访客,并从客户端ping主机。但是端口8000上的Django服务器从主机操作系统无法访问。
是否有任何必须启用的配置设置才能将Django服务器从guest虚拟机路由到主机?在Ubuntu或VMWare(工作站或Fusion)中,还是在Vista或Mac OS X中?
编辑:
我找到了解决方案。当调用django-admin.py runserver时,有一个可记录的可选参数ipaddr:port。将此设置为172.16.1.6(而不是默认的127.0.0.1)启用了从guest虚拟机到主机的正确路由。
发现你可以使用以下命令启动服务器,并打开所有的ip的...
python管理。 py runserver 0.0.0.0:8000
欢迎您。
Software: VMWare Fusion 2.05 on Mac OS X 10.5.8 (also applies to VMWare Workstation 6.5.2 on Vista, used for verification of the issue) Guest: Ubuntu Server 9.04 (also applies to Ubuntu Desktop 9.04, used for verficiation of the issue) VMWare Networking: bridged Router: Apple TimeCapsule, latest firmware
Issue:
After successfully installing Django 1.1 on the guest, and starting Django's built-in webserver (listening on 127.0.0.1:8000), I verified via wget 127.0.0.1:8000 (and also via Firefox on Ubuntu Desktop 9.04) that indeed the server works.
However, I haven't been able to connect to the Django server from the host machine.
Specifically:
In bridged mode the guest OS has the IP 172.16.1.6 (assigned via DHCP by the TimeCapsule), the host OS has the IP 172.16.1.2 (assigned via DHCP by the TimeCapsule). I can successfully ping the guest from the host, and also ping the host from the guest. But the Django server on port 8000 is not reachable from the host OS.
Is there any configuration setting that must be enabled for routing the Django server from the guest to the host? Either in Ubuntu, or in VMWare (Workstation or Fusion), or in Vista or Mac OS X?
EDIT:
I found the solution. When invoking django-admin.py runserver, there is a documented optional argument ipaddr:port. Setting this to 172.16.1.6 (instead of the default 127.0.0.1) enabled the correct routing from guest to host.
I found that you can just start up the server with the following command, and that opens up all ip's...
python manage.py runserver 0.0.0.0:8000
You're welcome.
这篇关于VMWare来宾网络服务器无法从主机访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!