How Firewalls Filter and Control Network Traffic

A firewall is a network security device or service that monitors incoming and outgoing traffic and allows or blocks it according to a defined security policy. It sits at the boundary between networks — typically between a trusted internal network and untrusted external ones like the internet — and enforces rules about which connections are permitted, forming the first and most fundamental layer of network defense.

The firewall is the oldest and most universal network security control, and it remains foundational even as the perimeter it once guarded has dissolved. What has changed is not whether organizations need firewalls, but what a firewall must now be: no longer a static gate at a single edge, but a distributed, application-aware, identity-conscious policy engine that follows workloads into the cloud.

01 — OVERVIEW

What is a firewall?

At its core, a firewall is a filter for network traffic. It inspects packets or connections against a rule set — an ordered list of policies stating which sources, destinations, ports, protocols, applications, and users are allowed or denied — and permits, drops, or rejects traffic accordingly. Everything not explicitly allowed is, in a well-configured firewall, denied by default.

The concept dates to the late 1980s, when the first packet-filtering firewalls appeared to separate trusted networks from the emerging internet. The technology has since passed through several generations — stateful inspection, application-layer proxies, and today's next-generation firewalls — each adding depth as threats moved up the stack from packets to applications to encrypted content.

The enduring idea is segmentation of trust: a firewall draws a boundary and enforces policy across it. Historically that boundary was the network perimeter — inside trusted, outside untrusted. Modern security recognizes that a single perimeter is no longer enough (a compromised internal device is "inside" the wall), which is why firewalls now appear not only at the internet edge but between internal segments, around cloud workloads, and as software services — and why they increasingly operate under Zero Trust assumptions rather than implicit internal trust.

02 — HOW IT WORKS

How does a firewall work?

A firewall applies its policy to traffic through a consistent process:

  1. Traffic interception. All traffic crossing the boundary the firewall guards is routed through it; nothing bypasses the filter.
  2. Inspection. The firewall examines each packet or connection. Depending on its generation, this ranges from header fields (source/destination IP, port, protocol) to connection state, to the actual application and content inside the payload.
  3. Rule matching. The traffic is evaluated against the ordered rule set, top to bottom, until it matches a rule.
  4. Action. The matched rule's action is applied — allow (permit the traffic), deny/drop (silently discard), or reject (discard and notify the sender). Advanced firewalls add actions like inspect, log, rate-limit, or redirect.
  5. State tracking. Stateful firewalls record active connections so that return traffic for an allowed session is automatically permitted, without a separate rule, and unexpected packets are dropped.
  6. Logging & telemetry. The decision is logged for monitoring, compliance, and investigation — firewall logs are a primary source of network security evidence.

03 — TYPES

Types of firewalls

Firewalls are commonly described by generation, each adding inspection depth: Explore COSGrid NGFW

Type
Packet-filtering (stateless)
Stateful inspection
Proxy / application-layer gateway
Next-Generation Firewall (NGFW)
Firewall-as-a-Service (FWaaS)
Inspects
Individual packet headers (IP, port, protocol)
Connection state + headers
Full application-layer content, as an intermediary
App, user, content, threats — plus stateful base
Same as NGFW, delivered from the cloud
Strength
Fast, simple, low overhead
Tracks sessions; blocks unexpected packets
Deep inspection; hides internal hosts
Application/user awareness, IPS, TLS inspection
Elastic, location-independent, follows the user
Limitation
No connection context; blind to payload
Still limited visibility into application content
Latency; per-protocol proxies
More compute; requires tuning
Data-path and trust considerations

04 — NGFW

What is a Next-Generation Firewall (NGFW)?

A Next-Generation Firewall (NGFW) combines the stateful firewall's connection control with deeper, higher-layer capabilities that a traditional firewall lacks. Gartner's original definition centered on integrated intrusion prevention and application awareness; in practice a modern NGFW typically provides:

  • Application awareness and control — identifying and governing traffic by application (e.g., "allow Salesforce, block BitTorrent") regardless of port, rather than by port number alone.
  • User-identity integration — writing policy by user and group via directory integration, not just IP address.
  • Integrated intrusion prevention (IPS) — detecting and blocking known exploits and attack patterns inline.
  • Deep packet inspection and TLS/SSL inspection — examining payloads, including decrypting encrypted traffic where policy allows, to see the threats that hide in HTTPS.
  • Threat intelligence — consuming reputation and threat feeds to block known-malicious destinations and indicators.
  • Advanced malware detection — sandboxing or content analysis for files traversing the firewall.

05 — ARCHITECTURE

Firewall architecture & deployment models

Where and how a firewall runs shapes what it can protect and how it scales.

Hardware appliance

A purpose-built physical device at the network edge or between segments. Hardware firewalls — often using specialized ASICs for throughput — deliver high performance for datacenter and campus edges. The trade-offs are capital cost, capacity planning, physical placement, and a refresh cycle tied to hardware; they also protect only the traffic that physically passes through them.

Virtual firewall

The same firewall software running as a virtual appliance in a hypervisor or cloud. Virtual firewalls bring firewalling to virtualized datacenters and public clouds where you can't rack hardware, and enable segmentation between virtual workloads. Performance depends on the host rather than dedicated silicon.

Cloud firewall / Firewall-as-a-Service (FWaaS)

The firewall is delivered as a cloud service, inspecting traffic at distributed points of presence rather than at a fixed appliance. FWaaS decouples firewalling from physical location: policy follows users and workloads wherever they are, scales elastically, and is a core component of the SASE framework. The consideration buyers weigh is the same as for any cloud-delivered security: where traffic is inspected, who operates that infrastructure, and where the data and logs reside — first-order questions under data-sovereignty and localization requirements.

Distributed / host & workload firewalls

Firewalls also run on individual hosts and workloads (host-based firewalls, and cloud security groups), enforcing policy at each endpoint. Combined with segmentation, this pushes firewalling down to the workload level — essential for Zero Trust and east-west control inside a network, not just at its edge.

Model
Hardware appliance
Virtual
FWaaS / cloud
Host / workload
Runs as
Physical device (often ASIC)
VM in hypervisor/cloud
Cloud service across PoPs
Agent on host / security group
Strength
High throughput at fixed edges
Cloud & datacenter segmentation
Elastic, follows users, SASE-native
East-west, Zero Trust control
Consideration
Capex, capacity, refresh, physical scope
Performance depends on host
Data-path custody & sovereignty
Management at scale

06 — COMPARISON

Firewall vs SWG vs IDS/IPS vs WAF vs ZTNA

Firewalls are constantly confused with adjacent controls. Each has a distinct job.

Firewall vs Secure Web Gateway (SWG).

A firewall governs network connections across all ports and protocols; an SWG specializes in outbound web and SaaS traffic, with deep URL categorization, TLS inspection at scale, and web DLP. NGFWs include some web filtering and SWGs include firewall functions, but the firewall is the general network gatekeeper while the SWG is the web-traffic specialist. In SASE they converge. Explore COSGrid Secure Web Access

Firewall vs IDS/IPS.

An IDS (Intrusion Detection System) monitors traffic and alerts on suspicious activity; an IPS (Intrusion Prevention System) goes further and blocks it inline. Modern NGFWs integrate IPS as a feature. The distinction: a firewall's default job is policy-based allow/deny of connections; IPS/IDS focus on detecting and stopping attack patterns within allowed traffic. They are complementary and, in NGFWs, combined.

Firewall vs WAF.

A Web Application Firewall (WAF) protects a specific web application from application-layer attacks (SQL injection, XSS, and the OWASP Top 10) by inspecting HTTP requests to that app. A network firewall protects the network. A WAF sits in front of your web servers/APIs; a firewall sits at network boundaries. You typically need both, for different assets.

Firewall vs ZTNA.

A firewall enforces policy at network boundaries, historically trusting what's already inside. ZTNA grants per-application, identity-verified access with no implicit trust, and keeps applications invisible to the network. They aren't substitutes: ZTNA modernizes user-to-application access, while firewalls (especially as segmentation and FWaaS) enforce network-level policy. In a Zero Trust architecture both appear, with the firewall increasingly used for internal segmentation rather than a single trusted perimeter. Explore COSGrid MicroZAccess (ZTNA)

Technology
Firewall / NGFW
SWG
IDS/IPS
WAF
ZTNA
Protects
The network
Web & SaaS access
Traffic integrity
A web app/API
Private app access
Layer / object
Connections, apps, users
Outbound web transactions
Attack patterns in flows
HTTP requests to that app
User→app sessions
Core question
"Is this connection allowed?"
"Is this web transaction safe?"
"Is this an attack?"
"Is this request malicious to my app?"
"Should this user reach this app?"

