Course contents

Chapter 12: Security FundamentalsLesson 15 of 19

Standard ACLs

Numbered and named standard ACLs, wildcard masks, implicit deny, placement and applying them to interfaces.

Intermediate · 13 min read

Technical definition

A standard ACL (access control list) is an ACL whose entries match only the source IPv4 address of a packet, using a wildcard mask to select a single host or a range. Entries are checked from top to bottom until one matches, and an implicit deny at the end drops anything not permitted.

Sales must not reach the payroll server

A small company has two user LANs on router R1: the Sales LAN and the Admin LAN. Behind R2 sits the server LAN, with a file server that holds payroll data. A new rule arrives from management: "Sales must not reach the server LAN. Admin can." Routing works perfectly, which is exactly the problem: every network can reach every other network.

You don't need a firewall for a rule this simple. A router can check each packet against a list of rules and drop the ones you don't want. That list is an access control list (ACL).

Diagram
The ACL lab: two user LANs on R1, servers behind R2
The ACL lab: two user LANs on R1, servers behind R2
Gi0/0192.168.10.0/24Gi0/2192.168.20.0/24Gi0/1Gi0/110.0.12.0/30Gi0/0PC1 (Sales)IP 192.168.10.10Admin PCIP 192.168.20.10R1R2SRV1 (web)IP 192.168.30.10/24

Device key: PC1 (Sales) (computer) · Admin PC (laptop) · R1, R2 (router) · SRV1 (web) (server)

Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type. Blocked: forwarding prevented by a port or policy. Down: failed link. Read the step for the cause.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • PC1 (Sales): IP 192.168.10.10
  • Admin PC: IP 192.168.20.10
  • SRV1 (web): IP 192.168.30.10/24
  1. 1. Admin to server: allowed. The packet leaves R2 Gi0/0. The ACL checks the source 192.168.20.10, finds no deny for it, and the final permit lets it out.
  2. 2. Sales to server: dropped at R2. As the packet tries to leave R2 Gi0/0, the first ACL entry matches its source network 192.168.10.0/24 and says deny. R2 drops it.
  3. 3. Sales to Admin: not affected. This traffic never leaves R2 Gi0/0, so the ACL there never sees it. An ACL only filters the interface and direction it is applied to.

What an ACL is

An ACL is an ordered list of permit and deny statements. Each statement is called an access control entry (ACE). On its own an ACL does nothing. It only filters traffic once you apply it to an interface in one direction: in (packets arriving on the interface) or out (packets leaving it).

A standard ACL is the simplest kind. It can only look at one thing: the packet's source IPv4 address. It can't see the destination, the protocol or the port. When you need those, you use an extended ACL. If the idea of filtering traffic by rules is new to you, read Firewall basics first.

Diagram
What an ACL is
What an ACL is
TypeMatches onNumbersNamed form
StandardSource IP only1-99, 1300-1999ip access-list standard NAME
ExtendedProtocol, source and destination IP, ports100-199, 2000-2699ip access-list extended NAME
Read each row across: the left box names the item, the others describe it.

Four rules every ACL follows

ACLs were designed to be fast. A router may check millions of packets a second, so the rules are simple and the order is fixed. Four rules explain almost everything an ACL does:

  • Top-down, first match wins. The router compares the packet with each entry in order. At the first entry that matches, it permits or denies the packet and stops looking. Later entries are never checked for that packet.
  • Implicit deny at the end. Every ACL ends with an invisible deny any. A packet that matches nothing is dropped. So an ACL with only deny entries blocks everything.
  • One ACL per interface, per direction, per protocol. Gi0/0 can have one IPv4 ACL inbound and one IPv4 ACL outbound. Applying a second one in the same direction replaces the first.
  • Standard ACLs go close to the destination. Because a standard ACL only knows the source, placing it near the source would block that source from going anywhere through that interface. Near the destination, it only affects traffic to that destination.

In the lab, a standard ACL on R1 Gi0/0 inbound denying Sales would cut Sales off from the Admin LAN and from every other network too. On R2 Gi0/0 outbound, it only stops Sales reaching the servers, which is the rule you were given.

