[CentOS] iptables nat PREROUTING chain

Tue Feb 14 20:21:24 UTC 2012
Nataraj <incoming-centos at rjl.com>

Is there a way to add a rule to the nat table (CentOS 5.7) that would
alter the port number of tcp packets destined for the server itself?  I
have ip_forwarding enabled, but the packets don't seem to hit the
prerouting chain.

I have the following redirect rule in the prerouting table.  I also
tried DNAT, but if the packets don't hit PREROUTING, it won't work either.

iptables -t nat -L -v -n
Chain PREROUTING (policy ACCEPT 16079 packets, 896K bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 REDIRECT   tcp  --  *      *       10.10.10.0/24           0.0.0.0/0           tcp dpt:25 redir ports 12345 


aspen 2# cat /proc/sys/net/ipv4/ip_forward 
1



Thanks,
Nataraj