A firewall is a device or set of devices designed to permit or deny network transmissions based upon a set of rules and is frequently used to protect networks from unauthorized access while permitting legitimate communications to pass.
Many personal computer operating systems include software-based firewalls to protect against threats from the public Internet. Many routers that pass data between networks contain firewall components and, conversely, many firewalls can perform basic routing functions.
The purpose of the firewall is to moderate traffic and/or log it. Most firewall are made for moderating ip traffic and are called ip firewalls.
The simplest ip firewall has two physical interfaces normally referred to as inside (LAN) and outside (WAN, the internet). It has two main access control lists (ACL) - e.g. named inside2outside and outside2inside.