knowledge

Overview

Firewalls are network security devices or software that monitor and control incoming and outgoing network traffic based on predetermined security rules. They act as a barrier between trusted internal networks and untrusted external networks, preventing unauthorized access while allowing legitimate communications. Firewalls can be hardware-based, software-based, or cloud-hosted.


Terminology

TermDefinition
Stateless FirewallFilters packets independently based on rules; does not track connection state
Stateful FirewallTracks active connections in a state table; permits packets based on connection history
Proxy FirewallActs as intermediary between clients and servers; can filter content at the application layer
NGFW (Next-Generation Firewall)Combines traditional firewall with application awareness, IPS, and deep packet inspection
DMZ (Demilitarized Zone)Network segment exposed to untrusted networks but isolated from internal infrastructure
Ruleset / PolicySet of security rules defining what traffic is allowed or blocked
NAT (Network Address Translation)Translates private IP addresses to public ones; hides internal addressing
DPI (Deep Packet Inspection)Examines packet payload content beyond headers to detect threats
IPS (Intrusion Prevention System)Detects and actively prevents malicious network activity
WAF (Web Application Firewall)Sits between web requests and the web server; protects against application-layer attacks
State TableRecord of active connections maintained by a stateful firewall
NetfilterCore Linux kernel framework providing packet filtering, NAT, and connection tracking

Core Concepts

Firewall Types

TypeOSI LayerDescription
Stateless FirewallLayer 3–4Filters packets on predefined rules only; no connection tracking; fast but limited
Stateful FirewallLayer 3–4Tracks active connections; automatically permits subsequent packets on established sessions
Hardware FirewallPerimeterDedicated appliance placed at the network perimeter
Software FirewallHostInstalled on endpoints or servers; manages traffic locally
Cloud FirewallCloudHosted firewall service for SaaS and hybrid network environments
Proxy FirewallLayer 7Acts as intermediary; inspects content; masks internal IPs
NGFWLayer 3–7Deep packet inspection, IPS, heuristic analysis, SSL/TLS decryption, threat intelligence

Firewall Rules

Rules define which traffic is allowed or blocked. Each rule contains:

ComponentDescription
Source AddressOrigin of the traffic
Destination AddressTarget system or network
PortNetwork port number
ProtocolCommunication protocol (TCP, UDP, ICMP, etc.)
ActionAllow, Deny, or Forward
DirectionInbound, Outbound, or Forwarded
ActionDescription
AllowPermit the traffic through
DenyBlock the traffic
ForwardRedirect traffic to another network segment

Advanced Features

  • Deep Packet Inspection (DPI) — examines payload content for embedded threats
  • Intrusion Prevention System (IPS) — detects and prevents malicious activity in real time
  • VPN Support — allows secure remote access through encrypted tunnels
  • Logging and Alerts — records firewall activity for auditing and security monitoring

Network Placement

  • Firewalls are placed at the network perimeter between internal and external networks
  • A DMZ isolates public-facing services (e.g., web servers) from the internal network
  • Defense-in-depth strategies layer multiple firewalls at different network segments

Linux Firewalls

The Linux kernel uses the Netfilter framework as the foundation for all firewall utilities.

Netfilter Hierarchy

  • Provides packet filtering, NAT, and connection tracking
  • All Linux firewall tools build on top of Netfilter
ToolDescription
iptablesWidely used tool built on Netfilter; long-standing standard
nftablesSuccessor to iptables; enhanced filtering and NAT capabilities
firewalldBuilt on Netfilter; provides predefined rules and network zones
ufwUncomplicated Firewall; simplifies rule creation by wrapping iptables


References / Images

  • Netfilter Hierarchy
  • Networking textbooks, vendor documentation, security best practices
  • Official Linux firewall documentation (iptables, nftables, ufw man pages)