26.2.3 Packet Tracer - Configure IP ACLs to Mitigate Attacks (Answers)
Topology

26.2.3 Packet Tracer - Configure IP ACLs to Mitigate Attacks
Addressing Table
| Device | Interface | IP Address | Subnet Mask | Default Gateway | Switch Port |
|---|---|---|---|---|---|
| R1 | G0/1 | 192.168.1.1 | 255.255.255.0 | N/A | S1 F0/5 |
| S0/0/0 | 10.1.1.1 | 255.255.255.252 | N/A | ||
| R2 | S0/0/0 | 10.1.1.2 | 255.255.255.252 | N/A | N/A |
| S0/0/1 | 10.2.2.2 | 255.255.255.252 | |||
| G0/0 | 209.165.200.225 | 255.255.255.224 | |||
| Lo0 | 192.168.2.1 | 255.255.255.0 | |||
| R3 | G0/1 | 192.168.3.1 | 255.255.255.0 | N/A | S3 F0/5 |
| S0/0/1 | 10.2.2.1 | 255.255.255.252 | N/A | ||
| PC-A | NIC | 192.168.1.3 | 255.255.255.0 | 192.168.1.1 | S1 F0/6 |
| PC-C | NIC | 192.168.3.3 | 255.255.255.0 | 192.168.3.1 | S3 F0/18 |
Objectives
- Verify connectivity between devices before ACL configuration.
- Use ACLs to ensure remote access to the routers is available only from management station PC-C.
- Configure ACLs on R1 and R3 to mitigate attacks.
- Verify ACL functionality.
Background / Scenario
Access to routers R1, R2, and R3 should only be permitted from PC-C, which is the management station. PC-C is also used for connectivity testing to PC-A, which is a server that provides DNS, SMTP, FTP, and HTTPS services.
You will apply ACLs on edge routers to mitigate common threats based on source and destination IP address. In this activity, you will create ACLs on edge routers R1 and R3 to achieve this goal. You will then verify ACL functionality from internal and external hosts.
The routers have been pre-configured with the following:
- Enable password: ciscoenpa55
- Password for console: ciscoconpa55
- SSH logon username and password: SSHadmin/ciscosshpa55
- IP addressing
- Static routing
Instructions
Part 1: Verify Basic Network Connectivity
Verify network connectivity prior to configuring the IP ACLs.
Step 1: From PC-A, verify connectivity to PC-C and R2.
a. From the command prompt, ping PC-C (192.168.3.3).
b. From the command prompt, establish an SSH session to R2 Lo0 interface (192.168.2.1) using username SSHadmin and password ciscosshpa55. When finished, exit the SSH session.
C:\> ssh -l SSHadmin 192.168.2.1
Step 2: From PC-C, verify connectivity to PC-A and R2.
a. From the command prompt, ping PC-A (192.168.1.3).
b. From the command prompt, establish an SSH session to R2 Lo0 interface (192.168.2.1) using username SSHadmin and password ciscosshpa55. Close the SSH session when finished.
C:\> ssh -l SSHadmin 192.168.2.1
c. Establish another SSH session to R2 G0/0 interface (209.165.200.225) using username SSHadmin and password ciscosshpa55. When finished, exit the SSH session.
d. Open a web browser to the PC-A server (192.168.1.3) to display the web page. Close the browser when done.
Part 2: Secure Access to Routers
Step 1: Configure ACL 10 to block all remote access to the router VTY lines except from PC-C.
a. Use the access-list command to create a numbered IP ACL on R1, R2, and R3.
R1(config)# access-list 10 permit host 192.168.3.3 R2(config)# access-list 10 permit host 192.168.3.3 R3(config)# access-list 10 permit host 192.168.3.3
Step 2: Apply ACL 10 to ingress traffic on the VTY lines.
Use the access-class command to apply the access list to incoming traffic on the VTY lines.
R1(config-line)# access-class 10 in R2(config-line)# access-class 10 in R3(config-line)# access-class 10 in
Step 3: Verify exclusive access from management station PC-C.
a. Establish an SSH session to 192.168.2.1 from PC-C (should be successful).
C:\> ssh -l SSHadmin 192.168.2.1
b. Establish an SSH session to 209.165.200.225 from PC-C (should be successful).
c. Establish an SSH session to 192.168.2.1 from PC-A (should fail).
Part 3: Create a Numbered IP ACL 120 on R1
Create an IP ACL numbered 120 with the following rules:
- Permit any outside host to access DNS, SMTP, and FTP services on server PC-A.
- Deny any outside host access to HTTPS services on PC-A.
- Permit PC-C to access R1 via SSH.
Note: Check Results will not show a correct configuration for ACL 120 until you modify it in Part 4.
Step 1: Verify that PC-C can access the PC-A via HTTPS using the web browser.
Be sure to disable HTTP and enable HTTPS on server PC-A.
Step 2: Configure ACL 120 to specifically permit and deny the specified traffic.
Use the access-list command to create a numbered IP ACL with number 120.
R1(config)# access-list 120 permit udp any host 192.168.1.3 eq domain R1(config)# access-list 120 permit tcp any host 192.168.1.3 eq smtp R1(config)# access-list 120 permit tcp any host 192.168.1.3 eq ftp R1(config)# access-list 120 deny tcp any host 192.168.1.3 eq 443 R1(config)# access-list 120 permit tcp host 192.168.3.3 host 10.1.1.1 eq 22
Step 3: Apply the ACL to interface S0/0/0.
Use the ip access-group command to apply the access list to incoming traffic on interface S0/0/0.
R1(config)# interface s0/0/0 R1(config-if)# ip access-group 120 in
Step 4: Verify that PC-C cannot access PC-A via HTTPS using the web browser.
Part 4: Modify an Existing ACL on R1
Permit ICMP echo replies and destination unreachable messages from the outside network (relative to R1). Deny all other incoming ICMP packets.
Step 1: Verify that PC-A cannot successfully ping the loopback interface on R2.
Step 2: Make any necessary changes to ACL 120 to permit and deny the specified traffic.
Use the access-list command to append the required entries to ACL 120.
R1(config)# access-list 120 permit icmp any any echo-reply R1(config)# access-list 120 permit icmp any any unreachable R1(config)# access-list 120 deny icmp any any R1(config)# access-list 120 permit ip any any
Step 3: Verify that PC-A can successfully ping the loopback interface on R2.
Part 5: Create a Numbered IP ACL 110 on R3
Deny all outbound packets with a source address outside the range of internal IP addresses on R3.
Step 1: Configure ACL 110 to permit only traffic from the inside network.
Use the access-list command to create a numbered IP ACL.
R3(config)# access-list 110 permit ip 192.168.3.0 0.0.0.255 any
Step 2: Apply the ACL to interface G0/1.
Use the ip access-group command to apply the access list to incoming traffic on interface G0/1.
R3(config)# interface g0/1 R3(config-if)# ip access-group 110 in
Part 6: Create a Numbered IP ACL 100 on R3
On R3, block all packets containing the source IP address from the following pool of addresses: any RFC 1918 private addresses, 127.0.0.0/8, and any IP multicast address. Because PC-C is being used for remote administration, permit SSH traffic from the 10.0.0.0/8 network to return to the host PC-C.
Step 1: Configure ACL 100 to block all specified traffic from the outside network.
You should also block traffic sourced from your own internal address space if it is not an RFC 1918 address. In this activity, your internal address space is part of the private address space specified in RFC 1918.
Use the access-list command to create a numbered IP ACL 100.
R3(config)# access-list 100 permit tcp 10.0.0.0 0.255.255.255 eq 22 host 192.168.3.3 R3(config)# access-list 100 deny ip 10.0.0.0 0.255.255.255 any R3(config)# access-list 100 deny ip 172.16.0.0 0.15.255.255 any R3(config)# access-list 100 deny ip 192.168.0.0 0.0.255.255 any R3(config)# access-list 100 deny ip 127.0.0.0 0.255.255.255 any R3(config)# access-list 100 deny ip 224.0.0.0 15.255.255.255 any R3(config)# access-list 100 permit ip any any
Step 2: Apply the ACL to interface Serial 0/0/1.
Use the ip access-group command to apply the access list to incoming traffic on interface Serial 0/0/1.
R3(config)# interface s0/0/1 R3(config-if)# ip access-group 100 in
Step 3: Confirm that the specified traffic entering interface Serial 0/0/1 is handled correctly.
a. From the PC-C command prompt, ping the PC-A server. The ICMP echo replies are blocked by the ACL because they are sourced from the 192.168.0.0/16 address space.
b. Establish an SSH session to 192.168.2.1 from PC-C. (should fail)
c. Establish an SSH session to 209.165.200.225. (should be successful).
Step 4: Check results.
Your completion percentage should be 100%. Click Check Results to see feedback and verification of which required components have been completed.
Device Configs - Final
ROUTER R1
! ==============================================================
!--- 26.2.3 Packet Tracer - Configure IP ACLs to Mitigate Attacks
!--- 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: enable/console passwords, SSH (SSHadmin/ciscosshpa55), IP
!--- addressing and static routing are already pre-configured per the
!--- activity's own Background note - this script only adds the ACLs.
! ==============================================================
enable
configure terminal
! --------------------------------------------------------------
!--- Part 2: Restrict VTY (remote) access to R1 so only the management
!--- station PC-C can reach it - by SSH or Telnet.
! --------------------------------------------------------------
!--- Only PC-C is allowed in; everything else hits the implicit deny.
access-list 10 permit host 192.168.3.3
line vty 0 4
access-class 10 in
exit
! --------------------------------------------------------------
!--- Part 3, Step 2: Numbered extended ACL 120 - control what outside
!--- hosts can reach on the PC-A server, and let PC-C manage R1 itself.
! --------------------------------------------------------------
!--- Outside hosts may reach PC-A's DNS, SMTP and FTP services...
access-list 120 permit udp any host 192.168.1.3 eq domain
access-list 120 permit tcp any host 192.168.1.3 eq smtp
access-list 120 permit tcp any host 192.168.1.3 eq ftp
!--- ...but HTTPS to PC-A is explicitly blocked from outside.
access-list 120 deny tcp any host 192.168.1.3 eq 443
!--- PC-C (the management station) may SSH directly into R1's WAN
!--- address (10.1.1.1) - this is traffic destined for the router
!--- itself, not transit traffic to PC-A.
access-list 120 permit tcp host 192.168.3.3 host 10.1.1.1 eq 22
! --------------------------------------------------------------
!--- Part 3, Step 3: Apply ACL 120 inbound on the WAN-facing interface -
!--- the traffic being filtered arrives here from R2/the outside.
! --------------------------------------------------------------
interface Serial0/0/0
ip access-group 120 in
exit
! --------------------------------------------------------------
!--- Part 4, Step 2: Append ICMP handling to ACL 120 - allow only the
!--- reply/error types a host needs for diagnostics (echo-reply,
!--- unreachable), block every other ICMP type, then re-permit
!--- everything else so normal transit traffic keeps flowing.
! --------------------------------------------------------------
access-list 120 permit icmp any any echo-reply
access-list 120 permit icmp any any unreachable
!--- Blocks echo (ping) requests and every other ICMP type/code not
!--- covered above - e.g. PC-A pinging out will get no reply back in.
access-list 120 deny icmp any any
!--- Required catch-all: without this, the ACL's own implicit deny
!--- would silently block every other protocol (not just ICMP) once
!--- the explicit "deny icmp any any" line is added.
access-list 120 permit ip any any
end
! --------------------------------------------------------------
!--- Save the configuration to NVRAM. (Press Enter when prompted for the destination filename.)
! --------------------------------------------------------------
copy running-config startup-config
! ==============================================================
!--- Verification:
!--- show access-lists 10 -> only "permit host 192.168.3.3"
!--- show access-lists 120 -> all 9 lines in order, with match counts once traffic flows
!--- show ip interface serial0/0/0 -> "Inbound access list is 120"
!--- ssh -l SSHadmin 192.168.2.1 (from PC-C) -> succeeds (Part 2)
!--- ssh -l SSHadmin 192.168.2.1 (from PC-A) -> fails (Part 2, not PC-C)
!--- https:// to 192.168.1.3 (from PC-C, simulating an outside host) -> fails (Part 3)
!--- ping 192.168.2.1 (from PC-A, after Part 4) -> succeeds again (echo-reply now permitted back)
!--- Note: "Check Results" will not show ACL 120 as correct until Part 4's
!--- four extra lines are appended - this matches the lab's own Part 3
!--- note ("Check Results will not show a correct configuration for ACL
!--- 120 until you modify it in Part 4").
! ==============================================================
ROUTER R2
! ============================================================== !--- 26.2.3 Packet Tracer - Configure IP ACLs to Mitigate Attacks !--- ANSWER SCRIPT FOR ROUTER R2 !--- Usage: copy this whole file and paste it into the R2 terminal (start at the R2> prompt). Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless. !--- Scope: enable/console passwords, SSH, IP addressing and static !--- routing are already pre-configured per the activity's own !--- Background note - R2 is transit-only in this lab, so it only !--- needs the VTY-restriction ACL (no ACL 120/110/100 traffic touches R2). ! ============================================================== enable configure terminal ! -------------------------------------------------------------- !--- Part 2: Restrict VTY (remote) access to R2 so only the management !--- station PC-C can reach it - by SSH or Telnet. ! -------------------------------------------------------------- !--- Only PC-C is allowed in; everything else hits the implicit deny. access-list 10 permit host 192.168.3.3 line vty 0 4 access-class 10 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 10 -> only "permit host 192.168.3.3" !--- show line vty 0 4 -> "access class 10 in" listed !--- ssh -l SSHadmin(from PC-C) -> succeeds !--- ssh -l SSHadmin (from PC-A) -> fails (not PC-C) !--- Note: R2 has no other ACL requirement in this lab - ACL 120 lives on !--- R1 (WAN edge facing the outside), and ACL 110/100 live on R3 (LAN !--- edge / anti-spoofing); R2 sits between them and only needs the VTY !--- restriction that every device in this lab shares. ! ==============================================================
ROUTER R3
! ============================================================== !--- 26.2.3 Packet Tracer - Configure IP ACLs to Mitigate Attacks !--- ANSWER SCRIPT FOR ROUTER R3 !--- Usage: copy this whole file and paste it into the R3 terminal (start at the R3> prompt). Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless. !--- Scope: enable/console passwords, SSH, IP addressing and static !--- routing are already pre-configured per the activity's own !--- Background note - this script adds the VTY ACL, the LAN-egress !--- anti-spoofing ACL, and the WAN-ingress anti-spoofing ACL. ! ============================================================== enable configure terminal ! -------------------------------------------------------------- !--- Part 2: Restrict VTY (remote) access to R3 so only the management !--- station PC-C can reach it - by SSH or Telnet. ! -------------------------------------------------------------- !--- Only PC-C is allowed in; everything else hits the implicit deny. access-list 10 permit host 192.168.3.3 line vty 0 4 access-class 10 in exit ! -------------------------------------------------------------- !--- Part 5: ACL 110 - anti-spoofing on the LAN-facing interface. Only !--- traffic that legitimately originates from R3's own LAN !--- (192.168.3.0/24, where PC-C lives) is allowed out toward the rest !--- of the network; anything claiming a different source address on !--- this interface is necessarily forged and is dropped. ! -------------------------------------------------------------- access-list 110 permit ip 192.168.3.0 0.0.0.255 any interface gigabitethernet 0/1 ip access-group 110 in exit ! -------------------------------------------------------------- !--- Part 6: ACL 100 - anti-spoofing on the WAN-facing interface, applied !--- to traffic arriving FROM the outside (R2 direction). No outside !--- source address should ever legitimately be a private (RFC 1918), !--- loopback, or multicast address, nor R3's own internal network - !--- all of those are classic spoofed-source attack signatures. ! -------------------------------------------------------------- !--- Required exception, and must come first: this permits the return !--- leg of SSH sessions PC-C itself initiated toward the 10.0.0.0/8 !--- address space - "eq 22" here matches the SOURCE port (22, the !--- remote SSH server replying), not the destination, since it appears !--- before the destination "host 192.168.3.3". Without this line first, !--- the broader "deny ip 10.0.0.0 ..." below would block those replies. access-list 100 permit tcp 10.0.0.0 0.255.255.255 eq 22 host 192.168.3.3 !--- Block forged private-address (RFC 1918) sources arriving from outside. access-list 100 deny ip 10.0.0.0 0.255.255.255 any access-list 100 deny ip 172.16.0.0 0.15.255.255 any access-list 100 deny ip 192.168.0.0 0.0.255.255 any !--- Block forged loopback and multicast/class D sources. access-list 100 deny ip 127.0.0.0 0.255.255.255 any access-list 100 deny ip 224.0.0.0 15.255.255.255 any !--- Required explicit permit - without this, the implicit deny at the !--- end of the ACL would block all other legitimate inbound traffic too. access-list 100 permit ip any any interface serial 0/0/1 ip access-group 100 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 10 -> only "permit host 192.168.3.3" !--- show access-lists 110 -> "permit ip 192.168.3.0 0.0.0.255 any" !--- show access-lists 100 -> 6 lines, SSH-return permit first, then !--- the 4 spoofing denies, then the catch-all permit ip any any !--- show ip interface gigabitethernet0/1 -> "Inbound access list is 110" !--- show ip interface serial0/0/1 -> "Inbound access list is 100" !--- ssh -l SSHadmin(from PC-C) -> succeeds (Part 2) !--- ssh -l SSHadmin (from PC-A) -> fails (Part 2, not PC-C) !--- Note: double-check ACL 110's applied interface against your own !--- topology before pasting - if R3's LAN-facing interface in your build !--- is not G0/1, adjust that one line to match; the ACL content itself !--- is unaffected. ! ==============================================================
