Port forwarding with iptables is not working?!!
Hello,
I have a problem with iptables port forwarding.
I read a lot of documents and questions about that.
I also checked everything about that in the forum but it's nerver work.
I would like to forward all data from 10.1.1.53:1240 to 10.1.1.240:9000.
I'm using redhat 9.
I added some rules with a script :
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d 10.1.1.53 --dport 1240 -j DNAT --to 10.1.1.240:9000
/sbin/iptables -A FORWARD -p tcp -i eth0 -d 10.1.1.240 --dport 9000 -j ACCEPT
and I modified the file /etc/sysctl.conf --> # Controls IP packet forwarding
net.ipv4.ip_forward = 1
After restarting the network and iptables I have the following status.
[root@localhost init.d]# ./iptables status
Table: nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- anywhere 10.1.1.53 tcp dpt:1240 to:10.1.1.240:9000
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Table: filter
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere 10.1.1.240 tcp dpt:9000
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
But the IP forwarding is not working.
I also tried a lot of different configurations.
Where is the problem?
I'm going to become crazy!!!
Thanks a lot in advance for your help.
Alain.
|