07 — ZERO TRUST

Firewalls, segmentation & Zero Trust

The single-perimeter model — hard shell, soft interior — fails against attackers who get inside, because everything internal is implicitly trusted and lateral movement is unimpeded. Modern architecture responds with segmentation: using firewalls (and microsegmentation) to divide the network into zones and enforce policy between them, so a breach in one segment can't spread freely.

This aligns firewalling with Zero Trust, which grants no implicit trust by network location. Under Zero Trust, firewall policy becomes identity- and context-aware and is enforced not just at the edge but pervasively — between segments, around workloads, and at hosts. The firewall's role shifts from "guard the one gate" to "enforce least-privilege network policy everywhere," complementing ZTNA (which handles application access) and NAC (which handles device admission). The firewall doesn't disappear in Zero Trust — it multiplies and moves inward.

08 — USE CASES

Common firewall use cases

Perimeter defense

Controlling traffic between the internal network and the internet.

Network segmentation

Isolating zones (production, corporate, guest, OT) to contain breaches and limit lateral movement.

Datacenter and cloud workload protection

Enforcing policy around servers and cloud instances, north-south and east-west.

Branch and multi-site security

Consistent policy across distributed locations, increasingly delivered as FWaaS/SASE.

Threat prevention (NGFW)

Blocking exploits, malware, and malicious destinations inline via IPS and threat intelligence.

Application and user control

Allowing sanctioned apps and users while blocking risky ones, by identity rather than IP.

Compliance

Enforcing and evidencing access controls required by PCI-DSS, HIPAA, RBI, SEBI CSCRF, and similar regimes.

Remote-access and VPN termination

Historically, though this role is increasingly served by ZTNA.

09 — LIMITATIONS

Limitations & what a firewall does not do

A firewall is essential but not sufficient. Honest constraints:

  • It doesn't secure what bypasses it. Traffic that doesn't cross the firewall — internal lateral movement inside a flat segment, or a user on a coffee-shop network reaching SaaS directly — is outside its view unless firewalling is distributed.
  • Perimeter firewalls trust the interior. Without segmentation and Zero Trust, a firewall implicitly trusts everything inside, which attackers exploit after initial access.
  • It is not a complete security stack. Firewalls complement — don't replace — endpoint protection (EDR), web security (SWG), application security (WAF), data protection (DLP), and detection/response (NDR).
  • Encrypted traffic requires deliberate inspection. Without TLS inspection, an NGFW is blind to threats inside HTTPS; with it, there's compute cost and edge cases to manage.
  • Misconfiguration is the dominant real-world risk. Overly permissive rules, stale entries, and rule-order mistakes cause more incidents than firewall "bypass." Firewalls are only as good as their rule hygiene.
  • Appliance capacity is finite. Hardware firewalls must be sized for peak load and TLS-inspection overhead; undersized appliances become bottlenecks or get inspection disabled to keep up.

10 — BEST PRACTICES

Firewall best practices

  1. Default deny. Permit only what's explicitly required; block everything else. Every allow rule should have a documented business justification.
  2. Least privilege, by identity and application. Write rules scoped to specific users, groups, and applications — not broad any-any rules or IP ranges that outlive their purpose.
  3. Segment the interior. Don't rely on a single perimeter. Use internal firewalling/microsegmentation to contain breaches and enforce Zero Trust between zones.
  4. Keep the rule base clean. Regularly review and remove stale, shadowed, and overly permissive rules; rule sprawl is the top source of firewall risk. Audit rule order.
  5. Turn on threat prevention and TLS inspection deliberately. Enable IPS and, where policy and privacy allow, TLS inspection — staged, with sensitive-category exclusions — so the NGFW can actually see modern threats.
  6. Patch on a disciplined cadence. Firewalls are internet-facing security infrastructure; unpatched firewall vulnerabilities are a prized attacker target. Track and apply security fixes promptly, and factor vendor patch responsiveness into selection.
  7. Log, monitor, and integrate. Send firewall logs to your SIEM/NDR, alert on anomalies, and use the firewall as both an enforcement point and a telemetry source.
  8. Plan the data path for compliance. For cloud/FWaaS models, decide deliberately where inspection happens and where logs live, in line with data-localization obligations.

11 — COSGRID FIT

