ACLs: standard, extended, named, and PACL/VACL/RACL together
An ACL is an ordered list read from the top: the first line that matches decides, and processing stops; anything unmatched hits the implicit deny. Order is everything. On a switch, a port ACL filters traffic entering a Layer 2 port, a VLAN map filters within a VLAN, and a router ACL filters on a Layer 3 interface, and a packet may meet several.
By Arif, founder of Daveth · Updated
The full 8 min walkthrough is in Daveth Pro (Network). See what the plan opens
What this page answers
What is a port ACL (PACL)?
An ACL on a Layer 2 port that filters traffic entering it; on a trunk it filters every VLAN on the trunk. PACLs are supported only in hardware and cannot filter Layer 2 control packets such as CDP, VTP, DTP and STP. Read it in “4.1 How an ACL decides”
How are ACL lines processed?
From the top, the lowest sequence number, until a line matches; that line's action is taken and processing stops. A packet that matches nothing hits the implicit deny at the end. Read it in “4.1 How an ACL decides”
How do you apply an IPv6 ACL?
IPv6 ACLs are named only: build one with ipv6 access-list name and apply it with ipv6 traffic-filter name in or out on a Layer 3 interface, or inbound on a Layer 2 port as a port ACL. Read it in “4.1 How an ACL decides”
4.1 How an ACL decides
An ACL has permit ip any any on line 10 and deny ip host 10.1.2.2 any on line 20. Is 10.1.2.2 blocked?
No. An ACL is an ordered list of access control entries, each a permit or deny with conditions. Processing "starts at the top (lowest sequence)" and goes down until a line matches; that line's action is taken "and processing stops". A packet that matches nothing hits the implicit deny at the end. So line 10 lets 10.1.2.2 through, and line 20 never gets read. It works like a bouncer reading a guest list from the top: the first line with your name on it decides, and he doesn't read on to see whether you're banned further down. Order is everything; Cisco says the order of conditions "is critical".
Addresses are matched with wildcard masks. A 0 bit must match; a 1 bit can be anything. To match 192.168.1.0/24 you write 192.168.1.0 0.0.0.255, and you can get the wildcard by subtracting the subnet mask from 255.255.255.255: 255.255.128.0 becomes 0.0.127.255 (the bit rule is the octet rule of p750, bit by bit). It's like a stencil: the solid parts must line up exactly and the cut-out parts let anything through. Two shorthands: any is 0.0.0.0 255.255.255.255, and host 192.168.1.1 is 192.168.1.1 0.0.0.0.
permit ip any any on line 10 is the most generous bouncer in networking: every deny written below it is a strongly worded letter nobody opens.
Standard ACLs match only the source; they're numbered 1-99 and 1300-1999. Extended ACLs can match source, destination, protocol, ports and more; they're numbered 100-199 and 2000-2699. Example 26-1 is a standard ACL:
access-list 1 deny 172.16.0.0 0.0.255.255 access-list 1 deny host 192.168.1.1 access-list 1 permit any interface GigabitEthernet0/1 ip access-group 1 in
The last line matters: without permit any, "all traffic will be dropped because of the implicit deny". Check the wildcard, too: 0.0.255.255 matches 172.16.0.0/16, whatever the guide's sentence about a /24 says.
Example 26-2 is extended: access-list 100 deny tcp any any eq 23, deny icmp any any, deny ip host 10.1.2.2 host 10.1.2.1, then permit ip any any. With TCP and UDP, eq, lt and gt match ports, and log or log-input can be added to a line.
Named ACLs do the same jobs with a name: ip access-list {standard | extended} name, then [sequence] {permit | deny} ... lines in ACL configuration mode, applied with ip access-group name {in | out}. The guide calls them "generally preferred". There's a practical reason as well. Entries added with the global access-list command always go to the end: C1 says "any additions are placed at the end of the list" and you "cannot reorder the list or selectively add or remove ACEs". In ACL configuration mode, which the guide opens for a number too (ip access-list extended 100), a line takes a sequence number, so 15 deny ... lands between 10 and 20, and a named ACL's lines can be removed with no permit ... or no deny .... If you've ever tried to insert a line in the middle of a printed form, you know why the sequence numbers matter. On 17.5.1 and later, show ip access-list lists the lines in sequence order.
IPv6 ACLs are named only, built with ipv6 access-list name, and applied with ipv6 traffic-filter name {in | out}, on a Layer 3 interface or, for a port ACL, inbound on a Layer 2 one. There's no standard/extended split and no number ranges, and addresses are written as prefixes rather than wildcards: Cisco's own example line is permit ipv6 host 2001:0DB8:0:4::2/128 any (from the ipv6 access-class command reference 08-1 uses). They also end in an implicit deny. The trap is neighbor discovery: IPv4 ACLs let ARP through because ARP isn't IP, but ND runs over IPv6 itself, so "you must add IPv6 ACLs to allow IPv6 neighbor discovery packets". C3 also says ASR 1000 IPv6 ACLs "do not contain implicit permit rules", which suggests other platforms add some; which ones isn't in the sources read. Wherever implicit permits exist, they'd sit ahead of the implicit deny, so the trap springs when you write your own final deny ipv6 any any. Permit ND explicitly above any such line (neighbor solicitations and advertisements, and router solicitations and advertisements if hosts use SLAAC), just like when you leave the letterbox open on a door you've bolted: the post still has to get in.
The guide introduces Example 26-1 as blocking a /24 and then writes a /16 wildcard, which is the ACL equivalent of ordering one pizza and having 256 delivered.
An ACL does nothing until something uses it. On a Layer 3 interface it's sometimes called a router ACL, or RACL. On an interface that's ip access-group {number | name} {in | out}, one IPv4 ACL per direction, with IPv6 filtered separately by ipv6 traffic-filter. On a Layer 3 interface, "the interface must have been configured with an IP address". in checks packets as they arrive, before routing; out checks them as they leave. Think of it as a doorman on the way in and a lift attendant on the way out: the same guest list works differently depending on which of them holds it. The guide also lists route maps, class maps, NAT, SNMP and vty lines as other users of ACLs.
show ip access-lists (and show ipv6 access-list) shows each line with its match count. On a Catalyst 9300 that count "does not account for packets that are access controlled in hardware", so a zero doesn't mean nothing matched. The log keyword sends a message for matches, but logging is done in software: the first match is logged at once and later ones "are collected over 5-minute intervals", and not every packet is logged when the rate is high. That's a bit like a speed camera that photographs the first car and then sends a summary every five minutes: good for spotting a pattern, useless for counting cars.
| Output | Proves | Doesn't prove |
|---|---|---|
the ACL in show running-config | it exists, with these lines in this order | that anything uses it |
ip access-group NAME in on the interface | the interface is set to filter inbound IPv4 with NAME | that NAME exists or has lines; or anything about IPv6 (ipv6 traffic-filter) |
a rising match count in show ip access-lists (or show ipv6 access-list) | packets matched that line in software | the whole count: hardware matches may not appear |
| a zero match count | nothing matched in software | that nothing matched |
| a log message for a line | at least one packet matched | how many: logs are summarised every 5 minutes |
An ACL that isn't applied anywhere is the network's most reliable security control: it has never once blocked anything by mistake.
A switch has two more places to put an ACL. A port ACL (PACL) sits on a Layer 2 port and filters traffic entering it; on a trunk it filters every VLAN on the trunk, and on a port with a voice VLAN it filters both the data and the voice VLAN. The guide adds that PACLs "are supported only in hardware" and can't filter Layer 2 control packets such as CDP, VTP, DTP, PAgP, UDLD and STP. It's supported on physical ports and EtherChannels, not on EtherChannel members, and a port can carry one IP ACL and one MAC ACL. The syntax is the same ip access-group name in on a switchport interface (Example 26-4). A PACL is like a gate on one driveway: it controls who leaves that house, not who walks down the street.
Direction is where the sources disagree. The guide says outbound PACLs aren't supported; Cisco's 17.9 IPv4 page says both that port ACLs "can be applied to the interface in inbound and outbound direction" and that they "can only be applied to Layer 2 interfaces in the inbound direction"; its IPv6 page says inbound. Treat PACLs as inbound and test anything else on your platform. The guide lists these as restrictions that "vary from platform to platform", including no IPv6; on a 9300 at 17.9, an IPv6 ACL applies "to inbound traffic on Layer 2 interfaces".
A VLAN map (VACL) filters traffic within a VLAN, and routed traffic into or out of it. You build it like a route map: vlan access-map name sequence, one match ip address acl (or match mac address) and one action forward | drop [log] per sequence, then vlan filter name vlan-list list to apply it (Example 26-5). It has no direction, and a VLAN takes one map. The ACL inside only picks traffic out: in Example 26-5, TELNET's permit tcp any any eq 23 matched with action drop log drops Telnet. That's the stumbling block, a bit like the difference between a list of names and what the bouncer does with it: permit here means "is on the list", and the map's action decides. Two things the sources read don't state: what a deny line in the match ACL does to a packet (the usual reading is that it just doesn't match that sequence), and what happens to a packet that matches no sequence. Example 26-5 ends with an OTHER sequence that forwards everything, so it never finds out; do the same, and test the rest in the lab. The guide adds that only dropped traffic can be logged, and that a dACL pushed by ISE after authentication overwrites a PACL on the same port (what ISE sends after 802.1X, dACL included: 08-7).
Example 26-4 promises to block RDP, Telnet and one host, then blocks Telnet, ICMP and one host, so if you were hoping to stop RDP, keep reading other books.
A switch with port ACLs, VLAN maps and SVI router ACLs raises the real question: which of them does a packet actually meet? The guide gives an order. Bridged traffic (same VLAN) meets the inbound PACL, then the VLAN's map inbound and outbound. Routed traffic meets the inbound PACL, the inbound VLAN's map, the inbound SVI ACL, the outbound SVI ACL, then the outbound VLAN's map.
Cisco's 17.9 Catalyst 9300 pages describe precedence instead: "from greatest to least for ingress traffic is port ACL, VLAN map, and then router ACL", and for egress "router ACL, VLAN map, and then port ACL". Then they give cases, each for one SVI's VLAN. With a VLAN map, an input router ACL and an input port ACL: packets received on the port-ACL ports "are only filtered by the port ACL"; "Incoming routed IP packets received on other ports are filtered by both the VLAN map and the router ACL". With a VLAN map, an output router ACL and an input port ACL: the port-ACL ports' packets again "are only filtered by the port ACL", and "Outgoing routed IP packets are filtered by both the VLAN map and the router ACL". So in C1's text, a port ACL takes its own VLAN's map and input SVI ACL out of play for that port's packets. That's a different model from the guide's pipeline, where every ACL on the way is checked.
Two cautions before you lean on it. C1's cases stay inside one VLAN: they don't say whether a packet from a port-ACL port in VLAN 10 meets VLAN 20's map or SVI 20's outbound ACL. D1 draws those as applying and marks them "not in C1". And the same C1 page contradicts itself elsewhere (on PACL direction, and on whether VLAN maps touch routed traffic), so treat its precedence text as documentation to test, not as proven hardware behaviour. With the two models side by side, think of them as two rules for a house with a driveway gate: in the guide's, the gate and the street's rules both apply; in C1's text, the gate replaces the street's rules for that house.
Continue the lesson
The whole lesson, with its drawings and its questions. The rest of this section and 9 more after it.

