Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
73 views34 pages

Chapter 5 Switch Configuration

The document discusses basic switch configuration including the boot sequence of a Cisco switch and recovering from system crashes. When a switch powers on, it goes through a POST, loads the bootstrap program, then loads the IOS from flash or a TFTP server. If the IOS cannot load, the bootloader allows accessing recovery commands. Switch ports have LED indicators for link, activity, speed, duplex, and PoE status.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views34 pages

Chapter 5 Switch Configuration

The document discusses basic switch configuration including the boot sequence of a Cisco switch and recovering from system crashes. When a switch powers on, it goes through a POST, loads the bootstrap program, then loads the IOS from flash or a TFTP server. If the IOS cannot load, the bootloader allows accessing recovery commands. Switch ports have LED indicators for link, activity, speed, duplex, and PoE status.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

1/11/2018

Routing and Switching Essentials v6

Chapter 5
Switching Configuration

H.Swaih 1

Chapter 5 ‐ Sections & Objectives

 Basic Switch Configuration
– Explain the basic concepts of a switched environment.
– Configure initial settings on a Cisco switch.
– Configure switch ports to meet network requirements.
 Switch Security: Management and Implementation
– Configure the management virtual interface on a switch.
– Configure the port security feature to restrict network 
access.

H.Swaih 2

1
1/11/2018

Basic Switch Configuration
Router/Switch Bootup Process
1.POST (Power On Self Test)
2.the Bootstrap
1
program(is copied from 
2 ROM into RAM) are 
located in ROM.
3.Load IOS from Flash, 
which is Typically stored in 
3 flash memory.
4.None in Flash, then load 
4
from TFTP server.
5.Load from NVRAM.
6.None in NVRAM, then 
5 load from TFTP server. 
7.No Server/file, then 
6 enter Setup mode from 
the console. If setup mode 
7 not used, a default running‐
config file is created

Note (from Step3&4): If a full IOS image cannot be located, a scaled‐down version of the IOS is 
copied from ROM.  This version of IOS is used to help diagnose any problems and to try to load 
a complete version of the IOS into RAM
H.Swaih 3

Basic Switch Configuration
Switch Boot Sequence
After a Cisco switch is powered on, it goes through the following boot 
sequence:
1. Switch loads the power‐on self‐test (POST) program stored in ROM: 
It checks the CPU subsystem, tests CPU, DRAM, and the portion of the 
flash device that makes up the flash file system.
2. Switch loads the boot loader software which is a small program in 
ROM.
3. The boot loader performs low‐level CPU initialization. 
– It initializes the CPU registers, which control where physical 
memory is mapped, the quantity of memory, and its speed.
4. The boot loader initializes the flash file system on the system board.
5. The boot loader locates and loads a default IOS operating system 
software image into memory and hands control over to the IOS. 
6. The IOS operating system then initializes the interfaces using the 
Cisco IOS commands found in the configuration file, startup‐config, 
which is stored in NVRAM.
H.Swaih 4

2
1/11/2018

Basic Switch Configuration
Switch Boot Sequence (cont.)
To find a suitable Cisco IOS image, the switch goes through the following 
steps:
 By default, the the boot loader attempts to load and execute the first 
executable file it can by searching the flash file system. 
 If boot system commands in startup‐config
a. Run boot system commands in order they appear in startup‐config to 
locate  the IOS
b. If boot system commands fail, use default fallback sequence to locate 
the IOS (Flash, TFTP, ROM)
On Catalyst 2960 Series switches, the image file is normally contained in 
a directory that has the same name as the image file (excluding the .bin 
file extension).

H.Swaih 5

Basic Switch Configuration
Switch Boot Sequence (cont.)
the BOOT environment variable is set using the boot system global 
configuration mode command. Use the show bootvar (show boot in 
older IOS versions) command to see to what the current IOS boot file 
is set.

H.Swaih 6

3
1/11/2018

Basic Switch Configuration
Recovering from a System Crash
 If the IOS can’t load, the boot loader can be used to recover:
1. Connect a PC by console cable to the switch console port. 
2. Unplug the switch power cord.
3. Reconnect the power cord to the switch and press and hold down 
the Mode button.
– The System LED turns briefly amber and then solid green. 
4. Release the Mode button.
5. The boot loader switch: prompt appears in the terminal emulation 
software on the PC.
6. The boot loader command line supports commands to format the 
flash file system, reinstall the operating system software, and 
recover from a lost or forgotten password. 
For example, the dir command can be used to view a list of files within a 
specified directory (flash or nvram) as shown in Figure next slide:
H.Swaih 7

