Open port 5000?

9,201

You open a port with a program. The operating system provides primitives for you to do so, which is usually done at the OS level is to allow the port to accept connections. For this, you may need to configure the firewall or even SELinux, depending on your installation (even though I did not see Ubuntu standard installation bringing any of these). @ Andrea pointed out that you do not need special permission to the program if it wants to open the port. Again, this is a program, a server, which will be listening on a port. Any network communication, using connection-oriented protocol (such as TCP / IP), needs a listening server port, and connecting client. I do not know Heroku, but I guess by the looks of the command that you posted, you are trying to migrate a database from one place to another. That depends if you open two connections, one to extract the data from and the other one to write into. If you intend to receive connections from the Internet, then you need a port on a public IP, which arrives to the port 5000 of your server machine. If you think you have a correct installation, then try this command:

sudo netstat -tnlp 

It should give you something like this output:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      940/sshd   

This is the case, for a SSH server, listening on port 22. You should have something similar, for the 5000 port. It that's the case, then try connecting from your internal network to the server's IP, and then figure out how to open it to Internet. You can do this with the telnet command:

$ telnet 192.168.1.1 22
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.8p1 Debian-7ubuntu1
^\
Connection closed by foreign host.

If you got the word "Connected" then your port is alive and kicking :) This is a sample for a SSH server listening, your heroku output should be different.

Share:
9,201

Related videos on Youtube

Matteo Pagliazzi
Author by

Matteo Pagliazzi

Updated on September 18, 2022

Comments

  • Matteo Pagliazzi
    Matteo Pagliazzi over 1 year

    Yesterday I tried to use this heroku command:

    heroku run db:migrate
    

    and after a long wait it said that it was in timeout

    After many tries I've googled about this and I found that, since also other commands have given the same response, the problem was that my pc (or my net?) hasn't the port 5000 open.

    Can i open this? How in Ubuntu?

    If it is releated to my providere I read somewhere that probably I can whitelist this port: can i do this from Ubuntu? How?

    • Andrea Corbellini
      Andrea Corbellini about 12 years
      All ports > 1024 can be bound without any special permission by default in Ubuntu. Maybe you want it to be accessible from the Internet and you are under a router? If this is the case, then you need to play with your router's configuration (look for port mapping, which should be the quickest solution)
    • Matteo Pagliazzi
      Matteo Pagliazzi about 12 years
      "All ports > 1024 can be bound without any special permission by default in Ubuntu." how?
    • Matteo Pagliazzi
      Matteo Pagliazzi about 12 years
      and about router configuration do you know where can i found it?
    • jedijf
      jedijf about 12 years
      Router Configuration page. If your ip is 192.168.1.x, then probably 192.168.1.1. Look for 'Port Forwarding'. You'll need name and password. If you haven't set it, google will help you find defaults, or look on bottom if isp provided router.
    • Matteo Pagliazzi
      Matteo Pagliazzi about 12 years
      it seems that my router isn't configurable....
    • Иван Бишевац
      Иван Бишевац about 12 years
      I have same problem. Couldn't run heroku run db:migrate.
    • Matteo Pagliazzi
      Matteo Pagliazzi about 12 years
      it seem that my provider is blocking it: i can open it using a "port mapping" but it's not working