26.1.2 Lab - Implement IPv4 ACLs
26.1.2 Lab - Implement IPv4 ACLs
Topology
Addressing Table
Device Interface IP Address Subnet Mask Default Gateway
R1
G0/0/1 192.168.1.1 255.255.255.0 N/A
R3
G0/0/1 192.168.2.1 255.255.255.0 N/A
R3
Loopback0 192.168.3.1 255.255.255.0 N/A
Objectives
Part 1: Build the Network and Configure Basic Device Settings
Part 2: Verify Initial Connectivity
Part 3: Implement Standard ACLs on R3
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 1 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
Background / Scenario
Access control lists (ACLs) are sequential lists of individual access control entries (ACEs) that permit or deny
packets based on predefined conditional matching statements. Finding a match in an ACL starts at the top
with the lowest sequence number and proceeds down the list (higher sequence numbers) until a matching
ACE is found. When a match is found, the preset action (permit or deny) is applied and processing stops. At
the end of every ACL is an implicit deny “any” ACE, which denies all packets that did not match prior ACEs.
ACLs can be used for packet classification with quality of service (QoS), Network Address Translations
(NAT), and numerous other services.
In this lab, you will configure three different types of ACLs. Router ACL (RACL) is the most common ACL is
the IP-based ACL that are applied to routed interface. The ACL that applies to traffic entering and leaving a
VLAN is a VLAN ACL (VACL). The VACLs can filter traffic based on MAC addresses, IP addresses, and port
numbers. A VACL that is applied to an individual port inside a VLAN is a port-based ACL (PACL).
The focus of this lab is using IPv4 ACLs for packet filtering.
Note: This lab is an exercise in configuring various types of access control lists and does not necessarily
reflect network troubleshooting best practices.
Note: The routers used with CCNP hands-on labs are Cisco 4221 with Cisco IOS XE Release 16.9.4
(universalk9 image). The switches used in the labs are Cisco Catalyst 3650s with Cisco IOS XE Release
16.9.4 (universalk9 image) and Cisco Catalyst 2960s with Cisco IOS Release 15.2(2) (lanbasek9 image).
Other routers, switches, and Cisco IOS versions can be used. Depending on the model and Cisco IOS
version, the commands available and the output produced might vary from what is shown in the labs. Refer to
the Router Interface Summary Table at the end of the lab for the correct interface identifiers.
Note: Make sure that the routers and switches have been erased and have no startup configurations. If you
are unsure, contact your instructor.
Required Resources
2 Routers (Cisco 4221 with Cisco IOS XE Release 16.9.4 universal image or comparable)
2 Switches (Cisco 3650 with Cisco IOS XE Release 16.9.4 universal image or comparable)
1 Switch (Cisco 2960 with Cisco IOS Release 15.2(2) lanbasek9 image or comparable)
3 PC (Choice of operating system with a terminal emulation program and a packet capture utility installed)
Console cables to configure the Cisco IOS devices via the console ports
Ethernet cables as shown in the topology
Instructions
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 2 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
Router R1
hostname R1
no ip domain lookup
username admin privilege 15 algorithm-type scrypt secret cisco123
banner motd # R1, Lab Access Control Lists #
line con 0
exec-timeout 0 0
logging synchronous
exit
interface g0/0/1
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
interface Serial 0/1/0
ip address 192.168.13.1 255.255.255.252
no shutdown
exit
router ospf 1
router-id 0.0.0.1
network 192.168.1.0 0.0.0.255 area 1
network 192.168.13.0 0.0.0.3 area 0
exit
line vty 0 4
login local
transport input telnet
end
Router R3
hostname R3
no ip domain lookup
username admin privilege 15 algorithm-type scrypt secret cisco123
banner motd # R3, Lab Access Control Lists #
line con 0
exec-timeout 0 0
logging synchronous
exit
interface Loopback0
ip address 192.168.3.1 255.255.255.0
exit
interface g0/0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 3 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
exit
interface Serial 0/1/0
ip address 192.168.13.2 255.255.255.252
no shutdown
exit
router ospf 1
router-id 0.0.0.3
network 192.168.2.0 0.0.0.255 area 2
network 192.168.3.0 0.0.0.255 area 0
network 192.168.13.0 0.0.0.3 area 0
exit
line vty 0 4
login local
transport input telnet
end
Switch D1
hostname D1
no ip domain lookup
username admin privilege 15 algorithm-type scrypt secret cisco123
banner motd # D1, Lab Access Control Lists #
line con 0
exec-timeout 0 0
logging synchronous
exit
interface range g1/0/1-24, g1/1/1-4, g0/0
shutdown
exit
interface range g1/0/11, g1/0/23
switchport mode access
no shutdown
exit
interface vlan 1
ip address 192.168.1.2 255.255.255.0
no shut
exit
ip default-gateway 192.168.1.1
line vty 0 15
login local
transport input telnet
end
Switch D2
hostname D2
no ip domain lookup
username admin privilege 15 algorithm-type scrypt secret cisco123
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 4 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 5 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
no shut
exit
ip default-gateway 192.168.2.1
crypto key generate rsa modulus 1024
end
b. Set the clock on each device to UTC time.
c. Save the running configuration to startup-config.
d. Configure and verify the IP address on PC1 and PC2.
e. Verify ICMP connectivity between all devices and PCs.
Close configuration window
Step 1: Configure a numbered standard ACL on R3 and block data traffic from the 192.168.1.0
/24 network.
a. Create a numbered standard ACL using the number 99 to deny the source network of 192.168.1.0/24.
Open configuration window
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 6 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
Step 2: Apply the numbered standard ACL to the correct interface and in the correct direction.
a. Apply the ACL to the G0/0/1 interface.
R3(config)# interface g0/0/1
R3(config-if)# ip access-group 99 ?
in inbound packets
out outbound packets
b. Specify outbound on G0/0/1 because the data traffic is originating from R1 and exiting G/0/1 to access the
192.168.2.0/24 network.
R3(config-if)# ip access-group 99 out
R3(config-if)# end
c. Next, from PC1, ping the loopback on R3 at 192.168.3.1. The ping should be successful. This verifies
connectivity to resources on R3. However, ACL 99 denies access to the 192.168.2.0/24 network.
d. Remove the access list from R3 and remove the ip access-group command from interface G0/0/1 to
provide connectivity to 192.168.2.0/24 network.
R3(config)# no access-list 99
R3(config)# interface g0/0/1
R3(config-if)# no ip access-group 99 out
e. Verify that PC1 can ping devices on the 192.168.2.0/24 network.
Step 5: Apply the named standard ACL to the correct interface and in the correct direction.
Use the access-class command to apply the MGMT-TRAFFIC ACL to all inbound vty lines on R3. Outbound
Telnet connections from R3 will still be allowed.
R3(config)# line vty 0 4
R3(config-line)# access-class MGMT-TRAFFIC in
R3(config-line)# end
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 7 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
c. Issue the show access-lists on R3 to view the packet “matches” from each ACE.
R3# show access-lists
Standard IP access list MGMT-TRAFFIC
10 permit 192.168.1.10 (2 matches)
20 deny any log (3 matches)
Close configuration window
Note: During testing, the first packet in a flow will trigger a syslog message. Enabling logging with the log
option in the deny any statement provides insight into the amount of denied traffic. Unfortunately, ACL
logging can be CPU-intensive and can negatively affect other functions of the network device. There are
two primary factors that contribute to the CPU load increase from ACL logging: process switching of
packets that match log-enabled access control entries (ACEs), and the generation and transmission of log
messages. Care should be taken when using the log option in a production network.
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 8 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
Note: Sequence 70 essentially filters all other traffic that does not originate from area 1.
Step 2: Apply the named extended ACL to the correct interface and in the correct direction.
a. Apply the named ACL to the G0/0/1 interface on R1. Because traffic originates from area 1, apply the
ACL inbound to R1
R1(config)# interface g0/0/1
R1(config-if)# ip access-group AREA1_TO_AREA2 in
R1(config-if)# end
Step 3: Verify that the AREA1_TO_AREA2 named extended ACL is working properly.
a. Test the first two lines of the ACL. From PC1, you should be able to successfully ping PC2.
b. From PC1, ping PC2 again, but this time set the TTL value to 20 inside the IP header on PC1. Use the
following command on PC1 to set the TTL to 20 for the ICMP packet.
C:\> ping 192.168.2.10 –i 20
The ICMP packets with a TTL value of 20 should be dropped by R1, which is the area border router
(ABR) for area 1. R1 sends error messages to PC1.
c. Continue to test each individual ACE within the ACL.
o From PC1, you should be able to successfully access D2 via Telnet. However, accessing any other
device in area 2 via Telnet should be denied.
o From any device in area 1, you should be able to SSH to A1. However, accessing any other device
on area 2 via SSH should be denied.
o From PC1, you should be able to access the web interface on A1 using either HTTP or HTTPS.
However, all other attempts to access other devices using HTTP and HTTPS should time out.
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 9 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
d. After testing each ACE, issue the show access-list command. Notice that each ACE has matches. Your
match counts will be different.
R1# show access-lists
Extended IP access list AREA1_TO_AREA2
10 deny ip host 192.168.1.10 any ttl lt 25 (62 matches)
20 permit icmp host 192.168.1.10 192.168.2.0 0.0.0.255 echo (12 matches)
30 permit tcp host 192.168.1.10 host 192.168.2.2 eq telnet (31 matches)
40 permit tcp 192.168.1.0 0.0.0.255 host 192.168.2.3 eq 22 (21 matches)
50 permit tcp host 192.168.1.10 host 192.168.2.3 eq www (15 matches)
60 permit tcp host 192.168.1.10 host 192.168.2.3 eq 443 (92 matches)
70 deny ip any any (49 matches)
b. Verify your configuration by entering the same show run command. Your output should be same as
shown above.
c. Next, apply the ACL to the G/0/1 interface in the outgoing direction. Because traffic originated from area 1
and is returning from area 2, configure the ACL going outbound on the G/0/1 interface towards area 1.
R1(config)# interface g0/0/1
R1(config-if)# ip access-group AREA2_TO_AREA1 out
R1(config-if)# end
Step 2: Verify that the AREA2_TO_AREA1 named extended ACL is working properly.
a. Repeat the tests from Part 4, Step 4. The return traffic permitted in the ACL AREA2_TO_AREA1 should
be successful.
b. Issue the show ip access-list AREA2_TO_AREA1 command on R1 to see the matches for the return
traffic from area 2.
R1# show access-lists AREA2_TO_AREA1
Extended IP access list AREA2_TO_AREA1
10 permit icmp 192.168.2.0 0.0.0.255 host 192.168.1.10 echo-reply (4 matches)
20 permit tcp host 192.168.2.2 eq telnet host 192.168.1.10 established (36 matches)
30 permit tcp host 192.168.2.3 eq 22 192.168.1.0 0.0.0.255 established (23 matches)
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 10 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
40 permit tcp host 192.168.2.3 eq www host 192.168.1.10 established (13 matches)
50 permit tcp host 192.168.2.3 eq 443 host 192.168.1.10 established (26 matches)
60 deny ip any any log
Note: The established option allows only TCP responses to traffic that originates from area 1
(192.168.1.0/24) to return. A match occurs if the returning TCP segment has either the ACK or reset
(RST) bit set. Either of these bits indicates that the packet belongs to an established connection.
Therefore, when filtering return traffic, the source port number must be checked.
c. To verify that both ACLs are applied to the G0/0/1 interface on R1, issue the following filtered show ip
interface command.
R1# show ip interface g0/0/1 | s AREA
Outgoing access list is AREA2_TO_AREA1
Inbound access list is AREA1_TO_AREA2
Close configuration window
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 11 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 12 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
b. From D2, use Telnet to access A1. The connection should time out.
D2# telnet 192.168.2.3
Trying 192.168.2.3 ...
% Connection timed out; remote host not responding
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 13 of 14 www.netacad.com
Lab - Implement IPv4 ACLs
Note: To find out how the router is configured, look at the interfaces to identify the type of router and how many
interfaces the router has. There is no way to effectively list all the combinations of configurations for each router
class. This table includes identifiers for the possible combinations of Ethernet and Serial interfaces in the device.
The table does not include any other type of interface, even though a specific router may contain one. An example
of this might be an ISDN BRI interface. The string in parenthesis is the legal abbreviation that can be used in
Cisco IOS commands to represent the interface.
End of document
2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 14 of 14 www.netacad.com