I have Vagrant/VirtualBox running an Ubuntu 12.04 LTS OS. I have configured Vagrant to forward the guest port 8000 to my host port 8888.
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 8000 => 8888 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
When the virtual machine starts up, I start a Django dev server on port 8000.
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Okay great, I can put it in the background and I can even curl localhost:8000
and get some output from the server
<div id="explanation">
<p>
You're seeing this message because you have <code>DEBUG = True</code> in your
Django settings file and you haven't configured any URLs. Get to work!
</p>
</div>
But when I try to hit the server from my host machine with a Firefox/Chrome/Telnet I'm getting Connection Reset/Connection Lost/ERR_CONNECTION_RESET etc.
First I thought it may be some iptables thing, but it turns out Ubuntu has default allow everything. I also turned off the firewall on my host machine. How can I get to the bottom of this?
I had Django listening on 127.0.0.1:8000 (default)
As explained in Mitchell's answer here: Vagrant's port forwarding not working I should have been listening on 0.0.0.0. Here is a quote of his answer:
I wanted to add an additional note that often this is caused by the server within the VM because it binds to 127.0.0.1, which is loopback. You'll want to make sure that the server is bound to 0.0.0.0 so that all interfaces can access it.
If you're using Django, you want to start the dev server like this: ./manage.py runserver 0.0.0.0:8000