Access Control Lists (ACLs)
Access Control Lists (ACLs) are used in network devices, including Cisco routers and switches, to control and filter network traffic based on various criteria. Below are the commands to create, apply, verify, remove, and configure ACLs on Cisco devices, including extended ACLs and named ACLs.
1. Create Standard ACL:
- To create a standard ACL that filters traffic based on source IP addresses, use the following command:
bashRouter(config)# access-list acl_number {deny | permit} source_address [source_wildcard]
- For example, to deny traffic from source IP 192.168.1.10:
bashRouter(config)# access-list 10 deny 192.168.1.10
2. Apply ACL on Interface:
- To apply a standard ACL to an interface (e.g., to filter incoming traffic), use the following command:
bashRouter(config-if)# ip access-group acl_number {in | out}
- For example, to apply ACL 10 to the incoming traffic on interface GigabitEthernet0/0:
bashRouter(config-if)# ip access-group 10 in
3. Verify ACL:
- To verify the ACL configuration, use the following command:
bashRouter# show access-lists
- This command displays the configured ACLs and their rules.
4. Remove ACL from Interface:
- To remove an ACL from an interface, use the following command:
bashRouter(config-if)# no ip access-group acl_number {in | out}
- For example, to remove ACL 10 from the incoming traffic on interface GigabitEthernet0/0:
bashRouter(config-if)# no ip access-group 10 in
5. Create Extended ACL:
- To create an extended ACL that filters traffic based on source and destination IP addresses, ports, and protocols, use the following command:
bashRouter(config)# access-list acl_number {deny | permit} protocol source source_wildcard [operator port] destination destination_wildcard [operator port]
- For example, to permit TCP traffic from source IP 192.168.1.10 to destination IP 10.0.0.1 on port 80:
bashRouter(config)# access-list 100 permit tcp 192.168.1.10 0.0.0.0 eq 80 10.0.0.1 0.0.0.0
6. Apply Extended ACL on Interface:
- To apply an extended ACL to an interface, use the same
ip access-groupcommand as for standard ACLs, but specify the extended ACL number.
7. Establish Keyword (Extended ACL):
- In extended ACLs, you can use the
establishedkeyword to filter traffic for established connections (e.g., TCP sessions). This can be used for security purposes.
bashRouter(config)# access-list acl_number permit tcp any any established
8. Log Keyword (Extended ACL):
- You can use the
logkeyword to log matches of ACL entries. This can be useful for monitoring and troubleshooting.
bashRouter(config)# access-list acl_number permit tcp any any log
9. Create Named ACL:
- To create a named ACL (extended or standard), use the following command:
bashRouter(config)# ip access-list {standard | extended} acl_name
- For example, to create a named standard ACL called "my_acl":
bashRouter(config)# ip access-list standard my_acl
- Once created, you can configure ACL entries within the named ACL just like regular ACLs.
Comments
Post a Comment