Basic Switch Configuration
Recovering from a System Crash

H.Swaih 8

4
1/11/2018

Basic Switch Configuration
Switch LED Indicators
• Each port on the Cisco Catalyst switches have status LED indicator lights. 
– LED lights reflect port activity, but they can also provide other 
information about the switch through the Mode button. Port LEDs
• The following modes are available on Catalyst 2960 switches: System LED
1. System LED
2. Redundant Power System (RPS) LED 
• If RPS is supported on the switch
3. Port Status LED (Default mode)
4. Port Duplex LED
5. Port speed LED
6. PoE Status (If supported)
7. Port LEDs
8. Mode button

H.Swaih 9

Status LEDs LED is … Description


Off System is not powered
System LED Green System is operating normally
Amber System is receiving power but is not functioning properly
Off RPS is off or not properly connected
Green RPS is connected and ready to provide back-up
Redundant
Blinking Green RPS providing power to another device
Power
Amber RPS is in standby mode or in a fault condition.
Blinking Amber Internal power supply has failed, and the RPS is providing power.
Green A link is present.
Off There is no link, or the port was administratively shut down
Blinking green Activity and the port is sending or receiving data.
Port Status LED
Alternating Green-Amber There is a link fault.
Amber Port is blocked to ensure there is no STP (Spanning Tree Protocol) loop
Blinking amber Port is blocked to prevent a possible loop in the forwarding domain.

Port Duplex Off Ports are in half-duplex mode.


LED Green Port is in full-duplex mode.
Off Port is operating at 10 Mb/s.
Port speed LED Green Port is operating at 100 Mb/s.
Blinking Green Port is operating at 1000 Mb/s.
Off LED is off, the PoE is off.

PoE Status Green LED is green, the PoE is on


(If supported) Alternating Green-Amber PoE is denied because it will exceed the switch power capacity
Blinking Amber LEDH.Swaih
is blinking amber, PoE is off due to a fault. 10
Amber PoE for the port has been disabled.

5
1/11/2018

Basic Switch Configuration
Preparing for Basic Switch Management
 To remotely manage a Cisco switch, it must be configured to access the network.
– An IP address and a subnet mask must be configured.
– If managing the switch from a remote network, a default gateway must also 
be configured.
 The IP information (address, subnet mask, gateway) must be assigned to a 
switch virtual interface (SVI).
– Although these IP settings allow remote management and remote access to 
the switch, they do not allow the switch to route Layer 3 packets.
Notes:
 SVI is a concept related to VLANs. VLANs are numbered logical groups to which 
physical ports can be assigned. Configurations and settings applied to a VLAN are 
also applied to all the ports assigned to that VLAN. 
 By default, the switch is configured to have the management of the switch 
controlled through VLAN 1. All ports are assigned to VLAN 1 by default. For 
security purposes, it is considered a best practice to use a VLAN other than VLAN 
1 for the management VLAN. Furthermore, it is also a best practice to use a 
VLAN that is not used by end devices such as users and printers.
H.Swaih 11

Basic Switch Configuration
Preparing for Basic Switch Management (cont.)
S1# conf t
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)# interface vlan 99
S1(config-if)# ip address 172.17.99.11 255.255.255.0
S1(config-if)# no shutdown
S1(config-if)# end
S1# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
S1#

Notice that the VLAN 99 interface is in the down 
state even though you entered the no shutdown 
command. 

H.Swaih 12

6
1/11/2018

Basic Switch Configuration
Preparing for Basic Switch Management (cont.)
To changed Interface Vlan99 state to up: First,The new VLAN 99 must be created on 
the switch, and then switch ports are assigned to change Interface Vlan99 state to up
S1# configure terminal
S1(config)# vlan 99
S1(config-vlan)# name Enginering
S1(config-vlan)# exit
S1(config)# interface vlan 99
%LINK-5-CHANGED: Interface Vlan99, changed state to up
S1(config-if)# ip address 172.17.99.11 255.255.255.0
S1(config-if)# no shutdown
S1(config-if)#exit
Assign all user ports to VLAN 99*
S1(config)# interface range f0/1–24,g0/1-2 (g0/1-2 if thers are two Gigabit
Ethernet Interface on Switch)*
S1(config-if-range)#switchport mode access
S1(config-if-range)# switchport access vlan 99
S1(config-if-range)# end
S1#copy running-config startup-config
S1#