Wildcard masks, step by step

An ACL entry describes a group of addresses with an address and a wildcard mask. The wildcard tells the router which bits of the address to check. Read each bit of the wildcard like this:

  • 0 = this bit must match the address in the entry.
  • 1 = ignore this bit; it can be anything.

That is the reverse of a subnet mask, which you met in Subnet mask basics. For any normal subnet, there is a quick way to get the wildcard:

Diagram
Process, step by step
Write the subnet mask
192.168.10.0/26 → 255.255.255.192
Subtract each octet from 255
255-255 . 255-255 . 255-255 . 255-192
That is the wildcard
0.0.0.63: check the first 26 bits, ignore the last 6
Write the entry
deny 192.168.10.0 0.0.0.63 → matches .0 to .63

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

Turning a subnet into a wildcard mask

Two wildcards are so common that IOS has keywords for them:

  • host 192.168.20.10 is the same as 192.168.20.10 0.0.0.0: check every bit, so exactly one address.
  • any is the same as 0.0.0.0 255.255.255.255: check no bits, so every address.

Try some entries below. Pick a preset or type your own, then test an address against it. The last preset shows something a subnet mask can't do: a wildcard whose 1 bits are not all at the end. IOS accepts it, but you will rarely need it.

Try it · wildcard mask explorer
Address
11000000
10101000
00001010
00000000
Wildcard
00000000
00000000
00000000
11111111
Test
11000000
10101000
00001010
01001101
wildcard 0 = bit must matchwildcard 1 = bit ignoredchecked bit that differs
Matches
192.168.10.0 – 192.168.10.255
256 addresses, the same as 192.168.10.0/24
IOS shorthand
192.168.10.0 0.0.0.255
Subnet mask 255.255.255.0 → 255 minus each octet = 0.0.0.255
✓ 192.168.10.77 matches: every checked bit is the same as in 192.168.10.0.

To convert quickly in either direction, use the Wildcard Mask Calculator.

Where R2 checks the list

Where does the ACL check happen in the router's work? An inbound ACL runs before the routing decision. An outbound ACL runs after the router has chosen the exit interface.

Diagram
Path, step by step
Packet arrives
on R2 Gi0/1
Inbound ACL?
none on Gi0/1
Routing lookup
192.168.30.10 → Gi0/0
Outbound ACL
list 10 on Gi0/0
Sent or dropped
first match decides

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

Where R2 checks the ACL for a packet heading to the server LAN

Now follow two packets through ACL 10 on R2 Gi0/0 outbound. The list has two entries:

10 deny 192.168.10.0 0.0.0.255 20 permit any (implicit) deny any

ACL 10 as the router evaluates it. The last line is never shown, but it is always there.

  1. PC1 (192.168.10.10) sends a packet to SRV1. R2 compares the source with entry 10: the first three octets must equal 192.168.10, and they do. The entry says deny, so R2 drops the packet and sends an ICMP "administratively prohibited" message back to PC1. Entry 20 is never checked.
  2. The Admin PC (192.168.20.10) sends a packet to SRV1. Entry 10 does not match (the third octet is 20, not 10). Entry 20, permit any, matches everything, so the packet is sent.
  3. If entry 20 were missing, the Admin packet would reach the implicit deny and be dropped too. A list of only deny entries blocks everything.

Writing and applying the list on R2

Based on Cisco IOS / IOS XE documentation, not run on a lab device.

There are two steps: create the list in global configuration mode, then apply it to an interface with ip access-group.

Finish the policy before attaching it

In this isolated IOS/IOS XE IPv4 lab, first inspect R2's current lists and outbound binding. The examples below assume the selected list is not already in use. Build and inspect the complete ACL before attaching it. Adding only the Sales deny to an already referenced list can also deny Admin through the implicit deny until the permit is added.

show ip access-lists show ip interface GigabitEthernet0/0

Privileged EXEC on R2: inspect existing entries and the current inbound/outbound list names before changing them. Read-only inspection does not prove the intended policy is installed or that end-to-end traffic works.

