Cisco IOS CLI Standard ACLs Extended ACLs Named ACLs Wildcard Masks Hands-On Lab

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.

1.1

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.

Real-Life Analogy: The VIP Club Security Guard

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.

1.2

How Cisco Routers Read & Process ACLs

Before typing a single command, you must understand the 5 golden rules of how Cisco IOS evaluates packets:

  1. Top-Down Order: Rules (called Access Control Entries or ACEs) are read strictly from top to bottom (Sequence 10 → 20 → 30...).
  2. 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.
  3. The Invisible "Implicit Deny": Every Cisco ACL automatically has an invisible deny any (or deny ip any any) at the very end.
  4. You Need at Least One permit: Because of the implicit deny at the bottom, an ACL with only deny rules will block 100% of traffic!
  5. 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).
Packet Arrives at Interface
↓ Check Top Line First
Does Packet Match Line 10?
→ YES →
Execute Line 10 & STOP
↓ NO (Move Down)
Does Packet Match Line 20?
→ YES →
Execute Line 20 & STOP
↓ NO (Reached Bottom of List)
IMPLICIT DENY ANY → Packet Dropped Silently!
1.3

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:

Wildcard Mask Formula
  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)
Interactive Classroom Tool: Subnet Mask → Wildcard Converter
Subnet Mask: 255.255.255.0 (/24)  |  Wildcard Mask: 0.0.0.255

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
1.4

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").
1.5

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:

The "1 ACL Per Interface, Per Direction" Rule

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.

Why Extended Goes Near Source & Standard Goes Near Destination
  • 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.10 near 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.
2.1

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

Standard Numbered ACL — Command Syntax
! 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.

Router R2 (Closest to Destination)
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
2.2

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)#.

Standard Named ACL — Syntax & Example
! 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
2.3

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.

Beginner Trap: ip access-group vs. access-class
  • On Interfaces (Gi0/0) → use ip access-group NAME in
  • On VTY Lines (line vty 0 4) → use access-class NAME in
Locking Down Router SSH Access
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
3.1

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:

access-list 101 1. Command &
ACL Number
permit 2. Action
(permit / deny)
tcp 3. Protocol
(ip, tcp, udp, icmp)
192.168.10.0 0.0.0.255 4. Source IP +
Wildcard Mask
host 10.0.0.50 5. Destination IP +
Wildcard Mask
eq 6. Port Operator
(eq, neq, gt, lt, range)
443 7. Destination
Port Number

Port Comparison Operators

OperatorMeaningExample
eqEqual to one porteq 80 (HTTP)
neqNot equal to portneq 23 (not Telnet)
gtGreater than portgt 1023
ltLess than portlt 1024
rangePort range (inclusive)range 20 21 (FTP)

Common Protocols & Ports Cheat Sheet

ServiceProtocolPort / Keyword
FTPTCP20, 21 (ftp)
SSH / TelnetTCP22 / 23 (telnet)
SMTP (Mail)TCP25 (smtp)
DNSUDP / TCP53 (domain)
DHCPUDP67, 68
HTTP / HTTPSTCP80 (www) / 443
PingICMPecho / echo-reply
3.2

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.

Extended Numbered ACL — All Protocol Syntaxes
! 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):

Router R1 (Closest to Student LAN Source)
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
3.3

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.

Extended Named ACL — DMZ Firewall Example
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
3.4

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."

Permitting Outbound Web Replies While Blocking Unsolicited Inbound Traffic
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
4.1

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.

Inserting, Deleting, Resequencing, and Removing ACLs
! 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
4.2

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).

Time-Based ACL + Remark + Logging Example
! 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
4.3

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.
4.4

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.

Office & Guest LANs HR PC: 192.168.10.10 IT PC: 192.168.10.50 Guest: 192.168.20.15
Router R1 Branch Gateway
Router R2 HQ Core Router
HQ Server Web & DNS 10.1.1.100

Lab Tasks for Students

  1. Task 1 (Extended Named ACL on R1): On R1 Gi0/1 (inbound from Guest LAN 192.168.20.0/24), allow Guests to access HTTP (80), HTTPS (443), and DNS (UDP 53) on 10.1.1.100, block all other Guest traffic to 10.1.1.0/24, and permit Guests to reach all other networks.
  2. Task 2 (Standard Numbered ACL on R2): On R2 Gi0/0 (outbound toward HQ Server LAN 10.1.1.0/24), block HR PC (192.168.10.10) completely from accessing the Server LAN, while permitting everyone else.
  3. 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)
Router R1 Solution
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
Router R2 Solution
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
4.5

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.