*( red sentences not part of configuration)


To establish connectivity between the host and the switch, the ports used by the host must 
be in the same VLAN as the switch.  H.Swaih 13

Basic Switch Configuration
Preparing for Basic Switch Management (cont.)
Assign a Default Gateway
Default Gateway
172.17.99.11

172.17.99.1

172.17.99.100
Def Gw 172.17.99.1
S1(config)# ip default-gateway 172.17.99.1
S1(config)# end
S1# copy running-config startup-config
S1#

H.Swaih 14

7
1/11/2018

Basic Switch Configuration
Preparing for Basic Switch Management (cont.)
Verify the Configuration
 show ip interface brief 
command is useful when 
determining the status of 
both physical and virtual 
interfaces.

 The interface VLAN 99 
has been configured with 
an IP address and a 
subnet mask, and that 
FastEthernet port Fa0/18 
has been assigned to the 
VLAN 99 management 
interface. Both interfaces 
are now “up/up” and 
operational.

H.Swaih 15

Configuring Switch Ports
Duplex Communication
 Switch ports by default operate in full duplex (unless attached to a hub). 
 Increases effective bandwidth allowing bidirectional forwarding. 

H.Swaih 16

8
1/11/2018

Configuring Switch Ports
Duplex Communication (cont.)

• Half‐duplex communication is unidirectional and sending and 
receiving data does not occur at the same time. 
– Half‐duplex communication often resulting in collisions. 
– Typically seen in older hardware, such as hubs. 

• Most Ethernet and Fast Ethernet NICs sold today offer full‐
duplex capability. 
– Gigabit Ethernet and 10Gb NICs require full‐duplex 
connections.

H.Swaih 17

Configuring Switch Ports
Duplex Communication (cont.)

H.Swaih 18

9
1/11/2018

Configuring Switch Ports
Configuring Switch Ports at the Physical Layer
Configure Duplex and Speed

 Duplex and speed settings on most switches are autosensed.
 Manual 
Switch(config-if)# speed [10 | 100 | 1000 | auto]
Switch(config-if)# duplex [half | full | auto]
 When troubleshooting switch port issues, the duplex and speed settings 
should be checked.
– Mismatched settings for the duplex mode and speed of switch ports 
can cause connectivity issues. 
– Auto‐negotiation failure creates mismatched settings.

H.Swaih 19

Configuring Switch Ports
Configuring Switch Ports at the Physical Layer
Configure Duplex and Speed (cont.)

It’s best practice is to manually set the speed/duplex settings when connecting to 
known devices (i.e., servers, dedicated workstations, or network devices).
S1(config)# interface fastethernet 0/1 S2(config)# interface fastethernet 0/1
S1(config-if)# speed ? S2(config-if)# speed 100
10 Force 10 Mbps operation S2(config-if)# duplex full
100 Force 100 Mbps operation S2(config-if)# end
auto Enable AUTO speed configuration S2#copy running-config startup-config
S1(config-if)# speed 100 S2#
S1(config-if)# duplex ?
auto Enable AUTO duplex configuration
full Force full duplex operation
half Force half-duplex operation
S1(config-if)# duplex full
S1(config-if)#end
S1#copy running-config startup-config
S1#
H.Swaih 20

10
1/11/2018

Configuring Switch Ports
Auto‐MDIX Feature
 Certain cable types (straight‐through or crossover) were 
historically required when connecting devices.
 The automatic medium‐dependent interface crossover 
(auto‐MDIX) feature eliminates this problem.
 When auto‐MDIX is enabled, the interface automatically 
detects and appropriately configures the connection.
 When using auto‐MDIX on an interface, the interface speed 
and duplex must be set to auto.
 Modern Cisco switches support the mdix auto interface 
configuration command to enable the automatic medium‐
dependent interface crossover (auto‐MDIX) feature. 

H.Swaih 21

Configuring Switch Ports
Auto‐MDIX Feature (cont.)
Configuring MDIX Setting

