Alpha Centauri Studies
CoursesFor Institutions

Loading...

Alpha Centauri Studies

CSEC past papers, worked

Past papers worked question by question, and courses built on the CSEC syllabus, for students across the Caribbean.

Serving Caribbean students since 2025

Explore

CoursesAboutContact

Support

PrivacyTermsHelp

Subscribe to Our Newsletter

New papers and courses, when they land.

Connect With Us
© 2026 Alpha Centauri Studies. All rights reserved.
5.7 Configure and verify Layer 2 security features

TutorialLab 1235 min

Lab 123: Configuring Port Security

Lab 123: Configuring Port Security

You can control to access your switch port. For example, you can control who can access a specific interface of a switch or how many devices could be connected to a specific switch interface. There is a feature called Switch Port Security that allow you to do so. In this exercise, we will explain how to configure switch port security.

Before configuring switch port security on a switch, let’s have a look at the commands used to configure it.

In the following figure, the first command shows the sub-commands that are used to configure switch port related options. The second command shows the sub-commands that are used to configure port security related options.

An IOS Command Line Interface window titled Switch1 using context help to find the port security commands. switchport ? lists access for access mode characteristics, mode for the trunking mode, native for trunking native characteristics when the interface is in trunking mode, nonegotiate for a device that will not engage in negotiation protocol on this interface, port-security described only as Security related command, priority for appliance 802.1p priority, trunk for trunking characteristics and voice for voice appliance attributes. switchport port-security ? then lists mac-address for a secure mac address, maximum for max secure addresses, violation for the security violation mode, and <cr>. The nonegotiate description is clipped by the right edge of the window and reads "on thi" before wrapping to "interface".

Configuration

We will use the following topology to configure switch port security. Create the following topology in Cisco Packet Tracer.

The Packet Tracer topology for the port security lab: a single 2960-24TT switch, labelled only Switch, with one PC-PT named PC1 connected below it by a straight cable. No port numbers, VLANs or IP addresses are marked on the figure.

  1. First of all open the Command Prompt of PC1 and execute the ipconfig /all command and note down its MAC address.

A Packet Tracer Command Prompt on PC1 showing the banner Packet Tracer PC Command Line 1.0 and the output of ipconfig /all. The Physical Address is 00D0.BC9A.42DC, boxed in red because it is the MAC the student will configure as the secure address. IP Address, Subnet Mask, Default Gateway and DNS Servers are all 0.0.0.0, the PC has no addressing. The window ends at the PC> prompt.

  1. Next, switch to the interface on which you want to implement port security. For example interface Fa0/ 1.
Switch( config)# interface fa0/ 1
  1. Next, execute the following commands to enable the access mode and port security feature.
Switch1( config-if)# switchport mode access
Switch1( config-if)# switchport port-security
  1. Next, execute the following commands to bind the MAC address that you want to allow to access this interface and to set the maximum number of MAC addresses to this interface.
Switch1( config-if)# switchport port-security mac-address 00D0. BC9A. 42DC
Switch1( config-if)# switchport port-security maximum 1
  1. Next, execute the following commands to set the violation policy and exit from the interface configuration mode.
Switch1( config-if)# switchport port-security violation shutdown
Switch1( config-if)# exit
Switch1( config)# exit
  1. The following figure shows the port-security configuration options.

An IOS Command Line Interface window titled Switch, showing port security being applied to one access port. The student enters interface fa0/1, sets switchport mode access, turns on switchport port-security, binds the secure address with switchport port-security mac-address 00D0.BC9A.42DC, limits the port with switchport port-security maximum 1, sets switchport port-security violation shutdown, then exits twice to the Switch# prompt. The hostname is never changed from the default Switch.

  1. Next, execute the following command to show the MAC addresses associated with the interfaces, as shown in the following figure.
Switch# show port-security address
  1. The following figure port-security configuration example.

The output of show port-security address on the switch, headed Secure Mac Address Table. The table has one entry: Vlan 1, Mac Address 00D0.BC9A.42DC, Type SecureConfigured, Port FastEthernet0/1. The MAC and the command itself are boxed in red in the source. Below the table, Total Addresses in System (excluding one mac per port) is 0 and Max Addresses limit in System (excluding one mac per port) is 1024. The fourth column header is clipped by the right edge of the window and shows only "Remain" with "(mins)" wrapped beneath it, so the full header cannot be read, and the entry's own value in that column is off screen.

  1. Next, execute the following command to show the port security settings of the interface Fa0/ 1, as shown in the following figure.
Switch# show port-security interface 0/ 1

The output of show port-security interface fa0/1, with Enabled, Shutdown and the Configured MAC Addresses count highlighted in pink in the source. Port Security is Enabled, Port Status is Secure-up, Violation Mode is Shutdown, Aging Time is 0 mins, Aging Type is Absolute, SecureStatic Address Aging is Disabled, Maximum MAC Addresses is 1, Total MAC Addresses is 1, Configured MAC Addresses is 1, Sticky MAC Addresses is 0, Last Source Address:Vlan is 0000.0000.0000:0 and Security Violation Count is 0. A partial line above the command, the tail of the previous Max Addresses limit output, is scrolled behind the window border.

Source: itexamanswers.net