Ubuntu 13.04:

No LSB modules are available
Distributor ID: Ubuntu
Description:    Ubuntu 13.04
Release:        13.04
Codename:       raring

I'm attempting to open port 8888 on an Ubuntu VM that I'm accessing with VirtualBox/Vagrant. On the vm, I run the following command

vagrant@vagrant-ubuntu-raring-32:~$ curl -v 'http://localhost:8888'

and I get the following response:

* About to connect() to localhost port 8888 (#0)
*   Trying
* Connection refused
* Failed connect to localhost:8888; Connection refused
* Closing connection 0
curl: (7) Failed connect to localhost:8888; Connection refused

So I then try this (per an answer I found here on AskUbuntu):

sudo ufw allow 8888/tcp

Then I retry the curl command and I get the same thing. Not that it should make any difference but I sudo the curl command and it makes no difference. I've also reverted the machine to baseline and then run sudo ufw allow 8888 and that doesn't work either. Are there other things which might be blocking that port?

  • Localhost doesn't have firewall by default. Are you sure a process is listening that port? Add the output of lsof -i:8888 to your question. – Braiam Jan 15 '14 at 20:59
  • @Braiam as falconer guessed (and you're right too), I needed to have something listening on that port. Seems obvious now but for some reason it didn't occur to me that the connection would be refused unless someone were listening. – Onorio Catenacci Jan 16 '14 at 14:59

Is anything listening on port 8888? If nothing is listening on the port you can't connect to it.

You can check if anything is listening on that port with

sudo netstat -tulpn

The port is likely open already as linux firewalls won't block localhost if you don't ask them to block it.

  • That was it--nothing listening on the port. Thanks! – Onorio Catenacci Jan 15 '14 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.