Basic ACLs can be used in device management, routing policies, multicast packet filtering, and QoS services.
Table 1 describes the typical applications of basic ACLs.
Typical Application |
Usage Scenario |
Operation |
---|---|---|
Device management |
When a device functions as an FTP or TFTP server, configure a basic ACL on the device to allow only the clients that match specific ACL rules to access the server. |
For details on how to configure rights to access an FTP or TFTP server, see
|
Configure a basic ACL to restrict the incoming or outgoing calls on VTY user interfaces. |
For details on how to configure the restriction on incoming and outgoing calls on VTY user interfaces, see Setting Restrictions for Incoming and Outgoing Calls on VTY User Interfaces. |
|
Specify an NMS and manageable MIB objects for SNMP-based communication between the NMS and managed device to improve communication security. |
For details on how to configure the NMS's right to access devices, see
|
|
Multicast packet filtering |
To filter multicast packets, configure a basic ACL to receive or forward only the multicast packets that match the ACL rules. |
For details on how to filter multicast packets, see
|
Routing policies |
To control the reception and advertisement of routing information on a device, configure a basic ACL on the device to allow the device to receive or advertise only the routes that match the ACL rules. |
For details on how to control the reception and advertisement of routing information on a device, see
|
QoS services |
To process different types of traffic, configure a basic ACL to perform traffic policing, traffic shaping, or traffic classification on traffic that matches the ACL rules. |
For details on how to process different types of traffic, see Configuring the Traffic Policing Policy, Configuring Traffic Shaping, and Configuring Traffic Behaviors. |
Cases of applying a basic ACL in device management
acl number 2001 rule 5 deny source 192.168.2.100 0 rule 10 permit ftp acl 2001
Matching result: Users with the IP address 192.168.2.100 are prohibited from logging in to the device using FTP.
acl number 2001 rule 5 permit source 192.168.2.100 0 rule 10 deny user-interface vty 0 4 acl 2001 inbound
Matching result: Only users with the IP address 192.168.2.100 are allowed to log in to the device using Telnet.
acl number 2001 rule 5 deny source 192.168.2.100 0 rule 10 permit snmp-agent community read cipher public acl 2001
Matching result: Users with the IP address 192.168.2.100 are prohibited from logging in to the device using SNMP.
Case of applying a basic ACL in multicast packet filtering
acl number 2001 rule 5 permit source 10.10.1.2 0 rule 10 deny source 10.10.1.1 0 pim source-policy 2001
Matching result: The device permits multicast packets containing the source address 10.10.1.2 whereas discarding those containing the source address 10.10.1.1.
Cases of applying a basic ACL in routing policies
A route-policy of a routing protocol is used to filter routes.
ip route-static 1.1.1.0 255.255.255.0 NULL0
ip route-static 192.168.2.0 255.255.255.0 NULL0
ip route-static 192.168.2.100 255.255.255.255 NULL0
bgp 1
peer 10.1.1.1 as-number 1
ipv4-family unicast
undo synchronization
import-route static route-policy test
peer 10.1.1.1 enable
route-policy test permit node 0
if-match acl 2001
acl number 2001
rule 5 permit source 192.168.2.100 0
rule 10 deny source 1.1.1.0 0.0.0.255
Matching result: Routes from the network segments 1.1.1.0 and 192.168.2.0 are filtered out, whereas the route 192.168.2.100 is permitted.
route-policy test permit node 0 if-match acl 2001 apply cost 100 route-policy test permit node 1 apply cost 200 acl number 2001 rule 5 permit source 192.168.2.100 0
Matching result: The cost of the route 192.168.2.100 is changed to 100, whereas the costs of other routes are changed to 200.
In the preceding route-policy, permit is specified for node 0, the route 192.168.2.100/32 passes the check by the if-match clause, and the device takes the action (apply cost 100) specified in the apply clause. As a result, the cost of the route is changed to 100. The other routes do not pass the check by the if-match clause, and the device takes the action (apply cost 200) specified in node 1 in the route-policy. As a result, the costs of these routes are changed to 200.
route-policy test deny node 0 if-match acl 2001 apply cost 100 route-policy test permit node 1 apply cost 200 acl number 2001 rule 5 permit source 192.168.2.100 0
In the preceding route-policy, deny is specified for node 0, the route 192.168.2.100/32 passes the check by the if-match clause, and the device does not take the action (apply cost 100) specified in the apply clause. As a result, the cost of the route is not changed to 100. The other routes do not pass the check by the if-match clause, and the device takes the action (apply cost 200) specified in node 1 in the route-policy. As a result, the costs of these routes are changed to 200.
A filter-policy of a routing protocol is used to filter routes.
ip route-static 1.1.1.0 255.255.255.0 NULL0
ip route-static 192.168.2.0 255.255.255.0 NULL0
ip route-static 192.168.2.100 255.255.255.255 NULL0
bgp 1
peer 10.1.1.2 as-number 1
ipv4-family unicast
undo synchronization
filter-policy 2001 export
import-route static
peer 10.1.1.2 enable
acl number 2001
rule 5 permit source 192.168.2.100 0
rule 10 deny source 1.1.1.0 0.0.0.255
Matching result: Routes from the network segments 1.1.1.0 and 192.168.2.0 are filtered out, whereas the route 192.168.2.100 is permitted.
Cases of applying a basic ACL in QoS services
acl number 2001
rule 5 permit source 5.0.0.0 0.255.255.255
rule 10 deny source 6.0.0.0 0.255.255.255
traffic classifier acl
if-match acl 2001
traffic behavior test
deny
traffic policy test
classifier acl behavior test
interface GigabitEthernet0/1/1
traffic-policy test inbound
Matching result: Packets 1 and 2 are discarded but packet 3 is permitted.
acl number 2001
rule 5 permit source 5.0.0.0 0.255.255.255
rule 10 deny source 6.0.0.0 0.255.255.255
traffic classifier acl
if-match acl 2001
traffic behavior test
remark ip-precedence 7
traffic policy test
classifier acl behavior test
interface GigabitEthernet0/1/1
traffic-policy test inbound
Matching result: Packet 1 is permitted, and its IP precedence is re-marked 7; packet 3 is permitted, and its IP precedence remains 0; packet 2 is discarded.