From: ATest@sbsdk12.org (Coutts, Ashe (Testing Account))
To: netfilter@lists.netfilter.org
Subject: Linux with NAT -- Also needing web access to postgres on same box
Date: Fri, 22 Nov 2002 10:26:29 -0800 [thread overview]
Message-ID: <3DDE0655.3406.2E6F78CF@localhost> (raw)
I am using RedHat 7.3 with iptables 1.2.6a,
Apache 1.3.27 compiled with PHP 4.2.3 and mod_perl 1.27,
and running postgresql.
I want to access data stored within postgresql from a php script.
The exact line used for connection to postgresql is this:
$database = pg_connect ("host=localhost user=postgres dbname=xbase");
If I temporarily reset the NAT process all is good, i.e. a web page displays with
the data correctly extracted from postgresql.
Alas, when the system is functioning in its normal, NAT, mode I get the
following error message rather than the correct web page display:
===== Begin web error message =======
Warning: pg_connect() unable to connect to PostgreSQL server:
could not connect to server: Connection timed out
Is the server running on host localhost and accepting
TCP/IP connections on port 5432? in
/usr/www/site.admin/htdocs/sasixp/DPHS.php on line 21
An error occured with the connection.
===== End web error message =======
My thought is that a few correct addition(s) to my iptables script should allow
the internal connection to postgresql.
Unfortuneately, I don't yet have the skill to determine what those line(s) should
be.
Any help and or suggestions would be very much appreciate and, I'm sure,
instructive.
THANKS
====== Begin current script for NAT ========
# Nat Reset
/sbin/iptables --flush INPUT
/sbin/iptables --policy INPUT ACCEPT
/sbin/iptables --flush FORWARD
/sbin/iptables --policy FORWARD ACCEPT
/sbin/iptables --flush OUTPUT
/sbin/iptables --policy OUTPUT ACCEPT
/sbin/iptables --table nat --flush PREROUTING
/sbin/iptables --table nat --policy PREROUTING ACCEPT
/sbin/iptables --table nat --flush POSTROUTING
/sbin/iptables --table nat --policy POSTROUTING ACCEPT
/sbin/iptables --table nat --flush OUTPUT
/sbin/iptables --table nat --policy OUTPUT ACCEPT
# Nat SetUp
/sbin/iptables --table nat --flush POSTROUTING
/sbin/iptables --table nat --policy POSTROUTING DROP
/sbin/iptables --table nat \
--append POSTROUTING \
--source 172.16.0.0/16 \
--jump SNAT \
--to 204.48.xxx.yyyI
echo 1 > /proc/sys/net/ipv4/ip_forward
====== End current script for NAT ========
"Experience is not what happens to you, it
is what you do with what happens to you"
-- Aldous Huxley (1894-1963)
Ashe Coutts (ashe@sbceo.k12.ca.us)
805.963.7751 Ext 260
Fax 805.884.1557
reply other threads:[~2002-11-22 18:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3DDE0655.3406.2E6F78CF@localhost \
--to=atest@sbsdk12.org \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.