1

I am running Vagrant on Macos 10.10.2 with Ubuntu 14.04 server as guest. On the ubuntu system, I have installed rails 4.2.0 (ruby 2.1.5).

The problem is that I can't access the rails web server from the host. The vagrant box is set up with port forwarding like so:

config.vm.network "forwarded_port", guest: 3000, host: 8080

However, no HTTP request seems to reach it. When curling to it (through the port forwarding), I get the following result, and the web server's log does not report any request:

$ curl localhost:8080
curl: (52) Empty reply from server

Curling locally on the ubuntu box itself yields the web page.

It seems to me that either the firewall on the Mac or on the Ubuntu server is blocking the call. When running nmap, it only finds ports 22 and 111 open:

$ nmap -P0 192.168.33.10
Starting Nmap 6.47 ( http://nmap.org ) at 2015-02-24 12:55 CET
Nmap scan report for 192.168.33.10
Host is up (0.0019s latency).
Not shown: 998 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
111/tcp open  rpcbind

However, no firewall is running on either the Mac nor the ubuntu server; on the latter, iptables isn't even installed.

I have looked at several other questions on this topic, including the following, but none of them seem relevant to my situation. Vagrant Port Forwarding not working Vagrant's port forwarding not working Vagrant port forwarding not working on Mavericks

What else can I try?

Community
  • 1
  • 1
NiklasR
  • 473
  • 6
  • 19
  • `# netstat -tulpn` is the command. Taken from [here](http://www.cyberciti.biz/faq/what-process-has-open-linux-port/). Your server in the VM *have* to be listening on `0.0.0.0` or the IP address of the VM, not `127.0.0.1`. – zloster Feb 15 '16 at 17:50

1 Answers1

1

i was having the same problem with a django server and saw in one of the comments from your similar linked issues that if you start your server bound to 127.0.0.1 then it's only on the loopback interface of the virtual host, but if you start it to 0.0.0.0 then it will accept all incoming connections on that port.

you can also see this question for details on specifying rails ip address binding: How to change the default binding ip of Rails 4.2 development server?

Community
  • 1
  • 1