Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Postgresql giving connection timed out because of iptables


    In our development box we are configured postgresql to work with Jboss. The thing is we have firewall iptables in our linux box. when the iptables is stopped we can connect the postgres db locally using -h option, also we can connect thru a weblink we have created using Jboss. But when the iptables is started we can't connect the db locally using the -h option and the web is giving the below error.

    Caused by: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openC onnectionImpl(
    at org.postgresql.core.ConnectionFactory.openConnecti on(
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init >(
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init >(
    at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3C
    at org.postgresql.Driver.makeConnection( 93)
    at org.postgresql.Driver.connect(
    at org.jboss.resource.adapter.jdbc.local.LocalManaged ConnectionFactory.getLocalManagedConnection(LocalM

    We have defined the postgres,Jboss ports plus all the ports in the start up error logs in the iptables still same issue persists. I have also attached the iptables and Jboss startup error logs which is because of the postgres db.

    Your replies are highly welcome.
    Attached Files Attached Files

  2. #2
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Charlotte, NC, USA
    You have a default policy of "drop" for the forwarding table, but no other rules that reference it. For simple, local setups like this one, I would advise creating a user defined table, then "jumping" (-J) all other tables to that table as a target. In that table, you can then define what you want to allow. That approach works well with single-homed boxes and will allow you to remove those input and output rules that are basically duplicates.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts