Using Firewall With UFW in Ubuntu
Ubuntu comes with UFW (Uncomplicated Firewall) installed by default.
It is called uncomplicated firewall because it makes things a lot easier than using something iptables or nftables for creating firewall rules.
But this doesn't mean that there is no learning curve involved. You do need to learn how to use it.
This here is a collection of tutorials and tips that will help you better understand and use UFW on Ubuntu.