• mdix auto interface configuration 
– Requires the commands speed auto and duplex auto
S1(config)# interface fa0/1 S2(config)# interface fa0/1
S1(config-if)# speed auto S2(config-if)# speed auto
S1(config-if)# duplex auto S2(config-if)# duplex auto
S1(config-if)# mdix auto S2(config-if)# mdix auto
S1(config-if)#end S2(config-if)#end
S1#copy running-config startup- S2#copy running-config startup-
config config
S1# S2#
• Note:
– The auto‐MDIX feature is enabled by default on Catalyst 2960 and 
Catalyst 3560 switches, but is not available on the older Catalyst 2950 
and Catalyst 3550 switches.
– Don’t depend on auto‐mdix – use the correct cable in the lab.
H.Swaih 22

11
1/11/2018

Configuring Switch Ports
Auto‐MDIX Feature (cont.)
To examine the auto‐MDIX setting for a specific interface, use the show 
controllers ethernet‐controller command with the argument interface‐id and 
the phy keyword. To limit the output to lines referencing auto‐MDIX, use the 
include Auto‐MDIX filter. As shown in Figure, the output indicates On or Off for 
the feature.

H.Swaih 23

Configuring Switch Ports
Verifying Switch Port Configuration
Cisco Switch IOS Commands
Display interface status and 
S1# show interfaces [interface‐id]
configuration.
Display current startup configuration. S1# show startup‐config
Display current operating config. S1# show running‐config
Displays info about flash file system. S1# show flash:
Displays system hardware & software 
S1# show version
status.
Display history of commands entered. S1# show history
Display IP information about an
S1# show ip [interface‐id]
interface.
S1# show mac‐address‐table
Display the MAC address table. or
S1# show mac address‐table
H.Swaih 24

12
1/11/2018

Configuring Switch Ports
Network Access Layer Issues
Verify interface Status
S1# show interfaces fa 0/1
FastEthernet0/1 is up, line protocol is up (connected)
Hardware is Lance, address is 000d.bda1.5601 (bia 000d.bda1.5601)
BW 100000 Kbit, DLY 1000 usec,
If the output is: 250/255, txload 1/255, rxload 1/255
reliability
Encapsulation ARPA, loopback not set
•up down:set
Keepalive Encapsulation
(10 sec) type mismatch, the interface on the other end
could be error-disabled,
Full-duplex, 100Mb/s or there could be a hardware problem.
input flow-control is off, output flow-control is off
•down
ARP type:down:
ARPA,A cable is not attached
ARP Timeout 04:00:00or some other interface problem exists.
Last input 00:00:08, output 00:00:05, output hang never
•administratively down: The shutdown command has been issued.
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue :0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
956 packets input, 193351 bytes, 0 no buffer
Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 watchdog, 0 multicast, 0 pause input
0 input packets with dribble condition detected
2357 packets output, 263570 bytes, 0 underruns
0 output errors, 0 collisions, 10 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
S1# H.Swaih 25

Configuring Switch Ports
Network Access Layer Issues

H.Swaih 26

13
1/11/2018

Configuring Switch Ports
Network Access Layer Issues (cont.)
Network Access Layer Issues
Input Errors :Total number of errors. It includes runts, giants, no 
buffer, CRC, frame, overrun, and ignored counts.
Runt Frames: Ethernet frames that are shorter than the 64‐byte 
minimum allowed length are called runts. 
Giants: Ethernet frames that are longer than the 1518 bytes 
maximum allowed length are called giants. (Bad NIC)
CRC errors: On Ethernet and serial interfaces, CRC errors usually 
indicate a media or cable error. 
Collisions: Only part of normal operations if interface is operating in 
half duplex – connected to a hub. 
Late Collisions: Operating in half duplex and excessive cable length.
Cause: Result of duplex mismatch
One side half duplex
Other side full duplex
H.Swaih 27

Configuring Switch Ports
Troubleshooting Switch Media (Connection) Issues

H.Swaih 28

14
1/11/2018

Secure Remote Access
SSH Operation

 Secure Shell (SSH) is a protocol that provides a secure (encrypted) 
command‐line based connection to a remote device.
– SSH is commonly used in UNIX/Linux‐based systems.
– The IOS software also supports SSH.
 Because of its strong encryption features, SSH should replace Telnet for 
management connections.
 Note:
– By default, SSH uses TCP port 22 and Telnet uses TCP port 23.
H.Swaih 29

Secure Remote Access
SSH Operation
S1# show version
Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M),
Version 15.0(2)SE, RELEASE SOFTWARE (fc1)

<output omitted>

 Not all IOS support SSH.
 A version of the IOS software, including cryptographic (encrypted) 
features and capabilities, is required to enable SSH on Catalyst 2960 
switches.
 Use the show version command to verify the IOS version.
 “K9” indicates that the version supports SSH.
 Verify SSH support using the show ip ssh command
– The command is unrecognized if SSH is not supported.

H.Swaih 30

15
1/11/2018

Secure Remote Access
Configuring SSH
A switch must be minimally configured with a unique hostname and the 
correct network connectivity settings.
1. Verify SSH support using the show ip ssh command
– The command is unrecognized if SSH is not supported.
2. Configure the IP domain using the ip domain‐name domain‐name
global config command. (The domain name and  hostname are the 
parameters used in order to name the key) 
• Generate RSA key pairs using the crypto key generate rsa global 
configuration mode command. (Use the crypto key generate rsa
global configuration mode command to enable the SSH server on the 
switch and generate an RSA key pair).
– Cisco recommends a minimum modulus size of 1,024 bits
– A longer modulus length is more secure, but it takes longer to 
generate and to use.
– Generating an RSA key pair automatically enables SSH. 
H.Swaih 31

Secure Remote Access
Configuring SSH
4. Configure user authentication using the username username password 
password global configuration mode command. In the example, the user 
admin is assigned the password class.
5. Configure the vty lines.
– Use the line vty global configuration mode command. The Catalyst 2960 
has vty lines ranging from 0 to 15.
– Enable the SSH using the transport input ssh line configuration mode 
command. This configuration prevents non‐SSH (such as Telnet) 
connections and limits the switch to accept only SSH connections.
– Enable local login using the login local line configuration mode command 
to require local authentication for SSH connections from the local 
username database. 
6. Enable SSH version 2.
– SSH version 1 has known security flaws. 
– Use the ip ssh version 2 global configuration mode command. 
H.Swaih 32

16
1/11/2018

Secure Remote Access
Configuring SSH
switch# config t
switch(config)# hostname S1
S1(config)# ip domain-name cisco.com
S1(config)# crypto key generate rsa
The name for the keys will be: S1.cisco.com
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.

How many bits in the modulus [512]: 1024


% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

*Mar 1 2:59:12.78: %SSH-5-ENABLED: SSH 1.99 has been enabled


S1(config)# username admin secret class
S1(config)# line vty 0 15
S1(config-line)# transport input ssh
S1(config-line)# login local
S1(config-line)# exit
S1(config)# ip ssh version 2
S1(config)#

H.Swaih 33

Secure Remote Access
Verifying SSH

Configure PuTTY
with SSH Client 
Connection 
Parameters

H.Swaih 34

17
1/11/2018

Secure Remote Access
Verifying SSH

Remote Management SSH Connection
H.Swaih 35

Secure Remote Access
Verifying SSH

To display the 
version and 
configuration data 
for SSH on the 
device that you 
configured as an SSH 
server, use the show 
ip ssh command. In 
the example, SSH 
version 2 is enabled. 
To check the SSH 
connections to the 
device, use the show 
ssh command

H.Swaih 36

18
1/11/2018

Switch Port Security
Secure Unused Ports
 A simple method that many administrators use to help secure the network from 
unauthorized access is to disable all unused ports on a switch
 For example, if a Catalyst 2960 switch has 24 ports and there are three Fast 
Ethernet connections in use, it is good practice to disable the 21 unused ports, 
using the interface range command to disable all unused ports one time.
S1(config)#int range fa0/4–24
S1(config-if-range)# shutdown
%LINK-5-CHANGED: Interface FastEthernet0/4, changed state to
administratively down
%LINK-5-CHANGED: Interface FastEthernet0/5, changed state to
administratively down
%LINK-5-CHANGED: Interface FastEthernet0/6, changed state to
administratively down
%LINK-5-CHANGED: Interface FastEthernet0/7, changed state to
administratively down
%LINK-5-CHANGED: Interface FastEthernet0/8, changed state to
administratively down
.....
Note: if any a port must be reactivated, then it can be enabled with the no 
shutdown command. H.Swaih 37

Switch Port Security
Secure Unused Ports
Disabling unused ports is a simple, yet efficient security guideline.

H.Swaih 38

19
1/11/2018

Switch Port Security
Port Security: Operation
 Port security limits the number of valid MAC addresses allowed on a 
port.
 The MAC addresses of legitimate devices are allowed access, while 
other MAC addresses are denied.
 Any additional attempts to connect by unknown MAC addresses 
generate a security violation.
– By default, the port will shut down if the wrong device connects. 
• It has to be brought up again manually
 Secure MAC addresses can be configured in a number of ways:
– Static secure MAC addresses
– Dynamic secure MAC addresses
– Sticky secure MAC addresses
 To verify port security status: show port‐security
H.Swaih 39

Switch Port Security
Port Security: Secure MAC Address Types
 The switch supports these types of secure MAC addresses:
• Static
– Manually Configured using switchport port-security mac-
address mac-address interface configuration mode command.
– Stored in the address table
– Added to running configuration.
• Dynamic
– These are dynamically configured 
– Stored only in the address table
– Removed when the switch restarts
• Sticky
– These are dynamically configured using  switchport port-security
mac-address sticky interface configuration mode command
– Stored in the address table
– Added to the running configuration. 
– If running‐config saved to startup‐config, when the switch restarts, the 
interface does not need to dynamically reconfigure them.
– Note: When you enter this command, the interface converts all the dynamic 
secure MAC addresses, including those that were dynamically learned before 
sticky learning was enabled, to sticky secure MAC addresses. The interface adds 
all the sticky secure MAC addresses to the running configuration.
H.Swaih 40

20
1/11/2018

Switch Port Security
Violation

 Station attempting to access 
the port is different from any 
of the identified secure MAC 
addresses, a security violation 
occurs. 

H.Swaih 41

Switch Port Security
Violation
Switch(config-if)#switchport port-security violation
{protect | restrict | shutdown}

 By default, if the maximum number of connections is achieved and a new 
MAC address attempts to access the port, the switch must take one of the 
following actions: 
 Protect: Frames from the nonallowed address are dropped, but there is no 
log message of the violation (port is not shutdown), which means there is no 
notification that a security violation has occurred.
 Restrict: Frames from the nonallowed address are dropped, a log message is 
created and Simple Network Management Protocol (SNMP) trap sent (port 
is not shutdown), which means there is a notification that a security 
violation has occurred..
 Shut down: If any frames are seen from a nonallowed address, the interface 
is errdisabled, a log entry is made, SNMP trap sent and manual intervention 
(no shutdown) or errdisable recovery must be used to make the interface 
usable.
H.Swaih 42

21
1/11/2018

Switch Port Security
Port Security Defaults
Feature Default setting
Port Security Disabled on a port
Maximum # of Secure 
1
MAC Addresses
Shutdown
• The port shuts down when the maximum
Violation number of secure MAC addresses is exceeded, 
and an SNMP (Simple Network Management 
Protocol ) trap notification is sent.
Sticky Address Learning Disabled
 Secure MAC addresses can be configured as follows:
– Dynamically (learned but not retained after a reboot)
– Statically (prone to errors)
– Sticky (learned dynamically and retained)
H.Swaih 43

Switch Port Security
Configuring Dynamic Port Security

• Learned dynamically
– Switch(config‐if)# switchport mode access (set the interface mode to access)
– Switch(config‐if)# switchport port‐security ( Enable port security on the interface)

• By default, only 1 address is learned.
– Put in MAC address table
– Not shown in running configuration

• It is not saved or in the configuration when switch restarts.
H.Swaih 44

22
1/11/2018

Switch Port Security
Configuring Dynamic Port Security
Commands for Dynamic Port Security
Switch(config-if)#interface FastEthernet0/18
Switch(config-if)#switchport mode access
– Sets the interface mode as access; an interface in the default mode 
(dynamic) cannot be configured as a secure port.
Switch(config-if)#switchport port-security
– Enables port security on the interface

H.Swaih 45

Switch Port Security
Port Security: Verifying

H.Swaih 46

23
1/11/2018

Switch Port Security
Static Secure MAC address

• Static secure MAC address is manually configured in interface config mode

– Switch(config‐if)# switchport mode access
– Switch(config‐if)# switchport port‐security ( Enable port security on the interface)
– Switch(config‐if)# switchport port‐security mac‐address 000c.7259.0a63

• MAC address is stored in MAC address table
• Shows in the running configuration
• Can be saved with the configuration. 

H.Swaih 47

