I want to apply this iptables rule:

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

(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 rule
PREROUTING -d -j DNAT --to-destination

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



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

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.