ACLs explained: wildcard masks and order
Standard or extended: the choice that starts every ACL question
An access control list (ACL) is an ordered list of permit and deny statements that a router applies to packets on an interface, in one direction. A standard ACL matches only the source address; an extended ACL matches source, destination, protocol and port numbers. The decision rule: if the requirement names only who the traffic comes from, use standard; the moment it mentions a destination, a protocol or a port, you need extended. Whichever you use, the router checks entries top to bottom, the first match decides, and an invisible deny any waits at the end.
| Standard | Extended | |
|---|---|---|
| Matches | source address | source, destination, protocol, ports |
| Numbered ranges | 1-99, 1300-1999 | 100-199, 2000-2699 |
| Typical placement | close to the destination | close to the source |
| Typical use | limit who reaches a VTY line or a subnet | permit web, block telnet, filter by service |
The number ranges are from Cisco’s ACL configuration guide. Named ACLs (ip access-list standard NAME or extended NAME) have the same behaviour and allow editing by sequence number.
Wildcard masks, computed
A wildcard mask is the inverse of a subnet mask: a 0 bit must match, a 1 bit is ignored. To get it, subtract each octet of the subnet mask from 255.
- /24 (255.255.255.0) gives 0.0.0.255.
- /27 (255.255.255.224) gives 0.0.0.31. So
192.168.10.64 0.0.0.31matches 192.168.10.64 through 192.168.10.95: the block size is 32 and the wildcard is always block size minus 1. - /20 (255.255.240.0) gives 0.0.15.255. So
172.16.32.0 0.0.15.255matches 172.16.32.0 through 172.16.47.255. - A single host is
0.0.0.0, writtenhost 10.1.1.5; every address isany, which means0.0.0.0 255.255.255.255.
The wildcard is not a subnet mask applied to a different address: for 192.168.10.64 0.0.0.31 the router compares only the bits whose wildcard bit is 0. If you need the subnet maths first, see subnetting step by step.
Order and the implicit deny: a worked list
Requirement: the sales subnet 192.168.10.0/24 must not reach the web server 10.0.0.80 on port 80, but may reach everything else; the host 192.168.10.5 is the exception and may reach it.
ip access-list extended SALES-IN
10 permit tcp host 192.168.10.5 host 10.0.0.80 eq 80
20 deny tcp 192.168.10.0 0.0.0.255 host 10.0.0.80 eq 80
30 permit ip any any
!
interface g0/1
ip access-group SALES-IN in
Packet from .5 to port 80: matches line 10, permitted, processing stops. Packet from .7 to port 80: line 10 does not match (different source), line 20 matches, dropped. Packet from .7 to anything else: lines 10 and 20 do not match, line 30 permits it. Swap lines 10 and 20 and .5 is blocked too, because the broader deny matches first. Delete line 30 and every packet that matched nothing is dropped by the implicit deny, which Cisco’s documentation describes as present at the end of every ACL. The consequence worth remembering: a list with only deny statements blocks everything.
Two more points the exam likes. Cisco’s guide notes that an inbound list filters before the routing lookup and an outbound list after it, and that filtering by source is done on the inbound interface. And an outbound interface ACL does not filter traffic that the router itself originates; for management access you apply a standard or extended ACL to the VTY lines with access-class. See network services and security explained for that.
Placement, and the reason behind the rule
Because a standard ACL sees only the source, putting it near the source would also block that source from everything else, so it goes close to the destination. An extended ACL can be specific, so putting it close to the source drops unwanted traffic before it crosses the network. These are the standard teaching rules; a question that gives you an exact requirement (“block only telnet to the server”) overrides them.
Which exams test this
| Exam | How the topic appears | Where on this site |
|---|---|---|
| CCNA 200-301 | v1.1 (until Feb 2, 2027): Security Fundamentals, objective 5.6, configure and verify access control lists. v2.0 (from Feb 3, 2027): Network Services and Security, objective 4.6, configure IPv4 ACLs, naming standard, extended, numbered and named lists | Network services and security explained |
| CompTIA Network+ N10-009 | Network Security, objective 4.3: ACLs listed among the security rules to apply; Network Troubleshooting, objective 5.3, also names ACLs as a cause of switching issues. Concepts rather than Cisco syntax | Network security explained |
| CompTIA Security+ SY0-801 | Minor, indirect topic: Security Operations, objective 4.1 lists access controls and rule-based firewalls among mitigating controls; ACL syntax and wildcard masks are not on the outline | General security concepts explained mentions ACLs among technical controls |
How ACL questions are built
Three patterns. First, the ordering trap: a specific line placed after a broader one never matches. Second, the missing permit ip any any, where a correct deny silently blocks everything. Third, direction and interface: the right list on the wrong interface or with out instead of in. Constraint words that decide it: “only the source” (standard), “port 443” or “telnet” (extended), “closest to the destination” (standard placement), “all other traffic” (final permit), “inbound” (traffic entering the interface). Related: NAT types use an ACL to pick which addresses to translate, and the NSG rule evaluation guide shows the cloud counterpart, where rules are evaluated by priority rather than by list position.
Practice questions
Question 1. Which ACL statement matches exactly the hosts 172.16.32.0 through 172.16.47.255?
- A. permit 172.16.32.0 0.0.0.255
- B. permit 172.16.32.0 0.0.16.255
- C. permit 172.16.32.0 0.0.15.255
- D. permit 172.16.32.0 0.0.31.255
Show answer
Answer: C
The block is 16 in the third octet (32 to 47), so the wildcard in that octet is 15, and the last octet is 255 because every value is included: 0.0.15.255. 0.0.16.255 and 0.0.31.255 are not block size minus 1 for a 16-block. 0.0.0.255 would match only 172.16.32.0 to 172.16.32.255.
Question 2. An administrator applies an inbound ACL with these lines in order: 10 deny ip 10.1.1.0 0.0.0.255 any, 20 permit ip host 10.1.1.9 any. Host 10.1.1.9 cannot reach anything. What is the cause and the fix?
- A. The implicit deny drops it; add permit ip any any at the end
- B. The broader deny matches first; move line 20 above line 10
- C. The wildcard mask is wrong; use 255.255.255.0
- D. The ACL must be applied outbound instead
Show answer
Answer: B
Entries are processed top to bottom and the first match wins. Line 10 matches 10.1.1.9 because it is inside 10.1.1.0/24, so line 20 is never reached. The permit for the exception must come before the broader deny. Adding a permit at the end would not help, since the packet already matched, and the implicit deny is not the cause here.