A firewall is a network security device that filters incoming and outgoing network traffic based on an organization's previously established security policies. It can block or allow traffic based on various criteria, such as IP address, port, and protocol. Here's a simple example of configuring a basic firewall rule in a Linux system using iptables:
# Allow incoming traffic on port 80 (HTTP)
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# Block all other incoming traffic
sudo iptables -A INPUT -j DROP