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:
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.
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.
Whenever possible, assemble your access lists following the precept "allow what you need" rather than "deny what you don't."
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: