I'm having trouble accessing my webserver when it's located on a virtual machine. If I put the webserver on the physical host machine, I can access it from the internet. However, when I try to access the webserver when it's on the VM (on the same host machine), it just hangs (from the browser, and
I'm a little annoyed why this isn't working because the parts to this setup all work in isolation, but don't work when put together.
When I put it on a virtual machine, I make sure to set up a bridged network connection and can access it from elsewhere in my network on separate machines. I also set up port forwarding on the router to the static ip assigned to the static IP assigned to the VM.
The following represent configurations. The first configuration is the one I'm trying to achieve. The second and third are "partial configurations" that seem like if they both work (and they do) then the first configuration should also work.
- webserver <-> virtual machine <-> host machine <-> router <-> modem <-> internet
- webserver <-> virtual machine <-> host machine <-> router <-> other computer
- ................................webserver <-> host machine <-> router <-> modem <-> internet
Basically #2 means I can access the webserver locally, and #3 means I can access the webserver from the internet, if the webserver is not on the virtual machine, but on the host of the vm.
I'm currently using:
webserver: python's SimpleHTTPServer at port 8888 virtual machine: centos deployed by vagrant on virtualbox. host machine: thinkpad, windows router: apple airport, wrt-54g (tried both, same results) modem: SB6121 cable modem internet: comcast
I set up port forwarding from port 8888 to the webserver's local static ip address 10.0.1.99 @ 8888.
Thought everything should be right. I asked a friend to try to access the webserver from his own router/internet and he has the same results: it just hangs.
It's the combination of port forwarding on the router and bridging the vm network adapter that seems to cause issues. I'm pretty certain I'm forwarding the right port, to the right static IP. Also, not sure why it's hanging, versus simply dropping my connection. Some people have suggested, the packets aren't finding their way back to the internet.