How COSGrid NexusShield implements the modern firewall

COSGrid NexusShield is COSGrid's next-generation firewall (NGFW / FWaaS) — the network-security enforcement plane of the COSGrid fabric. It applies the principles above with a design bias toward convergence, trustworthy operation, and sovereignty rather than treating the firewall as an isolated box at a single edge.

Next-generation, delivered flexibly.

NexusShield provides stateful inspection with application- and user-aware policy, integrated intrusion prevention, deep packet and TLS inspection, and threat intelligence — deployable as a virtual appliance, in the cloud, or as part of a distributed FWaaS footprint, so policy reaches datacenter, branch, and cloud workloads.

Converged on one plane with SD-WAN, ZTNA, NAC, and SWG.

NexusShield isn't a standalone product bolted onto separate connectivity and access tools. It shares the COSGrid fabric with ReFleX-WAN (SD-WAN), MicroZAccess (Mesh ZTNA), ZT-NAC (NAC), and SecureWebAccess (SWG) — one policy model, one console, one telemetry stream — so segmentation, threat prevention, access, and connectivity are governed together rather than stitched across four vendors' clouds.

Self-hostable and sovereignty-ready.

NexusShield can be deployed so that inspection and logs stay inside a customer-controlled footprint or sovereign region — directly addressing the DPDP Act, RBI localization, and SEBI CSCRF expectations that multi-tenant-only cloud firewalls struggle to meet. (Positioning note: this is a trust-and-sovereignty wedge, not a claim to out-perform dedicated ASIC hardware or to undercut incumbents on price.)

Built for multi-branch, regulated networks.

Consistent firewall and segmentation policy across many sites, with the logging and audit evidence that regulated NBFC and enterprise environments require — the profile behind COSGrid's converged multi-branch deployments.

Telemetry that feeds detection.

As part of a converged fabric, NexusShield's traffic visibility can inform COSGrid's broader detection stack — distinct from, and complementary to, NetShield (COSGrid's NDR).

12 — FAQS

Frequently asked questions

What is a firewall in simple terms?

A firewall is a security guard for network traffic. It sits between your network and others (like the internet), checks every connection against a set of rules, and allows or blocks it — permitting legitimate traffic while keeping unauthorized or malicious traffic out.

What are the main types of firewalls?

The main generations are packet-filtering (stateless), stateful inspection, proxy/application-layer, and next-generation firewalls (NGFW). Deployment types include hardware appliances, virtual firewalls, cloud firewalls/FWaaS, and host-based firewalls. Each adds inspection depth or flexibility.

What is the difference between a stateful and stateless firewall?

A stateless firewall inspects each packet in isolation against static rules. A stateful firewall tracks active connections, so it understands which packets belong to established sessions and automatically allows legitimate return traffic while dropping packets that don't fit. Stateful is the modern baseline.

What is a next-generation firewall (NGFW)?

An NGFW adds application awareness, user-identity policy, integrated intrusion prevention, deep packet and TLS inspection, and threat intelligence to the stateful firewall base. It exists because modern threats hide inside allowed applications and encrypted traffic that a port-based firewall can't see.

What is the difference between a firewall and a Secure Web Gateway?

A firewall controls network connections across all ports and protocols. An SWG specializes in outbound web and SaaS traffic — URL filtering, TLS inspection, and web DLP. NGFWs and SWGs overlap and converge in SASE, but the firewall is the general gatekeeper and the SWG is the web specialist.

What is the difference between a firewall and an IPS?

A firewall's primary job is allowing or blocking connections by policy. An IPS (Intrusion Prevention System) inspects allowed traffic for attack patterns and blocks exploits inline. Modern NGFWs integrate IPS as a feature, so they're complementary rather than competing.

Is a firewall enough for network security?

No. A firewall is foundational but not complete. Effective security layers it with endpoint protection (EDR), web security (SWG), application security (WAF), detection and response (NDR), access controls (ZTNA, NAC), and — critically — network segmentation and Zero Trust rather than a single trusted perimeter.

What is Firewall-as-a-Service (FWaaS)?

FWaaS delivers next-generation firewall capabilities from the cloud instead of a fixed appliance, inspecting traffic at distributed points of presence so policy follows users and workloads. It's a core SASE component; the key evaluation questions are where traffic is inspected and where data and logs reside.

We are here with you to help what suits your organization