Always use a hardware-based or software-based firewall on computers connected to the Internet. Ubuntu has a firewall application installed by default named Uncomplicated Firewall (UFW). This tool enables you to implement selective or restrictive policies regarding access to your computer or LAN.
UFW is run from the terminal, and you must have administrative privileges to use it. Commands are given like this:
matthew@seymour~:$ sudo ufw status
The most useful commands are listed in Table 19.1. For others, the UFW man page. Many are described in greater detail after the table.