Switch Port Security
Static Secure MAC address
Commands for Static Port Security
Switch(config-if)#interface FastEthernet0/2
Switch(config-if)#switchport mode access
– Sets the interface mode as access; an interface in the default mode 
(dynamic) cannot be configured as a secure port.
Switch(config-if)#switchport port-security
– Enables port security on the interface
Switch(config-if)#switchport port-security maximum 2
– (Optional) Sets the maximum number of secure MAC addresses for the 
interface. The range is 1 to 132; the default is 1.
Switch(config-if)#switchport port-security mac-address
000c.7259.0a63
Switch(config-if)#switchport port-security mac-address
000c.7259.0a67
– MAC address is manually configured on the interface.
Switch(config-if)#switchport port-security violation
shutdown
– (Optional) Set the violation mode, the action to be taken when a security 
violation is detected.  
H.Swaih 48

24
1/11/2018

Switch Port Security
Sticky Secure MAC address

• Dynamically learned and can be retained.
– Switch(config‐if)# switchport mode access
– Switch(config‐if)# switchport port‐security
– Switch(config‐if)# switchport port‐security mac‐address sticky
• You can choose how many can be learned (default 1).
• Added to the running configuration
• Saved only if you save running configuration.
• Note: 
– When you enter this command, the interface converts all the dynamic 
secure MAC addresses, including those that were dynamically learned 
before sticky learning was enabled, to sticky secure MAC addresses. 
– The interface adds all the sticky secure MAC addresses to the running 
configuration. H.Swaih 49

Switch Port Security
Sticky Secure MAC address
Commands for Sticky Port Security
Switch(config)#interface FastEthernet0/19
Switch(config-if)#switchport mode access
– Sets the interface mode as access; an interface in the default mode (dynamic) 
cannot be configured as a secure port.
Switch(config-if)#switchport port-security
– Enables port security on the interface
Switch(config-if)#switchport port-security maximum 10
– (Optional) Sets the maximum number of secure MAC addresses for the interface. 
The range is 1 to 132; the default is 1.
Switch(config-if)#switchport port-security mac-address
0025.83e6.4b02
– (Optional) Enter a static secure MAC address for the interface, repeating the 
command as many times as necessary. You can use this command to enter the 
maximum number of secure MAC addresses. If you configure fewer secure MAC 
addresses than the maximum, the remaining MAC addresses are dynamically 
learned. 
Switch(config-if)#switchport port-security mac-address
sticky
– Enable stick learning on the interface.
Switch(config-if)#switchport port-security violation
shutdown
– (Optional) Set the violation mode, the action to be taken when a security violation 
is detected.   H.Swaih 50

25
1/11/2018

Switch Port Security
Port Security: Verifying

H.Swaih 51

Switch Port Security


Port Security: Verifying (cont.)

Switch#show port-security address


Secure Mac Address Table
---------------------------------------------------------------------
Vlan Mac Address Type Ports Remaining Age
(mins)
----- ------------- --------- ------ -----------
1 0025.83e6.4b02 SecureSticky Fa0/19 -
---------------------------------------------------------------------

H.Swaih 52

26
1/11/2018

Switch Port Security
Port Security: Maximum of 1

Switch(config-if)# switchport port-security maximum 1

 The secure MAC addresses are stored in an address table. 

 Setting a maximum number of addresses to 1  and configuring 
the MAC address of an attached device ensures that the device 
has the full bandwidth of the port.

H.Swaih 53

Switch Port Security
Static Addresses X

Example: Static Secure MAC address

Switch(config)# interface fa 0/1


Switch(config-if)# switchport mode access
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security maximum 3
Switch(config-if)# switchport port-security mac-address 0000.0000.000a
Switch(config-if)# switchport port-security mac-address 0000.0000.000b
Switch(config-if)# switchport port-security mac-address 0000.0000.000c

 Restricts input to an interface by limiting and identifying MAC 
addresses of the stations allowed to access the port.
 The port does not forward packets with source addresses outside the 
group of defined addresses.  H.Swaih 54

27
1/11/2018

Switch Port Security
Ports in Error Disabled State
 A port security violation can put a switch in error disabled 
state.
 A port in error disabled is effectively shutdown.
 The switch communicates these events through console 
messages.

H.Swaih 55

Switch Port Security
Ports in Error Disabled State (cont.)
The show interface command also reveals a switch port on 
error disabled state.

H.Swaih 56

28
1/11/2018

Switch Port Security
Ports in Error Disabled State (cont.)
A shutdown or no shutdown interface configuration mode 
command must be issued to re‐enable the port.

H.Swaih 57

Summary
 When a Cisco LAN switch is first powered on it goes through the following boot 