Editing an active list is a live policy change. For a replacement, prepare a complete unused name and record the previous binding and recovery access before the controlled switch. Test the intended permitted and denied paths afterward; restore the verified prior binding if recovery is needed. Do not delete the list or add an early permit-any entry as a shortcut.

Staging guidance: Cisco IOS XE IP access-list overview. An attached list's first entry can take effect immediately; the documented sequence is to create the list before applying it.

A numbered standard ACL

access-list 10 remark Sales may not reach the server LAN access-list 10 deny 192.168.10.0 0.0.0.255 access-list 10 permit any

On R2. Each line is added to the end of list 10. The remark is a comment and doesn't match anything.

interface GigabitEthernet0/0 ip access-group 10 out

Apply the list to traffic leaving R2 toward the server LAN.

The same rule as a named ACL

A named ACL does the same job but has a name you choose. You enter a sub-mode for the list and type the entries without repeating the list name each time.

ip access-list standard PROTECT-SERVERS remark Sales may not reach the server LAN deny 192.168.10.0 0.0.0.255 permit any ! interface GigabitEthernet0/0 ip access-group PROTECT-SERVERS out

Names are case-sensitive. Use one or the other, not both: the second ip access-group in the same direction would replace the first.

Limiting who can log in to the router

Standard ACLs have a second common job: controlling which addresses can open a Telnet or SSH session to the router itself. Here you use access-class on the VTY lines instead of ip access-group on an interface. Logins themselves are covered in Passwords, local users and SSH.

access-list 5 remark Only the admin PC may manage R1 access-list 5 permit host 192.168.20.10 ! line vty 0 15 access-class 5 in

On R1. Any other source trying to connect to the VTY lines hits the implicit deny. This works no matter which interface the session arrives on.

A full example

! ---- R2 ---- ip access-list standard PROTECT-SERVERS remark Sales may not reach the server LAN deny 192.168.10.0 0.0.0.255 permit any ! interface GigabitEthernet0/0 description Server LAN ip address 192.168.30.1 255.255.255.0 ip access-group PROTECT-SERVERS out ! ! ---- R1 ---- ip access-list standard VTY-ADMIN permit host 192.168.20.10 ! line vty 0 15 access-class VTY-ADMIN in transport input ssh login local

Sales is kept off the server LAN at R2, and only the Admin PC can SSH to R1. Named ACLs work with access-class too.

Proving the ACL is applied and matching

Example output · based on Cisco documentation; exact format varies by platform and software version
R2#show access-lists
Standard IP access list PROTECT-SERVERS
    10 deny   192.168.10.0, wildcard bits 0.0.0.255 (12 matches)
    20 permit any (348 matches)
IOS numbers each entry (10, 20, ...) even if you didn't. The matches counters go up each time an entry is hit. A deny counter rising while a user complains is strong evidence the ACL is the cause. Matches on the implicit deny are not counted, because that entry isn't shown.
Example output · based on Cisco documentation; exact format varies by platform and software version
R2#show ip interface GigabitEthernet0/0
GigabitEthernet0/0 is up, line protocol is up
  Internet address is 192.168.30.1/24
  Broadcast address is 255.255.255.255
  ...
  Outgoing access list is PROTECT-SERVERS
  Inbound  access list is not set
  ...
This confirms the list is applied, and in which direction. Many "my ACL does nothing" problems end here: it was never applied, or it was applied in the wrong direction.
show running-config | include access-group|access-class

A quick way to list every place an ACL is applied on the device.

clear access-list counters

Reset the match counters, then test again, so you only see fresh hits.

Nothing blocked, or everything blocked

Diagram
Nothing blocked, or everything blocked
Nothing blocked, or everything blocked
SymptomLikely causeCheck / fix
Nothing is blockedACL not applied, applied in the wrong direction, or the name in ip access-group has a typo (an undefined ACL permits everything)show ip interface; compare the name with show access-lists
Everything is blockedNo permit entry, so the implicit deny drops all other trafficAdd permit any at the end, if that matches the policy
The deny never matchesA broader permit sits above it, or the wildcard is wrongRead the list top-down; watch which counters rise
Users blocked from far more than intendedStandard ACL placed near the sourceMove it close to the destination
Admin can't SSH to the routeraccess-class list doesn't include the admin's real source address (for example after NAT or a DHCP change)show access-lists counters; show users
Read each row across: the left box names the item, the others describe it.

