Ubuntu doesn't have a firewall turned on by default in the basic installation.
If you need a firewall, I recommend using gufw to turn it on and manage it:
gufw![Install gufw]()
Gufw is an easy, intuitive, way to manage your Ubuntu firewall, powered by ufw.
It supports common tasks such as allowing or blocking pre-configured services, common P2P, or individual IP/port(s), and many others!