26.2.1 Packet Tracer - Configure Extended IPv4 ACLs - Scenario 1 (Answers)
Topology
26.2.1 Packet Tracer - Configure Extended IPv4 ACLs - Scenario 1
Addressing Table
| Device | Interface | IP Address | Subnet Mask | Default Gateway |
|---|---|---|---|---|
| R1 | G0/0 | 172.22.34.65 | 255.255.255.224 | N/A |
| G0/1 | 172.22.34.97 | 255.255.255.240 | ||
| G0/2 | 172.22.34.1 | 255.255.255.192 | ||
| Server | NIC | 172.22.34.62 | 255.255.255.192 | 172.22.34.1 |
| PC1 | NIC | 172.22.34.66 | 255.255.255.224 | 172.22.34.65 |
| PC2 | NIC | 172.22.34.98 | 255.255.255.240 | 172.22.34.97 |
Objectives
- Part 1: Configure, Apply and Verify an Extended Numbered ACL
- Part 2: Configure, Apply and Verify an Extended Named ACL
Background / Scenario
Two employees need access to services provided by the server. PC1 only needs FTP access while PC2 only needs web access. Both computers need to be able to ping the server, but not each other.
Instructions
Part 1: Configure, Apply and Verify an Extended Numbered ACL
Step 1: Configure an ACL to permit FTP and ICMP from PC1 LAN.
a. From global configuration mode on R1, enter the following command to determine the first valid number for an extended access list.
Copy
R1(config)# access-list ?
<1-99> IP standard access list
<100-199> IP extended access list
b. Add 100 to the command, followed by a question mark.
Copy
R1(config)# access-list 100 ?
deny Specify packets to reject
permit Specify packets to forward
remark Access list entry comment
c. To permit FTP traffic, enter permit, followed by a question mark.
Copy
R1(config)# access-list 100 permit ?
ahp Authentication Header Protocol
eigrp Cisco's EIGRP routing protocol
esp Encapsulation Security Payload
gre Cisco's GRE tunneling
icmp Internet Control Message Protocol
ip Any Internet Protocol
ospf OSPF routing protocol
tcp Transmission Control Protocol
udp User Datagram Protocol
d. When configured and applied, this ACL should permit FTP and ICMP. ICMP is listed above, but FTP is not. This is because FTP is an application layer protocol that uses TCP at the transport layer. Enter TCP to further refine the ACL help.
Copy
R1(config)# access-list 100 permit tcp ?
A.B.C.D Source address
any Any source host
host A single source host
e. The source address can represent a single device, such as PC1, by using the host keyword and then the IP address of PC1. Using the keyword any permits any host on any network. Filtering can also be done by a network address. In this case, it is any host that has an address belonging to the 172.22.34.64/27 network. Enter this network address, followed by a question mark.
Copy
R1(config)# access-list 100 permit tcp 172.22.34.64 ?
A.B.C.D Source wildcard bits
f. Calculate the wildcard mask by determining the binary opposite of the /27 subnet mask.
Copy
11111111.11111111.11111111.11100000 = 255.255.255.224
00000000.00000000.00000000.00011111 = 0.0.0.31
g. Enter the wildcard mask, followed by a question mark.
Copy
R1(config)# access-list 100 permit tcp 172.22.34.64 0.0.0.31 ?
A.B.C.D Destination address
any Any destination host
eq Match only packets on a given port number
gt Match only packets with a greater port number
host A single destination host
lt Match only packets with a lower port number
neq Match only packets not on a given port number
range Match only packets in the range of port numbers
h. Configure the destination address. In this scenario, we are filtering traffic for a single destination, which is the server. Enter the host keyword followed by the server’s IP address.
Copy
R1(config)# access-list 100 permit tcp 172.22.34.64 0.0.0.31 host 172.22.34.62 ?
dscp Match packets with given dscp value
eq Match only packets on a given port number
established established
gt Match only packets with a greater port number
lt Match only packets with a lower port number
neq Match only packets not on a given port number
precedence Match packets with given precedence value
range Match only packets in the range of port numbers
<cr>
i. Notice that one of the options is
Copy
R1(config)# access-list 100 permit tcp 172.22.34.64 0.0.0.31 host 172.22.34.62 eq ?
<0-65535> Port number
ftp File Transfer Protocol (21)
pop3 Post Office Protocol v3 (110)
smtp Simple Mail Transport Protocol (25)
telnet Telnet (23)
www World Wide Web (HTTP, 80)
R1(config)# access-list 100 permit tcp 172.22.34.64 0.0.0.31 host 172.22.34.62 eq ftp
j. Create a second access list statement to permit ICMP (ping, etc.) traffic from PC1 to Server. Note that the access list number remains the same and a specific type of ICMP traffic does not need to be specified.
Copy
R1(config)# access-list 100 permit icmp 172.22.34.64 0.0.0.31 host 172.22.34.62
k. All other traffic is denied, by default.
l. Execute the show access-lists command and verify that access list 100 contains the correct statements. Notice that the statement deny any any does not appear at the end of the access list. The default execution of an access list is that if a packet does not match a statement in the access list, it is not permitted through the interface.
Copy
R1# show access-lists
Extended IP access list 100
10 permit tcp 172.22.34.64 0.0.0.31 host 172.22.34.62 eq ftp
20 permit icmp 172.22.34.64 0.0.0.31 host 172.22.34.62
Step 2: Apply the ACL on the correct interface to filter traffic.
From R1’s perspective, the traffic that ACL 100 applies to is inbound from the network connected to the Gigabit Ethernet 0/0 interface. Enter interface configuration mode and apply the ACL.
Note: On an actual operational network, it is not a good practice to apply an untested access list to an active interface.
Copy
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip access-group 100 in
Step 3: Verify the ACL implementation.
a. Ping from PC1 to Server. If the pings are unsuccessful, verify the IP addresses before continuing.
Copy
C:\> ping 172.22.34.62
Pinging 172.22.34.62 with 32 bytes of data:
Request timed out.
Reply from 172.22.34.62: bytes=32 time<1ms TTL=127
Reply from 172.22.34.62: bytes=32 time=1ms TTL=127
Reply from 172.22.34.62: bytes=32 time<1ms TTL=127
Ping statistics for 172.22.34.62:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
b. FTP from PC1 to Server. The username and password are both cisco.
Copy
C:\> ftp 172.22.34.62
Trying to connect...172.22.34.62
Connected to 172.22.34.62
220- Welcome to PT Ftp server
Username:cisco
331- Username ok, need password
Password:*****
230- Logged in
(passive mode On)
ftp>
c. Exit the FTP service.
Copy
ftp> quit
221- Service closing control connection.
d. Ping from PC1 to PC2. The destination host should be unreachable, because the ACL did not explicitly permit the traffic.
Copy
C:\> ping 172.22.34.98
Pinging 172.22.34.98 with 32 bytes of data:
Reply from 172.22.34.65: Destination host unreachable.
Reply from 172.22.34.65: Destination host unreachable.
Reply from 172.22.34.65: Destination host unreachable.
Reply from 172.22.34.65: Destination host unreachable.
Ping statistics for 172.22.34.98:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Part 2: Configure, Apply and Verify an Extended Named ACL
Step 1: Configure an ACL to permit HTTP access and ICMP from PC2 LAN.
a. Named ACLs start with the ip keyword. From global configuration mode of R1, enter the following command, followed by a question mark.
Copy
R1(config)# ip access-list ?
extended Extended Access List
standard Standard Access List
b. You can configure named standard and extended ACLs. This access list filters both source and destination IP addresses; therefore, it must be extended. Enter HTTP_ONLY as the name. (For Packet Tracer scoring, the name is case-sensitive and the access list statements must be the correct order.)
Copy
R1(config)# ip access-list extended HTTP_ONLY
c. The prompt changes. You are now in extended named ACL configuration mode. All devices on the PC2 LAN need TCP access. Enter the network address, followed by a question mark.
Copy
R1(config-ext-nacl)# permit tcp 172.22.34.96 ?
A.B.C.D Source wildcard bits
d. An alternative way to calculate a wildcard is to subtract the subnet mask from 255.255.255.255.
Copy
255.255.255.255
- 255.255.255.240
-----------------
= 0. 0. 0. 15
R1(config-ext-nacl)# permit tcp 172.22.34.96 0.0.0.15
e. Finish the statement by specifying the server address as you did in Part 1 and filtering www traffic.
Copy
R1(config-ext-nacl)# permit tcp 172.22.34.96 0.0.0.15 host 172.22.34.62 eq www
f. Create a second access list statement to permit ICMP (ping, etc.) traffic from PC2 to Server. Note: The prompt remains the same and a specific type of ICMP traffic does not need to be specified.
Copy
R1(config-ext-nacl)# permit icmp 172.22.34.96 0.0.0.15 host 172.22.34.62
g. All other traffic is denied, by default. Exit extended named ACL configuration mode.
Copy
R1(config-ext-nacl)# exit
h. Execute the show access-lists command and verify that access list HTTP_ONLY contains the correct statements.
Copy
R1# show access-lists
Extended IP access list 100
10 permit tcp 172.22.34.64 0.0.0.31 host 172.22.34.62 eq ftp
20 permit icmp 172.22.34.64 0.0.0.31 host 172.22.34.62
Extended IP access list HTTP_ONLY
10 permit tcp 172.22.34.96 0.0.0.15 host 172.22.34.62 eq www
20 permit icmp 172.22.34.96 0.0.0.15 host 172.22.34.62
Step 2: Apply the ACL on the correct interface to filter traffic.
From R1’s perspective, the traffic that access list HTTP_ONLY applies to is inbound from the network connected to the Gigabit Ethernet 0/1 interface. Enter interface configuration mode and apply the ACL.
Note: On an actual operational network, it is not a good practice to apply an untested access list to an active interface. It should be avoided if possible.
Copy
R1(config)# interface gigabitethernet 0/1
R1(config-if)# ip access-group HTTP_ONLY in
Step 3: Verify the ACL implementation.
a. Ping from PC2 to Server. If the ping is unsuccessful, verify the IP addresses before continuing.
Copy
C:\> ping 172.22.34.62
Pinging 172.22.34.62 with 32 bytes of data:
Reply from 172.22.34.62: bytes=32 time<1ms TTL=127
Reply from 172.22.34.62: bytes=32 time<1ms TTL=127
Reply from 172.22.34.62: bytes=32 time<1ms TTL=127
Reply from 172.22.34.62: bytes=32 time<1ms TTL=127
Ping statistics for 172.22.34.62:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
b. From PC2 open a web browser and enter the IP address of the Server. The web page of the Server should be displayed.
c. FTP from PC2 to Server. The connection should fail. If not, troubleshoot the access list statements and the access-group configurations on the interfaces.
Copy
C:\> ftp 172.22.34.62
Trying to connect...172.22.34.62
%Error opening ftp://172.22.34.62/ (Timed out)
.
(Disconnecting from ftp server)
Device Configs - Final
ROUTER R1
Copy
! ==============================================================
!--- 26.2.1 Packet Tracer - Configure Extended IPv4 ACLs - Scenario 1
!--- ANSWER SCRIPT FOR ROUTER R1
!--- Usage: copy this whole file and paste it into the R1 terminal (start at the R1> prompt). Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless.
!--- Scope: only R1 is configured in this activity - IP addressing on
!--- R1, the switches and PCs is already in place per the addressing table.
! ==============================================================
enable
configure terminal
! --------------------------------------------------------------
!--- Part 1: Numbered extended ACL 100 - permit FTP and ping from
!--- PC1's LAN (172.22.34.64/27) to the Server only, deny everything
!--- else implicitly.
! --------------------------------------------------------------
!--- FTP is TCP-based, so it has to be matched as tcp + "eq ftp",
!--- not as its own protocol keyword.
access-list 100 permit tcp 172.22.34.64 0.0.0.31 host 172.22.34.62 eq ftp
!--- Ping (ICMP) doesn't need a specific type/code to allow all of it.
access-list 100 permit icmp 172.22.34.64 0.0.0.31 host 172.22.34.62
!--- Apply inbound on G0/0 - that's the interface PC1's traffic enters
!--- R1 from, so this is where the source-based filter belongs.
interface gigabitethernet 0/0
ip access-group 100 in
exit
! --------------------------------------------------------------
!--- Part 2: Named extended ACL HTTP_ONLY - permit HTTP and ping from
!--- PC2's LAN (172.22.34.96/28) to the Server only.
!--- Note: the name is case-sensitive for Packet Tracer's auto-grading
!--- - it must be exactly "HTTP_ONLY" (all caps, one underscore).
! --------------------------------------------------------------
ip access-list extended HTTP_ONLY
!--- Web traffic (HTTP) is also TCP-based, matched as "eq www".
permit tcp 172.22.34.96 0.0.0.15 host 172.22.34.62 eq www
!--- Ping (ICMP) from PC2 to the Server.
permit icmp 172.22.34.96 0.0.0.15 host 172.22.34.62
exit
!--- Apply inbound on G0/1 - that's the interface PC2's traffic enters
!--- R1 from.
interface gigabitethernet 0/1
ip access-group HTTP_ONLY in
exit
end
! --------------------------------------------------------------
!--- Save the configuration to NVRAM. (Press Enter when prompted for the destination filename.)
! --------------------------------------------------------------
copy running-config startup-config
! ==============================================================
!--- Verification:
!--- show access-lists -> ACL 100 (2 entries) and HTTP_ONLY (2 entries), in this exact order
!--- show ip interface gigabitethernet 0/0 -> "Inbound access list is 100"
!--- show ip interface gigabitethernet 0/1 -> "Inbound access list is HTTP_ONLY"
!--- ping 172.22.34.62 (from PC1 and PC2) -> both succeed
!--- ftp 172.22.34.62 (from PC1) -> succeeds (user/pass: cisco/cisco)
!--- http://172.22.34.62 (from PC2) -> page loads
!--- ftp 172.22.34.62 (from PC2) -> fails - HTTP_ONLY permits only www and ICMP
!--- ping PC1 <-> PC2 directly -> both fail (Destination host unreachable) - neither ACL permits it
!--- Note: this deliberately has no trailing "deny ip any any" on
!--- either ACL - IOS already denies everything not explicitly matched,
!--- so PC1<->PC2 traffic and anything else is blocked by the implicit
!--- deny, exactly as the lab's own Step 1k/l calls out.
! ==============================================================
Download 26.2.1 Packet Tracer - Configure Extended IPv4 ACLs - Scenario 1 .PKA file:
26.2.1 Packet Tracer - Configure Extended IPv4 ACLs - Scenario 1 .PKA
1 file(s) 375.49 KB
Previous Lab
24.2.2 Packet Tracer – Logging from Multiple Sources
Next Lab
26.2.2 Packet Tracer – Configure Extended IPv4 ACLs – Scenario 2
