You are on page 1of 112

1587053101_deploying_zone.

qxd 11/2/06 3:12 PM Page 1

Chapter One ...........................................................3


Introduction to Zone-Based Firewalls

Chapter Two.........................................................12
Typical Zone-Based Firewall Designs

Chapter Three......................................................26
Configuring Zone-Based
Policy Firewalls in Cisco IOS

Chapter Four ........................................................54

Deploying Case Study:


Firewall with a Perimeter Network

Zone-Based Firewalls Chapter Five .........................................................66


Advanced Zone-Based
Policy Firewall Configuration

Ivan Pepelnjak Chapter Six...........................................................94


Configuring Transparent Firewalls

ciscopress.com
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 2

[2]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction

About the Author


Ivan Pepelnjak, CCIE No. 1354, has more than 15 years of experience in designing, installing, troubleshooting, and
operating large service provider and enterprise IP-based networks and security solutions. He is currently chief technolo-
gies advisor at NIL Data Communications, where he designed NIL’s Service Provider Academy program. He was one of
the architects of the Cisco Systems Service Provider curriculum. He also was the lead developer of several service
provider–focused courses covering Multiprotocol Label Switching (MPLS), Border Gateway Protocol (BGP), and IP
quality of service. Ivan has written four books for Cisco Press, covering Enhanced Interior Gateway Routing Protocol
(EIGRP), MPLS, and virtual private networking (VPN) technologies.

About the Technical Editor


Randy Ivener, CCIE No. 10722, is a security specialist with the Cisco Systems Applied Security Intelligence team. He
is a CISSP and ASQ CSQE. Randy has spent many years as a network security consultant helping companies understand
and secure their networks. Before becoming immersed in information security, he spent time in software development
and as a training instructor. Randy graduated from the U.S. Naval Academy and holds a master’s degree in business
administration.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 3

[3]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls
CHAPTER ONE
Introduction to Zone- Simple Zone-
Based Design.................................................4
Based Firewalls More Complex
Zone-Based Design.......................................5
In the mid-1990s, when the large corporate networks began to be
Implementing
connected to less-secure public networks (for example, the early
Zone-Based Designs.....................................7
Internet), security-conscious network administrators immediately
started to feel the need to secure their internal networks from potential
intruders. Networking vendors immediately responded with various
filtering mechanisms, most commonly implemented as packet filters
(filters that could accept or deny incoming or outgoing packets based
on their addresses, transport protocol, or port numbers). The initial
implementations of what we call firewalls today were thus more or less
a patchwork of packet filters.

NOTE It soon became obvious, however, that to implement reliable security


If you are not familiar solutions, one needs a more structured and better documented
with packet filters offered approach, resulting in the early concepts of firewalls, best documented
by the Cisco IOS, refer to
in the legendary book Firewalls and Internet Security by Cheswick and
the Cisco IOS Access Lists
book available through
Bellovin. Initial firewall designs were still based on packet filters, but
Safari Books Online or to with the increasing complexity of Internet protocols and resulting fire-
the relevant Cisco IOS wall policies, the concept of zone-based firewall design emerged.
documentation.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 4

[4]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls Designing zone-based firewalls is a simple process using the following four steps:

Step 1. Internetworking infrastructure under consideration is split into well-documented separate zones with various
security levels. In this step, do not consider physical implementation of the firewall (number of devices,
defense depth, redundancy, and so on), just the separation of your infrastructure into zones (obviously, the
public network to which your network is connected is one of them).
NOTE Step 2. For each pair of source-destination zones (for example, from inside network to Internet), the sessions (most
Within the context of this commonly, TCP and UDP sessions, but also ICMP sessions such as ICMP echo) that clients in source zones
discussion, server is any are allowed to open to servers in destination zones are defined. For traffic that is not based on the concept of
host that accepts incom-
sessions (for example, Encapsulating Security Payload [ESP] of IPSec), define unidirectional traffic flows
ing connections, regard-
less of its actual from source to destination and vice versa. As in the preceding step, do not contemplate the physical setup,
hardware or software just the traffic requirements between zones.
implementation.
Step 3. After the zones have been identified and the traffic requirements between them documented, design your
physical infrastructure, taking into account the security (dictating the number of devices between most-secure
and least-secure zones) and availability requirements (for example, redundant devices).
Step 4. For each firewall device in the design, identify zone subsets connected to its interfaces and (multiple zones
might be indirectly attached to a single interface of a firewall) merge the traffic requirements for those zones,
resulting in a device-specific interzone policy. (See the section “More Complex Zone-Based Design” on the
next page for more in-depth explanation of this rule.)

Simple Zone-Based Design


Consider, for example, a simple local area network (LAN) connected to the public Internet through the firewall, as shown
in Figure 1-1. Clearly, there are two zones in this example:

■ Inside network, which is trusted and should be protected


■ Outside (including Internet), which is not trusted

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 5

[5]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls
FIGURE 1-1 Outside
Simple firewall setup

Internet

Inside

The firewall policy in this design is also simple:

■ Clients in the internal network can open sessions to any server in the Internet.
■ No inbound sessions are allowed from the Internet to the internal network.
Assuming that the network under consideration does not have high resilience or availability requirements, a simple design
with a single firewall device between the inside and outside network is sufficient.

More Complex Zone-Based Design


NOTE A more complex set of requirements would come from a medium-sized organization with its own publicly accessible
The actual interzone fire- servers (for example, web server and e-mail server). Such a firewall would have three zones:
wall policies for this
design are described in ■ Internal network
the next chapter.
■ Perimeter network with web and mail server
■ Public internet

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 6

[6]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls If the customer would request a firewall design with at least two devices between the most protected (internal) network
and the public Internet, your best option would be the traditional firewall design shown in Figure 1-2.

FIGURE 1-2
Traditional firewall Public
Web/Mail Server
design

NOTE
Having a design with two Internet
independent devices is Inner Outer
Router Router
more secure than using a
single firewall device. If Internal Perimeter
the outside firewall in
Figure 1-2 is misconfig-
When implementing this design on actual devices, the firewall policy of each device would be based on a merge of
ured or fails, the inside
firewall still protects the several interzone firewall policies. For example, the inner router does not differentiate between sessions originating in the
internal network. internal zone and terminating in either the perimeter or public zone. Table 1-1 documents the firewall policy that needs to
be implemented on the inner router.

TABLE 1-1 Firewall Policy of the Inner Router


Client Zone (Hosts Server Zone (Hosts
Originating the Terminating the
Connections) Connections) Sessions Allowed
Inside Outside Traffic from internal zone to perimeter and public zones
Outside Inside Traffic from public and perimeter zones to internal zone

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 7

[7]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls
Implementing Zone-Based Designs
As mentioned at the beginning of this chapter, many devices used in firewall implementations are using a concept of
packet filters to filter traffic arriving or departing through an interface. For example, Cisco IOS implements packet filters
with the ip access-list and ip access-group configuration commands that enable you to specify filtering conditions based
on source and destination IP addresses, Layer 4 protocol (for example, TCP, UDP, or ICMP), and Layer 4 port numbers
(for example, TCP port 80 for HTTP).
However, implementing even a straightforward firewall policy (like the one described in the “Simple Zone-Based Design”
section) with Cisco IOS access lists can lead to a configuration nightmare. A typical TCP session established from an
inside client to an outside server is set up as follows (as illustrated in Figure 1-3):
1. The client picks a random TCP port number (usually greater than 1024) as the source TCP port number.
2. The initial packet (TCP SYN packet) is sent from that port number to the well-known destination port (for example,
port 80 for HTTP requests).
3. Return traffic from the server to the client is addressed to the high-numbered TCP port that the client picked.

Outside
FIGURE 1-3 10.0.0.2 172.18.25.1
TCP session estab-
From 10.0.0.2 port 1030 to 172.18.25.1 port 80
lishment across a
packet-filtering device

Internet

From 172.18.25.1 port 80 to 10.0.0.2 port 1030


Inside
?
To allow the return traffic, the packet filters on early firewalls thus had to permit traffic from anywhere on the Internet to
any high-numbered port in the internal network, resulting in an access list similar to the one in Listing 1-1. (The access
list also includes an antispoofing filter and allows incoming ICMP messages needed for normal network operation and
functions such as MTU path discovery.)
© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 8

[8]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls LISTING 1-1 Sample IP Packet Filter in an Early Cisco IOS Release
interface Serial0/0/0.100 point-to-point
description Link to the Internet
ip access-group fromInternet in
!
ip access-list extended fromInternet
! prevent spoofing
deny ip 10.0.0.0 0.0.0.255 any
! allow minimum subset of ICMP messages
permit icmp any any echo
permit icmp any any echo-reply
permit icmp any any time-exceeded
permit icmp any any packet-too-big
permit icmp any any unreachable
! allow traffic to high-numbered ports
permit tcp any 10.0.0.0 0.0.0.255 gt 1023
permit udp any 10.0.0.0 0.0.0.255 gt 1023

NOTE
Later Cisco IOS releases added the established keyword, which matched return traffic in TCP sessions, making recognition of TCP sessions much
NOTE easier (but still leaving some gaps that hackers successfully exploited with skillfully crafted IP fragments). No such mechanism is possible for
Cisco PIX, the Cisco UDP traffic, so UDP is usually not permitted to freely flow between internal and external networks.
standalone firewall appli-
ance, was designed
around the concept of Permitting the inbound traffic to high-numbered ports would not represent a major security risk if some IP-based services
conduits (old PIX termi- would not listen on high-numbered ports (some of them static, some of them assigned on demand), as demonstrated by
nology for traffic flows), Listing 1-2, taken on a personal computer running Windows XP. If you use packet filters as previously proposed, all the
which has from the highlighted services are vulnerable to an attack from the Internet.
beginning included the
proper handling of
return traffic.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 9

[9]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls LISTING 1-2 TCP and UDP Ports Opened on a Typical IP Host Running Windows XP
M:\>netstat -an
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:990 0.0.0.0:0 LISTENING
TCP 0.0.0.0:1039 0.0.0.0:0 LISTENING
TCP 0.0.0.0:23598 0.0.0.0:0 LISTENING
TCP 127.0.0.1:1058 0.0.0.0:0 LISTENING
TCP 127.0.0.1:5679 0.0.0.0:0 LISTENING
TCP 127.0.0.1:7438 0.0.0.0:0 LISTENING
TCP 127.0.0.1:62514 0.0.0.0:0 LISTENING
UDP 0.0.0.0:445 *:*
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:1025 *:*
UDP 0.0.0.0:1026 *:*
UDP 0.0.0.0:1515 *:*
UDP 0.0.0.0:3456 *:*
UDP 0.0.0.0:4500 *:*
UDP 127.0.0.1:123 *:*
UDP 127.0.0.1:1027 *:*
UDP 127.0.0.1:1051 *:*
UDP 127.0.0.1:1540 *:*
UDP 127.0.0.1:1900 *:*
UDP 127.0.0.1:62514 *:*
UDP 192.168.229.179:123 *:*
UDP 192.168.229.179:137 *:*
UDP 192.168.229.179:138 *:*
UDP 192.168.229.179:1900 *:*

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 10

[ 10 ]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls Even if the challenges of return TCP traffic are solved with smarter packet filters and the return UDP traffic is addressed
with stricter filtering rules (for example, allowing only UDP on port 53 between internal and external Domain Name
System [DNS] servers), another inherent problem remains: Some protocols use separate control sessions (on well-known
ports) and data sessions (on randomly assigned high-numbered ports). Most commonly used protocols exhibiting this
problem include File Transfer Protocol (FTP) and Voice over IP (VoIP, H.323 suite of protocols).

In Cisco IOS Release 11.2P (integrated into mainstream Release 11.3) Cisco has addressed the shortcomings of packet
filters implemented in Cisco IOS with Context-Based Access Control (CBAC, later renamed IOS Firewall Stateful
Inspection). This is a mechanism by which a router tracks session establishment of packet flows being routed through it
and adjusts the access lists in the return direction to anticipate the arrival of return packets. CBAC also implements Layer
7 packet inspection, which properly handles protocols such as FTP and H.323, resulting in a perfect firewall solution for
supported protocols.

NOTE To deploy CBAC in the simple LAN-to-WAN (wide area network) firewall solution shown in Figure 1-1, you just replace
CBAC support for ICMP the inbound access-list with a placeholder access-list denying all traffic and enable CBAC on the outside interface using
was added in 12.2(15)T the ip inspect command. This results in the router configuration shown in Listing 1-3.
and integrated in Cisco
IOS Release 12.3.
LISTING 1-3 Typical Router Configuration Using CBAC
router-traffic is a new
keyword added in Cisco ip inspect name Internet tcp audit-trail on router-traffic
IOS Release 12.3(14)T ip inspect name Internet udp audit-trail on router-traffic
and integrated in release ip inspect name Internet icmp audit-trail on router-traffic
12.4. !
interface Serial0/0/0.100 point-to-point
description Link to the Internet
ip access-group fromInternet in
ip inspect Internet out
!
ip access-list extended fromInternet
deny ip 10.0.0.0 0.0.0.255 any

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 11

[ 11 ]

CHAPTER 1 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Introduction to
Zone-Based
Firewalls After this configuration change, every session opened from an inside host to an outside server would also create a
dynamic entry (pinhole) at the bottom of the outside access list. Because the CBAC also handles outbound ICMP traffic
(pings and traceroutes) and ICMP responses associated with TCP or UDP sessions traversing the router, the fromInternet
access list has been significantly reduced and now includes only a generic filter preventing address spoofing.

The audit-trail option of the ip inspect command also generates the trail of TCP or UDP sessions in the router’s log, as
illustrated in Listing 1-4.

LISTING 1-4 Audit Trail Generated by the Router


04:27:19: %FW-6-SESS_AUDIT_TRAIL_START: Start tcp session: initiator (10.0.0.2:1064) -- responder (172.18.25.1:80)
04:27:21: %FW-6-SESS_AUDIT_TRAIL_START: Start tcp session: initiator (10.0.0.2:1065) -- responder (172.18.25.1:80)
04:27:26: %FW-6-SESS_AUDIT_TRAIL: Stop tcp session: initiator (10.0.0.2:1064) sent 307 bytes -- responder
(172.18.25.1:80) sent 2850 bytes
04:27:27: %FW-6-SESS_AUDIT_TRAIL: Stop tcp session: initiator (10.0.0.2:1065) sent 345 bytes -- responder
(172.18.25.1:80) sent 771 bytes

The introduction of CBAC has successfully addressed the shortcomings of packet filters, but it did not help improve the
scalability of firewall implementations—the packet filters still have to be configured to operate between interfaces. In
scenarios with multiple zones connected to a single networking device, this results in a serious drawback: Each packet
filter has to contain a mixture of multiple firewall policies. (For example, if three zones are attached to a router, a packet
filter applied on any interface has to filter traffic being sent into or received from two other zones.) Zone-based policy
firewall, a new configuration feature introduced in Cisco IOS Release 12.4(6)T, solves this problem, too, finally allowing
the implementation team to follow the zone-based design and specify the traffic permitted between zones.

Summary
In the next chapter, we focus first on typical firewall design scenarios, ranging from a simple small office/home office
(SOHO) LAN to a complex corporate firewall. In the subsequent chapters, a number of case studies show how you can
use the zone-based policy firewall feature to implement these designs on Cisco IOS-based networking devices.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 12

