- TCP/IP Primer: How Packet Filtering Works
- TCP and UDP Ports
- TCP's Three-way Handshake
- The Cisco Router as a Packet Filter
- An Alternative Packet Filter: IPChains
- The Cisco ACL
- Effective Uses of Packet-Filtering Devices
- Egress Filtering
- Tracking Rejected Traffic
- Problems with Packet Filters
- Dynamic Packet Filtering and the Reflexive Access List
- Summary
- References
The Cisco ACL
The Cisco ACL is simply a means to filter traffic that crosses your router. It has two major syntax typesnumbered and named listsand it comes in several filtering types, including standard, extended, and reflexive, all of which will be discussed in this chapter. Numbered access lists are entered in the format
access-list number criteria
where number is a given range that represents the type of access list it is. The range 199 represents standard IP lists, and the range 100199 represents extended IP lists. Over time, these basic ranges have been expanded to include 13001999 for standard and 20002699 for extended. Other access list number ranges are reserved for alternative protocols, and so on.
The named access list uses the format
ip access-list type name
where the type code stands for standard, extended, and so on, and the name code represents a unique name for the list. This can help make the list more identifiable. For example, "dnsinbound" might mean more to someone than the number "113" does.
Upon entering the preceding command to start list creation, you are dropped into a configuration mode just for that access list. Here, you can enter filtering commands in the following format:
permit|deny criteria
Either type of ACL works well and can be used separately or together. Although standard and extended lists can be written in either format, reflexive access lists can use only the named format. To remove either type of ACL, reenter it preceded by the word no.
Rule Order
Many of the access lists demonstrated throughout this text are "deny" access lists that show how to block a particular address or port. However, because of a concept called implicit deny, dropping such a list into an otherwise empty router configuration could cause the blocking of all traffic! Implicit deny takes place when as little as one access list is added to an interface on a Cisco router. The router stops its standard behavior of forwarding all routable traffic and instead begins comparing all packets received to the newly added access list. If the traffic doesn't match the applied access list(s), it is dropped. Adding one simple access list changes the behavior of the router entirely. Only packets that match the added access list as permitted traffic are allowed.
When multiple rules are added, even more concerns arise. Because rules are processed from the top down and a packet only has to pass or fail one rule to be dropped or allowed into the network, it is imperative to put specific filters before general filters. Otherwise, a more general rule might allow a packet access that may have been denied by another more specific rule later in the access list. When a packet "matches" a rule, the packet is immediately dropped (if it is a deny rule) or forwarded (if it is a permit rule) without being tested by the rest of the access list entries.
Be careful when planning the order of access list rules. That is why a complete access list rulebase needs to be laid out in advance and built from the ground up. Adding rules carelessly is a sure recipe for disaster.
Cisco IOS Basics
Before we go into detail on the syntax of Cisco access lists, it is necessary to discuss the interface by which Cisco routers are configured. Cisco routers can be configured in one of several ways. They can be accessed through a serial connection to the console port on the back of the router, through a Telnet session, or via a web browser with newer models. After you have access to the router, actually getting it into configuration mode is a relatively easy process, as outlined here:
You receive the standard prompt (designated by the > symbol) routername>.
You must go into enable mode before configuration mode. Typing enable and pressing the Enter key accomplishes this. You are prompted for a secret password. After entering it, you are in enable mode, which is identified by the routername# prompt (designated by the number sign [#]).
To configure the router, enter terminal configuration mode by typing config t (which is short for configure terminal) and pressing Enter. You then see the global configuration prompt: routername(config)#. This is where you enter global configuration commands, including access lists.
You can enter interface configuration mode from the global configuration mode by typing int s1, where int stands for interface and s1 is the interface name (in this case, serial 1). This format is also carried into Ethernet interfaces (e0, e1, and so on) as well as other interface types. Typing the interface command changes the prompt to the interface configuration prompt: routername(config-if)#. From here, you can type interface-specific commands, and this is where you can apply access lists to individual interfaces with the access-group command.
Exit any configuration level by typing the exit command. Completely exit out of configuration mode from any sublevel by pressing Ctrl+Z. Leave enable mode by typing disable.