Ccna Certification: All About Access Control Lists(acls)
In preparation of our CCNA Training exam, we want to make sure we cover the various concepts that we could see on our Cisco CCNA exam. So to assist you, below we will discuss Access Control Lists.
You can configure network security by using ACLs by either using the Cluster Management Suite (CMS) or through the command-line interface (CLI).
You can also use the security wizard to filter inbound traffic on the Catalyst 2950 switches. Filtering can be based on network addresses or TCP/UDP applications. You can choose whether to drop or forward packets that meet the filtering criteria. To use this wizard, you must know how the network is designed and how interfaces are used on the filtering device.
Packet filtering can limit network traffic and restrict network use by certain users or devices. ACLs can filter traffic as it passes through a switch and permit or deny packets from crossing specified interfaces. An ACL is a sequential collection of permit and deny conditions that apply to packets. When a packet is received on an interface, the switch compares the fields in the packet against any applied ACLs to verify that the packet has the required permissions to be forwarded, based on the criteria specified in the access lists. The switch tests the packet against the conditions in an access list one by one. The first match determines whether the switch accepts or rejects the packet. Because the switch stops testing conditions after the first match, the order of conditions in the list is critical. If no conditions match, the switch rejects the packet. If there are no restrictions, the switch forwards the packet; otherwise, the switch drops the packet.
You configure access lists on a Layer 2 switch to provide basic security for your network. If you do not configure ACLs, all packets passing through the switch could be allowed onto all parts of the network. You can use ACLs to control which hosts can access different parts of a network or to decide which types of traffic are forwarded or blocked at switch interfaces. For example, you can allow e-mail traffic to be forwarded but not Telnet traffic. ACLs can be configured to block inbound traffic.
An ACL contains an ordered list of access control entries (ACEs). Each ACE specifies permit or deny and a set of conditions the packet must satisfy in order to match the ACE. The meaning of permit or deny depends on the context in which the ACL is used.
The switch supports these types of ACLs:
IP ACLs filter IP traffic, including TCP and User Datagram Protocol (UDP). Ethernet ACLs filter Layer 2 traffic. ACLs
You can apply ACLs on management VLANs, and on physical Layer 2 interfaces. ACLs are applied on interfaces for inbound directions.
Standard IP access lists use source addresses for matching operations. Extended IP access lists use source and destination addresses and optional protocol type information for matching operations. MAC extended access list use source and destination mac addresses and optional protocol type information for matching operations. The switch examines access lists associated with features configured on a given interface and a direction. As packets enter the switch on an interface, ACLs associated with all inbound features configured on that interface are examined.
ACLs permit or deny packet forwarding based on how the packet matches the entries in the ACL. For example, you can use ACLs to allow one host to access a part of a network, but to prevent another host from accessing the same part. In Figure 12-1, ACLs applied at the switch input allow Host A to access the Human Resources network, but prevent Host B from accessing the same network.
Figure 12-1 Using ACLs to Control Traffic to a Network
Handling Fragmented and Unfragmented Traffic
IP packets can be fragmented as they cross the network. When this happens, only the fragment containing the beginning of the packet contains the Layer 4 information, such as TCP or UDP port numbers, ICMP type and code, and so on. All other fragments are missing this information. Some ACEs do not check Layer 4 information and therefore can be applied to all packet fragments. ACEs that do test Layer 4 information cannot be applied in the standard manner to most of the fragments in a fragmented IP packet. When the fragment contains no Layer 4 information and the ACE tests some Layer 4 information, the matching rules are modified:
Permit ACEs that check the Layer 3 information in the fragment (including protocol type, such as TCP, UDP, and so on) are considered to match the fragment regardless of what the missing Layer 4 information might have been. Deny ACEs that check Layer 4 information never match a fragment unless the fragment contains Layer 4 information. Consider access list 102, configured with these commands, applied to three fragmented packets:
Switch (config)# access-list 102 permit tcp any host 10.1.1.1 eq smtp Switch (config)# access-list 102 deny tcp any host 10.1.1.2 eq telnet Switch (config)# access-list 102 deny tcp any any
Note In the first and second ACEs in the examples, the eq keyword after the destination address means to test for the TCP-destination-port well-known numbers equaling Simple Mail Transfer Protocol (SMTP) and Telnet, respectively.
Packet A is a TCP packet from host 10.2.2.2, port 65000, going to host 10.1.1.1 on the SMTP port. If this packet is fragmented, the first fragment matches the first ACE (a permit), as if it were a complete packet because all Layer 4 information is present. The remaining fragments also match the first ACE, even though they do not contain the SMTP port information because the first ACE only checks Layer 3 information when applied to fragments. (The information in this example is that the packet is TCP and that the destination is 10.1.1.1.) Packet B is from host 10.2.2.2, port 65001, going to host 10.1.1.2 on the Telnet port. If this packet is fragmented, the first fragment matches the second ACE (a deny) because all Layer 3 and Layer 4 information is present. The remaining fragments in the packet do not match the second ACE because they are missing Layer 4 information. Because the first fragment was denied, host 10.1.1.2 cannot reassemble a complete packet, so packet B is effectively denied. However, the later fragments that are permitted will consume bandwidth on the network and resources of host 10.1.1.2 as it tries to reassemble the packet. Fragmented packet C is from host 10.2.2.2, port 65001, going to host 10.1.1.3, port ftp. If this packet is fragmented, the first fragment matches the third ACE (a deny). All other fragments also match the third ACE because that ACE does not check any Layer 4 information and because Layer 3 information in all fragments shows that they are being sent to host 10.1.1.3, and the earlier permit ACEs were checking different hosts. Understanding Access Control Parameters
Before configuring ACLs on the Catalyst 2950 switches, you must have a thorough understanding of the Access Control Parameters (ACPs). ACPs are referred to as masks in the switch CLI commands, output, and CMS. Each ACE has a mask and a rule. The Classification Field or mask is the field of interest on which you want to perform an action. The specific values associated with a given mask are called rules. Packets can be classified on these Layer 2, Layer 3, and Layer 4 fields.
Layer 2 fields: o Source MAC address (Specify all 48 bits.) o Destination MAC address (Specify all 48 bits.) o Ethertype (16-bit ethertype field)
You can use any combination or all of these fields simultaneously to define a flow.
Layer 3 fields: o IP source address (Specify all 32 IP source address bits to define the flow, or specify an user- defined subnet. There are no restrictions on the IP subnet to be specified.) o IP destination address (Specify all 32 IP destination address bits to define the flow, or specify an user- defined subnet. There are no restrictions on the IP subnet to be specified.)
You can use any combination or all of these fields simultaneously to define a flow.
Layer 4 fields: o TCP (You can specify a TCP source, destination port number, or both at the same time.) o UDP (You can specify a UDP source, destination port number, or both at the same time.)
Note A mask can be a combination of either multiple Layer 3 and Layer 4 fields or of multiple Layer 2 fields. Layer 2 fields cannot be combined with Layer 3 or Layer 4 fields.
There are two types of masks:
User-defined mask-masks that are defined by the user. System-defined mask-these masks can be configured on any interface: Switch (config-ext-nacl)# permit tcp any any Switch (config-ext-nacl)# deny tcp any any Switch (config-ext-nacl)# permit udp any any Switch (config-ext-nacl)# deny udp any any Switch (config-ext-nacl)# permit ip any any Switch (config-ext-nacl)# deny ip any any Switch (config-ext-nacl)# deny any any Switch (config-ext-nacl)# permit any any
Note In an IP extended ACL (both named and numbered), a Layer 4 system-defined mask cannot precede a Layer 3 user-defined mask. For example, a Layer 4 systemdefined mask such as permit tcp any any or deny udp any any cannot precede a Layer 3 user-defined mask such as permit ip 10.1.1.1 any. If you configure this combination, the ACL is not configured. All other combinations of system-defined and user-defined masks are allowed in security ACLs.
The Catalyst 2950 switch ACL configuration is consistent with other Cisco Catalyst switches. However, there are significant restrictions as well as differences for ACL configurations on the Catalyst 2950 switches.
Guidelines for Configuring ACLs on the Catalyst 2950 Switches
These configuration guidelines apply to ACL filters:
Only one ACL can be attached to an interface. For more information, refer to the ip access-group interface command in the Catalyst 2950 Desktop Switch Command Reference. All ACEs in an ACL must have the same user-defined mask. However, ACEs can have different rules that use the same mask. On a given interface, only one type of user-defined mask is allowed, but you can apply any number of system-defined masks. This example shows the same mask in an ACL: Switch (config)#ip access-list extended acl2 Switch (config-ext-nacl)# permit tcp 10.1.1.1 0.0.0.0 any eq 80 Switch (config-ext-nacl)# permit tcp 18.104.22.168 0.0.0.0 any eq 23
In this example, the first ACE permits all the TCP packets coming from the host 10.1.1.1 with a destination TCP port number of 80. The second ACE permits all TCP packets coming from the host 22.214.171.124 with a destination TCP port number of 23. Both the CCNA Certification ACEs use the same mask; therefore, a Catalyst 2950 switch supports this ACL.
Only four user-defined masks can be defined for the entire system. These can be used for either security or quality of service (QoS) but cannot be shared by QoS and security. You can configure as many ACLs as you require. However, a system error message appears if ACLs with more than four different masks are applied to interfaces. Table 12-1 lists a summary of the ACL restrictions on Catalyst 2950 switches.
Table 12-1 Summary of ACL Restrictions
Configuring ACLs on Layer 2 or Layer 3 management VLAN interfaces is the same as configuring ACLs on Cisco routers. The process is briefly described here.
The Catalyst 2950 switch does not support these IOS router ACL-related features:
Non-IP protocol ACLs (see Table 12-2). Bridge-group ACLs. IP accounting. No ACL support on the outbound direction. Inbound and outbound rate limiting (except with QoS ACLs). IP packets with a header length of less than five are not be access-controlled. Reflexive ACLs. Dynamic ACLs (except for certain specialized dynamic ACLs used by the switch clustering feature. ICMP-based filtering. IGMP-based filtering. Creating Standard and Extended IP ACLs
This section describes how to create switch IP ACLs. An ACL is a sequential collection of permit and deny conditions. The switch tests packets against the conditions in an access list one by one. The first match determines whether the switch accepts or rejects the packet. Because the switch stops testing conditions after the first match, the order of the conditions is critical. If no conditions match, the switch denies the packet.