I have a catalyst server running on a VM.
[info] Hello powered by Catalyst 5.90103
HTTP::Server::PSGI: Accepting connections at http://0:3009/
And connecting within the VM
vagrant@precise32:/var/log/apache2$ curl 'http://localhost:3009'
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
etc ...
The port seems to be listening
vagrant@precise32:/var/log/apache2$ netstat -an | grep "LISTEN "
tcp 0 0 0.0.0.0:36300 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3009 0.0.0.0:* LISTEN
Connecting remotely I can see port 80 but not 3009
curl 'http://localhost:80'
curl: (52) Empty reply from server
curl 'http://localhost:3009'
curl: (7) Failed to connect to localhost port 3009: Connection refused
I've seen similar threads but nothing has helped. This is iptables
vagrant@precise32:/var/log/apache2$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
And the firewall is turned off
vagrant@precise32:/var/log/apache2$ sudo ufw status
Status: inactive
I'm very new at VM, I'm not sure if this is a hosts problem, an apache problem or a cataylst problem. I did try running a python server and couldn't connect to that either. All advice is much appreciated. Thanks
EDIT - I've looked at similar posts, the general solutions there are not listening ports or firewall. I don't think either applies here.
Answer
You are trying to access the app on vagrant box listening on port 3009, using address localhost
remotely. For this to work, you need to setup the port forwarding correctly as mentioned in the vagrant doc: https://docs.vagrantup.com/v2/getting-started/networking.html
Check and make sure, it is setup correctly and that the request on http://localhost:3009
is forwarded to the vagrant box. You should also make sure that your local firewall is not blocking connection to the port.
Comments
Post a Comment