Extended Access Control Lists (ACLs)
Configuration Methods: Numbered vs. Named
- Concept: While numbered ACLs are traditionally configured directly from global configuration mode, modern Cisco IOS allows configuring them within named ACL configuration mode. This provides significant editing advantages without changing how the ACL is stored or displayed in the
running-config. - Details:
- Extended ACL Number Ranges: 100–199 and 2000–2699.
- Standard ACL Number Ranges (for reference): 1–99 and 1300–1999.
! Traditional Global Config Method (Harder to edit)
Router(config)# access-list 100 permit ip any any
! Named Config Mode Method (Recommended for editing)
Router(config)# ip access-list extended 100
Router(config-ext-nacl)# permit ip any any
Things to note: Even if configured in named ACL config mode, the running-config will display the numbered ACL as if it were configured using the traditional global config method.
Editing and Resequencing ACLs
- Concept: Named ACL configuration mode allows precise editing, including deleting individual entries and inserting new entries at specific sequence numbers.
- Details:
- Default sequence numbers start at 10 and increment by 10.
- In global config mode, using the
nocommand with an ACL statement deletes the entire ACL, not just the single entry.
! Deleting a specific entry (Must be in named ACL config mode)
Router(config)# ip access-list extended 100
Router(config-ext-nacl)# no 30
! Inserting a new entry at a specific sequence number
Router(config-ext-nacl)# 30 deny tcp 192.168.2.0 0.0.0.255 any
! Resequencing an ACL (Global config mode)
! Syntax: ip access-list resequence [ACL Name/Number] [Starting Seq] [Increment]
Router(config)# ip access-list resequence 100 10 10
Things to note: The resequence command is executed from global configuration mode and works for both numbered/named and standard/extended ACLs. It is essential when sequence numbers are exhausted (e.g., 1, 2, 3, 4, 5) and you need to insert a rule in the middle.
Extended ACL Parameters & Protocol Matching
- Concept: Extended ACLs provide granular control by matching traffic based on Layer 3 (Source/Destination IP) and Layer 4 (Protocol and Port) parameters. A packet must match ALL specified parameters in an entry to be considered a match.
- Details: You can match protocols by name or by their IPv4 header protocol number.
| Protocol Name | Protocol Number | Use Case |
|---|---|---|
| ICMP | 1 | Ping, traceroute |
| TCP | 6 | HTTP, HTTPS, FTP, SSH |
| UDP | 17 | DNS, DHCP, TFTP |
| EIGRP | 88 | EIGRP routing updates |
| OSPF | 89 | OSPF routing updates |
| IP | N/A | Matches all IP traffic (used for permit ip any any) |
! Deny OSPF traffic (Protocol 89)
Router(config-ext-nacl)# deny 89 any any
! Deny ICMP (Ping) from a specific host to a specific subnet
Router(config-ext-nacl)# deny icmp host 172.16.1.1 192.168.0.0 0.0.0.255
Things to note: In extended ACLs, to specify a /32 (single host) source or destination, you must use the host keyword or the 0.0.0.0 wildcard mask. You cannot just write the IP address alone (unlike some standard ACL contexts).
Port Number Matching
- Concept: When the protocol is specified as TCP or UDP, you can optionally match specific source or destination port numbers.
- Details: Port matching uses specific operators. If no port is specified, all ports for that protocol are matched.
| Operator | Meaning | Example | Effect |
|---|---|---|---|
| eq | Equal to | eq 80 or eq www |
Matches exactly port 80 |
| gt | Greater than | gt 1023 |
Matches ports 1024 and above |
| lt | Less than | lt 80 |
Matches ports 0 through 79 |
| neq | Not equal to | neq 23 |
Matches all ports except 23 |
| range | Inclusive range | range 20000 30000 |
Matches ports 20000 through 30000 |
! Deny TCP traffic from any source to host 1.1.1.1 on destination port 80 (HTTP)
Router(config-ext-nacl)# deny tcp any host 1.1.1.1 eq 80
! Permit TCP traffic from 10.0.0.0/16 to host 2.2.2.2 on destination port 443 (HTTPS)
Router(config-ext-nacl)# permit tcp 10.0.0.0 0.0.255.255 host 2.2.2.2 eq 443
! Deny UDP traffic from any source using source ports 20000-30000 to host 3.3.3.3
Router(config-ext-nacl)# deny udp any range 20000 30000 host 3.3.3.3
Things to note: While keywords like www (80) or tftp (69) can be used, many common ports do not have keywords. Memorize the actual port numbers for the CCNA exam.
ACL Placement Rules
- Concept: The placement of an ACL determines network efficiency and security.
- Details:
- Standard ACLs: Place as close to the destination as possible. (They only check source IP; placing them near the source might accidentally block legitimate traffic to other destinations).
- Extended ACLs: Place as close to the source as possible. (They are highly specific, so dropping unwanted traffic early saves bandwidth and router processing resources).
graph LR
subgraph Source Network
PC1[PC 192.168.1.0/24]
PC2[PC 192.168.2.0/24]
end
subgraph Router R1
G0_1[G0/1]
G0_0[G0/0]
G0_2[G0/2]
end
subgraph Destination Network
SRV1[SRV1 10.0.1.0/24]
SRV2[SRV2 10.0.2.0/24]
end
PC1 -->|Extended ACL Applied INBOUND here| G0_1
PC2 -->|Extended ACL Applied INBOUND here| G0_2
G0_1 <--> G0_0
G0_2 <--> G0_0
G0_0 -->|Standard ACL Applied OUTBOUND here| SRV1
G0_0 -->|Standard ACL Applied OUTBOUND here| SRV2
Verification Commands
- Concept: Verify ACL contents and interface applications.
- Details:
show ip interface briefdoes not show ACLs. You must use the fullshow ip interfacecommand or check the running configuration.
! View all configured ACLs and their hit counts
Router# show access-lists
! View detailed IP information for a specific interface, including applied ACLs
Router# show ip interface GigabitEthernet0/1
Command Summary
! Enter extended named/numbered ACL configuration mode
Router(config)# ip access-list extended [name | 100-199 | 2000-2699]
! Configure an ACL entry with a specific sequence number
Router(config-ext-nacl)# [seq_num] [permit | deny] [protocol] [source_ip] [source_wildcard] [dest_ip] [dest_wildcard] [eq|gt|lt|neq|range port]
! Delete a specific ACL entry (Must be in ACL config mode)
Router(config-ext-nacl)# no [seq_num]
! Resequence an ACL (Global config mode)
Router(config)# ip access-list resequence [ACL_name_or_number] [starting_seq] [increment]
! Apply ACL to an interface
Router(config)# interface [type number]
Router(config-if)# ip access-group [ACL_name_or_number] [in | out]
! Verify ACL configuration and hit counts
Router# show access-lists
! Verify which ACLs are applied to an interface (inbound/outbound)
Router# show ip interface [type number]
Things to note:
- Every ACL has an implicit deny any at the end. Always end your ACLs with an explicit
permit ip any any(or similar) if you want to allow non-matched traffic. - When configuring extended ACLs, the order of parameters is strict:
Protocol->Source IP->Source Wildcard->Destination IP->Destination Wildcard->Port Operators. - The
show ip interfacecommand output is lengthy; look specifically for the lines stating “Inbound access list is…” and “Outbound access list is…”.