sequence:
1. First, the switch loads a power‐on self‐test (POST) program stored in ROM. 
POST checks the CPU subsystem. It tests the CPU, DRAM, and the portion of 
the flash device that makes up the flash file system.
2. Next, the switch loads the boot loader software. The boot loader is a small 
program stored in ROM and is run immediately after POST successfully 
completes.
3. The boot loader performs low‐level CPU initialization. It initializes the CPU 
registers, which control where physical memory is mapped, the quantity of 
memory, and its speed.
4. The boot loader initializes the flash file system on the system board.
5. Finally, the boot loader locates and loads a default IOS operating system 
software image into memory and gives control of the switch over to the IOS.
 If the Cisco IOS files are missing or damaged, the boot loader program can be used 
to reload or recover from the problem.
 The operational status of the switch is displayed by a series of LEDs on the front 
panel. These LEDs display such things as port status, duplex, and speed.
H.Swaih 58

29
1/11/2018

Summary
 An IP address is configured on the SVI of the management VLAN to allow for 
remote configuration of the device. A default gateway belonging to the 
management VLAN must be configured on the switch using the ip default‐
gateway command. If the default gateway is not properly configured, remote 
management is not possible. 
 It is recommended that Secure Shell (SSH) be used to provide a secure 
(encrypted) management connection to a remote device to prevent the sniffing 
of unencrypted user names and passwords, which is possible when using 
protocols such as Telnet.
 One of the advantages of a switch is that it allows full‐duplex communication 
between devices, effectively doubling the communication rate. Although it is 
possible to specify the speed and duplex settings of a switch interface, it is 
recommended that the switch be allowed to set these parameters 
automatically to avoid errors.
 Port security is only one defense against network compromise. 

H.Swaih 59

Lab Configurins Switch Security Features

H.Swaih 60

30
1/11/2018

H.Swaih 61

H.Swaih 62

31
1/11/2018

Configuring the Router R1
Continue with configuration dialog? [yes/no]: n
Router>
Router> enable
Router# configure terminal
Router(config)# hostname R1
R1(config)# line console 0
R1(config-line)# logging synchronous
R1(config-line)# exec-time 0 0
R1(config-line)# password cisco
R1(config-line)# login
R1(config-line)# exit
R1(config)# no ip domain-lookup
R1(config)# interface g0/1
R1(config-if)# ip address 172.16.99.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# enable secret class
R1(config)# line vty 0 4
R1(config-line)# password cisco
R1(config-line)# login
R1(config-line)# exit
R1(config)# service password-encryption
R1(config)# end
R1#copy running-config startup-config
Destination filename [startup-config]?
R1#

H.Swaih 63

Configuring the Switch S1
Switch> enable
Switch# configure terminal
Switch(config)# hostname S1
S1(config)# no ip domain-lookup
S1(config)# line console 0
S1(config-line)# logging synchronous
S1(config-line)# exec-time 0 0
S1(config-line)# password cisco
S1(config-line)# login
S1(config-line)# exit
S1(config)# line vty 0 15
S1(config-line)# password cisco
S1(config-line)# login
S1(config-line)# exit
S1(config)# ip default-gateway 172.16.99.1
S1(config)# service password-encryption
S1(config)# end
S1# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
S1#
H.Swaih 64

32
1/11/2018

Configuring the Switch S1
S1# conf t
S1(config)# vlan 99
S1(config-vlan)# name Management
S1(config-vlan)# exit
S1(config)# interface vlan 99
%LINK-5-CHANGED: Interface Vlan99, changed state to up
S1(config-if)# ip address 172.16.99.11 255.255.255.0
S1(config-if)# no shut
S1(config-if)# exit
S1(config)# inter fa0/5
S1(config-if)# switchport mode access
S1(config-if)# switchport access vlan 99
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan99, changed
state to up
S1(config-if) #exit
S1(config)# inter fa 0/6
S1(config-if)# switchport mode access
S1(config-if)# switchport access vlan 99
S1(config-if)# end
S1# copy running-config startup-config
S1#

H.Swaih 65

H.Swaih 66

33
1/11/2018

TO CLEAR A SWITCH
 ALWAYS DO THE FOLLOWING TO CLEAR A SWITCH!!

S1# delete vlan.dat


Delete filename [vlan.dat]?
Delete flash:/vlan.dat? [confirm]

S1# erase startup-config


Erasing the nvram filesystem will remove all configuration files!
Continue? [confirm]
[OK]
Erase of nvram: complete
%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
S1# reload
Proceed with reload? [confirm]

H.Swaih 67

34

You might also like