Free tech learning for everyone, from basics to pro

Network SecurityNetworking SecurityAdvanced

Zone-based policy firewall on Cisco IOS: zones, zone pairs and inspection policies

In short: A zone-based policy firewall turns a Cisco router into a stateful firewall. Interfaces are placed in zones, traffic between zones is dropped unless a zone-pair policy allows it, and the inspect action tracks sessions so replies come back automatically. Class maps choose traffic and policy maps decide what happens.

Why zones?

Access control lists on a router filter packets one at a time and must be written for every interface and direction. In a small branch or lab, you often want the router itself to act as a stateful firewall, so that replies to inside users are allowed back automatically while new connections from the internet are blocked. Cisco IOS provides this with the zone-based policy firewall (ZPF), which replaced the older Context-Based Access Control (CBAC).

Instead of thinking about interfaces, you think about zones of trust, such as INSIDE, OUTSIDE and DMZ, and write policies for traffic moving from one zone to another.

The default rules

  • Traffic between two interfaces in the same zone is allowed.
  • Traffic between different zones is dropped unless a zone pair with a policy allows it.
  • An interface that is in a zone cannot talk to an interface that is in no zone. Once you start, put every interface in a zone.
  • The self zone is the router itself (management, routing protocols). Traffic to and from it is allowed until you define a zone pair that involves it.
  • Policies are one-way. A zone pair from INSIDE to OUTSIDE does not allow new sessions from OUTSIDE to INSIDE.

The building blocks

Building a zone-based firewallZonesINSIDE,OUTSIDEClass mapwhich trafficPolicy mapinspect, pass,dropZone pairfrom, toInterfacesjoin zones
Figure 1. The five building blocks of a Cisco IOS zone-based policy firewall, in the order you usually configure them.
ElementPurpose
class-map type inspectMatches traffic by protocol or ACL, for example HTTP, HTTPS and DNS.
policy-map type inspectGives each class an action: inspect (stateful, allows replies), pass (one direction only, no state) or drop.
zone-pair securityNames a source zone and destination zone and attaches the policy.
zone-member securityPuts an interface into a zone.

A simple configuration

This example lets inside users browse the web and use DNS, and drops and logs everything else from inside to outside. Return traffic is allowed because the action is inspect.

zone security INSIDE
zone security OUTSIDE
!
class-map type inspect match-any WEB-DNS
 match protocol http
 match protocol https
 match protocol dns
!
policy-map type inspect IN-TO-OUT
 class type inspect WEB-DNS
  inspect
 class class-default
  drop log
!
zone-pair security IN-OUT source INSIDE destination OUTSIDE
 service-policy type inspect IN-TO-OUT
!
interface GigabitEthernet0/0
 zone-member security INSIDE
interface GigabitEthernet0/1
 zone-member security OUTSIDE

Check the result with these commands:

show zone security
show zone-pair security
show policy-map type inspect zone-pair sessions

Tip: if you add a DMZ zone for a web server, you need a separate zone pair from OUTSIDE to DMZ that inspects only HTTPS to the server's address, and you never need a pair from DMZ to INSIDE for normal operation.

Real-world example: a branch office router

A charity's branch office had a single router connecting eight staff PCs to a broadband line, with only an outbound NAT and no filtering. During a review, the IT volunteer configured INSIDE and OUTSIDE zones with an inspect policy for web, DNS, email submission and the head office VPN, and a drop-and-log default. When a PC later tried to reach an unusual port on the internet, the router logs showed the drops, which led the team to an unwanted remote-control tool that was then removed. The same router also kept its SSH access restricted by adding a self-zone policy for management.

Practice

Two interfaces are both in the INSIDE zone. Is traffic between them allowed by default?
Yes. Traffic within the same zone is allowed unless you configure otherwise.
What is the difference between inspect and pass?
Inspect tracks the session so return traffic is allowed automatically; pass allows traffic in one direction only with no state, so you would need a matching rule for replies.
After you put Gi0/0 in a zone, users on Gi0/2 (not in any zone) cannot reach Gi0/0. Why?
A zoned interface cannot exchange traffic with an interface that is not in any zone. Gi0/2 must be assigned to a zone.

Key takeaways

  • ZPF turns a Cisco router into a stateful firewall based on zones of trust.
  • Same-zone traffic is allowed; traffic between zones is dropped unless a zone pair allows it.
  • Class maps pick traffic; policy maps inspect, pass or drop it; zone pairs apply them in one direction.
  • The self zone is the router itself and is open until you write a policy for it.
  • Verify with show zone-pair security and the session table.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.