Gufw is a very efficient and easy-to-configure firewall for Linux. Leaving aside IPTables that used to be distributed with all distributions, it seems like this firewall has managed to gain the general trust of the users due to its power and simplicity.
Protect Ubuntu with this Firewall
As with all the firewalls, Gufw will allow us to configure each application that we allow to connect to the Internet, as well as denying incoming or outgoing connections to whoever we want. This may not be as necessary in Linux as in Windows, but even when viruses aren't such a big problem, all protection comes in handy if the PC that we're protecting contains important data.
This firewall is developed to be used together with many P2P programs because it includes certain presets for them, thus, we can provide it with some BitTorrent clients that it will automatically know how to deal with (which ports it has to open and the connections that it has to allow).
Gufw works on Ubuntu without any problems and it will help you to obtain a much more secure system, avoiding programs that connect to the Internet without any sense or incoming connections from unknown places.