To test if your computer firewall is protecting you on the internet, see this post.
Ubuntu installs a firewall when you install it to your computer. However, the firewall is not active. To activate the firewall, open a terminal window on your system, then enter the commands in italics as shown below:
$ sudo ufw enable <enter>
To disable the firewall, enter the following command in a terminal windows:
$ sudo ufw disable <enter>
ufw is the command used to enable the firewall.
To verify that the firewall has been enabled, enter the following command in a terminal window:
$ sudo iptables -L <enter>
Once you have activated your firewall, see this post.