Access Control Lists (ACLs) in Cisco Routers
A complete, beginner-friendly visual handbook covering every concept, wildcard shortcut, placement rule, CLI command, and real-world lab scenario—with zero steps skipped.
What is an ACL? (Starting from Zero)
By default, a Cisco router is a "friendly" device—it routes packets between every connected network without restriction. An Access Control List (ACL) is a set of sequential permit or deny rules that turns your router into a security checkpoint.
Imagine a security guard standing at a door holding a printed guest list:
- Every person (packet) trying to walk through the door gets checked against the list starting from Line 1.
- As soon as the guard finds a matching line on the list, they immediately let the person in (permit) or turn them away (deny) and stop reading the rest of the list.
- If a person isn't listed anywhere on the sheet, the invisible rule at the bottom says: "Nobody else gets in" (Implicit Deny).
1. Traffic Filtering
Block unauthorized departments, guest Wi-Fi users, or external hackers from reaching sensitive servers.
2. Router Login Protection
Lock down SSH/Telnet management lines (line vty) so only IT admin PCs can log into the router.
3. Traffic Selection
Identify which traffic should be translated by NAT/PAT, encrypted by VPNs, or prioritized by QoS.
How Cisco Routers Read & Process ACLs
Before typing a single command, you must understand the 5 golden rules of how Cisco IOS evaluates packets:
- Top-Down Order: Rules (called Access Control Entries or ACEs) are read strictly from top to bottom (Sequence 10 → 20 → 30...).
- First-Match Wins: The moment a packet matches a line, the router executes that line and ignores all lines below it. Therefore, always put specific rules at the top and general rules at the bottom.
- The Invisible "Implicit Deny": Every Cisco ACL automatically has an invisible
deny any(ordeny ip any any) at the very end. - You Need at Least One
permit: Because of the implicit deny at the bottom, an ACL with onlydenyrules will block 100% of traffic! - Router-Self Exception: An outbound ACL blocks traffic passing through the router from other interfaces, but it never blocks packets created by the router itself (like pings issued from the router CLI or OSPF/EIGRP routing updates).
Wildcard Masks Made Easy (No Math Headache!)
Cisco ACLs do not use Subnet Masks. Instead, they use a 32-bit Wildcard Mask—which is simply the exact inverse (opposite) of a subnet mask.
Wildcard Bit 0 = MUST MATCH
A 0 tells the router: "Check this octet/bit carefully—it must match the IP address exactly."
Wildcard Bit 255 (or 1) = IGNORE
A 255 tells the router: "Don't care—allow any number in this octet."
The 10-Second Subtraction Trick
To find any wildcard mask, subtract the subnet mask from 255.255.255.255:
255.255.255.255 <-- Always start with four 255s - 255.255.255.0 <-- Subtract your /24 Subnet Mask ------------------ 0. 0. 0.255 <-- Your Wildcard Mask! (First 3 octets must match, last octet can be anything)
Two Must-Know Cisco Shortcuts (host and any)
| What You Want to Match | Long Way (IP + Wildcard) | Cisco Shortcut (Preferred) |
|---|---|---|
| One Single PC / Server (e.g., 192.168.1.50) | 192.168.1.50 0.0.0.0 |
host 192.168.1.50 |
| Every IP Address on Earth (0.0.0.0/0) | 0.0.0.0 255.255.255.255 |
any |
Standard vs. Extended ACLs (What's the Difference?)
Cisco routers support two main types of ACLs. Both can be created using either Numbers or Names.
| Feature | Standard ACL | Extended ACL |
|---|---|---|
| ACL Numbers | 1 – 99 and 1300 – 1999 |
100 – 199 and 2000 – 2699 |
| Named Mode? | Yes (ip access-list standard NAME) |
Yes (ip access-list extended NAME) |
| What It Checks | ONLY the Source IP address. (Blunt tool: blocks or permits everything from that IP) |
Source IP, Destination IP, Protocol (TCP/UDP/ICMP/IP), and Port Numbers (HTTP, SSH, DNS, etc.). |
| Where to Place It | Closest to the DESTINATION | Closest to the SOURCE |
| Best Use Case | Securing VTY (SSH/Telnet) lines, NAT rules, or simple whole-subnet blocks. | Granular firewall rules (e.g., "Allow web browsing, block ping, deny SSH to servers"). |
Where to Configure & Where to Apply (Crucial!)
Every ACL requires two separate steps in two different CLI modes:
Step 1: Create the ACL
Done in Global Configuration Mode (Router(config)#).
Note: Creating an ACL does nothing until Step 2!
Step 2: Apply (Activate) the ACL
Done in Interface Mode (Router(config-if)#) using ip access-group, or Line VTY Mode using access-class.
Understanding in (Inbound) vs. out (Outbound)
Imagine you are standing inside the router looking out at its ports:
in(Inbound): Traffic enters the interface from the cable into the router. Filtered before the router looks up the routing table (saves CPU!).out(Outbound): Traffic has already been routed inside the router and is about to exit that interface onto the cable.
On any single router interface (such as GigabitEthernet0/0), you can have at most ONE inbound IPv4 ACL and ONE outbound IPv4 ACL. Applying a second ACL in the same direction automatically replaces the first one.
- Extended ACL → Near Source: Why let unwanted traffic travel across your entire network only to drop it at the end? Drop it immediately at the entry port!
- Standard ACL → Near Destination: Since a Standard ACL only looks at Source IP, putting
deny host 192.168.1.10near PC1 would block PC1 from reaching every network (even Google!). Putting it on the exit port right before the HR Server blocks PC1 only from the HR Server.
Standard Numbered ACLs (1–99, 1300–1999)
Standard Numbered ACLs use the classic single-line access-list command in Global Configuration Mode and inspect only the Source IP.
Syntax Blueprint
! Step 1: Create rules in Global Config Mode (Numbers 1-99 or 1300-1999) Router(config)# access-list <1-99> {permit | deny | remark} <source-ip> [wildcard-mask] [log] ! Step 2: Apply to an Interface Router(config)# interface <interface-name> Router(config-if)# ip access-group <1-99> {in | out}
Worked Example
Goal: Block single PC 192.168.10.25 from accessing the Finance Server LAN (10.10.20.0/24 on R2 Gi0/1), while allowing all other PCs.
R2# configure terminal R2(config)# access-list 10 remark Block Intern PC 192.168.10.25 from Finance LAN R2(config)# access-list 10 deny host 192.168.10.25 R2(config)# access-list 10 permit any R2(config)# interface GigabitEthernet0/1 R2(config-if)# ip access-group 10 out R2(config-if)# end
Standard Named ACLs
Standard Named ACLs do the exact same job as Standard Numbered ACLs, but you give the list a clear, human-readable name (like ALLOW_ADMIN_SUBNET) and enter an ACL sub-configuration prompt (config-std-nacl)#.
! Step 1: Enter Named Standard ACL Mode R1(config)# ip access-list standard ALLOW_IT_SUBNET R1(config-std-nacl)# remark Only IT subnet 192.168.99.0/24 can reach Management LAN R1(config-std-nacl)# permit 192.168.99.0 0.0.0.255 R1(config-std-nacl)# deny any log R1(config-std-nacl)# exit ! Step 2: Bind the Named ACL to the Destination Interface R1(config)# interface GigabitEthernet0/2 R1(config-if)# ip access-group ALLOW_IT_SUBNET out
Securing Router VTY Lines (SSH / Telnet Access)
By default, anyone who can ping your router's IP address can try to SSH or Telnet into it. To restrict who can log into the router itself, create a Standard ACL and apply it to line vty using the access-class command.
ip access-group vs. access-class- On Interfaces (
Gi0/0) → useip access-group NAME in - On VTY Lines (
line vty 0 4) → useaccess-class NAME in
R1(config)# ip access-list standard VTY_ADMIN_ONLY R1(config-std-nacl)# remark Allow only Network Admin PC to SSH into Router R1(config-std-nacl)# permit host 192.168.99.10 R1(config-std-nacl)# deny any log R1(config-std-nacl)# exit R1(config)# line vty 0 4 R1(config-line)# transport input ssh R1(config-line)# login local R1(config-line)# access-class VTY_ADMIN_ONLY in R1(config-line)# exit
Extended ACL Anatomy, Operators & Port Numbers
Extended ACLs inspect both Layer 3 (IP addresses) and Layer 4 (Protocols & TCP/UDP Port Numbers). Read every Extended ACL line from left to right like an English sentence:
ACL Number
(permit / deny)
(ip, tcp, udp, icmp)
Wildcard Mask
Wildcard Mask
(eq, neq, gt, lt, range)
Port Number
Port Comparison Operators
| Operator | Meaning | Example |
|---|---|---|
eq | Equal to one port | eq 80 (HTTP) |
neq | Not equal to port | neq 23 (not Telnet) |
gt | Greater than port | gt 1023 |
lt | Less than port | lt 1024 |
range | Port range (inclusive) | range 20 21 (FTP) |
Common Protocols & Ports Cheat Sheet
| Service | Protocol | Port / Keyword |
|---|---|---|
| FTP | TCP | 20, 21 (ftp) |
| SSH / Telnet | TCP | 22 / 23 (telnet) |
| SMTP (Mail) | TCP | 25 (smtp) |
| DNS | UDP / TCP | 53 (domain) |
| DHCP | UDP | 67, 68 |
| HTTP / HTTPS | TCP | 80 (www) / 443 |
| Ping | ICMP | echo / echo-reply |
Extended Numbered ACLs (100–199, 2000–2699)
Extended Numbered ACLs use numbers 100–199 (or 2000–2699) and should be placed as close to the source as possible.
! 1. TCP or UDP Rule (with Destination Port) Router(config)# access-list <100-199> {permit | deny} {tcp | udp} <src-ip> <src-wc> <dst-ip> <dst-wc> eq <port> ! 2. ICMP (Ping) Rule Router(config)# access-list <100-199> {permit | deny} icmp <src-ip> <src-wc> <dst-ip> <dst-wc> [echo | echo-reply] ! 3. Entire IP Protocol Rule (Matches TCP + UDP + ICMP + Everything) Router(config)# access-list <100-199> {permit | deny} ip <src-ip> <src-wc> <dst-ip> <dst-wc>
Worked Classroom Example
Policy for Student LAN (192.168.10.0/24 entering R1 Gi0/0):
- Allow HTTP (80) and HTTPS (443) web browsing everywhere.
- Allow DNS (UDP 53) queries to DNS Server
10.1.1.10. - Block SSH (22), Telnet (23), and Ping (
icmp echo) to the Server LAN (10.1.1.0/24). - Allow all other traffic so nothing breaks unintentionally.
R1(config)# access-list 110 remark === STUDENT LAN SECURITY POLICY === R1(config)# access-list 110 permit tcp 192.168.10.0 0.0.0.255 any eq 80 R1(config)# access-list 110 permit tcp 192.168.10.0 0.0.0.255 any eq 443 R1(config)# access-list 110 permit udp 192.168.10.0 0.0.0.255 host 10.1.1.10 eq 53 R1(config)# access-list 110 deny tcp 192.168.10.0 0.0.0.255 10.1.1.0 0.0.0.255 eq 22 R1(config)# access-list 110 deny tcp 192.168.10.0 0.0.0.255 10.1.1.0 0.0.0.255 eq 23 R1(config)# access-list 110 deny icmp 192.168.10.0 0.0.0.255 10.1.1.0 0.0.0.255 echo R1(config)# access-list 110 permit ip 192.168.10.0 0.0.0.255 any R1(config)# interface GigabitEthernet0/0 R1(config-if)# ip access-group 110 in
Extended Named ACLs (Industry Standard Best Practice)
In real production networks, engineers almost always use Extended Named ACLs because descriptive names make troubleshooting fast during emergencies, and sequence numbers make editing painless.
R1(config)# ip access-list extended INTERNET_INBOUND_POLICY R1(config-ext-nacl)# 10 remark Allow External Visitors to Public Web Server R1(config-ext-nacl)# 20 permit tcp any host 203.0.113.10 eq 80 R1(config-ext-nacl)# 30 permit tcp any host 203.0.113.10 eq 443 R1(config-ext-nacl)# 40 remark Block Spoofed Private IPs Coming from Internet R1(config-ext-nacl)# 50 deny ip 10.0.0.0 0.255.255.255 any log R1(config-ext-nacl)# 60 deny ip 172.16.0.0 0.15.255.255 any log R1(config-ext-nacl)# 70 deny ip 192.168.0.0 0.0.255.255 any log R1(config-ext-nacl)# 80 deny ip any any log R1(config-ext-nacl)# exit R1(config)# interface GigabitEthernet0/1 R1(config-if)# ip access-group INTERNET_INBOUND_POLICY in
Allowing Return Traffic (established Keyword)
Why do beginners accidentally break the internet? Suppose your internal PC sends a request to Google.com. Google sends a reply packet back. If you put an inbound ACL on your WAN port that blocks all external traffic, Google's reply gets dropped!
Adding established to a TCP rule tells the router: "Allow inbound TCP packets ONLY if they are replies (ACK or RST bit set) to a connection our internal users started first."
R1(config)# ip access-list extended WAN_IN R1(config-ext-nacl)# permit tcp any 192.168.10.0 0.0.0.255 established R1(config-ext-nacl)# permit icmp any 192.168.10.0 0.0.0.255 echo-reply R1(config-ext-nacl)# deny ip any any R1(config-ext-nacl)# exit R1(config)# interface GigabitEthernet0/1 R1(config-if)# ip access-group WAN_IN in
Editing Existing ACLs (Sequence Numbers)
Cisco IOS automatically numbers every line in steps of 10 (10, 20, 30, 40...). This leaves empty gaps so you can insert a new rule right in the middle (like 15) or delete a single line without rebuilding the entire ACL.
! 1. Check existing line sequence numbers R1# show access-lists ! 2. Insert a rule at Sequence 15 (between 10 and 20) — works on BOTH Named and Numbered ACLs! R1(config)# ip access-list extended 110 R1(config-ext-nacl)# 15 deny tcp host 192.168.10.99 any eq 443 ! 3. Delete just line 20 (WARNING: Never type "no access-list 110" unless you want to wipe the whole list!) R1(config-ext-nacl)# no 20 R1(config-ext-nacl)# exit ! 4. Clean up messy sequence numbers back to 10, 20, 30... R1(config)# ip access-list resequence 110 10 10 ! 5. Properly delete an entire ACL (Always unbind from interface FIRST!) R1(config)# interface GigabitEthernet0/0 R1(config-if)# no ip access-group 110 in R1(config-if)# exit R1(config)# no ip access-list extended 110
Remarks, Logging & Time-Based ACLs
remark (Comments)
Adds human notes inside show running-config so future admins understand why a rule exists.
log (Hit Alerts)
Prints a console/syslog alert showing Source IP, Dest IP, and Port whenever packets match that line.
time-range (Schedules)
Activates an ACL rule only during specific hours/days (e.g., block YouTube during class/office hours).
! Define the schedule first R1(config)# time-range CLASS_HOURS R1(config-time-range)# periodic weekdays 09:00 to 17:00 R1(config-time-range)# exit ! Attach time-range to an Extended ACL rule R1(config)# ip access-list extended LAB_INTERNET_RULES R1(config-ext-nacl)# 10 remark Block HTTP/HTTPS during class hours only R1(config-ext-nacl)# 20 deny tcp 192.168.10.0 0.0.0.255 any eq 443 time-range CLASS_HOURS log R1(config-ext-nacl)# 30 permit ip any any
Essential Verification & Troubleshooting Commands
| Cisco IOS Command | What It Shows & Why You Use It |
|---|---|
show access-lists |
Displays all ACLs, sequence numbers, and live match counters (e.g., (24 matches)) so you can see which rule is catching packets. |
show ip interface Gi0/0 |
Confirms whether an ACL is actually applied to the interface and in which direction (Inbound access list is 110). |
show running-config | section access-list |
Displays exact ACL configuration lines including remark comments. |
clear access-list counters |
Resets match counters back to 0 before running a ping/web test in class. |
Complete Classroom Lab (All 3 ACL Types Together)
Build this topology in Cisco Packet Tracer or GNS3 to practice Extended Named ACL, Standard Numbered ACL, and Standard Named VTY ACL in one lab.
Gi0/1 (.20.1)
172.16.1.0/30
10.1.1.0/24
Lab Tasks for Students
- Task 1 (Extended Named ACL on R1): On R1
Gi0/1(inbound from Guest LAN192.168.20.0/24), allow Guests to access HTTP (80), HTTPS (443), and DNS (UDP 53) on10.1.1.100, block all other Guest traffic to10.1.1.0/24, and permit Guests to reach all other networks. - Task 2 (Standard Numbered ACL on R2): On R2
Gi0/0(outbound toward HQ Server LAN10.1.1.0/24), blockHR PC (192.168.10.10)completely from accessing the Server LAN, while permitting everyone else. - Task 3 (Standard Named VTY ACL on R1 & R2): Allow only
IT PC (192.168.10.50)to SSH into R1 and R2.
Click to Reveal Complete Solution Commands (Router R1 & Router R2)
enable configure terminal ! Task 1: Extended Named ACL (Applied Inbound at Source Interface Gi0/1) ip access-list extended GUEST_FILTER 10 remark Allow Guest Web and DNS to HQ Server 20 permit tcp 192.168.20.0 0.0.0.255 host 10.1.1.100 eq 80 30 permit tcp 192.168.20.0 0.0.0.255 host 10.1.1.100 eq 443 40 permit udp 192.168.20.0 0.0.0.255 host 10.1.1.100 eq 53 50 deny ip 192.168.20.0 0.0.0.255 10.1.1.0 0.0.0.255 log 60 permit ip 192.168.20.0 0.0.0.255 any exit interface GigabitEthernet0/1 ip access-group GUEST_FILTER in exit ! Task 3: Standard Named ACL for VTY SSH Access ip access-list standard VTY_IT_ONLY permit host 192.168.10.50 deny any log exit line vty 0 4 transport input ssh access-class VTY_IT_ONLY in exit end
enable configure terminal ! Task 2: Standard Numbered ACL (Applied Outbound Closest to Destination Gi0/0) access-list 20 remark Block HR PC from Server LAN access-list 20 deny host 192.168.10.10 access-list 20 permit any interface GigabitEthernet0/0 ip access-group 20 out exit ! Task 3: Standard Named ACL for VTY SSH Access ip access-list standard VTY_IT_ONLY permit host 192.168.10.50 deny any log exit line vty 0 4 transport input ssh access-class VTY_IT_ONLY in exit end
Top 7 Beginner Mistakes (Quick Troubleshooting Guide)
| # | Common Mistake | How to Fix It |
|---|---|---|
| 1 | Created the ACL, but traffic isn't filtered at all. | You forgot Step 2! Bind it with ip access-group NAME in|out on the interface. |
| 2 | Blocked 100% of network traffic accidentally. | You wrote only deny lines and forgot permit any (or permit ip any any) before the implicit deny. |
| 3 | Specific deny rule never gets any matches. |
A broad permit rule is above it. Put specific rules first, general rules last. |
| 4 | Used ip access-group under line vty. |
VTY lines require access-class NAME in, not ip access-group. |
| 5 | Filtered the wrong direction (in vs out). |
Stand inside the router: arriving from wire = in; leaving onto wire = out. |
| 6 | Typed no access-list 100 to remove one line. |
That deletes the whole ACL! Use ip access-list extended 100 then no 20. |
| 7 | Put a Standard ACL near the source PC. | Move Standard ACLs as close to the destination interface as possible. |