Server Not accepting TCP/IP Connections

22,612

Run the following command to see the ports are open in the firewall:

sudo iptables -L

If you don't see the ports listed follow the instructions in this : http://wiki.centos.org/HowTos/Network/IPTables

If they are listed you need to enable remote access for postgres: http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html

Share:
22,612

Related videos on Youtube

Manoj G
Author by

Manoj G

Updated on September 18, 2022

Comments

  • Manoj G
    Manoj G over 1 year

    I have a Wt application running in a CentOS server machine(Machine A) in the port number 9798. Application is up and I could view the web page with the URL,

    http://localhost:9798
    

    But application is not loading up in another machine(Machine B) in the same network with the URL,

    http://<ip of server>:9798
    

    The port is open and listening.

    Same thing happens with the PostgreSQL which is running in the server machine. I'm unable to connect to PostgreSQL from other machine through PgAdmin III.

    But reverse is happening, I am able to connect to the Application and PostgreSQL from Machine A to Machine B.

    I double checked the running ports, PostgreSQL settings, etc., but could not figure out why is this happening.

    Why is this happening, what should I try now to explore?

    Machine A = CentOS 6.4 server,
    Machine B = Ubuntu 12.04 Desktop

    • lk-
      lk- almost 10 years
      Your programs might be configured to only listen for local connections, have you checked for this? Possibly related question: Cannot connect to postgres from remote host
    • Craig Ringer
      Craig Ringer almost 10 years
      "But application is not loading up". Details? Error message? Is it a timeout? Connection refused? Other?
    • Manoj G
      Manoj G almost 10 years
      It is a web application... "Web Page is not available" - same kind of error if application is not running or like trying to access any website without internet connection...
  • Manoj G
    Manoj G almost 10 years
    Thanks for you response. I have enabled remote access for postgres already. But did not see ports listed in iptables. But adding iptalbe rules also did not help :(
  • Manoj G
    Manoj G almost 10 years
    Not only postgres, could not access anything outside to the server, in the web page including Wt application, python's simple http server, etc even after changing the rules of iptables.
  • Rocky Raccoon
    Rocky Raccoon almost 10 years
    @ManojG Try running the following command from the second machine: nc <machine1_ip> <port_number>
  • Manoj G
    Manoj G almost 10 years
    I tried. nc <machine1_ip> <port> did not give any result. But nc <machine2_ip> <port> from machine1 works properly. It establishes connection and transfers messages also...
  • Rocky Raccoon
    Rocky Raccoon almost 10 years
    Then its the firewall, because there is no other service that prevents a remote connections from all the ports. Make sure you added the rules correctly. Plus in CentOS changed rules need to be saved so if you didn't run the save command and you rebooted the machine you will need to add the rules again.
  • Manoj G
    Manoj G almost 10 years
    Thanks a lot for your time. I have added, saved and restarted the iptables service. Will check with iptables again to see whether i have added the rules correctly and will update what happens.
  • Manoj G
    Manoj G almost 10 years
    Once I stopped iptables service, everything works!! Thank you so much. Is it good to keep iptables stopped or good to keep it running with proper rules?