A good habit: before you apply an ACL to a remote router, make sure you won't block your own session. If you manage R2 from the Admin LAN, an inbound ACL on R2 Gi0/1 with no permit for your address cuts you off immediately.

Typos and habits that break ACLs

  • Typing a subnet mask instead of a wildcard. deny 192.168.10.0 255.255.255.0 is accepted, but it checks only the last octet: it matches any address ending in .0.
  • Forgetting the implicit deny. A list with only deny lines blocks every packet.
  • Wrong order. permit any as the first entry makes every later entry useless.
  • Deleting a whole numbered ACL by accident. In the old global syntax, no access-list 10 deny 192.168.10.0 0.0.0.255 removes all of list 10, not just that line. Edit with sequence numbers instead (shown in Extended and named ACLs).
  • Using ip access-group on VTY lines (it's access-class there), or access-class on an interface.

Exam tip: expect to calculate wildcard masks (for example, which entry matches hosts 172.16.4.0 to 172.16.7.255: 172.16.4.0 0.0.3.255), to spot that a list blocks everything because of the implicit deny, and to choose placement: standard close to the destination. Know the number ranges (1-99, 1300-1999), the host and any keywords, and that access-class is for VTY lines while ip access-group is for interfaces.

Standard ACL essentials

  • A standard ACL matches only the source IPv4 address.
  • Entries are checked top-down and the first match wins; a packet that matches nothing meets the invisible deny any.
  • Wildcard 0 = must match, 1 = ignore. For a subnet, 255 minus each mask octet.
  • Place standard ACLs close to the destination.
  • Apply with ip access-group on interfaces and access-class on VTY lines.

Test yourself on standard ACLs

Predict · scenario 1

PROTECT-SERVERS is referenced outbound but unfinished. You add only the Sales deny; Admin's intended permit is not present yet. What is the concern?

Predict · scenario 2

Which wildcard mask matches exactly the subnet 10.20.0.0/22?

Predict · scenario 3

An ACL has two entries: 'deny 192.168.10.0 0.0.0.255' and 'deny host 192.168.20.50'. It is applied outbound on the server LAN interface. What can reach the server LAN through that interface?

Predict · scenario 4

You must stop the Sales LAN reaching only the server LAN, using a standard ACL. Where is the best place to apply it?

Predict · scenario 5

Only 192.168.20.10 should be able to SSH to R1. Which command applies standard ACL 5 for this?

Predict · scenario 6

A standard ACL entry reads 'permit 172.16.8.0 0.0.7.255'. Does it match 172.16.17.4?

FAQ

What is the difference between a wildcard mask and a subnet mask?
They are opposites. In a subnet mask a 1 bit marks the network part. In a wildcard mask a 0 bit means 'this bit must match' and a 1 bit means 'ignore this bit'. For a normal block of addresses the wildcard is simply 255 minus each octet of the subnet mask, so 255.255.255.0 becomes 0.0.0.255.
Does an ACL with no entries block everything?
An empty or undefined classic IOS IPv4 interface ACL is not a reliable deny-all policy. Do not attach it as a staging shortcut: the first entry can activate the implicit deny before the remaining rules exist. Build a complete unused list, inspect it, then attach it and verify the result on the exact platform and release.
Do ACLs filter traffic that the router itself sends?
An outbound ACL on an interface does not filter packets the router creates itself, such as its own pings or routing updates. Inbound ACLs do check packets arriving at the router, including packets addressed to the router.
Should I use numbered or named ACLs?
Named ACLs are easier to read and to edit, so most engineers prefer them. Both work the same way. The CCNA exam expects you to read and write both, and to know the number ranges: 1-99 and 1300-1999 for standard, 100-199 and 2000-2699 for extended.