---
title: "Cisco ACLs for CCNA: Standard and Extended | CyberWithMadhav"
description: "Free CCNA lesson on IPv4 ACLs: first match, the implicit deny, wildcard masks, standard, extended and named ACLs, VTY access-class, with an ACL tester and lab."
url: https://www.cyberwithmadhav.com/learn-ccna-access-control-lists.html
source_format: markdown rendering of the HTML page
---

[Learn](https://www.cyberwithmadhav.com/learn.html) / [Stage 3: Networking and CCNA](https://www.cyberwithmadhav.com/learn.html#stage-3) / Lesson 3.9

$ lesson 3.9 --track ccna --domain security

# Access Control Lists: Standard, Extended, Named and VTY Protection

ACLs are the simplest traffic policy a router can enforce, and the easiest way to cause an outage. Learn how a packet walks the list, how wildcards work, where to put each type, how to edit a live ACL safely, and how to make sure only admins can even reach the login prompt.

- Stage **3** Networking and CCNA
- Level **Intermediate to advanced**
- **65** min
- **6** sections, quiz, lab

Start the lesson Jump to the lab

## In this lesson

1. How an ACL decides
2. Wildcard masks
3. Numbered, named and extended syntax
4. Try it: walk a packet through GUEST-IN
5. Protecting the router itself
6. Practise on R1
7. Flashcards
8. Quick quiz
9. Hands-on lab
10. Key takeaways

## By the end of this lesson you can

- Predict which line of an ACL matches a packet, including the implicit deny
- Write wildcard masks for hosts, subnets and ranges
- Configure numbered and named standard and extended ACLs
- Choose the right interface and direction for each ACL
- Restrict VTY access with access-class and read match counters

3.9.01

## How an ACL decides

An **access control list** is an ordered list of permit and deny lines. When a packet is checked against it, the router:

1. Compares the packet with the first line, then the next, top to bottom.
2. Stops at the **first line that matches** and does what it says. Later lines are never read for that packet.
3. If no line matches, drops the packet. Every ACL ends with an invisible `deny any`.

That last rule causes the classic outage: an ACL with only `deny host 192.168.10.10` does block that host, and it also blocks everyone else, because nothing is permitted. If you mean "everyone except this host", add `permit any` at the end.

| Type | Numbers | Matches on | Place it |
| --- | --- | --- | --- |
| Standard | 1 to 99, 1300 to 1999 | Source IP only | Close to the destination, so it does not block the source from everywhere else. |
| Extended | 100 to 199, 2000 to 2699 | Protocol, source, destination, ports, some flags | Close to the source, so unwanted traffic is dropped before it crosses the network. |

On an interface you get **one ACL per direction per protocol**: one IPv4 ACL in, one out. "In" means packets arriving on that interface, before routing. "Out" means packets leaving it, after routing. Outbound ACLs do not filter packets the router itself generates, such as its own pings or routing updates.

3.9.02

## Wildcard masks

ACLs (and OSPF network statements) use **wildcard masks**: a 0 bit means "this bit must match", a 1 bit means "ignore this bit". For a normal subnet the wildcard is the subnet mask inverted, which you can get by subtracting each octet from 255.

| To match | Address and wildcard | Shortcut |
| --- | --- | --- |
| One host | 192.168.10.10 0.0.0.0 | `host 192.168.10.10` |
| A /24 | 192.168.20.0 0.0.0.255 |  |
| A /26 (64 addresses) | 192.168.20.64 0.0.0.63 |  |
| A /30 | 10.0.13.0 0.0.0.3 |  |
| All of 192.168.0.0 to 192.168.255.255 | 192.168.0.0 0.0.255.255 |  |
| Everything | 0.0.0.0 255.255.255.255 | `any` |

Wildcards can also match patterns a subnet mask cannot. `192.168.1.0 0.0.254.255` matches every odd third octet (192.168.1.x, 192.168.3.x and so on). You will rarely write one, but you should recognise that a wildcard is not always a contiguous block.

3.9.03

## Numbered, named and extended syntax

```
! numbered standard
R1(config)#access-list 10 deny host 192.168.10.10
R1(config)#access-list 10 permit any
! named extended, with sequence numbers
R1(config)#ip access-list extended GUEST-IN
R1(config-ext-nacl)#10 permit udp 192.168.20.0 0.0.0.255 host 10.10.10.10 eq domain
R1(config-ext-nacl)#20 permit tcp 192.168.20.0 0.0.0.255 host 10.10.10.10 eq www
R1(config-ext-nacl)#30 deny ip 192.168.20.0 0.0.0.255 192.168.0.0 0.0.255.255 log
R1(config-ext-nacl)#40 permit ip 192.168.20.0 0.0.0.255 any
! insert or delete one line later
R1(config-ext-nacl)#15 permit icmp 192.168.20.0 0.0.0.255 host 10.10.10.10 echo
R1(config-ext-nacl)#no 30
! apply
R1(config)#interface GigabitEthernet0/0/0.20
R1(config-subif)#ip access-group GUEST-IN in
```

- Extended line order: `action protocol source [source port] destination [destination port] [options]`. Ports need `tcp` or `udp`.
- Port operators: `eq`, `neq`, `gt`, `lt`, `range`. Names like `www` (80) and `domain` (53) are accepted.
- `established` matches TCP packets with ACK or RST set, which is a cheap way to allow replies. It is a flag check, not session tracking, so it is not a stateful firewall.
- **Named** ACLs give each line a sequence number, so you can insert line 15 between 10 and 20 or delete one line, instead of deleting and retyping a numbered list.

3.9.04

## Try it: walk a packet through GUEST-IN

This is the guest VLAN policy from the lab. Pick an example packet, or edit the ACL and type your own, then read the trace to see exactly which line decided.

### ACL rule tester

Edit the ACL, describe a packet, and watch it walk the list top to bottom. The first matching line decides. If nothing matches, the invisible deny at the end drops it.

ACL lines
Packet

Protocol

Source IP

Destination IP

Destination port

Source port

ACK set (a reply in an existing connection)

ICMP type

Notice the last example. GUEST-IN only matches guest sources, so a staff packet falls through to the implicit deny. That is fine, because the ACL is applied only on the guest subinterface, but it shows why applying an ACL to the wrong interface breaks things.

3.9.05

## Protecting the router itself

An ACL on a data interface does not protect SSH to the router from every direction. For the VTY lines use `access-class`, which filters who may open a remote session, whichever interface they arrive on.

```
R1(config)#ip access-list standard MGMT-ONLY
R1(config-std-nacl)#permit 192.168.99.0 0.0.0.255
R1(config-std-nacl)#deny any log
R1(config)#line vty 0 4
R1(config-line)#access-class MGMT-ONLY in
```
How attackers abuse this

Once one guest laptop is compromised, a flat network lets the attacker scan and reach everything: staff PCs, printers, and the SSH prompt of every router and switch, where password guessing starts. The same goes for spoofed traffic arriving from the internet claiming to come from your own private ranges.
Defender move

Extended ACLs between VLANs so guests reach only what they need, `access-class` on every device's VTY lines so only the admin subnet can even try to log in, `log` on the important deny lines (sent to syslog in lesson 3.11), and edge filters that drop inbound packets with RFC 1918 or your own internal source addresses (the idea behind BCP 38).

3.9.06

## Practise on R1

R1 already routes for VLANs 10, 20 and 99 (router on a stick, as in lesson 3.6) and reaches the server LAN on Gi0/0/1. Match counters in this console are sample numbers, standing in for real traffic.

console: R1 (R1 ACL console)

#### Missions  0/12

Simplified IOS simulator in your browser. It teaches the commands; Packet Tracer and real gear have many more.

## Flashcards: do you remember?

Tap a card to flip it. Try to answer in your head first; recalling is what makes it stick.

## Quick quiz

Instant feedback on every answer. Score 70% or more to pass this lesson's quiz.

### Q1 An ACL contains only `access-list 5 deny host 10.1.1.5` and is applied. What happens to traffic from 10.1.1.6?

### Q2 Which wildcard matches 172.16.8.0/22?

### Q3 Where should an extended ACL that blocks guests from staff be placed?

### Q4 How do you stop non-admins reaching SSH on a router?

### Q5 `permit tcp any host 10.1.1.1 eq 22 established` matches:

### Q6 How many IPv4 ACLs can be applied inbound on one interface?

**0 / 6**

## Hands-on lab

Cisco Packet Tracer lab  50 minutes  simulated network

### Packet Tracer lab 3.9: segment guests and lock down management

**You need:** Cisco Packet Tracer (free with a Cisco Networking Academy account; version 9.0.1 was the current download on the NetAcad Resource Hub when this lesson was written). Start from your lesson 3.6 router on a stick file, or build it: 1 x ISR4331, 2 x 2960, 3 x PC-PT, 1 x Server-PT. SSH from lesson 3.3 should already work on R1 and SW1.

**Simulator lab, zero risk.** This lab runs inside Cisco Packet Tracer, so it touches no real network. Packet Tracer is free with a Cisco Networking Academy account (netacad.com). It simulates a subset of Cisco IOS, so where support for a feature is uncertain we say so instead of promising it works.

#### Topology and addressing

R1 Gi0/0/0 trunks to SW1 with subinterfaces .10, .20 and .99. R1 Gi0/0/1 to SW2 and Server-Web.

| Device | Interface | IPv4 address / prefix | Default gateway or note |
| --- | --- | --- | --- |
| R1 | Gi0/0/0.10 / .20 / .99 | 192.168.10.1 / 192.168.20.1 / 192.168.99.1 (/24) | gateways for each VLAN |
| R1 | Gi0/0/1 | 10.10.10.1/24 | server LAN |
| SW1 | VLAN 99 | 192.168.99.2/24 | gateway 192.168.99.1 |
| PC-Staff / PC-Guest / Admin-PC | Fa0 | 192.168.10.10 / 192.168.20.10 / 192.168.99.10 | gateway .1 |
| Server-Web | Fa0 | 10.10.10.10/24 | gateway 10.10.10.1, HTTP and DNS on |

1. Guest policy, close to the source`ip access-list extended GUEST-IN    10 permit udp 192.168.20.0 0.0.0.255 host 10.10.10.10 eq domain    20 permit tcp 192.168.20.0 0.0.0.255 host 10.10.10.10 eq www    30 deny ip 192.168.20.0 0.0.0.255 192.168.0.0 0.0.255.255 log    35 deny ip 192.168.20.0 0.0.0.255 10.0.0.0 0.255.255.255 log    40 permit ip 192.168.20.0 0.0.0.255 any   interface GigabitEthernet0/0/0.20    ip access-group GUEST-IN in`  Done
2. Management lockdown (R1 and SW1)`ip access-list standard MGMT-ONLY    permit 192.168.99.0 0.0.0.255    deny any log   line vty 0 4    access-class MGMT-ONLY in`On SW1 apply it to `line vty 0 15` if that range exists in your model.  Done
3. Insert a line without retyping`R1(config)#  ip access-list extended GUEST-IN   R1(config-ext-nacl)#  15 permit icmp 192.168.20.0 0.0.0.255 host 10.10.10.10 echo`  Done
4. Standard ACL near the destination`R1(config)#  access-list 10 deny host 192.168.10.10   R1(config)#  access-list 10 permit any   R1(config)#  interface GigabitEthernet0/0/1   R1(config-if)#  ip access-group 10 out`  Done
5. Test from each PCFrom PC-Guest: browse `http://10.10.10.10` (works), ping 10.10.10.10 (works after step 3), ping 192.168.10.10 (fails), SSH to 192.168.99.1 (fails). From PC-Staff: browse the server (fails after step 4). From Admin-PC: SSH to R1 (works).  Done
6. Verify`R1#  show access-lists   R1#  show ip interface GigabitEthernet0/0/0.20   R1#  show running-config | section vty`  Done

**You are done when:** show access-lists shows every line with a sequence number and match counters that rise only on the lines your tests hit. show ip interface for Gi0/0/0.20 reports GUEST-IN as the inbound list. The VTY section shows access-class MGMT-ONLY in. PC-Staff cannot reach the server but PC-Guest can, because ACL 10 filters by source only.

#### Packet Tracer limits and notes

- Numbered and named standard and extended ACLs, sequence numbers and `access-class` work in Packet Tracer in the outline author's experience, but test in your own build.
- The `log` keyword is accepted, but whether Packet Tracer actually generates log messages for ACL hits is UNVERIFIED. Rely on the match counters.
- IPv6 ACLs (`ipv6 access-list` with `ipv6 traffic-filter`) follow the same ideas but are not part of this lab.
- Packet Tracer simulates a subset of IOS. If a command here is rejected in your version, note it, skip that step and carry on; the concept still applies to real Cisco gear.

[Download the lab checklist (.txt)](https://www.cyberwithmadhav.com/assets/learn/learn-ccna-access-control-lists-lab-checklist.txt)  Print it or keep it open beside Packet Tracer.

## Key takeaways

- First match wins, and every ACL ends with an invisible deny any.
- Standard near the destination, extended near the source.
- Wildcard = 255 minus each mask octet for normal subnets.
- Use named ACLs so you can insert and delete single lines.
- Protect the management plane with access-class, and log the denies that matter.

Finished the sections, quiz and lab? Mark the lesson complete. Progress is saved only in this browser.

[Previous 3.8 Single Area OSPFv2: Neighbours, DR/BDR, Cost and Troubleshooting](https://www.cyberwithmadhav.com/learn-ccna-ospf.html)[Next 3.10 DHCP, DNS and NAT/PAT: Addresses, Names and the Internet Edge](https://www.cyberwithmadhav.com/learn-ccna-dhcp-dns-nat.html)
