Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant Port Forwarding not working

I've installed CouchDB on my vagrant 0.9.0 box that is running CentOS 6.2.

In Vagrantfile I've added config.vm.forward_port 5984, 5985.

After reloading vagrant i attempt to curl the address: curl -v localhost:5985 with poor results.

* About to connect() to localhost port 5985 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 5985 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
> Host: localhost:5985
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
* Closing connection #0

I get the feeling that port forwarding isn't working properly - at first I thought it might have something to do with iptables so I disabled that but, alas, results did not improve.

Been beating my head against this for days now. Would greatly appreciate some assistance.

like image 902
joseym Avatar asked Jan 28 '12 01:01

joseym


2 Answers

It's quite likely that your CouchDB is listening on address 127.0.0.1 of the virtual machine (not of the physical machine). This is the default for CouchDB. Do you have the following in local.ini?

[httpd]
bind_address = 0.0.0.0

After restarting CouchDB check with netstat, on the virtual machine, if the change took effect:

sudo netstat -tlnp |grep :5984

Then check that CouchDB is running fine from the virtual machine:

curl http://127.0.0.1:5984/

If you don't see {"couchdb":"Welcome","version":"1.1.1"}, check the logs for error messages. It may be some permissions problem.

How have you installed CouchDB?

like image 132
Marcello Nuccio Avatar answered Nov 07 '22 00:11

Marcello Nuccio


in my case, the solution to a very similar problem was much more obvious: coming from ubuntu, I didn't expect a firewall to be running on the centos box

this will disable it:

sudo service iptables stop

thanks to this blog!

like image 4
Cpt. Senkfuss Avatar answered Nov 06 '22 22:11

Cpt. Senkfuss