I was trying to make my server's firewall redirect port 8080/TCP to port 80/TCP. This is simply done by adding the lines before the COMMIT line to create a new *nat
*nat
:PREROUTING ACCEPT [0:0]
-A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-port 80
However, after disabling and trying to enable ufw, I got this error
ERROR: problem running ufw-init Bad argument
*nat' Error occurred at line: 75 Tryiptables-restore -h' or 'iptables-restore --help' for more information.
I had also enabled port forwarding in /etc/sysctl.conf file by uncommenting the line #net.ipv4.ip_forward=1
-- before #net.ipv4.ip_forward=1
--after net.ipv4.ip_forward=1
Therefore, this is not the problem.
No, its done after the COMMIT line, put it after the COMMIT line, add another COMMIT
disable ufw, enable ufw, and you good to go