1

I want to apply this iptables rule:

 iptables -t nat -A PREROUTING -d 87.13.180.182 -j DNAT --to-destination 192.168.0.13

(87blabla is my public ip and 192blabla is my private ip).

People suggested me to use ufw instead iptables since it's easier to use.

So I:

1) Set DEFAULT_FORWARD_POLICY="ACCEPT" on /etc/default/ufw
2) Set net.ipv4.ip_forward=1 on /etc/ufw/sysctl.conf
3) Created the NAT table and added my rule on /etc/ufw/before.rules

//Nat table
*nat
:POSTROUTING ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]

//Nat rule
PREROUTING -d 87.13.180.182 -j DNAT --to-destination 192.168.0.13

But it doesen't work when i run ufw disable && ufw enable (error on that line).

1

Try:

-A PREROUTING -i eth0 -p tcp -m tcp -d 87.13.180.182 -j DNAT –to-destination 192.168.0.13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.