Standard Access Control Lists (ACLs)
What are ACLs?
- Concept: Access Control Lists (ACLs) function as packet filters that instruct a router to permit or discard specific traffic.
- Purpose: Primarily used for security to control which devices have access to different parts of the network.
- Filtering Criteria: Can filter based on Source/Destination IP addresses, and Source/Destination Layer 4 port numbers. (CCNA focuses on IPv4 ACLs).
ACL Logic and Processing
- Access Control Entries (ACEs): ACLs are made up of an ordered sequence of ACEs.
- Top-to-Bottom Processing: The router processes ACEs sequentially from top to bottom.
- First Match Wins: Once a packet matches an entry, the router takes the specified action (permit or deny) and stops processing the remaining entries.
- Implicit Deny: Every ACL has an invisible
deny anystatement at the very end. If a packet does not match any configured entries, it is dropped. - Interface Limits: A maximum of one ACL can be applied to a single interface per direction (one Inbound, one Outbound). Applying a second ACL in the same direction replaces the previous one.
graph TD
A[Packet arrives at Interface] --> B{Check ACL Direction}
B -->|Inbound| C[Process ACL before routing]
B -->|Outbound| D[Route packet to exit interface]
D --> E[Process ACL before sending]
C --> F{Match ACE Top-to-Bottom}
E --> F
F -->|Match Permit| G[Forward Packet]
F -->|Match Deny| H[Drop Packet]
F -->|No Match| I[Implicit Deny: Drop Packet]
ACL Placement Rule of Thumb
- Standard ACLs: Should be applied as close to the destination as possible.
- Reason: Standard ACLs only filter based on the source IP address. If placed close to the source, they will block the source from reaching all destinations, which is usually too restrictive.
Types of ACLs
| Feature | Standard ACLs | Extended ACLs |
|---|---|---|
| Matching Criteria | Source IP address only | Source/Dest IP, Source/Dest Ports, Protocol, etc. |
| Numbered Ranges | 1 - 99, 1300 - 1999 | 100 - 199, 2000 - 2699 |
| Complexity | Simple | Complex |
| Placement | Close to destination | Close to source |
Standard Numbered ACL Configuration
Configured in Global Configuration Mode.
- Syntax:
access-list [number] [permit | deny] [source IP] [wildcard mask] - Number Ranges: 1-99 or 1300-1999.
Wildcard Masks and Host Matching
- Wildcard Mask: Inverse of a subnet mask. Used to match a range of IPs.
- Single Host (/32):
- Method 1:
1.1.1.1 0.0.0.0(Router automatically converts to1.1.1.1) - Method 2:
1.1.1.1(Omit wildcard mask) - Method 3:
host 1.1.1.1(Old method, still works)
- Method 1:
- Any Host (/0):
- Method 1:
anykeyword - Method 2:
0.0.0.0 255.255.255.255(Router automatically converts toany)
- Method 1:
Adding Remarks
- Concept: Like an interface description, used for documentation. Does not affect ACL logic.
- Syntax:
access-list [number] remark [text]
! Configure Standard Numbered ACL 1
R1(config)# access-list 1 permit 192.168.1.1 0.0.0.0
R1(config)# access-list 1 deny 192.168.1.0 0.0.0.255
R1(config)# access-list 1 permit any
R1(config)# access-list 1 remark Permit PC1, block rest of LAN 1
! Single host examples (all do the exact same thing)
R1(config)# access-list 1 deny 1.1.1.1 0.0.0.0
R1(config)# access-list 1 deny 1.1.1.1
R1(config)# access-list 1 deny host 1.1.1.1
Standard Named ACL Configuration
Configured by entering Named ACL Configuration Mode.
- Syntax to enter mode:
ip access-list standard [name] - Syntax for entries:
[sequence number] [permit | deny] [source IP] [wildcard mask] - Sequence Numbers:
- Automatically assigned in increments of 10 (10, 20, 30…) if not specified.
- Can be manually specified to control the exact order of entries.
- Note: Cisco IOS may internally reorder
/32host entries to optimize processing efficiency, but this does not change the ACL’s logical outcome. (Note: Cisco Packet Tracer does not perform this internal reordering and will display them in exact sequence order).
! Configure Standard Named ACL
R2(config)# ip access-list standard BLOCK_BOB
R2(config-std-nacl)# 5 deny 1.1.1.1
R2(config-std-nacl)# 10 permit any
R2(config-std-nacl)# remark Block Bob's PC only
Applying ACLs to Interfaces
After creating the ACL globally, it must be applied to an interface in a specific direction to take effect.
- Inbound (
in): ACL is checked before the router routes the packet. - Outbound (
out): ACL is checked after the router routes the packet, right before it exits the interface. - Syntax:
ip access-group [acl_number | acl_name] [in | out]
! Apply ACL 1 outbound on GigabitEthernet 0/2
R1(config)# interface GigabitEthernet0/2
R1(config-if)# ip access-group 1 out
! Apply Named ACL outbound on GigabitEthernet 0/1
R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip access-group BLOCK_BOB out
Practical Example & Placement Logic
Requirements:
- PC1 (192.168.1.1) can access 192.168.2.0/24.
- Other PCs in 192.168.1.0/24 cannot access 192.168.2.0/24.
- All other traffic is permitted.
Configuration on R1:
! 1. Create the ACL (Order is critical!)
R1(config)# access-list 1 permit 192.168.1.1 0.0.0.0
R1(config)# access-list 1 deny 192.168.1.0 0.0.0.255
R1(config)# access-list 1 permit any
! 2. Apply the ACL close to the destination (192.168.2.0/24)
R1(config)# interface GigabitEthernet0/2
R1(config-if)# ip access-group 1 out
Things to note: Applying it inbound on R1’s G0/1 would block the 192.168.1.0/24 subnet from reaching any external network. Applying it outbound on G0/2 restricts them only from reaching the 192.168.2.0/24 destination, satisfying the “close to destination” rule.
Important Concepts & Common Misconceptions
- Implicit Deny: Always remember the hidden
deny anyat the end of every ACL. If you don’t explicitly permit other traffic, it will be dropped. - Order Matters: Because of top-to-bottom processing, specific entries (e.g., permit host) must be placed above broader entries (e.g., deny subnet).
- Directional Filtering:
- If an ACL is applied outbound, it only filters traffic leaving the interface.
- If an ACL is applied inbound, it only filters traffic entering the interface.
- Return traffic is evaluated independently based on its own source IP and the ACL applied to the interface it enters/exits.
- Replacing ACLs: Applying a new ACL to an interface/direction where an ACL already exists will overwrite the old one.
Verification Commands
! Display all ACLs and their match counters
R1# show access-lists
! Display only IPv4 ACLs
R1# show ip access-lists
! Filter running config for ACL application on interfaces
R1# show running-config | include access-list
! Display the entire ACL configuration block (Best for Named ACLs)
R1# show running-config | section access-list
Command Summary
! --- Standard Numbered ACL Configuration ---
access-list [1-99, 1300-1999] [permit|deny] [source] [wildcard]
access-list [number] remark [text]
! --- Standard Named ACL Configuration ---
ip access-list standard [name]
[seq] [permit|deny] [source] [wildcard]
remark [text]
! --- Applying to Interface ---
interface [type/number]
ip access-group [number|name] [in|out]
! --- Verification ---
show access-lists
show ip access-lists
show running-config | include access-list
show running-config | section access-list