Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VMWare guest web-server not reachable from host

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.

like image 840
nikola Avatar asked Jan 23 '23 07:01

nikola


2 Answers

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.

like image 118
Leddo Avatar answered Jan 25 '23 19:01

Leddo


This may be a serverFault question?

I run multiple VMWare instances on macs all the time and they access each other fine and access from the host works fine, so there is no theoretical problem here. I also find nothing wrong in what you describe, though I'm not a Django expert.

I suggest trying something easier, like trying to access a simple text index.html file, first from 127.0.0.1:8000 from within the VM and then 172.16.1.6:8000 from the host. Or perhaps even set up apache and try these on port 80 to make sure the connectivity is OK.

like image 38
Devin Ceartas Avatar answered Jan 25 '23 19:01

Devin Ceartas