Access control lists match packets in sequence and permit or deny them. Standard IPv4 ACLs match source addresses; extended IPv4 and IPv6 ACLs can match protocol, addresses and ports.
Configuration
Replace highlighted placeholders. Configure only the variants required by the task.
Prerequisites and dependency links
Determine required traffic, direction and interface.
Remember the implicit deny and add all required permits before applying an ACL.
Named standard IPv4 ACL Recommended / essential starting point
Start in privileged EXEC; block enters and exits configuration mode.Section link
Alternative group: acl-method. Select the applicable method; do not apply mutually exclusive variants in sequence.
enable
configure terminal
ip access-list standard [ACL-NAME]
permit [SOURCE-NETWORK][SOURCE-WILDCARD]
deny any
exit
interface [INTERFACE]
ip access-group [ACL-NAME][DIRECTION]
exit
end
Command parameters
[ACL-NAME]
Access control list name.
[SOURCE-NETWORK]
IPv4 source network address.
[SOURCE-WILDCARD]
IPv4 source wildcard mask.
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[DIRECTION]
in or out, according to the policy.
Numbered standard IPv4 ACL Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode.Section link
Alternative group: acl-method. Select the applicable method; do not apply mutually exclusive variants in sequence.
enable
configure terminal
access-list [STANDARD-ACL-NUMBER] permit [SOURCE-NETWORK][SOURCE-WILDCARD]
access-list [STANDARD-ACL-NUMBER] deny any
interface [INTERFACE]
ip access-group [STANDARD-ACL-NUMBER][DIRECTION]
exit
end
Command parameters
[STANDARD-ACL-NUMBER]
Valid numbered standard IPv4 ACL ID.
[SOURCE-NETWORK]
IPv4 source network address.
[SOURCE-WILDCARD]
IPv4 source wildcard mask.
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[DIRECTION]
in or out, according to the policy.
Named extended IPv4 ACL Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode.Section link
Alternative group: acl-method. Select the applicable method; do not apply mutually exclusive variants in sequence.
enable
configure terminal
ip access-list extended [ACL-NAME]
permit tcp [SOURCE-NETWORK][SOURCE-WILDCARD] host [DESTINATION-IP] eq [PORT]
deny ip any any
exit
interface [INTERFACE]
ip access-group [ACL-NAME][DIRECTION]
exit
end
Command parameters
[ACL-NAME]
Access control list name.
[SOURCE-NETWORK]
IPv4 source network address.
[SOURCE-WILDCARD]
IPv4 source wildcard mask.
[DESTINATION-IP]
IPv4 destination or probe target.
[PORT]
Transport-layer port number or supported service keyword.
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[DIRECTION]
in or out, according to the policy.
Numbered extended IPv4 ACL Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode.Section link
Alternative group: acl-method. Select the applicable method; do not apply mutually exclusive variants in sequence.
enable
configure terminal
access-list [EXTENDED-ACL-NUMBER] permit tcp [SOURCE-NETWORK][SOURCE-WILDCARD] host [DESTINATION-IP] eq [PORT]
access-list [EXTENDED-ACL-NUMBER] deny ip any any
interface [INTERFACE]
ip access-group [EXTENDED-ACL-NUMBER][DIRECTION]
exit
end
Command parameters
[EXTENDED-ACL-NUMBER]
Valid numbered extended IPv4 ACL ID.
[SOURCE-NETWORK]
IPv4 source network address.
[SOURCE-WILDCARD]
IPv4 source wildcard mask.
[DESTINATION-IP]
IPv4 destination or probe target.
[PORT]
Transport-layer port number or supported service keyword.
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[DIRECTION]
in or out, according to the policy.
IPv6 ACL Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode.Section link
Alternative group: acl-method. Select the applicable method; do not apply mutually exclusive variants in sequence.
Allow required IPv6 control traffic such as router advertisements, solicitations and ICMPv6 error messages as appropriate before the final deny.
enable
configure terminal
ipv6 access-list [ACL-NAME]
permit tcp [SOURCE-IPV6-PREFIX]/[PREFIX-LENGTH] host [DESTINATION-IPV6] eq [PORT]
permit icmp any any nd-ns
permit icmp any any nd-na
deny ipv6 any any
exit
interface [INTERFACE]
ipv6 traffic-filter [ACL-NAME][DIRECTION]
exit
end
Command parameters
[ACL-NAME]
Access control list name.
[SOURCE-IPV6-PREFIX]
Source IPv6 network without slash length.
[PREFIX-LENGTH]
IPv6 prefix length without slash.
[DESTINATION-IPV6]
IPv6 destination address.
[PORT]
Transport-layer port number or supported service keyword.
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[DIRECTION]
in or out, according to the policy.
Restrict IPv4 management sources Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode.Section link
Alternative group: acl-method. Select the applicable method; do not apply mutually exclusive variants in sequence.
enable
configure terminal
ip access-list standard [MGMT-ACL]
permit [SOURCE-NETWORK][SOURCE-WILDCARD]
exit
line vty 0 [VTY-LAST]
access-class [MGMT-ACL] in
exit
end
Command parameters
[MGMT-ACL]
Management ACL name.
[SOURCE-NETWORK]
IPv4 source network address.
[SOURCE-WILDCARD]
IPv4 source wildcard mask.
[VTY-LAST]
Last VTY line number supported by the device; configure remaining lines as needed.