About Access Control Lists (ACLs)
Access Control Lists (ACLs) let a network administrator permit or deny passage of traffic based on network addresses, protocols, service ports, and other packet attributes. ACLs are composed of one or more Access Control Entries (called ACEs). Each ACE defines a filter criteria and an action, eitherpermitordeny. If the traffic matches the filter criteria, the specified action is taken. Thepermitaction permits the traffic to continue through the switch. Thedenyaction causes the traffic to be discarded (dropped). ACEs can also log or count matching traffic.
Three ACL types are supported; IPv4, IPv6, and MAC. Each ACL type is focused on relevant frame or packet characteristics.
acl必须应用lied (using anapply access-list
command) to take effect. ACLs can be applied to interfaces (including LAGs), VLANs, or the Control Plane.
Access Control Entries (ACEs) are listed according to priority by sequence number and processed in lowest to highest sequence number order. Each ACE attempts to match on one or more attributes of the particular traffic type. Attempted ACE matching ceases upon the first successful match. For a match to be considered successful, a packet must match all the criteria, qualifiers, and attributes of a particular ACE. Higher-numbered ACEs are only processed if no lower-numbered ACE matches. If the traffic matches no ACE in the entire ACL, the default actiondenyis taken, causing the traffic to be discarded (dropped).
When defining an ACE, if the sequence number is omitted, the ACE is auto-assigned a new sequence number that is 10 greater than the existing highest ACE sequence number. The first auto-assigned sequence number is 10. If you choose to include the ACE sequence numbers, you can use any number you like, however it is suggested that you follow the practice of entering them as 10, 20, 30, and so on. Regardless of the order in which ACEs are entered, they are stored in low-to-high sequence number order. If you enter three ACEs numbered 10, 30, 20, when creating an ACL, the ACEs are stored in the ACL as 10, 20, 30.
This simple ACL definition permits traffic passage for a particular address range and otherwise counts all nonmatching (dropped) traffic:
switch(config)#访问列表的ip network-A-udp-onlyswitch(config-acl-ip)#10 permit udp any 172.16.1.0/24switch(config-acl-ip)#20 deny any any any countswitch(config-acl-ip)#exit
Protocol such as: ICMP, TCP, UDP
Source and/or destination addresses (IPv4, IPv6, or MAC)
Source and/or destination TCP/UDP ports (if applicable to the specified protocol)
A few real-world uses of ACLs are as follows:
Restrict traffic arriving on a port, destined to a particular address or subnet by applying an ACL that matches on a destination IP address or an IP address and a mask.
Prevent certain protocols from using a particular multicast MAC address (advertising through a port) by applying an ACL that matches on the destination MAC address.
Prevent any IP host from accessing a particular IP port/application on a specific server by applying an ACL that matches on IP addresses and Layer 4 port.