5.2.2.9 Lab - Configuring Switch Security Features - Solution
5.2.2.9 Lab - Configuring Switch Security Features - Solution
Topology
Addressing Table
Objectives
Part 1: Set up the Topology and Initialize Devices
Part 2: Configure Basic Device Settings and Verify Connectivity
Part 3: Configure and Verify SSH Access on S1
Configure SSH access.
Modify SSH parameters.
Verify the SSH configuration.
Part 4: Configure and Verify Security Features on S1
Configure and verify general security features.
Configure and verify port security.
Background / Scenario
It is quite common to lock down access and install strong security features on PCs and servers. It is important
that your network infrastructure devices, such as switches and routers, are also configured with security
features.
In this lab, you will follow some best practices for configuring security features on LAN switches. You will only
allow SSH and secure HTTPS sessions. You will also configure and verify port security to lock out any device
with a MAC address not recognized by the switch.
Note: The router used with CCNA hands-on labs is a Cisco 1941 Integrated Services Router (ISR) with Cisco
IOS Release 15.2(4)M3 (universalk9 image). The switch used is a Cisco Catalyst 2960 with Cisco IOS
Release 15.0(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 output produced might vary from what is
shown in this lab. Refer to the Router Interface Summary Table at the end of this lab for the correct interface
identifiers.
Note: Make sure that the router and switch have been erased and have no startup configurations. If you are
unsure, contact your instructor or refer to the previous lab for the procedures to initialize and reload devices.
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 1 of 16
Lab – Configuring Switch Security Features
Required Resources
1 Router (Cisco 1941 with Cisco IOS Release 15.2(4)M3 universal image or comparable)
1 Switch (Cisco 2960 with Cisco IOS Release 15.0(2) lanbasek9 image or comparable)
1 PC (Windows 7, Vista, or XP with terminal emulation program, such as Tera Term)
1 Console cable to configure the Cisco IOS devices via the console ports
2 Ethernet cables as shown in the topology
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 2 of 16
Lab – Configuring Switch Security Features
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 3 of 16
Lab – Configuring Switch Security Features
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 4 of 16
Lab – Configuring Switch Security Features
S1(config)#
S1(config)# end
e. Verify the SSH configuration.
S1# show ip ssh
SSH Enabled - version 1.99
Authentication timeout: 120 secs; Authentication retries: 3
Minimum expected Diffie Hellman key size : 1024 bits
IOS Keys in SECSH format(ssh-rsa, base64 encoded):
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCKWqCN0g4XLVdJJUOr+9qoJkFqC/g0OuAV1semrR5/
xy0bbUBPywvqhwSPJtucIKxKw/YfrRCeFwY+dc+/jGSeckAHahuv0jJfOdFcgqiKGeeluAu+iQ2drE+k
butnlLTGmtNhdEJMxri/ZeO3BsFcnHpO1hbB6Vsm4XRXGk7OfQ==
What version of SSH is the switch using? _______________________ 1.99
How many authentication attempts does SSH allow? _______________________ 3
What is the default timeout setting for SSH? _______________________ 120 seconds
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 5 of 16
Lab – Configuring Switch Security Features
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 6 of 16
Lab – Configuring Switch Security Features
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 7 of 16
Lab – Configuring Switch Security Features
Note: Entering the switchport port-security command sets the maximum MAC addresses to 1 and the
violation action to shutdown. The switchport port-security maximum and switchport port-security
violation commands can be used to change the default behavior.
4) Configure a static entry for the MAC address of R1 G0/1 interface recorded in Step 2a.
S1(config-if)# switchport port-security mac-address xxxx.xxxx.xxxx
(xxxx.xxxx.xxxx is the actual MAC address of the router G0/1 interface)
Note: Optionally, you can use the switchport port-security mac-address sticky command to
add all the secure MAC addresses that are dynamically learned on a port (up to the maximum set) to the
switch running configuration.
5) Enable the switch port.
S1(config-if)# no shutdown
S1(config-if)# end
d. Verify port security on S1 F0/5 by issuing a show port-security interface command.
S1# show port-security interface f0/5
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Shutdown
Aging Time : 0 mins
Aging Type : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 1
Total MAC Addresses : 1
Configured MAC Addresses : 1
Sticky MAC Addresses : 0
Last Source Address:Vlan : 0000.0000.0000:0
Security Violation Count : 0
What is the port status of F0/5?
____________________________________________________________________________________
The status is Secure-up, which indicates that the port is secure, but the status and protocol are up.
e. From R1 command prompt, ping PC-A to verify connectivity.
R1# ping 172.16.99.3
f. You will now violate security by changing the MAC address on the router interface. Enter interface
configuration mode for G0/1 and shut it down.
R1# config t
R1(config)# interface g0/1
R1(config-if)# shutdown
g. Configure a new MAC address for the interface, using aaaa.bbbb.cccc as the address.
R1(config-if)# mac-address aaaa.bbbb.cccc
h. If possible, have a console connection open on S1 at the same time that you do the next two steps. You
will eventually see messages displayed on the console connection to S1 indicating a security violation.
Enable the G0/1 interface on R1.
R1(config-if)# no shutdown
i. From R1 privileged EXEC mode, ping PC-A. Was the ping successful? Why or why not?
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 8 of 16
Lab – Configuring Switch Security Features
____________________________________________________________________________________
No, the F0/5 port on S1 is shut down because of the security violation.
j. On the switch, verify port security with the following commands.
S1# show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation Security Action
(Count) (Count) (Count)
--------------------------------------------------------------------
Fa0/5 1 1 1 Shutdown
----------------------------------------------------------------------
Total Addresses in System (excluding one mac per port) :0
Max Addresses limit in System (excluding one mac per port) :8192
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 9 of 16
Lab – Configuring Switch Security Features
R1(config-if)# no shutdown
R1(config-if)# end
l. From R1, ping PC-A again at 172.16.99.3. Was the ping successful? _________________ No
m. On the switch, issue the show interface f0/5 command to determine the cause of ping failure. Record
your findings.
____________________________________________________________________________________
F0/5 port on S1 is still in an error disabled state.
S1# show interface f0/5
FastEthernet0/5 is down, line protocol is down (err-disabled)
Hardware is Fast Ethernet, address is 0023.5d59.9185 (bia 0023.5d59.9185)
MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
n. Clear the S1 F0/5 error disabled status.
S1# config t
S1(config)# interface f0/5
S1(config-if)# shutdown
S1(config-if)# no shutdown
Note: There may be a delay while the port states converge.
o. Issue the show interface f0/5 command on S1 to verify F0/5 is no longer in error disabled mode.
S1# show interface f0/5
FastEthernet0/5 is up, line protocol is up (connected)
Hardware is Fast Ethernet, address is 0023.5d59.9185 (bia 0023.5d59.9185)
MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
p. From the R1 command prompt, ping PC-A again. The ping should be successful.
Reflection
1. Why would you enable port security on a switch?
_______________________________________________________________________________________
It would help prevent unauthorized devices from accessing your network if they plugged into a switch on your
network.
2. Why should unused ports on a switch be disabled?
_______________________________________________________________________________________
One excellent reason is that a user could not connect a device to the switch on an unused port and access
the LAN.
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 10 of 16
Lab – Configuring Switch Security Features
Router Model Ethernet Interface #1 Ethernet Interface #2 Serial Interface #1 Serial Interface #2
1800 Fast Ethernet 0/0 Fast Ethernet 0/1 Serial 0/0/0 (S0/0/0) Serial 0/0/1 (S0/0/1)
(F0/0) (F0/1)
1900 Gigabit Ethernet 0/0 Gigabit Ethernet 0/1 Serial 0/0/0 (S0/0/0) Serial 0/0/1 (S0/0/1)
(G0/0) (G0/1)
2801 Fast Ethernet 0/0 Fast Ethernet 0/1 Serial 0/1/0 (S0/1/0) Serial 0/1/1 (S0/1/1)
(F0/0) (F0/1)
2811 Fast Ethernet 0/0 Fast Ethernet 0/1 Serial 0/0/0 (S0/0/0) Serial 0/0/1 (S0/0/1)
(F0/0) (F0/1)
2900 Gigabit Ethernet 0/0 Gigabit Ethernet 0/1 Serial 0/0/0 (S0/0/0) Serial 0/0/1 (S0/0/1)
(G0/0) (G0/1)
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.
Device Configs
Router R1
R1#sh run
Building configuration...
Current configuration : 1232 bytes
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
hostname R1
!
enable secret 4 06YFDUHH61wAE/kLkDq9BGho1QM5EnRtoyr8cHAUg.2
!
no ip domain-lookup
!
interface GigabitEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface GigabitEthernet0/1
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 11 of 16
Lab – Configuring Switch Security Features
Switch S1
S1#sh run
Building configuration...
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 12 of 16
Lab – Configuring Switch Security Features
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 13 of 16
Lab – Configuring Switch Security Features
!
interface FastEthernet0/2
shutdown
!
interface FastEthernet0/3
shutdown
!
interface FastEthernet0/4
shutdown
!
interface FastEthernet0/5
switchport access vlan 99
switchport mode access
switchport port-security
switchport port-security mac-address 30f7.0da3.1821
!
interface FastEthernet0/6
switchport access vlan 99
switchport mode access
!
interface FastEthernet0/7
shutdown
interface FastEthernet0/8
shutdown
!
interface FastEthernet0/9
shutdown
!
interface FastEthernet0/10
shutdown
!
interface FastEthernet0/11
shutdown
!
interface FastEthernet0/12
shutdown
!
interface FastEthernet0/13
shutdown
!
interface FastEthernet0/14
shutdown
!
interface FastEthernet0/15
shutdown
!
interface FastEthernet0/16
shutdown
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 14 of 16
Lab – Configuring Switch Security Features
!
interface FastEthernet0/17
shutdown
!
interface FastEthernet0/18
shutdown
!
interface FastEthernet0/19
shutdown
!
interface FastEthernet0/20
shutdown
!
interface FastEthernet0/21
shutdown
!
interface FastEthernet0/22
shutdown
!
interface FastEthernet0/23
shutdown
!
interface FastEthernet0/24
shutdown
!
interface GigabitEthernet0/1
shutdown
!
interface GigabitEthernet0/2
shutdown
!
interface Vlan1
no ip address
shutdown
!
interface Vlan99
ip address 172.16.99.11 255.255.255.0
!
ip default-gateway 172.16.99.1
no ip http server
ip http secure-server
!
banner motd ^CWarning! Unauthorized Access is Prohibited.^C
!
line con 0
password cisco
logging synchronous
login
line vty 0 4
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 15 of 16
Lab – Configuring Switch Security Features
login local
transport input ssh
line vty 5 15
login local
transport input ssh
!
end
© 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 16 of 16