Firewall
Generally a firewall allows finer grain control about the connections made in and out of your computer. For a normal computer, this normally means block all incoming connections, and allow outgoing. For servers, this normally means block all incoming except for these ports from these IPs.
ufw
A simpler firewall manager. More information here
gufw
Graphical Front end for the ufw firewall 1. Install gufw 2. Open gufw 3. Click on the status slider to turn it on. 4. This will block other computers on the network from making connections into your machine.
iptables
"traditional userspace utility for managing a firewall" - Arch Wiki
Some docs here here and here for some explanation on how to use.
Other
See more here