LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Can't add a Port address translation rule (https://www.linuxquestions.org/questions/linux-security-4/cant-add-a-port-address-translation-rule-4175439073/)

Tekiano 11-28-2012 01:05 AM

Can't add a Port address translation rule
 
Hi All,

I try since two days to redirect traffic coming in a port to another address and port, the problem is that iptables returns me :
Code:

iptables: No chain/target/match by that name.
I use linux kernel 2.6.39
iptables version iptables v1.4.12

here the rules
Code:

iptables -v -t nat -D PREROUTING -p tcp --dport 80 -j DNAT --to-dest
ination 192.168.0.3:81
DNAT  tcp opt -- in * out *  0.0.0.0/0  -> 0.0.0.0/0  tcp dpt:80 to:192.168.0.3:81
iptables: No chain/target/match by that name.

Does any one Know which option I have to activate in the kernel to resolve this ?

Thank you

eSelix 11-28-2012 04:00 AM

Option "-D" means to delete specific rule, you want to use option "-I PREROUTING" or "-A PREROUTING" to add new rule. Remember also to enable forwarding on this machine, by for example:
Code:

echo 1 > /proc/sys/net/ipv4/ip_forward

Tekiano 11-28-2012 04:43 AM

Thank you eSelix, this fixes my problem.


All times are GMT -5. The time now is 09:06 AM.