Configuring NAT with ufw instead iptables

11,740

Try:

-A PREROUTING -i eth0 -p tcp -m tcp -d 87.13.180.182 -j DNAT –to-destination 192.168.0.13
Share:
11,740

Related videos on Youtube

Removed
Author by

Removed

Updated on September 18, 2022

Comments

  • Removed
    Removed over 1 year

    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).