breakfixlearn.com

NET-09Networking

ACLs & wildcard masks

Use this when: you permit or deny traffic on a router or switch, or lock down who can SSH to it.

NET-09 ACLs & wildcard masks cheat sheet. Every table on it is repeated as text below.
Tap the sheet for the full-size image. The text version below is screen-reader friendly.

Text version

Everything on the sheet, as plain HTML: handy for screen readers, copy-paste and search.

Wildcard masks

A 0 bit means the address bit must match; a 1 bit means ignore it. Wildcard = 255.255.255.255 minus the subnet mask.

MatchAddress and wildcardCovers
One host192.0.2.10 0.0.0.0Same as host 192.0.2.10
/24192.0.2.0 0.0.0.255192.0.2.0 to .255
/26192.0.2.64 0.0.0.63192.0.2.64 to .127
Everything0.0.0.0 255.255.255.255Same as any

How an ACL decides

  1. It checks lines from top to bottom.
  2. The first match wins, and checking stops there.
  3. No match? A hidden deny any at the end drops the packet.

Standard vs extended

StandardExtended
Numbers1-99, 1300-1999100-199, 2000-2699
MatchesSource IP onlyProtocol, source, destination, ports
Place itNear the destinationNear the source

Named ACLs: ip access-list standard NAME or ip access-list extended NAME.

Rules of thumb

  • One ACL per interface, per direction, per protocol
  • Inbound ACLs run before routing; outbound after
  • Put specific lines above general ones
  • Port operators: eq, gt, lt, neq, range

Extended, named ACL

  • ip access-list extended WEB-IN
  • remark HTTPS to the web server
  • 10 permit tcp any host 192.0.2.10 eq 443
  • 20 permit tcp 198.51.100.0 0.0.0.255 host 192.0.2.10 eq 22
  • 30 deny ip any any log
  • interface g0/1, then ip access-group WEB-IN in

Sequence numbers let you insert a line (15 permit ...) or delete one (no 20).

Lock down SSH

  • access-list 10 permit host 198.51.100.5
  • line vty 0 15, then access-class 10 in and transport input ssh

Only the admin PC can SSH in. On lines, use a numbered standard ACL with access-class, not access-group.

Check it

CommandShows
show access-listsLines and hit counts
show ip interface g0/1Which ACL is applied, and which way
show run | section access-listThe config
clear access-list countersReset hit counts
deny ip any any logSee what the hidden deny drops

Don't lock yourself out

Danger. A new ACL on your management path can cut you off. Permit your admin subnet first, and set reload in 10 as a safety net.

Caution. An ACL with only deny lines blocks everything.

Caution. An outbound ACL does not filter traffic the router itself sends.

Remember

  • /27 mask .224 = wildcard .31
  • First match wins
  • Hidden deny any at the end

Sources

Go deeper on the blog