A firewall protects your LAN from the outside world while filtering packets and allowing selected Internet or WAN traffic through.
Linux Firewall – What is a firewall, iptables, ports, NAT, IP forwarding
How to setup a Linux firewall using a script and iptables
How to stop iptables logging to the console