[ 12 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs
CHAPTER TWO
Typical Zone-Based Simple LAN-to-
Internet Firewall ..........................................12
Firewall Designs Firewall with
Public Servers .............................................15
NOTE In the preceding chapter, you saw how the philosophy of firewall
Redundant Firewall
Network designers who design has evolved from packet-filter-oriented designs toward zone-
Designs.........................................................20
are already familiar with based designs. In this chapter, we discuss several well-known firewall
the zone-based firewall Complex Firewall
designs and describe the filtering policies used in them. These designs
design principles can Designs.........................................................20
skip this chapter and
then serve as the blueprints for the following implementation chapters,
in which you’ll see how you can translate a zone-based design directly Reducing the Complexity
continue to the imple-
mentation section. All into Cisco IOS configuration commands. of Advanced Firewalls ................................23
other readers are highly
advised to read it,
because a well-thought-
out and well-documented Simple LAN-to-Internet
design almost always
results in superior imple-
Firewall
mentation. The simplest possible design is a protected LAN connected to the
public IP network (for example, the Internet) through a firewall. No
publicly accessible servers reside in the protected LAN (which means,
for example, that the users connected to the LAN have to download
their e-mails from somewhere else—for example, from their Yahoo! or
Hotmail accounts). Figure 2-1 shows a simple firewall design.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 13

[ 13 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs
Inside Outside
FIGURE 2-1
Simple LAN-to-
Internet firewall

Internet

Two firewall policies are commonly used in such setups:

NOTE ■ Permissive policy (documented in Table 2-1), where the internal users can access any service on the Internet
All the firewall policy
■ Restrictive policy (documented in Table 2-2), where the internal users can access only a restricted set of services (for
tables in this book
assume a stateful firewall example, web and mail services)
implementation, so there
are no special entries for TABLE 2-1 Permissive Firewall Policy
the return packets. Client Zone Server Zone Sessions Allowed
Inside Outside All
Outside Inside None

When establishing a restrictive inside-to-outside policy, consider the following caveats:

■ Internet Control Message Protocol (ICMP) echo has to be enabled to allow the internal users to use ping for connec-
tivity troubleshooting.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 14

[ 14 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs ■ Domain Name Service (DNS) on UDP port 53 has to be enabled; otherwise, the internal clients will not be able to
resolve the hostnames into IP addresses.
NOTE
Most versions of ■ In some environments, additional UDP traffic has to be allowed to support the traceroute program.
Windows use ICMP to
trace the path to the ■ Post Office Protocol version 3 (POP3) or Internet Message Access Protocol (IMAP) as well as Simple Mail Transfer
destination host. UDP Protocol (SMTP) to some external server (for example, the Internet service provider’s servers) have to be enabled to
packets as the trace allow users to receive and send e-mail.
packets are used by some
UNIX environments (for ■ Web servers sometimes use nonstandard port numbers. If your users want to access those servers, you must enable
example, Linux) as well as access to specific ports on specific IP addresses.
Cisco IOS.
TABLE 2-2 Restrictive Firewall Policy
NOTE Client Zone Server Zone Sessions Allowed
TCP ports needed for Inside Outside DNS (UDP port 53) to ISP’s name servers
FTP data sessions are ICMP echo
identified automatically HTTP (TCP port 80) to everywhere
by the stateful firewall HTTPS (TCP port 443) to everywhere
implementations. If FTP (TCP port 21) to everywhere
you’re not using a state- POP3 (TCP port 110) to ISP’s e-mail servers
ful firewall, you need to SMTP (TCP port 25) to ISP’s e-mail servers
allow TCP port 20, too,
Outside Inside None
and advise the clients to
use passive FTP.
The simple LAN-to-Internet firewall design successfully addresses the needs of small home offices and small companies
(SOHO environment) that do not own e-mail or web servers. If customers want to run their own publicly accessible
servers, however, the firewall policies have to be changed to allow incoming sessions (for example, incoming SMTP and
HTTP sessions). Because of the many times hackers have successfully exploited publicly accessible servers to penetrate
private networks, it’s almost a necessity to put such servers into a separate zone, as described in the next section.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 15

[ 15 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs
Firewall with Public Servers
There are two common ways of designing a firewall with a perimeter network (also known as demilitarized zone [DMZ])
containing public servers:

■ A simple setup in which all three zones are connected to the same networking device, as shown in Figure 2-2.
■ A more complex setup with two firewalls and a transit perimeter network, as shown in Figure 2-3. This setup is
slightly more secure because the two networking devices are configured independently, thus reducing the risk of a
fatal configuration error (defense-in-depth principle).

FIGURE 2-2
Simple firewall with a Inside Outside
perimeter network

Internet

Web/Mail Server

Perimeter

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 16

[ 16 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs
Inside Perimeter Outside
FIGURE 2-3 Web/Mail Server

Transit perimeter
network

Internet

As in the preceding section, a firewall with a perimeter network can implement a permissive firewall policy, where the
internal users can access any service on the public network, or a more restrictive one, as documented in Table 2-3.
NOTE When designing a restrictive firewall policy, you must consider the implementation details of the DNS and e-mail serv-
Please refer to Bind 9 ices. DNS service can be implemented in the following ways:
documentation for an
in-depth explanation of ■ The customer does not run a DNS server. In this case, DNS requests from inside to an outside (ISP-owned) DNS
name server nomencla- server must be permitted.
ture.
■ The customer runs a caching DNS server in the perimeter network but does not control its own domain. In this case,
DNS requests flow from inside to the perimeter and from the perimeter to outside.
■ The customer runs an authoritative DNS server for its domain in the perimeter network. This server usually acts as a
caching DNS server for the inside clients. In this setup, the DNS requests to the perimeter DNS server arrive from
inside and outside zones, and the perimeter DNS server (when acting on behalf of the inside clients) sends DNS
requests to the outside. Table 2-3 describes this scenario.
■ The customer runs a caching name server on the inside network and an authoritative name server on the perimeter
network. DNS requests thus flow from the inside server to the outside. There is also a bidirectional flow of requests
between the perimeter server and the outside.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 17

[ 17 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs E-mail service can also be implemented in several ways:
■ Most commonly (also assumed in Table 2-3), the customer runs an internal e-mail server that uses SMTP to commu-
nicate with the outside world. In this case, bidirectional SMTP is required between the inside server and the perime-
ter server and between the perimeter server and any host on the outside, assuming the perimeter server is using DNS
Mail Exchange (MX) records to deliver outbound mail.
■ The customer could also decide to store all external e-mail on the perimeter server. In this scenario, bidirectional
SMTP is needed between the perimeter server and outside servers. Inside clients use SMTP to send mail to the
perimeter server and POP3 or IMAP to retrieve it from the perimeter server.

TABLE 2-3 Restrictive Policy of a Firewall with a Perimeter Network


Client Zone Server Zone Sessions Allowed
Inside Outside ICMP echo, HTTP, HTTPS
(Optionally) FTP
Outside Inside None
Inside Perimeter HTTP (to access own public web server)
SMTP from inside mail server to perimeter e-mail server
DNS
ICMP echo
FTP and SSH for server management
Perimeter Inside SMTP to inside mail server (to deliver inbound e-mail)
Perimeter Outside DNS
SMTP (to deliver outbound e-mail)
Outside Perimeter DNS (as the customer runs the authoritative name server for its domain)
HTTP to public web server
SMTP to public mail server
(Optional) FTP to public FTP server (Many sites are replacing FTP with HTTP
because its single-session design does not cause any firewall issues.)

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 18

[ 18 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs The firewall policy just documented is extremely restrictive, allowing only the minimum number of services needed. This
results in a secure network (for example, if the perimeter server is compromised, it cannot be used to launch attacks on
other networks), but it could also lead to reduced robustness of the network. (For example, if the perimeter server is
compromised, the inside clients cannot access the Internet because the DNS services are no longer accessible.)
Some large organizations opt for an even more restraining policy with proxy servers in the perimeter network, thus elimi-
nating any direct traffic between the internal network and the public Internet, as illustrated in Table 2-4.

NOTE TABLE 2-4 Policy of a Firewall with Proxy Servers in the Perimeter Network
DNS service between the Client Zone Server Zone Sessions Allowed
inside and the perimeter Inside Outside None
zones is no longer
needed when using Outside Inside None
HTTP proxy, because the Inside Perimeter HTTP, HTTPS (to access proxy web server)
external hostnames are ICMP echo
passed as strings in SMTP from inside mail server to perimeter mail server
HTTP requests to the FTP and SSH for server management
proxy server. Perimeter Inside SMTP to internal e-mail server (to deliver inbound e-mail)
Perimeter Outside DNS
SMTP from perimeter mail server (to deliver outbound e-mail)
HTTP, HTTPS (proxy access to the web)
(Optional) FTP
ICMP echo
Outside Perimeter DNS (only if the customer runs its own name server)
HTTP to public web server
SMTP to public mail server
(Optional) FTP; see also comments in Table 2-3

The transition from the single-device design (Figure 2-2) to the design with a transit perimeter network (Figure 2-3) illus-
trates one of the advantages of a well-documented zone-based design: Because all the firewall policies have already been
documented, they don’t have to be designed from scratch. You merely split the overall firewall policy into two parts: the

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 19

[ 19 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs inner firewall handles policies from inside to everywhere else, and the outer firewall handles policies from outside to
everywhere else. In fact, two zones are merged into one on each of the devices (perimeter and outside zones are merged
into the perimeter zone on the inner firewall, and perimeter and inside zones are merged into the perimeter zone on the
outer firewall), resulting in policies shown in Table 2-5 and Table 2-6 (assuming a transit perimeter network with proxy
servers). The merge is extremely simple because the previous firewall policy did not allow any direct traffic between the
inside and outside zones.

TABLE 2-5 Policy of the Inner Firewall


Client Zone Server Zone Sessions Allowed
Inside Perimeter HTTP, HTTPS (to access proxy web server)
ICMP echo
SMTP (to send mail)
FTP and SSH for server management.
Perimeter Inside SMTP to inside mail server (to deliver inbound e-mail)

TABLE 2-6 Policy of the Outer Firewall


Client Zone Server Zone Sessions Allowed
Perimeter Outside DNS
SMTP from perimeter mail server (to deliver outbound e-mail)
HTTP, HTTPS (proxy access to the web)
(Optional) FTP
ICMP echo
Outside Perimeter DNS (only if the customer runs its own name server)
HTTP to public web server
SMTP to public mail server
(Optional) FTP

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 20

[ 20 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs
Redundant Firewall Designs
As we move from simple SOHO designs to more-complex corporate designs, robustness and availability become more
and more important. To reach high availability, network designers usually deploy redundant setups in which each critical
device is duplicated, resulting in a design similar to the one shown in Figure 2-4.
FIGURE 2-4
Redundant Inside Perimeter Outside
firewall design Web/Mail Server

Internet

This scenario does not change the firewall policies. All the rules outlined in the preceding section are still valid (yet
another benefit of a good design independent of the physical implementation).

Complex Firewall Designs


Firewalls deployed by large organizations usually contain several zones in addition to the ones discussed in the previous
sections. Typical large-scale firewalls include zones to support the following:

■ Network administrators—Clients in this zone would have privileged access to servers in the perimeter network.
For example, they could open Secure Shell (SSH) sessions to them to change their configuration and perform other
maintenance duties.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 21

[ 21 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs ■ Remote IPsec users—Individual users accessing the corporate network with IPsec-encrypted sessions over the
public Internet would be in this zone. These users have limited access to the resources in the internal network; their
access to the perimeter network is usually equal to access granted to the regular internal users.
■ Remote offices—This zone is similar to individual users using IPsec to access the internal network. However,
because the remote offices are usually under stricter physical control (so that the risk of an intruder gaining access
through a remote office is lower), users in the remote offices would have access to more internal resources than the
individual users.
■ E-commerce perimeter network—Publicly accessible e-commerce servers usually execute transactions on internal
database servers. They are therefore best separated from other public servers; otherwise, an intruder gaining access
to any public server could penetrate the internal database.

Not surprisingly, the firewall policy for such a firewall is substantial, as shown in Table 2-7.

NOTE TABLE 2-7 Firewall Policy of a Complex Firewall


This design uses a Client Zone Server Zone Sessions Allowed
restrictive policy for
Inside Perimeter ICMP echo
inside clients with no
VPN users HTTP to web servers
HTTP proxy. For a less-
VPN offices SMTP to mail servers
restrictive policy or a
DNS to name servers
policy with HTTP
proxies, replace individ- Inside E-commerce ICMP echo
ual items in Table 2-7 VPN users HTTPS to e-commerce servers
with entries from the VPN offices
previous sections. The Inside Outside ICMP echo, HTTP, HTTPS, FTP
design also assumes that VPN users
the organization does not VPN offices
offer public FTP service.
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 22

[ 22 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs TABLE 2-7 Firewall Policy of a Complex Firewall continued
Client Zone Server Zone Sessions Allowed
NOTE Administrators Perimeter HTTP to web servers
Missing zone pairs in the SMTP to mail servers
table indicate that no DNS to name servers
traffic is allowed between SSH to all servers
those zones. For FTP to all servers
example, the e-commerce SNMP to all servers
servers cannot initiate
sessions to the outside Administrators E-commerce HTTPS, SSH, FTP, and SNMP to all servers
zone, further limiting Administrators Outside All services granted to inside users
complex exploits. Additional services if needed
Administrators VPN users All (to support remote users)
Administrators VPN offices All (to support remote offices)
Perimeter Inside SMTP to internal e-mail server
Minimum set of ICMP traffic
Perimeter Outside DNS
SMTP
E-commerce Inside SQL transactions
VPN users Inside Access to a subset of internal servers
RADIUS from VPN concentrator to authentication server
Outside VPN users IPsec traffic (ISAKMP + ESP)
VPN offices Inside Access to a less-restricted set of internal servers
RADIUS from VPN concentrator to authentication server
Outside VPN offices IPsec traffic (ISAKMP + ESP)

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 23

[ 23 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs Such a complex firewall is almost always implemented with multiple devices to improve its resiliency and reduce the
complexity of each individual device’s configuration. Assuming a two-device nonredundant setup, you could end up with
a design similar to the one in Figure 2-5.
FIGURE 2-5 E-commerce
Complex firewall
design

Outside
Web/Mail Server
Administrators

Internet

Inside Perimeter

VPN VPN
Users Offices

Reducing the Complexity of Advanced Firewalls


As you saw in the preceding section, firewalls of larger organizations tend to become rather complex. Developing a good
overall firewall policy in such cases can be a complicated, tedious, and error-prone task. It’s therefore best to approach
the complex firewalls with the millennia-old divide-and-conquer principle. In the example from the preceding section,
you could split the problem into three independent smaller firewalls, as shown in Figure 2-6.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 24

[ 24 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs E-commerce

FIGURE 2-6
Decomposed
complex firewall E-commerce Firewall Outside

Perimeter

Internet
Perimeter Firewall

VPN Users

VPN
Inside Firewall
and
Administrators

VPN Offices Encrypted

NOTE The firewall policy of each individual smaller firewall is significantly less complex than the overall policy because it
The firewall design is contains fewer security zones. Furthermore, the designer can now implement different physical setups for each firewall
further simplified by the based on its resiliency and availability requirements. For example, under budget restrictions, the e-commerce firewall
intended traffic flow:
could be implemented as a redundant transit perimeter firewall design (see the section “Redundant Firewall Designs” and
Traffic from VPN users
first enters the inside Figure 2-4 earlier in this chapter), the perimeter firewall could use the nonredundant setup (see the “Firewall with Public
network and is then addi- Servers” section), and the VPN firewall could be based on a simple LAN-to-Internet firewall design.
tionally screened by the
perimeter firewall.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 25

[ 25 ]

CHAPTER 2 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Typical Zone-
Based Firewall
Designs
Summary
In this chapter, you have seen how you can use zone-based firewall design principles to design a variety of firewall solu-
tions, ranging from simple firewalls suitable to SOHO environments to complex redundant solutions deployed by large
organizations. In the next chapters, you’ll find out how you can use the zone-based policy firewall configuration feature of
Cisco IOS to translate these designs into actual router configuration commands.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 26

[ 26 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls
in Cisco IOS
CHAPTER THREE
Configuring Zone-Based Initial Zone-Based Policy
Firewall Configuration ................................30
Policy Firewalls in Limiting Inside-to-
Outside Traffic.............................................37
Cisco IOS Protecting the Router.................................43

In the previous chapters, you’ve seen how you can design your firewall Monitoring and
using the zone-based design concepts. In this chapter, you’ll find the Debugging Zone-Based
Policy Firewall Configuration ....................47
Cisco IOS configuration commands that enable you to translate the
firewall policy into a working router configuration. Throughout this
chapter, we focus on the simple LAN-to-Internet firewall design
described in the preceding chapter. Figure 3-1 outlines the addressing
scheme used in the examples.
FIGURE 3-1
Sample firewall with 10.0.0.2 10.0.0.3
dns.isp.com
172.16.0.1
smtp.isp.com
172.16.0.2
addressing

172.16.10.32/28

10.0.0.0/24 Internet www.web.com


172.18.25.10
10.0.0.1 192.168.201.6

Inside Outside

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 27

[ 27 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls As you can see in the diagram, the inside LAN is using the private address space 10.0.0.0/24 that is translated using the
in Cisco IOS Network Address Translation (NAT) functionality of Cisco IOS into the provider-allocated public address space
172.16.10.32/28. Because the public address space covers the needs of the inside clients, NAT overload is not used.

The ISP provides mail (SMTP and POP3) services on smtp.isp.com and DNS and Web services on dns.isp.com. The
client computers will also access a third-party Web server at www.web.com.

Listing 3-1 shows the initial router configuration with basic IP addressing and NAT.

NOTE LISTING 3-1 Initial Router Configuration


The configuration in hostname fw
Listing 3-1 is slightly !
abridged. (For example,
service finger
vty and console configu-
!
ration has been removed.)
ip dhcp pool LAN
It has also not been prop-
erly secured. (For example, network 10.0.0.0 255.255.255.0
Finger and HTTP are !
enabled, and Telnet is interface Loopback1
used rather than SSH.) ip address 172.16.10.33 255.255.255.240
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
ip nat inside
!
interface Serial0/0/0
no ip address
encapsulation frame-relay
!
interface Serial0/0/0.100 point-to-point

continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 28

[ 28 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-1 Initial Router Configuration continued
in Cisco IOS description Link to the Internet
ip address 192.168.201.6 255.255.255.252
ip nat outside
frame-relay interface-dlci 100
!
ip route 0.0.0.0 0.0.0.0 Serial0/0/0.100
!
!
ip http server
no ip http secure-server
ip nat pool Internet 172.16.10.34 172.16.10.46 prefix-length 28
ip nat source list InternalHosts pool Internet
ip nat inside source list InternalHosts pool Internet
!
ip access-list standard InternalHosts
permit 10.0.0.0 0.0.0.255
!
end
NOTE
nmap, a public-domain
The configuration seems pretty secure by itself, because NAT should be able to hide inside hosts from potential intruders.
program available from
www.insecure.org, is used
An initial port scan done from the outside (results are shown in Listing 3-2) seems to confirm this assumption, because
to perform the port scans. the potential intruder can reach only one IP host (the router itself).
Printouts are abridged for
clarity. Do not perform
port scans on external
IP hosts without the
owner’s permission.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 29

[ 29 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-2 External Port Scan with No Active Host
in Cisco IOS External$ nmap --system-dns 172.16.10.32/28
(The 1671 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
23/tcp open telnet
79/tcp open finger
80/tcp open http

Nmap finished: 16 IP addresses (1 host up) scanned in 23.473 seconds

However, after an inside client establishes any session across the firewall router, its IP address becomes available to the
outside world. Because the router offers no additional protection beyond address translation, the intruders have free
access to the inside hosts, as documented in Listing 3-3. (Focus on the highlighted lines; the others are the publicly
accessible router services.)

LISTING 3-3 External Port Scan with Active NAT Translations


External$ nmap --system-dns 172.16.10.32/28
Interesting ports on 172.16.10.33:
(The 1671 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
23/tcp open telnet
79/tcp open finger
80/tcp open http

Interesting ports on 172.16.10.34:


(The 1668 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
135/tcp open msrpc

continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 30

[ 30 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-3 External Port Scan with Active NAT Translations continued
in Cisco IOS 139/tcp open netbios-ssn
445/tcp open microsoft-ds
3389/tcp open ms-term-serv
5800/tcp open vnc-http
5900/tcp open vnc

Nmap finished: 16 IP addresses (2 hosts up) scanned in 44.083 seconds

Obviously, additional protection is needed to change the initial setup into a real firewall.

Initial Zone-Based Policy Firewall Configuration


The zone-based policy firewall in Cisco IOS is configured in a modular fashion through these steps:

Step 1. Use the new zone security command to define the zones in your firewall.
NOTE Step 2. (Optional) Use the class-map type inspect global configuration commands to define the traffic classes based
Class map definitions are on specifications from the firewall design. A traffic class is a way of identifying a set of packets based on
mandatory unless you their content (for example, common application layer protocol).
want to rely on the
system-defined class- Step 3. Use the policy-map type inspect global configuration command to specify the firewall policy (what happens
default class, which to each interesting traffic class defined previously with class-map type inspect commands).
matches all traffic.
Step 4. Use the zone-pair security command to apply a predefined firewall policy to a pair of source (client) and
destination (server) zones.
Step 5. After the firewall policy is configured, assign the router interfaces to various security zones by using the
zone-member security interface configuration command.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 31

[ 31 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls IMPORTANT
in Cisco IOS
■ Only policy maps with type inspect can be used in the zone-pair security command.
■ Only class maps with type inspect can be used in policy maps with type inspect.
■ There can be no name overlap with other types of class maps or policy maps. You cannot have a quality-of-service
class map (with no type keyword) and an inspect class map with the same name.
■ A zone must be configured with the zone security global command before it can be used in the zone-member
security interface configuration command.
■ An interface cannot belong to multiple zones. To create a union of security zones, specify a new zone and appro-
priate policy map and zone pairs.
■ The zone-based policy firewall feature is a replacement for the Cisco IOS Firewall Stateful Inspection (also known
as Context-Based Access Control [CBAC]) feature. Remove the ip inspect interface configuration command
before applying the zone-member security command.
■ The zone-based policy firewall can coexist with Cisco IOS Firewall stateful inspection. You can still use the ip
inspect command on interfaces that are not members of security zones.
■ Traffic can never flow between an interface assigned to a zone and an interface without a zone assignment.
Applying the zone-member configuration commands will therefore always result in temporary interruption of
service.
■ The default interzone policy is to drop all traffic unless specified otherwise in the zone-pair configuration
command.
■ The router never filters the traffic between interfaces in the same zone.
■ The zone-member command does not protect the router itself (traffic to and from the router is not affected) unless
you configure the zone pairs using the predefined self zone (described later in this chapter).
■ CBAC dynamically creates entries in access lists attached to interfaces on which the ip inspect command is
configured. (Cisco IOS Firewall stateful inspection entries and access list entries are or-ed together.) The zone-
based policy firewall does not change the access lists. (The interzone policy is and-ed with the access list.) Review
the access list usage before using the zone-member commands.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 32

[ 32 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls Configuring Security Zones
in Cisco IOS
Our example has two security zones: inside and outside. Listing 3-4 shows the configuration commands used to create
them. To help network administrators understand the router configuration, you can assign a description to each zone with
the description zone configuration command.

LISTING 3-4 Creating Zones


zone security Inside
description Inside network
zone security Outside
description Outside network

Configuring Firewall Policy


NOTE The firewall policy in our design is very simple: All traffic is allowed from the inside zone to the outside zone, so we can
Class default is always use the class-default (match all) traffic class in the policy-map command. Similar to other modular CLI constructs in
the last class in a policy Cisco IOS, you have to specify what to do with the traffic matching the desired traffic class. You have the following
map. It thus applies only options:
to traffic not covered by
other class maps. ■ Pass the packets. This action is equivalent to an access-list permit statement and is thus unidirectional. There is no
provision for return traffic, so you have to specify the handling of return traffic manually. This option is useful only
for protocols such as IPsec-encrypted traffic.
■ Inspect the packet. This action is equivalent to the functionality of the ip inspect command of the Cisco IOS
Firewall Stateful Inspection feature. It automatically provides conduits for return traffic and potential ICMP
messages. For protocols requiring multiple parallel signaling and data sessions (for example, FTP or H.323), the
inspect action also handles the proper establishment of data sessions.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 33

[ 33 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls ■ Drop the packet. Equivalent to the access-list deny statement. Similar to the access lists, you can use the log option
in Cisco IOS to log the rejected packets.
■ Police. Rate-limits the traffic of the specified class. Can be used only in conjunction with the inspect or pass
command.
After the firewall policy has been configured, you can apply it to traffic between a pair of zones using the zone-pair
security configuration command. In this command, you specify the source zone (in which the clients reside), the destina-
tion zone (where the servers are), and the policy for handling the traffic between them.

Listing 3-5 shows the InsideToOutside firewall policy and the corresponding zone-pair command used in our firewall.
NOTE
There is no need for an LISTING 3-5 Creating Firewall Policy
outside-to-inside zone
policy-map type inspect InsideToOutside
pair because there are no
class class-default
inside servers that would
be accessible from the inspect
outside zone. !
zone-pair security InsideToOutside source Inside destination Outside
service-policy type inspect InsideToOutside

Assigning Interfaces to Security Zones


After the firewall policy is complete, you can assign individual interfaces to security zones with the zone-member
security configuration command, resulting in the final router configuration in Listing 3-6.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 34

[ 34 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-6 Initial Zone-Based Policy Firewall Configuration
in Cisco IOS policy-map type inspect InsideToOutside
class class-default
inspect
!
zone security Inside
description Inside network
zone security Outside
description Outside network
zone-pair security InsideToOutside source Inside destination Outside
service-policy type inspect InsideToOutside
!
interface FastEthernet0/0
zone-member security Inside
!
interface Serial0/0/0.100 point-to-point
zone-member security Outside

Testing the Firewall Configuration


The first port scan results from an outside host are encouraging; after the firewall policy has been configured, the internal
hosts are no longer visible to port scans from the outside, as shown in Listing 3-7. However, it’s obvious that the router
itself is still vulnerable.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 35

[ 35 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-7 Scanning the Protected LAN from the Outside
in Cisco IOS External$ nmap --system-dns 172.16.10.32/28
Starting Nmap 4.03 ( http://www.insecure.org/nmap ) at 2006-07-29 23:41
Interesting ports on 172.16.10.33:
(The 1671 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
23/tcp open telnet
79/tcp open finger
80/tcp open http

Nmap finished: 16 IP addresses (1 host up) scanned in 64.964 seconds


Raw packets sent: 2581 (112.944KB) | Rcvd: 1677 (77.142KB)

On the other hand, a simple test (Listing 3-8) proves that the inside clients can reach any service or server on the Internet.

LISTING 3-8 Scanning an External Web Server from the Inside


Inside$ nmap -v --system-dns web.com
Interesting ports on web.com (172.18.25.10):
(The 1663 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
21/tcp open ftp
25/tcp open smtp
80/tcp open http
135/tcp open msrpc
139/tcp open netbios-ssn
443/tcp open https
445/tcp open microsoft-ds
1026/tcp open LSA-or-nterm
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 36

[ 36 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-8 Scanning an External Web Server from the Inside continued
in Cisco IOS 3389/tcp open ms-term-serv
5800/tcp open vnc-http
5900/tcp open vnc

Nmap finished: 1 IP address (1 host up) scanned in 277.339 seconds


Raw packets sent: 1958 (86.132KB) | Rcvd: 1685 (77.510KB)

Deploying a zone-based firewall has an additional unexpected benefit: Because all the traffic between zones is inspected,
a port scan almost always triggers alerts and corresponding log messages (displayed in Listing 3-9).

LISTING 3-9 Alerts Generated by the Router During Port Scan


00:42:35: %FW-4-HOST_TCP_ALERT_ON: (target:class)-(InsideToOutside:class-default):Max tcp half-open connec-
tions (50) exceeded for host 172.18.25.10.
00:42:43: %FW-4-HOST_TCP_ALERT_ON: (target:class)-(InsideToOutside:class-default):Max tcp half-open connec-
tions (50) exceeded for host 172.18.25.10.
00:42:48: %FW-4-HOST_TCP_ALERT_ON: (target:class)-(InsideToOutside:class-default):Max tcp half-open connec-
tions (50) exceeded for host 172.18.25.10.
00:42:53: %FW-4-HOST_TCP_ALERT_ON: (target:class)-(InsideToOutside:class-default):Max tcp half-open connec-
tions (50) exceeded for host 172.18.25.10.
00:42:56: %FW-4-ALERT_ON: (target:class)-(InsideToOutside:class-default):getting aggressive, count (2/500)
current 1-min rate: 501

Configuration Command Summary


In this section, we have used the commands summarized in Table 3-1 to create an initial firewall configuration.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 37

[ 37 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls TABLE 3-1 Basic Zone-Based Policy Firewall Configuration Commands
in Cisco IOS Command Syntax Description
zone security name Creates a new security zone.
description text Optionally assigns a description to the selected security zone.
policy-map type inspect name Creates a new policy map or starts configuration of the existing policy map. The type inspect
keywords are mandatory.
class name Within a policy map, starts configuring firewall actions for the specified traffic class.
class class-default Within a policy map, starts configuring firewall actions for all unclassified traffic. The class
class-default command should be the last class specification in the policy map.
inspect Within a traffic class configuration, permits traffic and requests packet inspection to establish
automatic conduits for return traffic (equivalent to the ip inspect command of Cisco IOS
Firewall stateful inspection).
pass Within a traffic class configuration, permits traffic. You have to make manual provisions for
return traffic handling.
drop [log] Drops the packets of the selected traffic class with optional logging to the router’s log.
police rate bps burst burst-size Rate-limits traffic within the specified traffic class to the specified bits-per-second rate with a
specified maximum burst size.

Limiting Inside-to-Outside Traffic


In the preceding section, we configured a simple firewall that protected the inside network while allowing the inside users
to access any service on the Internet. In this section, we extend this design by limiting the services the inside users are
allowed to access (the second design of the section “Simple LAN-to-Internet Firewall” in Chapter 2, “Typical Zone-
Based Firewall Designs”). To reach that goal, we first have to define the traffic classes that will later be used in the

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 38

[ 38 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls policy-map commands to define the desired firewall policy. The traffic classes are defined with the well-known class-
in Cisco IOS map command augmented with the type inspect keyword.

NOTE class-map can classify traffic based on source and destination addresses and Layer 4 port numbers using extended IP
Class maps using these access lists, or based on well-known Layer 4 (TCP, UDP, ICMP, and so on) or Layer 7 (SMTP, HTTP, FTP, and so forth)
parameters are known as protocols. Table 3-2 shows the syntax of the class-map command and the associated match commands.
Layer 4 class maps.
Cisco IOS also supports
TABLE 3-2 Syntax of the class-map type inspect and Associated match Commands
deeper inspection of
HTTP, IMAP, instant Command syntax Description
messaging (AOL, MSN, class-map type inspect Starts configuration of the named class map. The traffic matched by the class map has to
Yahoo!), and peer-to-peer [match-all | match-any] name match all the specified match conditions (match-all option, also the default behavior) or
(edonkey, fasttrack, any of them (match-any option, which has to be explicitly specified).
gnutella, kazaa) proto-
match access-group Matches traffic permitted by the specified access group. You can use numbered or named
cols. Those class maps
{ACL-number | name ACL-name} IP access lists.
are called Layer 7 class
maps and are covered in match protocol Matches any packet of the specified Layer 4 protocol.
a later section. {tcp | udp | icmp}
match protocol protocol-name Matches the specified Layer 7 protocol based on its Layer 4 port number (specified as the
Layer 7 protocol name in the configuration). Protocols operating on nonstandard ports or
user-defined protocols can be specified with the ip port-map command, covered in
Chapter 5.
match class-map name Matches traffic specified by a previously defined class map. This command is useful when
you want to extend a previous traffic definition (use the match-any option in the class-map
command) or narrow it (with the match-all option in the class-map command). This command
can also be used to implement complex logical conditions that cannot be specified with a
single class map.
match not condition Matches all traffic not matching the specified condition.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 39

[ 39 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based To configure the desired firewall policy, we need to specify two traffic classes:
Policy Firewalls ■ Traffic permitted to any destination on the Internet (HTTP, HTTPS, FTP, ICMP)
in Cisco IOS
■ Traffic permitted to the Internet service provider’s (ISPs) servers (SMTP, POP3, DNS).
The configuration of the first traffic class is simple: Just use the class-map command with the match-any option and list
all the desired protocols, as shown in Listing 3-10.
LISTING 3-10 Class Map Matching the Default Internet Traffic
class-map type inspect match-any InternetTraffic
match protocol http
match protocol ftp
match protocol icmp
match protocol https

NOTE
You might be tempted to use the access list to match both IP addresses and TCP port numbers instead of using the match protocol commands.
However, when a protocol uses control and data sessions (as FTP does), the match protocol command matches all relevant sessions, and the
access list cannot do it. For example, match protocol ftp is not equivalent to permit tcp any any eq ftp.

The definition of traffic allowed toward the ISP servers is a bit more complex because we have to specify two conditions:
a list of protocols (using the match-any keyword) toward a set of IP addresses (here we need a match-all keyword).
Listing 3-11 contains the minimum configuration needed to achieve these goals.
LISTING 3-11 Matching Traffic Toward ISP Servers
class-map type inspect match-any ISPTraffic
match protocol dns
match protocol smtp
match protocol pop3
!
class-map type inspect match-all ToISP
match class-map ISPTraffic
match access-group name ISPServers
!
ip access-list extended ISPServers
permit ip any host 172.16.0.1
permit ip any host 172.16.0.2

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 40

[ 40 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls After defining the two traffic classes, you can specify the target firewall policy as follows:
in Cisco IOS
■ Inspect all traffic in classes ToISP and InternetTraffic.
■ Drop and log all the other traffic.
Listing 3-12 shows the final firewall configuration.

LISTING 3-12 Final Simple LAN-to-Internet Firewall Configuration


class-map type inspect match-any ISPTraffic
match protocol dns
match protocol smtp
match protocol pop3
class-map type inspect match-all ToISP
match class-map ISPTraffic
match access-group name ISPServers
class-map type inspect match-any InternetTraffic
match protocol http
match protocol ftp
match protocol icmp
match protocol https
!
!
policy-map type inspect InsideToOutside
class type inspect ToISP
inspect
class type inspect InternetTraffic
inspect
class class-default
drop log
!
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 41

[ 41 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-12 Final Simple LAN-to-Internet Firewall Configuration continued
in Cisco IOS zone security Inside
description Inside network
zone security Outside
description Outside network
zone-pair security InsideToOutside source Inside destination Outside
service-policy type inspect InsideToOutside
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
ip nat inside
zone-member security Inside
!
interface Serial0/0/0.100 point-to-point
description Link to the Internet
ip address 192.168.201.6 255.255.255.252
ip nat outside
zone-member security Outside
!
ip access-list extended ISPServers
permit ip any host 172.16.0.1
permit ip any host 172.16.0.2

To verify the proper operation of your configuration, you can use a port-scanning program from an inside host. As Listing
3-13 shows, Internet services (FTP, HTTP) can be reached on the ISP servers together with the ISP-specific services
(SMTP, POP3, DNS). On the other hand, only Internet services are available to inside clients on any other Internet host
(Listing 3-14).

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 42

[ 42 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-13 Port Scan of the ISP Servers from the Inside
in Cisco IOS Inside$ nmap --system-dns 172.16.0.0/28

Interesting ports on dns.isp.com (172.16.0.1):


(The 1669 ports scanned but not shown below are in state: filtered)
PORT STATE SERVICE
21/tcp open ftp
53/tcp open domain
80/tcp open http

Interesting ports on smtp.isp.com (172.16.0.2):


(The 1669 ports scanned but not shown below are in state: filtered)
PORT STATE SERVICE
25/tcp open smtp
53/tcp open domain
110/tcp open pop3

Nmap finished: 16 IP addresses (2 hosts up) scanned in 82.939 seconds

LISTING 3-14 Port Scan of an External Web Server from an Inside Host
Inside$ nmap --system-dns www.web.com
Interesting ports on web.com (172.18.25.10):
(The 1671 ports scanned but not shown below are in state: filtered)
PORT STATE SERVICE
21/tcp open ftp
80/tcp open http
443/tcp open https

Nmap finished: 1 IP address (1 host up) scanned in 26.047 seconds

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 43

[ 43 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls As expected, the port scan generates a number of router alerts, as shown in Listing 3-15.
in Cisco IOS
LISTING 3-15 Router Alerts During the Port Scan
01:06:13: %FW-6-DROP_PKT: Dropping tcp pkt 172.16.10.34:35860 => 172.16.0.1:535
01:07:44: %FW-6-DROP_PKT: Dropping rtsp pkt 172.16.10.34:58360 => 172.16.0.1:554
01:08:14: %FW-6-DROP_PKT: Dropping tcp pkt 172.16.10.34:58360 => 172.16.0.2:895

Protecting the Router


The firewall configuration in the previous section has successfully protected inside hosts from Internet attacks and limited
the services the inside hosts can access on the Internet. The router itself, however, remains vulnerable because the traffic
to and from the router itself is not restricted by the interzone policies (as shown in Listing 3-2 earlier in this chapter).

To protect the router, you could use incoming IP access lists on all interfaces. This approach (although commonly used in
the past) has a number of severe drawbacks:

■ The access list has to include all IP addresses configured on the router.
■ Whenever the router participates in several security zones, a different access list has to be specified for each zone.
■ The access lists cannot restrict the traffic originating in the router. (The only way to influence outgoing traffic is
through local policy routing.)
■ The zone-based policy firewall feature does not amend the access lists the way Cisco IOS Firewall stateful inspec-
tion does. Therefore, special precautions must be taken to ensure that there are no undesired side effects from apply-
ing access lists on interfaces assigned to security zones.
Zone-based policy firewall configuration in Cisco IOS offers a novel approach to this problem: The router itself can be
defined as a separate security zone (with the predefined name self), and the incoming and outgoing sessions can be
limited in the same way as the routed interzone traffic.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 44

[ 44 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls IMPORTANT
in Cisco IOS
When configuring the self zone, consider these facts:
■ All IP addresses configured on the router belong to the zone self, regardless of the zone memberships of their
interfaces.
■ Unless configured otherwise, traffic to and from the self zone is unrestricted.
■ The moment you use the self zone in a zone pair, the traffic between the self zone and the other zone in the zone
pair is restricted in both directions. For example, if you define a zone pair from inside to self, the router cannot
originate any sessions toward the inside zone until you define a zone pair from self to inside.
■ Traffic between the router itself and the zones not mentioned in combination with the self zone in a zone pair is
not affected.
■ When configuring the restrictions for the inbound traffic, consider the necessary outbound traffic (including the
routing and network management protocols). For example, if you restrict inbound traffic from a zone to the router
itself, the routing protocols could stop working on all interfaces belonging to that zone.
■ In early releases supporting zone-based policy firewall configuration (Cisco IOS 12.4(6)T), the match protocol
command cannot be used to classify traffic to or from the self zone. Only IP access lists can be used for traffic
classification purposes.

Configuring Router Protection


NOTE Common router protection measures in a small LAN-to-Internet firewall might include the following:
A more complex router
protection policy will be ■ No external access, apart from ping (icmp echo) and routing protocols (if needed)
developed in the next
■ No access to the Internet from the router (apart from the routing protocols, if needed)
chapter. A more security-
conscious environment ■ Limited internal access (for example, ping, Telnet or SSH, SNMP, HTTP, and HTTP/HTTPS
would also not allow full
access from the router to ■ Full access from the router to the inside network
the inside network.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 45

[ 45 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls To implement these protection measures, you need to configure, at minimum, the following:
in Cisco IOS
■ Two IP access lists, one for external (ping only) traffic and one for internal traffic.
■ Two class maps and three policy maps. (The third policy map allows any traffic from the router to the inside zone.)
■ Several zone pairs.
Listing 3-16 shows the complete configuration needed to protect the router.

LISTING 3-16 Protecting the Router with the Self Zone


ip access-list extended ICMPEcho
permit icmp any any echo
!
class-map type inspect match-any ping
match access-group name ICMPEcho
!
policy-map type inspect OutsideToRouter
class type inspect ping
inspect
class class-default
drop log
!
zone-pair security OutsideToRouter source Outside destination self
service-policy type inspect OutsideToRouter
!
ip access-list extended ManagementProtocols
permit tcp any any eq telnet
permit tcp any any eq 22 ! ssh

continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 46

[ 46 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-16 Protecting the Router with the Self Zone continued
in Cisco IOS permit tcp any any eq www
permit tcp any any eq 443 ! https
permit icmp any any echo
!
class-map type inspect match-any RouterManagement
match access-group name ManagementProtocols
!
policy-map type inspect InsideToRouter
class type inspect RouterManagement
inspect
class class-default
!
policy-map type inspect RouterToInside
class class-default
inspect
!
zone-pair security InsideToRouter source Inside destination self
service-policy type inspect InsideToRouter
zone-pair security RouterToInside source self destination Inside
service-policy type inspect RouterToInside

Quick port scans from an inside (Listing 3-17) and outside (Listing 3-18) host verify that the configuration in Listing
3-16 does protect the router. The inside host can only access the services that we have specified in the RouterManagement
access list, and the outside host cannot access the router at all (although it can still be pinged as –; see the “1 host up”
message from nmap).

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 47

[ 47 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-17 Port Scan of a Protected Router from the Inside
in Cisco IOS Inside$ nmap --system-dns 10.0.0.1
Interesting ports on fw (10.0.0.1):
(The 1671 ports scanned but not shown below are in state: filtered)
PORT STATE SERVICE
23/tcp open telnet
80/tcp open http
443/tcp closed https

Nmap finished: 1 IP address (1 host up) scanned in 22.552 seconds

LISTING 3-18 Port Scan of a Protected Router from the Outside


External$ nmap --system-dns 172.16.10.33
All 1674 scanned ports on 172.16.10.33 are: filtered
Nmap finished: 1 IP address (1 host up) scanned in 71.533 seconds

Monitoring and Debugging Zone-Based Policy


Firewall Configuration
As with every Cisco IOS features, a number of show and debug commands are available to network administrators to
monitor and troubleshoot the zone-based configurations.

If you would like to see the summary of your zone configuration, the show zone security command is the one you’re
looking for (Listing 3-19).

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 48

[ 48 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-19 Show Zone Security Command Displays Zones and Associated Interfaces
in Cisco IOS show zone security
fw#s
zone self
Description: System defined zone

zone Inside
Description: Inside network
Member Interfaces:
FastEthernet0/0

zone Outside
Description: Outside network
Member Interfaces:
Serial0/0/0.100

If you would like to see more details about the configured traffic classes and interzone policies, the obvious commands
are show class-map type inspect, show policy-map type inspect, and show zone-pair security. They display the speci-
fied class map, policy map, or zone pair so that you don’t have to browse through the router configuration. More useful is
the show policy-map type inspect zone-pair name command, which displays the traffic and usage statistics for a zone
pair, as shown in Listing 3-20.

LISTING 3-20 Output of a show policy-map type inspect zone-pair Command


show policy-map type inspect zone-pair InsideToOutside
fw#s
Zone-pair: InsideToOutside

Service-policy inspect : InsideToOutside

Class-map: InternetTraffic (match-any)


Match: protocol http
0 packets, 0 bytes
continues
© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 49

[ 49 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-20 Output of a show policy-map type inspect zone-pair Command continued
in Cisco IOS 30 second rate 0 bps
Match: protocol ftp
WARNING
3 packets, 84 bytes
The per-protocol traffic
counters displayed in the 30 second rate 0 bps
show policy-map type Match: protocol icmp
inspect zone-pair 1 packets, 40 bytes
command can be 30 second rate 0 bps
misleading. For example, Match: protocol https
the counters for the FTP 0 packets, 0 bytes
protocol list only the 30 second rate 0 bps
actual content packets Inspect
(excluding the TCP setup Packet inspection statistics [process switch:fast switch]
packets) exchanged in
tcp packets: [133:2363]
the FTP control session
icmp packets: [0:8]
and do not include the
ftp packets: [46:0]
data transferred in the
FTP data sessions.
Session creations since subsystem startup or last reset 7
Current session counts (estab/half-open/terminating) [2:0:0]
Maxever session counts (estab/half-open/terminating) [2:1:1]
Last session created 00:00:13
Last session created 00:00:13
Last statistic reset never
Last session creation rate 1
Last half-open session total 0

… printout repeated for other classes of traffic …

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 50

[ 50 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls The show policy-map type inspect zone-pair name sessions command gives an even more detailed printout. It includes all
in Cisco IOS the open sessions, too (see Listing 3-21). The name parameter is optional; without it, the router displays all sessions it tracks.

LISTING 3-21 Sessions Established Between a Pair of Zones


show policy-map type inspect zone-pair sessions
fw#s
Zone-pair: InsideToOutside

Service-policy inspect : InsideToOutside

Class-map: InternetTraffic (match-any)


Match: protocol http
0 packets, 0 bytes
30 second rate 0 bps
Match: protocol ftp
3 packets, 84 bytes
30 second rate 0 bps
Match: protocol icmp
1 packets, 40 bytes
30 second rate 0 bps
Match: protocol https
0 packets, 0 bytes
30 second rate 0 bps
Inspect
Established Sessions
Session 478AF96C (172.16.0.1:20)=>(10.0.0.2:1053) ftp-data SIS_OPEN
Created 00:04:30, Last heard 00:00:00
Bytes sent (initiator:responder) [1917424:0]
Session 478AFC24 (10.0.0.2:1051)=>(172.16.0.1:21) ftp SIS_OPEN
Created 00:06:04, Last heard 00:04:29
Bytes sent (initiator:responder) [98:247]

… rest of printout deleted …

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 51

[ 51 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls A few debugging command also support the zone-based policy firewall feature:
in Cisco IOS
■ The debug zone security command is focused on zone security events (for example, interface assignments).
■ The debug ip inspect policy command gives you an in-depth view of individual packet classification. Listing 3-22
shows a printout associated with a single TCP SYN packet trying to open a Finger session to the router.

WARNING LISTING 3-22 Output of the debug ip inspect policy Command


Use debug ip inspect 00:36:29: CBAC-C3PL : Policy lookup for pak 0x4716467C [insp_c3pl_policy_lookup]
policy only on a lightly
00:36:29: CBAC-C3PL : input i/f is FastEthernet0/0, output i/f is NULL [insp_c3pl_validate_zoning]
loaded router in a
00:36:29: CBAC-C3PL : Zone-pair and policy found [insp_c3pl_validate_zoning]
controlled environment
00:36:29: CBAC-C3PL : Packet L7 protocol is 59 L4 prot is 1 [insp_c3pl_classify_packet]
(preferably with no
00:36:29: CBAC-C3PL : zeroing out prot_flag [insp_c3pl_packet_classify_class_based_common]
logging to the router
console); otherwise, you 00:36:29: CBAC-C3PL : Checking if the packet(0x4716467C) matches with class RouterManagement
[insp_c3pl_packet_classify_class_based_common]
might easily overload its
CPU. 00:36:29: CBAC-C3PL : zeroing out prot_flag [insp_c3pl_packet_classify_class_based_common]
00:36:29: CBAC-C3PL : Checking if the packet(0x4716467C) matches with class class-default
[insp_c3pl_packet_classify_class_based_common]
00:36:29: CBAC-C3PL : Packet(0x4716467C) matched with class class-default
[insp_c3pl_packet_classify_class_based_common]
00:36:29: CBAC-C3PL : Classification returned protocol-id 0x0 classid 0 [insp_c3pl_classify_packet]
00:36:29: CBAC-C3PL : DROP action found in policy-map [insp_c3pl_process_actions_of_class]
00:36:29: CBAC-C3PL : Action processing returned code 1. [insp_c3pl_classify_packet]
00:36:29: CBAC-C3PL : classify processing returned 1 [insp_c3pl_policy_lookup]

Furthermore, because the zone-based firewall policy feature is closely linked to the Context-Based Access Control
(CBAC) code, many debug ip inspect commands work as expected. For example, you might debug DNS and FTP
inspection, resulting in the following printout when a user opens an FTP session from the inside to the outside zone
(Listing 3-23).

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 52

[ 52 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls LISTING 3-23 Debugging FTP and DNS Sessions
in Cisco IOS debug ip inspect dns
fw#d
INSPECT DNS Inspection debugging is on
debug ip inspect ftp-cmd
fw#d
INSPECT FTP commands and responses debugging is on
fw#
00:43:01: CBAC FUNC: insp_dns_sis_ext_create
00:43:01: CBAC FUNC: insp_handle_dns_control_stream
00:43:01: CBAC FUNC: insp_handle_dns_control_stream
00:43:01: CBAC FTP sis 478AFEDC FTP-Server: 220 sp IOS-FTP server (version 1.00) ready.~~
00:43:06: CBAC FUNC: insp_dns_handle_inactivity
00:43:16: CBAC FTP sis 478AFEDC FTP-Client: USER myUser~~
00:43:16: CBAC FTP sis 478AFEDC FTP-Server: 331 Password required for ‘myUser’.~~
00:43:18: CBAC FTP sis 478AFEDC FTP-Client: PASS xxxxxx
00:43:18: CBAC FTP sis 478AFEDC FTP-Server: 230 Logged in.~~
00:43:18: CBAC sis 478AFEDC User authenticated

Summary
In this chapter, you’ve seen how you can do almost a one-to-one mapping between your zone-based firewall design and
Cisco IOS configuration commands:

■ Traffic specifications described in your design are configured with class-map type inspect commands that can
match individual transport layer or application layer protocols with the match protocol command or IP addresses
(or port numbers) with the match access-group command. More complex logical conditions are also possible with
the right combination of match-all or match-any keywords, sometimes combined with hierarchical class-maps.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 53

[ 53 ]

CHAPTER 3 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Zone-Based
Policy Firewalls ■ Interzone policies are expressed as policy-map type inspect commands in Cisco IOS and are assigned to specific
in Cisco IOS pairs of zones with the zone-pair security command. The two configuration layers allow you to use the same policy
on multiple pairs of zones, thus further simplifying the configuration.
■ Interfaces are assigned to security zones with the zone-member security commands. All traffic entering or exiting
these interfaces (apart from traffic to and from the router itself) is subject to security screening, additionally improv-
ing the security of the zone-based firewall in Cisco IOS.
■ Traffic to and from the router is not monitored (doing so by default would probably quickly kill routing protocols
and network management in most implementations). To protect the router itself, you specify the interactions of the
predefined zone self with other security zones.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 54

[ 54 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network
CHAPTER FOUR
Case Study: Configuring the
Firewall Policy .............................................56
Firewall with a Protecting
the Router ....................................................60
Perimeter Network
In the preceding chapter, you saw the mandatory configuration
commands used to configure the zone-based policy firewall feature of
Cisco IOS. In this chapter, we use those commands to develop a
complete configuration of a firewall with a perimeter network shown
in Figure 4-1. The policy rules used by this firewall are documented in
Table 2-3 (Restrictive Policy of a Firewall with a Perimeter Network)
of Chapter 2, “Typical Zone-Based Firewall Designs.”
FIGURE 4-1
Client Mail Server Outside
Firewall with a 10.0.0.2 10.0.0.10
perimeter network

Internet

Inside 10.0.0.1

192.168.0.1

Perimeter

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 55

[ 55 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network To include the perimeter network in the existing firewall configuration (Listing 3-1) discussed in Chapter 3, “Configuring
Zone-Based Policy Firewalls in Cisco IOS,” we need to do the following:
NOTE
Using VLANs to connect ■ Configure a separate interface to which the public web server will be connected. If you’re limited by the router’s
interfaces in public and physical setup (for example, if it has only one Fast Ethernet interface), the best approach is to create a subinterface
private zones on the same in a different virtual LAN (VLAN).
physical interface of a
firewall should be done ■ Configure the IP subnet on the perimeter interface. We’ll use subnet 192.168.0.0/24 from the private IP address
only as a last resort. Any range.
misconfiguration of the
switch to which these ■ Fix the network address translation configuration. We reduce the size of the IP address pool (to gain a public IP
devices are attached address for the web server) and establish a static inside-to-outside mapping for the web server.
could cause a security
breach. Listing 4-1 shows the corresponding router configuration.

NOTE LISTING 4-1 Changes in IP Routing Configuration of the Firewall Router


You need to remove the interface FastEthernet0/0.100
previous NAT pool defi-
description public Web server
nition before redefining
encapsulation dot1Q 100
it.
ip address 192.168.0.1 255.255.255.0
ip nat inside
!
ip nat pool Internet 172.16.10.38 172.16.10.46 prefix-length 28
ip nat inside source static 192.168.0.2 172.16.10.34

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 56

[ 56 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network
Configuring the Firewall Policy
The first step in firewall policy configuration is defining traffic classes. We start by defining class maps matching the
basic protocol sets (ping, web traffic, mail delivery, and network management) encountered in this firewall (Listing 4-2).

NOTE LISTING 4-2 Configuring Basic Protocol Sets


Within this case study, class-map type inspect match-any ping
we optimize the class match access-group name IcmpEcho
definitions by grouping
!
similar protocols in the
ip access-list extended IcmpEcho
same traffic class. When
permit icmp any any echo
deploying application-
level packet inspection, permit icmp any any echo-reply
each protocol has to be !
defined as a separate ! Note: Web traffic also includes ability to ping
traffic class (see the next !
chapter for more details), class-map type inspect match-any WebTraffic
increasing the complexity match protocol http
of the configuration. It’s match protocol https
therefore mandatory that match class-map ping
you understand the final !
firewall requirements class-map type inspect FileTransfer
before you start configur-
match protocol ftp
ing the router.
!
class-map type inspect match-any PublicManagement
match protocol ftp
match protocol ssh
match protocol snmp
!
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 57

[ 57 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network LISTING 4-2 Configuring Basic Protocol Sets continued
class-map type inspect match-any SMTP
match protocol smtp extended
!
class-map type inspect match-any DNS
match protocol dns

Within the firewall policy, we also need refined traffic class definitions where a specific protocol (for example, SMTP)
will be allowed on only a specific server (for example, the inside mail server). For convenience, we also define a broader
traffic class covering all public services offered by the perimeter server: SMTP, HTTP, and DNS and ping for trou-
bleshooting purposes. The perimeter server is the authoritative server for the organization’s domain and a caching DNS
server for the internal clients.

Listing 4-3 shows the refined and extended traffic classes.

LISTING 4-3 Additional Traffic Class Definitions


class-map type inspect match-all MailDelivery
match class-map SMTP
match access-group name InternalServer
!
ip access-list extended InternalServer
permit ip any host 10.0.0.10
!
class-map type inspect match-any PublicProtocols
match class-map SMTP
match class-map WebTraffic
match class-map DNS
match class-map ping
!
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 58

[ 58 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network LISTING 4-3 Additional Traffic Class Definitions continued
class-map type inspect match-all PublicTraffic
match class-map PublicProtocols
match access-group name PerimeterServer
!
ip access-list extended PerimeterServer
permit ip any host 192.168.0.2

Next, we configure the individual zones and the policies between pairs of zones. Finally, individual interfaces are
assigned to the configured security zones (Listing 4-4).

NOTE LISTING 4-4 Firewall Policies and Zone Definitions


The configuration of
zone security Inside
service policies and zone
zone security Perimeter
pairs seems highly
zone security Outside
verbose. You will see
where you can benefit !
from this modularity policy-map type inspect InsideToOutside
when configuring more- class type inspect WebTraffic
complex firewall policies inspect
later in this chapter. class type inspect FileTransfer
inspect
!
policy-map type inspect InsideToPerimeter
class type inspect PublicTraffic
inspect
class type inspect PublicManagement
inspect
!
policy-map type inspect PerimeterToOutside
class type inspect DNS
continues
© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 59

[ 59 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network LISTING 4-4 Firewall Policies and Zone Definitions continued
inspect
class type inspect SMTP
inspect
class type inspect ping
inspect
!
policy-map type inspect OutsideToPerimeter
class type inspect PublicTraffic
inspect
!
policy-map type inspect PerimeterToInside
class type inspect MailDelivery
inspect
!
zone-pair security InsideToOutside source Inside destination Outside
service-policy type inspect InsideToOutside
zone-pair security InsideToPerimeter source Inside destination Perimeter
service-policy type inspect InsideToPerimeter
zone-pair security PerimeterToInside source Perimeter destination Inside
service-policy type inspect PerimeterToInside
zone-pair security PerimeterToOutside source Perimeter destination Outside
service-policy type inspect PerimeterToOutside
zone-pair security OutsideToPerimeter source Outside destination Perimeter
service-policy type inspect OutsideToPerimeter
!
interface FastEthernet0/0
description Inside LAN
zone-member security Inside
!
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 60

[ 60 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network LISTING 4-4 Firewall Policies and Zone Definitions continued
interface FastEthernet0/0.100
description Perimeter network
zone-member security Perimeter
!
interface Serial0/0/0.100 point-to-point
description Link to the Internet
zone-member security Outside

Protecting the Router


NOTE We complete the firewall configuration with the router-protection measures. Obviously, the only traffic allowed from the
There might be addi- outside or the perimeter network to the router is ICMP echo (ping). The router itself can only perform DNS queries, ping,
tional public services the and traceroute to external networks. To monitor potential intrusion activities, the router should log all other connection-
router itself needs to establishment attempts.
access (for example, the
Network Time Protocol Because you cannot match any other protocol except TCP, UDP, and H323 in class maps used in conjunction with the self
[NTP] service). zone, we need to define a completely new set of traffic classes based exclusively on extended IP access lists.

Cisco IOS is using UDP packets to perform the traceroute function. The initial destination UDP port number is 33434
(unless modified with the extended traceroute command); the port number is increased in every probe to allow the router
to match probes with ICMP replies. Therefore, the IP access list matching traceroute traffic defines a wide range of target
UDP ports.

NOTE Furthermore, because the router cannot properly handle ICMP responses to the UDP packets sent with the traceroute
Note that the same policy command, we need to include special provisions for ICMP replies arriving from the public network.
map is used twice to
specify firewall policies The configuration commands used to define firewall policy for inbound traffic from perimeter and outside networks are
between the router and shown in Listing 4-5. (Class map ping is defined in Listing 4-2.) Listing 4-6 contains commands defining the outbound
the outside and perimeter firewall policy. (IP access list IcmpEcho is defined in Listing 4-2.)
zones.
© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 61

[ 61 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network LISTING 4-5 Firewall Policy for Inbound Traffic from Perimeter and Outside Zones
class-map type inspect match-all ICMPreply
match access-group name ICMPreply
!
ip access-list extended ICMPreply
permit icmp any any host-unreachable
permit icmp any any port-unreachable
permit icmp any any ttl-exceeded
permit icmp any any packet-too-big
!
policy-map type inspect PublicToRouter
class type inspect ping
inspect
class type inspect ICMPreply
pass
class class-default
drop log
!
zone-pair security PerimeterToRouter source Perimeter destination self
service-policy type inspect PublicToRouter
zone-pair security OutsideToRouter source Outside destination self
service-policy type inspect PublicToRouter

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 62

[ 62 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network LISTING 4-6 Firewall Policy for Traffic from the Router Toward the Perimeter and Outside Zones
class-map type inspect match-any RouterPublicTraffic
match access-group name traceroute
match access-group name domainLookup
match access-group name IcmpEcho
!
ip access-list extended domainLookup
permit udp any any eq domain
ip access-list extended traceroute
permit udp any range 32768 65535 any range 33434 33523
!
policy-map type inspect RouterToPublic
class RouterPublicTraffic
inspect
!
zone-pair security RouterToPerimeter source self destination Perimeter
service-policy type inspect RouterToPublic
zone-pair security RouterToOutside source self destination Outside
service-policy type inspect RouterToPublic

The permitted traffic between the internal hosts and the firewall router shall obviously include ping and traceroute (as
above) as well as network management access to the firewall.

Ideally, the internal hosts would be allowed to open Telnet and SSH sessions to the router and perform router manage-
ment with SNMP while the router would send syslog, TFTP, and FTP traffic to the internal server. However, because

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 63

[ 63 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network Cisco IOS Release 12.4 does not perform in-depth inspection of router-generated traffic, FTP or TFTP to or from the
router cannot be handled properly. (The router cannot identify the data sessions.) There are three ways to resolve this
problem:

■ Full IP connectivity shall be allowed between the router and the internal server. This solution is not recommended
because anyone getting access to the firewall router would have full access to the internal server.
■ Use SSH or SCP (SSH-based Secure Copy) to download router configurations to the management station. You can
also use SCP to upgrade a router’s software.
■ Use HTTPS (preferred) or HTTP to download new software to the router and store router configurations to the inter-
nal server.

Listing 4-7 shows the configuration commands defining the firewall policy between the firewall router and the inside
network.

LISTING 4-7 Securing Inside Access to the Router


!
! Define inside-to-router policy
!
class-map type inspect RouterManagement
match access-group name RouterManagement
!
ip access-list extended RouterManagement
permit tcp any any eq telnet
permit tcp any any eq 22 ! SSH
permit udp host 10.0.0.10 host 10.0.0.1 eq snmp ! Network management
!
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 64

[ 64 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network LISTING 4-7 Securing Inside Access to the Router continued
policy-map type inspect InsideToRouter
class type inspect ping
inspect
class type inspect RouterManagement
inspect
class type inspect ICMPreply
pass
class class-default
drop log
!
zone-pair security InsideToRouter source Inside destination self
service-policy type inspect InsideToRouter
!
! Define router-to-inside policy
!
class-map type inspect RouterFileTransfer
match access-group name RouterFileTransfer
!
ip access-list extended RouterDataTransfer
permit tcp host 10.0.0.1 host 10.0.0.10 eq 22 ! SSH/SCP
permit tcp host 10.0.0.1 host 10.0.0.10 eq www ! Web (http)
permit tcp host 10.0.0.1 host 10.0.0.10 eq 443 ! SSL (https)
permit udp host 10.0.0.1 host 10.0.0.10 eq snmp ! SNMP traps
permit udp host 10.0.0.1 host 10.0.0.10 eq syslog ! SYSLOG messages
!
policy-map type inspect RouterToInside
class type inspect RouterPublicTraffic
inspect
class type inspect RouterDataTransfer
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 65

[ 65 ]

CHAPTER 4 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Case Study:
Firewall with a
Perimeter Network LISTING 4-7 Securing Inside Access to the Router continued
inspect
!
zone-pair security RouterToInside source self destination Inside
service-policy type inspect RouterToInside

Summary
In this chapter, you’ve seen how you can use the basic configuration commands supported by the zone-based policy fire-
wall feature of Cisco IOS to configure a firewall with public servers in a perimeter network. The configuration by itself is
sufficient for smaller organizations where you would not expect heavy load on the public servers; otherwise, the router
parameters have to be tuned to differentiate expected traffic load from denial-of-service attacks. In addition, this configu-
ration does not detect applications that hide within the HTTP protocol (for example, instant messaging or peer-to-peer
protocols). In the next chapter, you’ll see the advanced configuration commands that address these issues.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 66

[ 66 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall
Configuration
CHAPTER FIVE
Advanced Zone-Based Tuning the Stateful
Inspection ....................................................67
Policy Firewall Tuning Denial-of-
Service Protection ......................................70
Configuration Identifying Masquerading
Applications .................................................74
In the previous chapters, you’ve seen the mandatory configuration
commands used to configure the zone-based policy firewall feature of Application Layer
Packet Inspection .......................................79
Cisco IOS and how they can be used to implement various firewall
designs. In this chapter, we focus on optional and advanced topics, HTTP Packet
including the following: Inspection ....................................................86
Configuring
■ Tuning the stateful inspection
User-Defined Protocols .............................90
■ Tuning denial-of-service protection
■ Identifying applications masquerading as other well-known
applications
■ Configuring application layer inspection policies
■ Configuring user-defined application protocols
Throughout most of this chapter, we discuss the firewall with a
perimeter network from the previous chapter and incrementally fine-
tune its configuration.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 67

[ 67 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall
Configuration
Tuning the Stateful Inspection
The zone-based policy firewall shares a number of features with Cisco IOS firewall stateful inspection, one of them being
the capability to generate an audit log of interesting sessions. The audit log can be enabled for an individual traffic class
in a policy map with the help of a global parameter-map object that defines the inspection parameters. To configure
auditing of inspected sessions, use the configuration commands in Table 5-1.

TABLE 5-1 Configuring Session Auditing


Command Syntax Description
parameter-map type inspect name Creates or modifies the specified parameter map.
alert on | off Enables or disables syslog alerts (default: on).
audit-trail on | off Enables or disables a session audit trail written to the router’s log (default: off).
inspect parameter-map-name Within a policy-map class definition, attaches a predefined parameter map to the
inspect action to modify its default behavior.

For example, in the firewall setup from the preceding chapter, we might want to log all incoming SMTP sessions as
shown in Figure 5-1.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 68

[ 68 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall
Client Internal Server Outside
Configuration 10.0.0.2 10.0.0.10
Internet
FIGURE 5-1
Audit trail of inbound
SMTP sessions
External Mail Server
Inside 172.18.25.10
Syslog Alert Inbound SMTP
Session

Web/Mail Server
192.168.0.2
Perimeter

To configure the audit trail for the SMTP session, we need to do the following:

■ Configure a parameter map with the audit trail.


■ Assign SMTP to a separate traffic class. (Currently, it’s bundled with all other public protocols, and you can apply
auditing only to an entire class.)
WARNING
Do not delete and re- ■ Reconfigure the OutsideToPerimeter policy map to include the new traffic class. Because the new traffic class is a
create a policy map as subset of the existing traffic class, we need to put it at the beginning of the policy map. There is no way to insert
you would do with an class commands in a policy map (they are always appended), so all class definitions have to be erased and reentered.
access list. Deleting a
policy map silently Listing 5-1 includes the step-by-step configuration process.
removes all references to
it, thus potentially modi-
fying your router config-
uration.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 69

[ 69 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-1 Configuring the Audit Trail of Inbound SMTP Sessions
Configuration conf t
fw#c
Enter configuration commands, one per line. End with CNTL/Z
class-map type inspect PublicSMTP
fw(config)#c
match class-map SMTP
fw(config-cmap)#m
match access-group name ExternalServer
fw(config-cmap)#m
exit
fw(config-cmap)#e
parameter-map type inspect audit
fw(config)#p
audit-trail on
fw(config-profile)#a
exit
fw(config-profile)#e
policy-map type inspect OutsideToPerimeter
fw(config)#p
no class type inspect PublicTraffic
fw(config-pmap)#n
class type inspect PublicSMTP
fw(config-pmap)#c
inspect audit
fw(config-pmap-c)#i
class type inspect PublicTraffic
fw(config-pmap-c)#c
inspect
fw(config-pmap-c)#i
^Z
fw(config-pmap-c)#^
fw#

After this configuration change, the router generates a line in the syslog for every session establishment and termination
event. Sample log messages are displayed in Listing 5-2.

LISTING 5-2 SMTP Session Audit Trail


%FW-6-SESS_AUDIT_TRAIL_START: (target:class)-(OutsideToPerimeter:PublicSMTP):Start smtp session: initiator
(172.18.25.10:1044) -- responder (192.168.0.2:25)
%FW-6-SESS_AUDIT_TRAIL: (target:class)-(OutsideToPerimeter:PublicSMTP)
:Stop smtp session: initiator (172.18.25.10:1044) sent 31 bytes -- responder (192.168.0.2:25) sent 306 bytes

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 70

[ 70 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall
Configuration
Tuning Denial-of-Service Protection
The stateful firewall inspection in Cisco IOS contains inherent denial-of-service (DoS) protection mechanisms. The router
constantly monitors the number of established and half-open connections and the connection creation rate and issues
NOTE
Half-open TCP connec-
warnings or alerts when they exceed configured thresholds. The router also tries to cope with a DoS attack (primarily
tions are connections SYN attacks in which the intruder sends a large number of TCP SYN packets, also called SYN floods) by aggressively
where the SYN packet deleting half-open sessions when their number exceeds the threshold or when the session establishment rate exceeds the
has been received, but the threshold.
first non-SYN packet
hasn’t been seen yet.
WARNING
The rapid deletion of half-open TCP sessions helps preserve the integrity of the network infrastructure and
the existing TCP sessions (servers might simply crash or hang up under a DoS attack). It does not help
preserve the service availability, because the legitimate sessions in the establishment phase also get
dropped among the fake ones. TCP intercept is a much better mechanism to maintain service availability
during an aggressive SYN flood. However, it has a big performance impact, which might prevent its use on
a heavily loaded router.

The Cisco IOS Firewall Stateful Inspection (CBAC) feature enables you to configure only the global thresholds. The
zone-based policy firewall uses parameter maps that can be attached to every inspect statement in a policy map, resulting
in a very granular solution that can be fine-tuned to the actual network environment and traffic patterns.
The commands described in Table 5-2 are used to configure the inspect thresholds in a parameter map. (The parameter-
map syntax is described in Table 5-1.) Remember that all parameters apply to a single traffic class between a pair of
zones.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 71

[ 71 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall TABLE 5-2 Configuring Inspect Thresholds
Configuration Command Syntax Description
alert on | off Enables or disables syslog alerts (default: on).
audit-trail on | off Enables or disables the session audit trail written to the router’s log (default: off).
sessions maximum number Configures the maximum number of sessions in this traffic class.
dns-timeout seconds Configures the maximum time between the DNS query and response packet.
icmp idle-timeout seconds Configures the maximum time between ICMP request and reply.
max-incomplete high Configures the threshold at which the Cisco IOS firewall starts the DoS protection (high parameter)
number | low number and when the DoS protection stops (low parameter). While the DoS protection is active, the firewall
resets one half-open connection for every new connection attempt.
one-minute high number | Configures the per-minute session establishment threshold that triggers the DoS protection. The
low number process starts after the high threshold has been exceeded and stops when the session establishment
rate drops below the low threshold.
tcp max-incomplete host Configures the maximum number of half-open sessions from a single IP host. The offending host
threshold [ block minutes ] could be (optionally) blocked for the specified duration.
tcp synwait-time seconds Configures TCP timers—the maximum time between packets in session establishment, the
tcp finwait-time seconds maximum time between packets in session termination and the session idle timer.
tcp idle-time seconds
udp idle-time seconds Configures the idle timer for non-DNS UDP sessions.

You can display the default values of all these parameters with the show parameter-map type inspect default command,
which displays the values in Listing 5-3.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 72

[ 72 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-3 Default Stateful Packet Inspection Thresholds
Configuration show parameter-map type inspect default
fw#s
parameter-map type inspect default values
audit-trail off
alert on
max-incomplete low 400
max-incomplete high 500
one-minute low 400
one-minute high 500
udp idle-time 30
icmp idle-time 10
dns-timeout 5
tcp idle-time 3600
tcp finwait-time 5
tcp synwait-time 30
tcp max-incomplete host 50 block-time 0

You would usually need to modify the inspect thresholds in high-volume environments when the router starts issuing
warning and alert messages (similar to Listing 3-9). For example, it’s quite easy to get more than 500 HTTP requests per
minute on a popular website.

Before changing the thresholds, it might be beneficial to reduce the various timeouts (which will by itself reduce the
number of half-open sessions). For example, many host DNS resolvers time out in 2 seconds. Thus, having a 5-second
DNS timeout is overkill. Similarly, a 30-second synwait-time is useful only if there is a dialup connection in the
outbound session establishment path; otherwise, you should use a timeout of a few seconds. The 10-second icmp idle-
timeout can also be reduced unless you have very slow-speed congested links.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 73

[ 73 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall After you have adapted the timeouts to your environment, perform the following steps to fine-tune the half-open session
Configuration thresholds:

Step 1. Make sure your network is not infected with a worm or a target of a DoS attack. (In both cases, tuning DoS
protection will obviously not help.)
Step 2. Create a new parameter map that considerably increases the current thresholds (for example, by a factor of
10). Apply the new parameter map to the inspect statement in the policy map that triggers the DoS protec-
tion. (The alert message indicates the policy map and the class within it.)
Step 3. After a statistically significant time period (at least a day), review the inspect counters (see Listing 5-4).

LISTING 5-4 Displaying Session Inspection Parameters of a Zone Pair


sh policy-map type inspect zone-pair OutsideToPerimeter
fw#s
Zone-pair: OutsideToPerimeter
Service-policy inspect : OutsideToPerimeter

… service policy printout deleted …

Inspect
Session creations since subsystem startup or last reset 15480
Current session counts (estab/half-open/terminating) [6:2:0]
Maxever session counts (estab/half-open/terminating) [73:7:0]
Last session creation rate 37
Last half-open session total 0

… rest of printout deleted …

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 74

[ 74 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall Step 4. Set the max-incomplete low parameter to the Maxever session counts half-open value. Set the max-
Configuration incomplete high parameter to a value at least 25 percent above that. Increase the parameter to an even higher
value if you expect a significant increase in network traffic (for example, increased website traffic due to a
marketing campaign).
NOTE Step 5. The Cisco IOS printout gives you no reliable information that would allow you to set the one-minute thresh-
Server logs are an olds. As a starting point, set the one-minute low value to 3 times the Maxever session counts estab value and
extremely valuable the one-minute high value to a 50 percent higher value.
resource in the tuning
process. Computing one- Step 6. Repeat the process for every traffic class that needs adjusted DoS protection behavior.
minute session establish-
ment rate from a web Step 7. Perform ongoing firewall DoS protection monitoring, and log all related events to a syslog server. The logged
server log is a simple events will help you perform additional fine-tuning of the parameters.
exercise.

Identifying Masquerading Applications


Some applications (most notably, instant messaging and peer-to-peer applications) are extremely aggressive in their
attempts to establish connections with their servers. For example, Yahoo Messenger first tries to connect to Yahoo! servers
using its standard port numbers (5050 for instant messaging, 5061 for voice; see Listing 5-5 for details), but if that fails, it
uses any TCP port number that the firewall permits (for example, Telnet or HTTPS; see Listing 5-6 for an example). To
be fair, other instant messaging (IM) applications are no better, and Yahoo! even documents this behavior.

LISTING 5-5 Active TCP Connections After the Yahoo Messenger Has Started
Myhost $ netstat
Active Connections
Proto Local Address Foreign Address State
TCP myhost:1938 cs31.msg.dcn.yahoo.com:5050 ESTABLISHED
TCP myhost:1957 sip34.voice.re2.yahoo.com:5061 ESTABLISHED

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 75

[ 75 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-6 Yahoo Messenger Port Usage After Ports 5050 and 5061 Were Disabled on the Firewall
Configuration Myhost $ netstat
Active Connections
Proto Local Address Foreign Address State
TCP myhost:1988 cs31.msg.dcn.yahoo.com:telnet ESTABLISHED
TCP myhost:2005 sip38.voice.re2.yahoo.com:https ESTABLISHED

The applications that can adapt their TCP or UDP port usage or use well-known ports reserved for other applications as a
disguise are effectively trying to bypass firewall policies. For example, in the sample firewall designed in Chapter 4,
“Case Study: Firewall with a Perimeter Network,” the internal clients were only allowed to browse the web and use FTP
for file transfer. However, they could still use IM applications, because the inside clients have unlimited access to outside
web servers, giving the IM applications a TCP port they can use, as shown in Figure 5-2.
FIGURE 5-2 Unknown
Yahoo Messenger application, dropped
bypassing the Client Outside
firewall policy 10.0.0.2
scs.msg.yahoo.com:5050 STOP

scs.msg.yahoo.com:80
Yahoo Server

Inside
Looks like web
browsing, passed

Perimeter

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 76

[ 76 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall The masquerading applications fall into two categories:
Configuration
■ They use any TCP port permitted by the firewall, but only toward a well-known range of servers. For example, all
IM applications have to connect to well-known servers as they exchange the chat traffic through them.
■ Some peer-to-peer applications use any TCP port (or a fixed range of ports, such as web only) toward a wide range
of IP addresses. The only means of identifying these applications is by looking for their specific signatures in the
data stream (similar to the way virus scanners identify new viruses).
Cisco IOS can identify both types of applications starting in Release 12.4(9)T.

Identifying Peer-to-Peer Applications


To identify the peer-to-peer applications by their signature, use the signature option in the match command of a class
map. For example, to match all peer-to-peer applications in our sample firewall, you could use the traffic class definition
in Listing 5-7.

LISTING 5-7 Matching Peer-to-Peer Applications by Their Signature


class-map type inspect match-any peer2peer
match protocol gnutella signature
match protocol edonkey signature
match protocol kazaa2 signature
match protocol fasttrack signature

The signature-based classification bypasses the order of classes in a policy map, so the peer-to-peer sessions misusing
ports from other applications are detected regardless of the order of class maps in a policy map.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 77

[ 77 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall Identifying Instant Messaging Applications
Configuration
Instant messaging applications (and other applications that use unspecified ports to connect to their server) are identified
with the help of the protocol-info parameter-map using the syntax in Table 5-3.

TABLE 5-3 Configuring a Protocol Information Parameter Map


NOTE
Domain name resolution Command Syntax Description
must be enabled in the parameter-map type protocol-info name Creates or modifies the specified parameter map
router with the ip server {name name | ip address} Specifies a single server by its name or IP address
domain lookup
command and an external server ip range start end Specifies a range of servers between start and end IP addresses
DNS server configured
with the ip name-server The name of the protocol-info parameter-map can then be appended to the match command in a class map definition.
command before you can For example, to identify Yahoo Messenger, you could use the parameter map and class map configuration in Listing 5-8.
use the server name
name command. NOTE
The router allows you to attach a protocol-info parameter-map to any match protocol statement in a class map (with the exception of peer-to-
peer applications, where the signature keyword follows the protocol name), but it only works correctly for instant messaging applications in
Cisco IOS Release 12.4(9)T.

LISTING 5-8 Identifying a Yahoo Messenger Application


parameter-map type protocol-info YMServers
server name scs.msg.yahoo.com
server name insider.msg.yahoo.com
server name sip.yahoo.com
!
class-map type inspect match-all YahooMessenger
match protocol ymsgr YMServers

When you use protocol-info-based traffic classification in a policy map, you don’t have to worry about the order of the
class commands. The destination IP address match with the parameter map is done before the sequential scan of the
policy map, so the IM applications are correctly identified regardless of their position in the policy map.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 78

[ 78 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall If you want to disable access to Yahoo Messenger in our sample firewall from Chapter 4, you have to augment the
Configuration InsideToOutside policy map with the commands from Listing 5-9.

LISTING 5-9 Disable Yahoo Messenger in the Sample Firewall


policy-map type inspect InsideToOutside
class type inspect YahooMessenger
drop

You can monitor the protocol-info parameter maps with two show commands (both printouts are included in Listing 5-10):
■ show parameter-map type protocol-info {name} displays the definition of the parameter map (so you don’t have

to browse the router configuration).


■ show parameter-map type protocol-info dns-cache zone-pair name displays the IP addresses used in traffic clas-
sification in the specified zone pair; all parameter-maps used in the policy map attached to the zone pair with IP
addresses to which the hostnames specified in them resolve to.
LISTING 5-10 protocol-info-Related show Commands
show parameter-map type protocol-info
fw#s
parameter-map type protocol-info YMServers
server name scs.msg.yahoo.com
server name insider.msg.yahoo.com
server name sip.yahoo.com
show parameter-map type protocol-info dns-cache zone-pair InsideToOutside
fw#s
Application im-yahoo. Server DNS Name: ‘scs.msg.yahoo.com’.
Updates: 0 failed, 328 succeeded, next after 5.866 secs
Number of IP Addresses: 8
216.155.193.138 (0D:00H:00M) 216.155.193.139 (0D:00H:00M)
216.155.193.140 (0D:00H:00M) 216.155.193.141 (0D:00H:00M)
216.155.193.142 (0D:00H:00M) 216.155.193.143 (0D:00H:00M)
216.155.193.136 (0D:00H:00M) 216.155.193.137 (0D:00H:00M)
Application im-yahoo. Server DNS Name: ‘insider.msg.yahoo.com’.
Updates: 0 failed, 17 succeeded, next after 0.942 secs
Number of IP Addresses: 2
continues
© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 79

[ 79 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-10 protocol-info-Related show Commands continued
Configuration 68.142.194.14, 68.142.231.252 (0D:00H:00M)
Application im-yahoo. Server DNS Name: ‘sip.yahoo.com’.
Updates: 0 failed, 2 succeeded, next after 3.086 secs
Number of IP Addresses: 8
68.142.233.179 (0D:00H:00M) 68.142.233.180 (0D:00H:00M)
68.142.233.181 (0D:00H:00M) 68.142.233.182 (0D:00H:00M)
68.142.233.183 (0D:00H:00M) 68.142.233.176 (0D:00H:00M)
68.142.233.177 (0D:00H:00M) 68.142.233.178 (0D:00H:00M)

Application Layer Packet Inspection


In addition to the transport layer stateful inspection (which, for protocols with separate control and data sessions such as
FTP and H.323, includes some processing of an application data stream), the zone-based policy firewall feature supports
application layer inspection (also called deep packet inspection [DPI]) of several popular protocols, including the following:

■ Internet Mail Access Protocol (IMAP) and Post Office Protocol (POP). You can check whether the users are trying to
use cleartext authorization.
■ Simple Mail Transfer Protocol (SMTP). You can check maximum message length.
■ Sun Remote Procedure Call (SUNRPC). You can block access to specific programs over the RPC mechanism.
■ Peer-to-peer applications (eDonkey, FastTrack, Gnutella, and Kazaa). You can match and block transfer of files
matching the specified regular expression.
■ Instant messaging (AOL, MSN, Yahoo!). You can block the entire messaging service or just the text chat within it.
■ Hypertext Transport Protocol (HTTP). You can match on a large number of parameters, including web address
(Universal Resource Locator [URL]), content type, or any other component of the HTTP request or response header.
You can also identify applications misusing HTTP for tunneling, instant messaging, or peer-to-peer applications.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 80

[ 80 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall All application layer inspections are configured using application-specific class maps and policy maps that are then
Configuration attached with the service-policy command as children of Layer 4 policy maps.

Application-specific class maps are configured with the class-map type inspect protocol name configuration command.
The list of protocols supported is displayed in Listing 5-11.

LISTING 5-11 Application Layer Protocol Inspection in Cisco IOS Release 12.4(9)T
class-map type inspect ?
fw(config)#c
WORD class-map name
aol Configure CBAC class-map for IM-AOL protocol
edonkey eDonkey
fasttrack FastTrack Traffic - KaZaA, Morpheus, Grokster...
gnutella Gnutella Version2 Traffic - BearShare, Shareeza, Morpheus ...
http Configure CBAC class-map for HTTP protocol
imap Configure CBAC class-map for IMAP protocol
kazaa2 Kazaa Version 2
match-all Logical-AND all matching statements under this classmap
match-any Logical-OR all matching statements under this classmap
msnmsgr Configure CBAC class-map for IM-MSN protocol
pop3 Configure CBAC class-map for POP3 protocol
smtp Configure CBAC class-map for SMTP protocol
NOTE
sunrpc Configure CBAC class-map for RPC protocol
The match commands
available in the class ymsgr Configure CBAC class-map for IM-YAHOO protocol
map configuration are
protocol-specific; you Within each class map definition, you can use the match commands to match supported features of the protocol. After
can find a detailed list in the class maps have been defined, you can configure the application-specific policy maps with the policy-map type
the Cisco IOS documen- inspect application name command. The set of applications is a bit shorter (see Listing 5-12) because you can use any
tation. The extensive set instant-messaging class-map (aol, msnmsgr, and ymsgr) in im policy-map and similarly any peer-to-peer class map
of HTTP match (edonkey, fasttrack, gnutella) in p2p policy-map. For all other protocols, the type of the class-map has to match the
commands is described
type of the policy map within which it’s used.
in the next section.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 81

[ 81 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-12 Configuring the Application Layer Policy Map
Configuration policy-map type inspect ?
fw(config)#p
WORD policy-map name
http Configure CBAC policy-map for HTTP protocol
im Configure CBAC policy-map for IM protocol
imap Configure CBAC policy-map for IMAP protocol
p2p Configure CBAC policy-map for P2P protocols
pop3 Configure CBAC policy-map for POP3 protocol
smtp Configure CBAC policy-map for SMTP protocol
sunrpc Configure CBAC policy-map for RPC protocol

NOTE Within application layer policy maps, you can use the following actions:
Not all the actions are
available in all policy ■ log—Logs the session
maps. The allow action
is not available in IMAP ■ allow—Allows the traffic matching the class map
and POP3 policy maps, ■ reset—Resets the connection
and the reset action is
not available in the After the application layer policy maps are configured, you can attach them as a service policy to existing traffic classes
SUNRPC policy map in the Layer 4 policy maps.
(because you cannot reset
a UDP connection).
IMPORTANT
■ You can only attach a service policy to a class with the inspect action. Application layer policies thus require
stateful inspection at the parent level.
■ Application layer policies can be used only inside Layer 4 policies, not in zone pair definitions.
■ A single application layer policy map can be attached to a class in a Layer 4 policy map. This restriction might
force you to implement more granular Layer 4 classes.
■ The class to which a service policy is attached can match only protocols handled by the service policy. For
example, you cannot attach a POP3 service policy to a class matching both POP3 and IMAP protocols.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 82

[ 82 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall ■ Packets not matched by any class in a Layer 4 policy map are handled by class-default. If no action is specified in
Configuration class-default, these packets are dropped. Packets not matched by an application layer policy map are not dropped
NOTE
but are handled according to the specifications of the parent policy map.
Some of these issues
could be solved with
other mechanisms. For
Application Layer Packet Inspection Example
example, peer-to-peer Let’s illustrate these concepts with an example. We’ll use the very simple LAN-to-Internet firewall from Chapter 3,
services could be prohib- “Configuring Zone-Based Policy Firewalls in Cisco IOS,” where there were no restrictions on traffic from inside clients
ited, and secure POP3 to outside server. To control the Internet access link utilization, the IT manager would like to prevent download of MP3
and IMAP could be
files with peer-to-peer services and limit the size of e-mails the users can send. Furthermore, because the e-mail is hosted
deployed instead of
forcing the users to use
on external servers, the users shall be forced to use non-clear-text authentication methods to prevent a potential intruder
non-clear-text authentica- or an external wiretap from collecting the passwords (Figure 5-3).
tion on regular
POP3/IMAP sessions. No cleartext POP3
authentication
Outside
FIGURE 5-3 Client pp3.isp.com
Simple LAN-to- 172.16.0.2
POP3 USER command STOP
Internet firewall
POP3 APOP command

10.0.0.0/24
Internet
10.0.0.1 192.168.201.6
Inside

To implement these requirements, a large number of class maps and policy maps must be configured:
■ A class map and a policy map have to be configured for POP3, IMAP, and SMTP DPI (Listing 5-13).
■ Four class maps must be configured to cover all four supported peer-to-peer services together with a P2P policy map
(Listing 5-14).

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 83

[ 83 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall ■ Inspect class maps have to be configured to match individual protocols for which we want to perform DPI
Configuration (Listing 5-15).
■ Finally, a policy map (InsideToOutside) is configured tying together all the previously configured objects
(Listing 5-16). From there onward, use the remainder of the configuration from the beginning of Chapter 3.

LISTING 5-13 Application-Level Inspection of E-mail–Related Protocols


class-map type inspect imap match-any imapMail
match invalid-command
match login clear-text
!
policy-map type inspect imap imapPolicy
class type inspect imap imapMail
log
reset
!
class-map type inspect pop3 match-any pop3Mail
match invalid-command
match login clear-text
!
policy-map type inspect pop3 pop3Policy
class type inspect pop3 pop3Mail
reset
log
!
class-map type inspect smtp match-any smtpMail
match data-length gt 5000000
!

continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 84

[ 84 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-13 Application-Level Inspection of E-mail–Related Protocols continued
Configuration policy-map type inspect smtp smtpPolicy
class type inspect smtp smtpMail
reset

LISTING 5-14 Application-Level Inspection of Peer-to-Peer Traffic


class-map type inspect gnutella match-any noMP3gnutella
match file-transfer mp3
!
class-map type inspect fasttrack match-any noMP3fasttrack
match file-transfer mp3
!
class-map type inspect edonkey match-any noMP3edonkey
match file-transfer mp3
match search-file-name mp3
!
class-map type inspect kazaa2 match-any noMP3kazaa
match file-transfer mp3
!
policy-map type inspect p2p noMP3transfer
class type inspect edonkey noMP3edonkey
log
reset
class type inspect fasttrack noMP3fasttrack
log
reset
class type inspect gnutella noMP3gnutella
log
reset
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 85

[ 85 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-14 Application-Level Inspection of Peer-to-Peer Traffic continued
Configuration class type inspect kazaa2 noMP3kazaa
log
reset

LISTING 5-15 Class Maps Matching Individual Deeply Inspected Application Protocols
class-map type inspect match-any getMail
match protocol pop3
class-map type inspect match-any sendMail
match protocol smtp extended
class-map type inspect match-any readMail
match protocol imap
class-map type inspect match-any peer2peer
match protocol gnutella signature
match protocol edonkey signature
match protocol kazaa2 signature
match protocol fasttrack signature

LISTING 5-16 Inside-to-Outside Firewall Policy


policy-map type inspect InsideToOutside
class type inspect peer2peer
inspect
service-policy p2p noMP3transfer
class type inspect getMail
inspect
service-policy pop3 pop3Policy
class type inspect readMail
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 86

[ 86 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-16 Inside-to-Outside Firewall Policy continued
Configuration inspect
service-policy imap imapPolicy
class type inspect sendMail
inspect
service-policy smtp smtpPolicy
class class-default
inspect

HTTP Packet Inspection


NOTE Cisco IOS Firewall software offers only rudimentary packet-matching features for most protocols for which deep packet
HTTP packet inspection inspection is supported. Hypertext Transfer Protocol (HTTP), the protocol used to exchange content between the web
works only on non- server and its clients, is a notable exception. You can use a number of different match conditions (introduced in Cisco IOS
encrypted HTTP
Release 12.3(14)T with the HTTP Application Inspection Engine) to classify the web traffic, from extremely helpful ones
sessions. If the data
exchange takes place
(identifying HTTP misuse for unauthorized traffic) to arcane ones (for example, the number of header fields in the
over Secure Sockets request or response header).
Layer (SSL, also known
as HTTPS), the firewall
HTTP packet inspection is configured using the same configuration syntax as any other DPI:
cannot inspect the packet
■ The class-map type inspect http name command is used to define traffic classes.
content.
■ The policy-map type inspect http name command defines the HTTP inspection policy. You can use allow, reset,
and log action commands within it.
■ The HTTP inspection policy is attached to a class within a type inspect policy map with the service-policy http
name command. The class within which service-policy http is configured can match only the HTTP packets (and it
has to match them with the match protocol http command).

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 87

[ 87 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall The match commands that you can use in the class-map type inspect http command follow these rules:
Configuration
■ You can match on a condition in the HTTP request only (match request …), in the HTTP reply only
(match reply …), or in request or reply (match req-resp …).
■ You can match the fields in the HTTP request or response header (match … header) or body (match … body).
■ You can match header or body length (match … length gt size or match … length lt size) or inspect its contents
and match it with a regular expression (match … regex parameter-name).
■ You can also test individual fields in the request or response header, comparing them with a regular expression
(match … header fieldname regex parameter-name), checking whether the response values match the request
values, or checking for potential protocol violations.
■ Finally, several generic match commands are listed in Table 5-4.

TABLE 5-4 Matching HTTP Requests and Responses


Command Syntax Description
match request uri regex name Matches the web address (URI) with a regular expression
match request arg regex name Matches the HTTP request arguments with a regular expression
match request method Matches the HTTP method in the request (GET, POST …)
http-method-name
match request port-misuse Identifies potential misuses of HTTP by tunneling, peer-to-peer, or instant-
im | p2p | tunneling | any messaging applications
match response status-line Matches the status of the HTTP response (for example, 200 = OK, 403 = forbidden,
regex name 404 = not found)

Contrary to many other Cisco IOS features where you just enter the regular expression you need, the HTTP-specific
match commands use a new object named regex parameter-map, which is configured with the commands in Table 5-5.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 88

[ 88 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall TABLE 5-5 Configuring Regular Expression Parameter Maps
Configuration Command Syntax Description
parameter-map type regex name Creates a new regular expression parameter map.
pattern regex Specifies the pattern to match. Multiple patterns can be specified in the
same parameter-map.

The extensive set of match commands would let you believe that you can easily match almost any web-related condition
on the firewall. The reality is a bit different due to very limited syntax of the class-map and policy-map commands:

■ Hierarchical HTTP-specific class maps are not supported. You can thus only match on all conditions (match-all) or
any of them (match-any). There is no mechanism to build more complex logical expressions with the class maps.
■ Negation in a class map is not supported. It’s thus impossible to identify an HTTP request not matching a condition.
■ You cannot attach an action to the class-default of the HTTP-specific policy map. You are thus forced to define a
bogus match-all class to be able to attach an action to it.
Effectively, the configuration syntax only allows you to specify a logical condition that is an OR of multiple conditions,
each of those being an OR or an AND of the various match conditions.

Configuring Simple HTTP Inspection


Consider, for example, the simple LAN-to-Internet firewall with no traffic restrictions (from Chapter 3) that was improved
in the previous section (Figure 5-3). Now the IT manager would like to implement a simple HTTP inspection policy:
HTTP misuses and uncommon HTTP commands (anything but GET, POST, and HEAD) shall be denied. To configure
this requirement, you have to perform the following configuration steps (final configuration is in Listing 5-17):

■ class-map validHttpCommands is defined to match all allowed HTTP request methods.


■ class-map httpPortMisuse is defined to match any misuses of TCP port 80.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 89

[ 89 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall ■ class-map anyOtherHttp matches all HTTP traffic, effectively replacing the class-default.
Configuration
■ policy-map validHttp defines the HTTP inspection policy. The TCP session is reset when a port misuse is detected
or when the HTTP request method does not match one of the allowed methods.
■ A new inspect class-map is defined to match the HTTP traffic and is appended at the end of the existing
InsideToOutside policy map (just in front of the class-default line).

LISTING 5-17 Implementing Simple HTTP Inspection


NOTE
Adding an unrelated class-map type inspect http match-any validHttpCommands
condition (for example, match request method get
allowing only the three match request method post
request methods and only match request method head
the content types text/* !
and image/*) would class-map type inspect http match-any httpPortMisuse
result in a large set of match request port-misuse any
class maps and a !
complex policy map, class-map type inspect http match-any anyOtherHttp
because you would have
!
to match each combina-
policy-map type inspect http validHttp
tion of method and
class type inspect http httpPortMisuse
content type individually
reset
with a separate match-all
class map and then list log
all of them in the policy class type inspect http validHttpCommands
map. allow
class type inspect http anyOtherHttp
reset
!
class-map type inspect match-any httpTraffic
match protocol http
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 90

[ 90 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall LISTING 5-17 Implementing Simple HTTP Inspection continued
Configuration !
policy-map type inspect InsideToOutside
class type inspect httpTraffic
inspect
service-policy http validHttp

Configuring User-Defined Protocols


In many firewall scenarios, you have to identify nonstandard protocols (or protocols not yet recognized by Cisco IOS) or
standard protocols operating on nonstandard port numbers. A common requirement is the support for HTTP proxy
servers, which usually operate on TCP port 8080. For example, to implement a firewall with proxy server in the perimeter
network, the firewall policy configuration shall allow TCP sessions to port 8080 of the proxy server (Figure 5-4).
FIGURE 5-4 Client Outside
Proxy access to 10.0.0.2
external web server Internet
Re
qu
es
to

0
r t 8 External Web Server
n

o
po

Inside np
rt

o 172.18.25.10
st
80

ue
80

R eq

Proxy Web Server


192.168.0.2
Perimeter

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 91

[ 91 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall You could solve this challenge with existing configuration commands by defining an extended IP access list and a class
Configuration map based on the access list (similar to how we’ve recognized ICMP echo packets in previous configurations), or you
could define a user-defined protocol with the ip port-map command (see the syntax in Table 5-6).

TABLE 5-6 Defining Nonstandard TCP or UDP Port Use


Command Syntax Description
ip port-map user-protocol-name Specifies port usage for a user-defined protocol. The protocol name must start with the user-
port {tcp | udp} port-number prefix to ensure there is no overlap with future protocol additions to Cisco IOS.
ip port-map protocol port Specifies a nonstandard TCP or UDP port for a protocol recognized by Cisco IOS.
{tcp | udp} port-number

In the sample firewall, you could define your own protocol on TCP port 8080 and use it in a class map in a configuration
similar to the one in Listing 5-18.

LISTING 5-18 Configuring a User-Defined Protocol


ip port-map user-proxyhttp port tcp 8080
!
class-map type inspect match-all proxyhttp
match protocol user-proxyhttp
!
policy-map type inspect InsideToPerimeter
class type inspect proxyhttp ! matches TCP port 8080
inspect ! cannot use HTTP service policy
class type inspect ping
inspect

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 92

[ 92 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall When you define your own protocol, you cannot use extended features Cisco IOS supports for standard protocols. For
Configuration example, if you configure FTP on a nonstandard port as a user-defined protocol, Cisco IOS will not recognize its data
sessions. You also cannot use DPI for a user-defined protocol. In both cases, specifying additional port numbers for stan-
NOTE
dard protocols is preferred. So, if you want to use DPI of requests made from inside clients to the proxy server, you
Adding TCP or UDP
ports to standard proto- should define an additional port for the HTTP protocol (Listing 5-19).
cols with the ip port-
map command affects LISTING 5-19 Configuring Additional Port Numbers for a Standard Protocol
other Cisco IOS features ip port-map http port tcp 8080
that use the port map
!
functionality (for
class-map type inspect match-all web
example, Network-Based
match protocol http
Application Recognition
[NBAR]). !
policy-map type inspect InsideToPerimeter
class type inspect web ! matches TCP port 80 and port 8080
inspect ! can use HTTP service policy
class type inspect ping
inspect

After you define additional port numbers for standard protocols, any match protocol command will match these port
numbers as well. If you want to limit a traffic class to the standard port number (for example, when matching inbound
traffic for the public web server), you have to combine the match protocol command with an access list (Listing 5-20).

LISTING 5-20 Defining the WebTraffic Class


class-map type inspect WebTraffic
match protocol http
match access-group name WebPort80
!
ip access-list extended WebPort80
permit tcp any any eq www

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 93

[ 93 ]

CHAPTER 5 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Advanced Zone-
Based Policy
Firewall
Configuration
Summary
In this chapter, you’ve seen how you can use advanced configuration commands of the zone-based policy firewall config-
uration to do the following:

■ Generate an audit log of inspected sessions with a parameter-map type inspect containing the audit on parameter.
■ Configure DoS-prevention parameters with a parameter map.
■ Identify peer-to-peer and instant-messaging applications even when they use port numbers reserved for other appli-
cations.
■ Configure firewall policies for POP3, IMAP, SMTP, HTTP, peer-to-peer, and instant-messaging applications.
■ Configure user-defined protocols or add nonstandard TCP or UDP port numbers to protocols already recognized by
Cisco IOS with the ip port-map command.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 94

[ 94 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls
CHAPTER SIX
Configuring Protecting Internal
Servers: Alternate Design .......................103
Transparent Firewalls Case Study: Migrating a
Server to the Perimeter Network...........106
Cisco IOS Release 12.3(7)T introduced the transparent firewall
feature: the ability to filter IP traffic between a pair of bridged inter-
faces. This feature is fully supported by the new zone-based configura-
tion commands, making transparent firewall configuration extremely
simple. Before configuring this interesting feature (which introduces
no additional configuration commands), you have to understand its
underlying mechanisms and design rules, which we cover in depth in
this chapter. Throughout most of the examples, we focus on a slightly
modified version of the firewall with a perimeter network introduced
in Chapter 4, “Case Study: Firewall with a Perimeter Network”
(Figure 6-1).
FIGURE 6-1 Perimeter VLAN 518 Outside
Physical firewall Client
10.0.0.2 Web/Mail Server
structure 192.168.0.2
Inside
VLAN 516 Internet

Server
10.0.0.10

Inside
VLAN 517 VLAN trunk

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 95

[ 95 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls Our organization has built a switched LAN network with all clients and servers residing in one IP subnet. It has success-
fully implemented the external firewall and wants to increase the security of its internal LAN by isolating servers from
the end users and giving only the network administrators privileged access to the servers. Traditionally, to implement this
requirement, you would split the network into three subnets (requiring at least partial renumbering of the network) and
install a firewall in the middle. In not-so-well-managed LAN environments, where the DNS and DHCP services are inter-
mingled with static IP address and hostnames entered in hosts files, renumbering might not be a viable option.

In the new firewall design, the inside clients and servers have been split into two separate VLANs, and the perimeter
NOTE network is connected to a third VLAN, all three of them being connected to the firewall router with a VLAN trunk.
It’s a bad idea to connect (VLAN configuration on the router is included in Listing 6-1.) The client and the server host are in the same IP subnet, so
inside and perimeter or the traffic between them has to be bridged. The firewall should thus perform interzone checks both on routed and bridged
outside devices to the IP traffic.
same switch because they
might end up being
directly connected if the LISTING 6-1 VLAN Configuration on the Firewall Router
switch loses its configu- interface FastEthernet0/0
ration. However, if your description Trunk to the LAN switch
router has a single physi- !
cal LAN interface, that interface FastEthernet0/0.1
might be the only solu- encapsulation dot1Q 516
tion.
description Client VLAN
!
interface FastEthernet0/0.5
encapsulation dot1Q 517
description Server VLAN
!
interface FastEthernet0/0.100
encapsulation dot1Q 518
description Perimeter VLAN

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 96

[ 96 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls The Cisco IOS transparent firewall relies on the integrated routing and bridging (IRB) infrastructure, where a group of
bridged ports is treated as a logical IP interface. To configure IRB, perform the following steps:

Step 1. Enable integrated routing and bridging with the bridge irb command.
Step 2. Create a bridge group and specify its spanning tree protocol with the bridge number protocol protocol
command.
Step 3. Assign all bridged interfaces into the bridge group with the bridge-group number command.
Step 4. Configure IP routing for the bridge group with the bridge number route ip command.
Step 5. Configure a virtual IP interface representing the router’s attachment to the bridge group with the interface
bvi number command.
NOTE Listing 6-2 shows the IRB configuration of the firewall router. After these configuration commands, the router performs
For the remainder of the two distinct logical functions: It bridges between two interfaces and routes between BVI1, FastEthernet0/0.100, and the
router configuration, serial interface (see Figure 6-2).
including Network
Address Translation
LISTING 6-2 IRB and IP Configuration of the Firewall Router
(NAT) configuration,
see Chapter 4. bridge irb
!
interface FastEthernet0/0.1
bridge-group 1
!
interface FastEthernet0/0.5
bridge-group 1
!
interface FastEthernet0/0.100
ip address 192.168.0.1
ip nat inside

continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 97

[ 97 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls LISTING 6-2 IRB and IP Configuration of the Firewall Router continued
!
interface BVI1
ip address 10.0.0.1 255.255.255.0
ip nat inside
!
bridge 1 protocol ieee
bridge 1 route ip

FIGURE 6-2 FastEthernet 0/0.1


Logical structure of
the firewall router
10.0.0.0/24 BVI 1
192.168.0.0/24

VLAN 516
FastEthernet 0/0.100

VLAN 517 Serial 0/0.100

Firewall Router

192.168.201.4/30
FastEthernet 0/0.5

The packets traversing the router thus take one of the following paths:

■ If the packet arrives through one of the bridged interfaces and the destination MAC address is not the router’s own
MAC address, it’s bridged according to the entries in the bridge forwarding database (displayed with the show
bridge number command).

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 98

[ 98 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls ■ If the packet arrives through one of the bridge interfaces with the router’s MAC address as the destination MAC
address, it’s routed as if it were received through the BVI interface. The physical interface through which the packet
has been received is mostly ignored in the routing process.

NOTE
BVI interface configuration is considered when routing these packets. For example, if you configure ip access-group in on the physical
interface and the BVI interface, only the one on the BVI interface is applied.

■ If the packet arrives through any other interface and is routed to the BVI interface, the outbound configuration of the
BVI interface is applied (for example, the IP access list is checked, NAT translation is performed, and so on), and
then the packet is bridged into the bridge group (which might involve flooding the packet if the ARP cache entry is
still valid, but the destination MAC address is not available in the bridge forwarding database).
The transparent firewall feature of Cisco IOS can now be applied to the bridged interfaces by assigning them to security
zones. For example, you can create two new zones (clients and servers) and assign VLAN 516 to the clients zone and
VLAN 517 to the servers zone (Listing 6-3). The BVI1 interface is obviously assigned to the inside zone.

LISTING 6-3 Zone Assignments of the Inside Physical and Logical Interfaces
zone security Inside
zone security Clients
zone security Servers
!
class-map type inspect match-any Exchange
match protocol msrpc
match protocol imap
match protocol imaps
match protocol pop3
match protocol pop3s
match protocol smtp
match protocol ldap
match protocol ldaps
!
class-map type inspect match-any Netbios
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 99

[ 99 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls LISTING 6-3 Zone Assignments of the Inside Physical and Logical Interfaces continued
match protocol netbios-ns
match protocol netbios-ssn
match protocol netbios-dgm
!
class-map type inspect match-any SQLServer
match protocol ms-sql
!
policy-map type inspect ServerTraffic
class type inspect SQLServer
inspect
class type inspect Netbios
inspect
class type inspect Exchange
inspect
class class-default
drop
!
zone-pair security ClientsToServers source Clients destination Servers
service-policy type inspect ServerTraffic
!
interface FastEthernet0/0.1
zone-member security Clients
!
interface FastEthernet0/0.5
zone-member security Servers
!
interface BVI1
zone-member security Inside

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 100

[ 100 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls When defining the interzone policies, you have to define rules for traffic crossing from the clients zone to the servers
zone (in our example, we allowed NetBIOS, SQL Server, and Outlook traffic from clients to the server) and vice versa (in
our example, no sessions are allowed to be established from the servers toward the clients), but not between clients (or
servers) and outside (or perimeter). This is a bit startling at first glance, but not if you consider the switching path a
packet takes in the router:

■ When a packet is bridged between the Fast Ethernet interfaces, it’s considered to be crossing between the clients and
servers zones.
■ When a packet arrives through the bridged interfaces and is routed to another subnet, it’s considered to be arriving
through the BVI1 interface (thus from the inside zone).
It looks like a router would be split in two separate firewalls, one operating on the bridged level, and another one on the
routed level (see Figure 6-3).
FIGURE 6-3
Resulting firewall Perimeter
Clients BVI 1
structure 192.168.0.0/24
VLAN 516

FastEthernet 0/0.100

Inside
Serial 0/0.100
10.0.0.0/24

Servers Outside
VLAN 517 192.168.201.4/30

Using the transparent firewall feature in our sample firewall, you can filter the communication between the clients and the
servers residing in separate VLANs, but you cannot use the clients and servers zones to limit traffic that these two groups
of hosts are allowed to send to or receive from the perimeter or outside zones. If these hosts send the traffic to another

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 101

[ 101 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls routed zone, it appears as if the traffic is coming from the inside zone, so the only way to differentiate between clients
and servers when routing IP traffic is to define traffic classes used in the inside zone based on their IP addresses. In our
example, we would have to extend the configuration from Chapter 4 by defining new traffic classes covering traffic
toward the server or originating from the server and inserting them at the beginning of corresponding policy maps:

■ Class map AllServerTraffic covers all routed traffic to and from the server. This class is used as a catchall class that
drops all sessions that are not explicitly allowed.
■ Class map MailFromInside covers SMTP traffic from inside server to perimeter server.
■ There is no need for new classes covering traffic from outside or perimeter zones into the inside zone; no sessions
are allowed from outside to inside anyway and the existing configuration of PerimeterToInside policy map (Listing 4-4)
already filters traffic based on the server’s IP address.
■ The new classes are inserted at the beginning of the existing InsideToPerimeter policy map. (See Listing 4-4 for the
complete configuration.) The InsideToOutside policy map is also modified to prevent session establishment from the
server to the outside zone.
The modified firewall policy is included in Listing 6-4. As you can see, mixing IP hosts with different security require-
ments in the same security zone (which is obviously against the rules we established in Chapter 2, “Typical Zone-Based
Firewall Designs,” but is necessary because our design requirements and implementation details of the transparent fire-
wall) degrades the concept of security zones to the complexity of building firewalls with IP access lists (most obvious in
the InsideToPerimeter policy map).

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 102

[ 102 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls LISTING 6-4 Modified Firewall Policy for the Inside-to-Perimeter Zone Pair
class-map type inspect match-all MailFromInside
match protocol smtp
match access-group name ServerAccess
class-map type inspect match-all AllServerTraffic
match access-group name ServerAccess
!
ip access-list extended ServerAccess
permit ip any host 10.0.0.10
permit ip host 10.0.0.10 any
!
policy-map type inspect InsideToOutside
class type inspect AllServerTraffic
drop
class type inspect WebTraffic ! defined in Chapter 4
inspect
class type inspect FileTransfer
inspect
!
policy-map type inspect InsideToPerimeter
class type inspect MailFromInside
inspect
class type inspect AllServerTraffic
drop
class type inspect PublicTraffic ! defined in Chapter 4
inspect
class type inspect PublicManagement
inspect

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 103

[ 103 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls
Protecting Internal Servers: Alternate Design
The previous discussion of the transparent firewall behavior might have led you to believe that it has only marginal
NOTE
Adding a second firewall usability for our case study. This is the completely wrong impression; it’s counterintuitive only when used in a combined
in the inside network also routed/bridged environment. As an alternative, cleaner design, you could deploy the second physical firewall between the
slightly increases the servers and the clients, operating it in bridged-only mode. To illustrate the dilemmas arising in a mixed bridged/routed
security of the solution environment, we will also add the administrators zone (VLAN 515) that has privileged access to the servers
(defense-in-depth princi- (Figure 6-4).
ple); if an intruder gains
access to the outside fire- In the modified design, we still have three VLANs (servers, administrators, and clients) in the same IP subnet, so IRB is
wall or breaks through its still needed to connect them. Ideally, both the inside and outside firewall would connect to all relevant VLANs (inside
defenses, the internal
firewall to all three of them, outside firewall to clients and servers). However, with the introduction of the inter-VLAN
firewall still protects the
servers.
bridge in the inside firewall, IRB can no longer be used on the outside firewall, because the attachment of two inter-
VLAN bridges to the same VLANs would create a bridging loop, and at least one subinterface on the inside or outside
firewall would be disabled, resulting in suboptimal traffic flow (Figure 6-5).
FIGURE 6-4
Second firewall Administrators Outside
added to the LAN
network—physical
connectivity diagram
Internet

Servers
Perimeter
Web/Mail Server
192.168.0.2
Inside Clients

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 104

[ 104 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls
VLAN 515
FIGURE 6-5 Administrators
Bridging loop in the
redesigned network

Inside Router VLAN 516 Firewall Router


Clients

The easiest way out of this problem is to give administrators VLAN access to the firewall router through the clients
VLAN, resulting in the logical firewall structure in Figure 6-6. (The switch physically connecting end devices to VLANs
has been removed from the diagram for clarity.) The outside firewall router can then use the unmodified configuration
from Chapter 4, and the inside firewall performs interzone traffic control on bridged traffic between internal VLANs.

FIGURE 6-6
Final firewall Administrators Outside
structure—logical
connectivity diagram

Internet

Servers
Perimeter
Web/Mail Server
192.168.0.2
Inside Clients

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 105

[ 105 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls The inside firewall does not need IP routing at all, so it can be disabled if desired. IRB should be configured to give the
device a single IP address reachable through all interfaces. The firewall zones can then be configured and attached to
NOTE subinterfaces (Listing 6-5). After the initial configuration, you would create traffic classes, define firewall policies, and
When configuring fire- apply them to zone pairs as explained in the previous chapters.
wall policies, do not
forget that the adminis- LISTING 6-5 Initial Configuration of the Inside Firewall
trators have to pass
through the clients zone no ip routing
to get to the Internet. bridge irb
!
zone security Administrators
zone security Servers
zone security Clients
!
interface FastEthernet0/0.1
encapsulation dot1Q 516
description Client VLAN
bridge-group 1
zone-member security Clients
!
interface FastEthernet0/0.1
encapsulation dot1Q 515
description Administrators VLAN
bridge-group 1
zone-member security Administrators
!
interface FastEthernet0/0.5
encapsulation dot1Q 517
description Server VLAN
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 106

[ 106 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls LISTING 6-5 Initial Configuration of the Inside Firewall continued
bridge-group 1
zone-member security Servers
!
interface BVI1
ip address 10.0.0.1 255.255.255.0
!
bridge 1 protocol ieee
bridge 1 route ip

Case Study: Migrating a Server to the Perimeter


Network
In this case study, you’ll see how you can use IP routing tricks to work around the limitations of the transparent firewall.
Consider the network in Figure 6-7, where the public server is attached to the same LAN as the internal clients.
Obviously, this is a large security risk (an intruder gaining access to the public server could immediately explore the
internal LAN), so the administrator would like to move the server to the perimeter network. Assuming that IP renumber-
ing is not possible, a transparent firewall would be an ideal solution. However, because of its limitations, it would be
impossible to apply a clean three-zone design from Chapter 4 to this scenario.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 107

[ 107 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls
Public Server Outside dns.isp.com smtp.isp.com
10.0.0.2 10.0.0.20
FIGURE 6-7 172.16.0.1 172.16.0.2

Initial network design


172.16.10.32/28

10.0.0.0/24 Internet www.web.com


172.18.25.10
10.0.0.1 192.168.201.6

Inside

The best solution in this case study is to use three IP subnets on the firewall as in Chapter 4 and rely on the local area
mobility feature introduced in Cisco IOS Release 11.0 to insert a host route toward the public server in the perimeter
network (see the Local Area Mobility White Paper and Cisco IOS documentation for more details), as illustrated in
Figure 6-8.

FIGURE 6-8
Client Outside
Firewall design using 10.0.0.2
local area mobility

Internet

Inside 10.0.0.1/24
10.0.0.20/32

10.0.1.1/24 Host route to


public server

Public Server
10.0.0.20
Perimeter

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 108

[ 108 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls The local area mobility feature is configured with the ip mobile arp command. Apart from that command, the IP routing
configuration of the firewall is similar to the one from Chapter 4 (Listing 6-6).

NOTE LISTING 6-6 Configuration of Inside Interfaces on the Firewall Router


You could also use a
static route pointing to hostname fw
the perimeter interface !
(ip route 10.0.0.20 interface Loopback1
255.255.255.255 ip address 172.16.10.33 255.255.255.240
FastEthernet0/0.5) !
rather than local interface FastEthernet0/0
area mobility. Local area description Inside network
mobility might not work ip address 10.0.0.1 255.255.255.0
on all router platforms. ip nat inside
!
interface FastEthernet0/0.5
description Public Web server (Perimeter network)
encapsulation dot1Q 100
ip address 10.0.1.1 255.255.255.0
ip nat inside
ip mobile arp access-group PublicServerAddresses
!
interface Serial0/0/0
no ip address
encapsulation frame-relay
!
interface Serial0/0/0.100 point-to-point
description Link to the Internet
ip address 192.168.201.6 255.255.255.252
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 109

[ 109 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls LISTING 6-6 Configuration of Inside Interfaces on the Firewall Router continued
ip nat outside
frame-relay interface-dlci 100
!
ip route 0.0.0.0 0.0.0.0 Serial0/0/0.100
!
ip nat pool Internet 172.16.10.38 172.16.10.46 prefix-length 28
ip nat inside source static 10.0.0.20 172.16.10.34
ip nat source list InternalHosts pool Internet
ip nat inside source list InternalHosts pool Internet
!
! list all IP addresses of the public servers in the following access-list
!
ip access-list standard PublicServerAddresses
permit host 10.0.0.20
!
ip access-list standard InternalHosts
permit 10.0.0.0 0.0.0.255

After you’ve configured the local area mobility, you can check the proper insertion of the host routes with the show ip
route mobile command and debug its operation with debug arp and debug ip mobile local-area (Listing 6-7).

LISTING 6-7 Debugging and Monitoring Local Area Mobility


debug arp
fw#d
ARP packet debugging is on
debug ip mobile local-area
fw#d
IP local-area mobility debugging is on
fw#
continues

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 110

[ 110 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls LISTING 6-7 Debugging and Monitoring Local Area Mobility continued
04:02:45: Local MobileIP: FastEthernet0/0.5 add 10.0.0.20 accepted
04:02:45: IP ARP: rcvd req src 10.0.0.20 0017.5926.3f50, dst 10.0.0.1 FastEthernet0/0.5
04:02:45: Local MobileIP: FastEthernet0/0.5 add 10.0.0.20 accepted
04:02:45: Local MobileIP: route 10.0.0.20 added
04:02:45: IP ARP: sent rep src 10.0.0.1 0017.5926.5c58,
dst 10.0.0.20 0017.5926.3f50 FastEthernet0/0.5
show ip route mobile
fw#s
10.0.0.0 255.0.0.0 is variably subnetted, 3 subnets, 2 masks
M 10.0.0.20 255.255.255.255
[3/1] via 10.0.0.20, 00:36:24, FastEthernet0/0.5

After you’ve successfully configured and tested local area mobility, you have a working firewall with three routed inter-
faces. You can complete the configuration using zones, traffic classes, and policies similar to those in Chapter 4.

Summary
In this chapter, you’ve seen how you can configure the Cisco IOS transparent firewall using the zone-based configuration
commands. When designing the zone-based transparent firewall, keep in mind these guidelines:

■ Only a single zone pair is checked for every packet traversing the router.
■ If a packet is bridged through the router, the router checks the zone pair policy configured between the physical
interface zones.
■ If a packet is routed, the router checks the zone pair policy between the zones of the BVI interface and the outbound
IP interface.
■ If a packet is sent to the router itself, the router checks the zone pair policy between the zone of the BVI interface
and the self zone.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 111

[ 111 ]

CHAPTER 6 Deploying Zone-Based Firewalls by Ivan Pepelnjak

Configuring
Transparent
Firewalls ■ Configuring a zone pair between a bridged and a routed zone makes no sense (because it will never be used).
■ Although you could, do not apply the same zone on bridged and routed interfaces; that will only lead to confusion.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.
1587053101_deploying_zone.qxd 11/2/06 3:12 PM Page 112

[ 112 ]

Deploying Zone-Based Firewalls Feedback Information


At Cisco Press, our goal is to create in-depth technical books of the highest quality and value. Each book is crafted with care and
Ivan Pepelnjak precision, undergoing rigorous development that involves the unique expertise of members from the professional technical community.
Copyright© 2007 Cisco Readers’ feedback is a natural continuation of this process. If you have any comments regarding how we could improve
Published by: the quality of this digital short cut or otherwise alter it to better suit your needs, you can contact us through e-mail at
Cisco Press feedback@ciscopress.com. Please make sure to include the digital short cut title and ISBN in your message.
800 East 96th Street We greatly appreciate your assistance.
Indianapolis, IN 46240 USA
All rights reserved. No part of this digital short cut may be reproduced or transmit- Corporate and Government Sales
ted in any form or by any means, electronic or mechanical, including photocopy- Cisco Press offers excellent discounts on this digital short cut when ordered in quantity for bulk purchases or special sales.
ing, recording, or by any information storage and retrieval system, without written
For more information please contact: U.S. Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com
permission from the publisher, except for the inclusion of brief quotations in a
review. For sales outside the U.S. please contact: International Sales international@pearsoned.com
Printed in the United States of America 1 2 3 4 5 6 7 8 9 0
First Printing October 2006
ISBN: 1-58705-310-1

Warning and Disclaimer


This digital short cut is designed to provide information about network security.
Every effort has been made to make this digital short cut as complete and as accu-
rate as possible, but no warranty or fitness is implied.
The information is provided on an “as is” basis. The author, Cisco Press, and Cisco
shall have neither liability nor responsibility to any person or entity with respect to
any loss or damages arising from the information contained in this digital short cut.
The opinions expressed in this digital short cut belong to the author and are not
necessarily those of Cisco.

Trademark Acknowledgments
All terms mentioned in this digital short cut that are known to be trademarks or
service marks have been appropriately capitalized. Cisco Press or Cisco cannot
attest to the accuracy of this information. Use of a term in this digital short cut
should not be regarded as affecting the validity of any trademark or service mark.

© 2007 Cisco. All rights reserved. This publication is protected by copyright. Please see page 112 for more details.