How to mangle iptables?


How do I add mangle iptable firewall rules? Like I have the rules I just don’t know the commands… I need apt install iptables first yeah? Then how do I get the rules input?
/sbin/iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
Is that correct cause I just tried that before and it locked me out the server and I had to rebuild the os from scratch lol After fluishing the rules I made before hand I mean

Install SoftEther VPN Server [Ubuntu]

What are you trying to do with iptables ? It looks like you’re dropping all inbound traffic with that command. If you’re new to using firewalls on Ubuntu, I suggest using ufw (Uncomplicated Firewall) since it’s much less complicated, unless you run into a situation where you need iptables .

First and foremost, you’ll need to allow ssh access to your machine before enabling the firewall, as you’ll end up locking yourself out. If you’re running your ssh server on port 22, you can just do ufw allow 22/tcp and you’ll be good to go for ssh. Then ufw enable to enable the firewall.