Watch on Instagram

Network Bytes · Episode 57 · CCNA 5.6

"ACLs: the network bouncer"

An access control list is a router's list of permit and deny rules, read from the top. The first rule that matches wins, anything that matches nothing hits an invisible deny at the end, standard ACLs check only the source address and extended ACLs can also check destination, protocol and port.

Posted · About a 1 minute watch, 3 minute read · Take the quiz

The bouncer and the list

Picture a club with a bouncer at the door holding a numbered list of rules. Each guest is checked against the list from the top. An ACL works the same way on a router interface: every packet that enters (or leaves, depending on where the ACL is applied) is compared with the rules, one at a time, in order.

Permit or deny, plus what to match

Each line of an ACL (an access control entry) has two parts: an action, permit or deny, and a match, such as a source address range. For example:

  • deny 172.16.0.0/16
  • permit 192.168.1.0/24

A packet from 192.168.1.20 does not match the first line, matches the second, and is permitted.

First match wins, so order matters

The router stops at the first rule that matches and ignores everything below it. That means the same rules in a different order can give a different result. Put narrow, specific rules (a single host) above broad ones (a whole network) when you want the specific rule to count.

The hidden last rule: deny all

If a packet matches no rule, it is dropped. Every Cisco IPv4 ACL ends with an invisible implicit deny any. You never see it in the configuration, but it is there, so an ACL with only deny lines blocks everything. Most ACLs therefore include at least one permit.

Standard vs extended

  • Standard ACLs (numbered 1-99 and 1300-1999) match only the source address.
  • Extended ACLs (numbered 100-199 and 2000-2699) can match the source and destination address, the protocol (such as TCP or UDP) and the port (such as 443 for HTTPS).
  • Named ACLs work the same way, with a name instead of a number.

Typical placement: put standard ACLs close to the destination (they can only see the source, so placing them early would block too much), and extended ACLs close to the source (they are precise enough to stop unwanted traffic before it crosses the network).

Try it yourself

On paper, write a three-line ACL for a small office: deny host 192.168.1.50, permit 192.168.1.0/24, and nothing else. Now test three packets: from 192.168.1.50, from 192.168.1.77, and from 172.16.4.4. Which rule does each one hit? (Don't forget the hidden last line.) Then swap the first two lines and test again.

Good to know

  • Real Cisco ACLs use wildcard masks, not prefix lengths: permit 10.0.0.0/8 is written permit 10.0.0.0 0.255.255.255, and a single host is host 10.1.1.5 (or 10.1.1.5 0.0.0.0). The /8 style here is just for readability.
  • Each interface can have one ACL per direction (inbound and outbound) per protocol.
  • The implicit deny also drops traffic you might forget about, such as routing protocol updates, so test after applying an ACL.

For CCNA learners

This lines up with CCNA 200-301 exam topic 5.6, configure and verify access control lists: know top-down processing and first match, the implicit deny any, the difference between standard and extended (and their number ranges), wildcard masks, and where to place each type.

Answer to the comment question

Yes, 10.1.1.5 gets through. Rule one, permit 10.0.0.0/8, covers every address from 10.0.0.0 to 10.255.255.255, and 10.1.1.5 is inside that range. Because the first match wins, the router permits the packet at rule one and never reads rule two. To actually block 10.1.1.5, the deny host 10.1.1.5 line has to come before the broader permit.

Test your knowledge

Quick quiz: "ACLs: the network bouncer"

4 multiple-choice questions. Pick one answer for each, then check how you did.

1In what order does a router check the rules in an ACL?
2A packet matches none of the rules in an ACL. What happens?
3What can a standard ACL match on?
4You want to block only HTTPS (TCP port 443) from one network to one server. Which ACL type do you need?

Sources

Video transcript

How does a router decide which traffic gets through?

It can check an access control list, an ACL. Think of a bouncer with a list of rules, read from the top.

Each rule says permit or deny, plus what to match. The bouncer stops at the first rule that matches and ignores the rest. So order matters.

If nothing matches, the packet is dropped. Every ACL ends with an invisible deny everything.

Standard ACLs check only the source address. Extended ACLs can also check the destination, protocol and port.

Rule one: permit ten dot zero dot zero dot zero slash eight. Rule two: deny host ten dot one dot one dot five. Does ten dot one dot one dot five get through? Comment your answer below!

That's your byte.

More from Network Bytes

All Network Bytes lessons