Iptables problem
I'm trying to forward all traffic from port 172.18.1.40:50006 (eth0) to 172.18.1.40:5432 (postgresql)
My rules work from another machine on the LAN just fine. e.g. a telnet client connects to postgresql server on 50006. However trying to telnet from the machine hosting the postgresql server gets "connection refused." I've added the FORWARD (useless?) rules to try to get it to work on the local machine, but no go. Here are my rules. They are the only ones on the system.
#This rule maps hp's SIM postgre to the postgre default
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 50006 -j REDIRECT --to-port 5432
iptables -t nat -A PREROUTING -p udp -i eth0 --dport 50006 -j REDIRECT --to-port 5432
iptables -t nat -A PREROUTING -p tcp -i lo --dport 50006 -j REDIRECT --to-port 5432
iptables -t nat -A PREROUTING -p udp -i lo --dport 50006 -j REDIRECT --to-port 5432
#Must accept the traffic from 50006
iptables -A FORWARD -p tcp -m state --state NEW,ESTABLISHED,RELATED -o 172.18.1.40 --dport 5432 -j ACCEPT
iptables -A FORWARD -p udp -m state --state NEW,ESTABLISHED,RELATED -o 172.18.1.40 --dport 5432 -j ACCEPT
iptables -A FORWARD -p tcp -m state --state NEW,ESTABLISHED,RELATED -o 127.0.0.1 --dport 50006 -j ACCEPT
iptables -A FORWARD -p tcp -m state --state NEW,ESTABLISHED,RELATED -o 172.18.1.40 --dport 50006 -j ACCEPT
Any advice is welcome.
Last edited by mpapet; 06-04-2008 at 05:58 PM.
|