Page 1 of 1

DNAT rules does not work

Posted: 24 Sep 2014, 22:15
by vktechnology
Hello

1) When I turn off CSF and run this command manually everything is working fine.

Code: Select all


iptables -t nat -A POSTROUTING -s 192.168.100.0/30 -j SNAT --to-source 5.175.xx.xx

iptables -t nat -A PREROUTING -p tcp -d 5.175.xx.xx --dport 80 -j DNAT --to-destination 192.168.100.2:80
iptables -A FORWARD -p tcp -d 192.168.100.2 --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
2)When I put above code in to csfpre or csfpost file and start CSF and does not work.
What is values should I put to make it work ?

3) iptables -t nat -L -n -v

Code: Select all

root@EU [/etc/csf]# iptables -t nat -L -n -v
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            5.175.194.121       tcp dpt:80 to:192.168.100.2:80 

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 SNAT       all  --  *      *       192.168.100.0/30     0.0.0.0/0           to:5.175.194.121 

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination    

Re: DNAT rules does not work

Posted: 26 May 2015, 04:48
by nodje
Hi,

I've got the exact same problem, did you solve it?