Your Gateway to a Career in Network Engineering
Module 6: Firewall Operations and Basic Rule Configuration
A **firewall** is a network security device that monitors and controls incoming and outgoing network traffic based on predetermined security rules. It acts as a barrier between a trusted internal network and an untrusted external network, such as the Internet. Think of it as a security checkpoint at a country's border: it inspects every person (packet) trying to cross and decides whether to allow or deny them based on a strict set of rules.
The Power of Stateful Inspection
Early firewalls were "stateless," meaning they inspected every packet in isolation. Modern firewalls are **stateful**. This is the single most important concept in firewall operations.
Analogy: A Stateful Phone Call
Imagine your firewall is a receptionist for a secure building.
- An employee inside the building (**trusted network**) wants to call a client outside (**untrusted network**).
- The employee tells the receptionist, "I am calling this number." The receptionist notes this down in a "state table" and connects the call.
- When the client calls back, the receptionist checks the state table. They see an existing, approved conversation and immediately let the return call through.
- If a random stranger calls, the receptionist sees no existing connection in their state table and **blocks the call by default.**
This is how a stateful firewall works. It tracks active connections (like TCP sessions) and automatically allows the return traffic for connections that were initiated from the inside, without needing a specific "allow" rule for it.
The Anatomy of a Firewall Rule
A firewall's rulebase is a list of rules processed from top to bottom. As soon as a packet matches a rule, the firewall takes action and stops processing. Each rule typically consists of five components:
- Source: The IP address or network where the traffic is coming from.
- Destination: The IP address or network where the traffic is going.
- Port/Service: The TCP or UDP port number, which identifies the application (e.g., Port 80 for HTTP, Port 443 for HTTPS).
- Protocol: The transport protocol being used (e.g., TCP, UDP, ICMP).
- Action: What to do with the matching traffic (usually
PermitorDeny).
The Golden Rule: Deny by Default
The single most important principle in firewall configuration is to build a **"deny by default"** policy. This means that your last rule is an invisible "deny all" rule. You only create specific rules to **permit** the exact traffic your business needs, and everything else is blocked. This is much more secure than an "allow all" policy where you try to create specific rules to block bad traffic.
Example Firewall Rulebase
Let's consider a small office with an internal LAN (192.168.1.0/24) and a public web server in a DMZ (10.0.0.10). Here is a simplified example of their firewall rules.
| Rule # | Source | Destination | Service/Port | Action | Description |
|---|---|---|---|---|---|
| 1 | Any | Web Server DMZ (10.0.0.10) | HTTP (80), HTTPS (443) | Permit | Allow external users to browse our public website. |
| 2 | Internal LAN (192.168.1.0/24) | Any | Any | Permit | Allow our internal employees to access the internet. |
| 3 | Any | Any | Any | Deny | (Implicit Rule) Block all other traffic that did not match the rules above. |
Understanding Network Zones
Firewalls don't just think in terms of IP addresses; they group interfaces into **zones** to make rule creation easier. The three most common zones are:
- Inside / Trusted: Your internal corporate LAN. Traffic originating from here is generally trusted.
- Outside / Untrusted: The public internet. Traffic originating from here is never trusted.
- DMZ (Demilitarized Zone): A special, isolated network where you place public-facing servers (like web and email servers). Devices in the DMZ can be accessed from the internet, but they cannot initiate connections to the inside network.