zNetLaB › Guided labs › Security
Port security 49 — 1 and 2 MAC, restrict
Security Beginner 3 devices 5 checked tasks 100 points Free lab
Lock the Reception desk ports: Fa0/1 allows 1 MAC address, Fa0/2 allows 2, and a violation must restrict (drop the frame) rather than shut the port. You build it in a browser, type real commands at each device, and every task below is
checked against the running configuration — so you find out it is wrong before anybody else does.
Open this lab in the simulator
The simulator runs in your browser with nothing to install. This is a free lab: it stays open on the free plan. It needs an account, which keeps your progress.
The scenario
Lock the Reception desk ports: Fa0/1 allows 1 MAC address, Fa0/2 allows 2, and a violation must restrict (drop the frame) rather than shut the port.
Your role: a security engineer. Level: Beginner Done when: all 5 goals show as passed (100 points).
Network status
Devices: 1 switch, 2 PCs, cabled as drawn. No Layer 1 or Layer 2 faults: every link is connected and up. SW-Kolhapur starts with and VLAN 18 already configured. Reception-1 is a host with 10.68.0.11/24. Reception-2 is a host with 10.68.0.12/24.
Known problems
None: nothing is misconfigured. The network is simply not finished: what the goals list is what you have to build or secure.
Goals
Both ports are access ports in VLAN 18 (20 pts) Fa0/1 allows exactly 1 MAC (25 pts) Fa0/2 allows exactly 2 MAC (25 pts) The violation mode is restrict (15 pts) The two desks still reach each other (15 pts)
The activity, in order
Both ports are access ports in VLAN 18 On SW-Kolhapur, put FastEthernet0/1 in VLAN 18: interface FastEthernet0/1, switchport mode access, switchport access vlan 18. On SW-Kolhapur, put FastEthernet0/2 in VLAN 18: interface FastEthernet0/2, switchport mode access, switchport access vlan 18.Why: A VLAN is a separate broadcast domain; the port’s VLAN decides which devices can talk without a router. Verify with: show vlan brief Fa0/1 allows exactly 1 MAC Turn on port security on FastEthernet0/1 of SW-Kolhapur with a maximum of 1 MAC address(es).Why: Port security stops somebody plugging an extra switch or laptop into a wall port. Verify with: show port-security Fa0/2 allows exactly 2 MAC Turn on port security on FastEthernet0/2 of SW-Kolhapur with a maximum of 2 MAC address(es).Why: Port security stops somebody plugging an extra switch or laptop into a wall port. Verify with: show port-security The violation mode is restrict The configuration of SW-Kolhapur must contain the line: violation restrict. Type it in the right mode (global, interface or line) and check it appears.Why: This is the task that checks your configuration directly: the line must really be there, not just look right. Verify with: show running-config The two desks still reach each other From Reception-1, ping 10.68.0.12. If it fails, walk the path hop by hop: gateway, then each router’s routing table, then the way back.Why: A ping needs a route in BOTH directions. This is the end-to-end proof that everything before it worked. Verify with: ping 10.68.0.12
Tips
Work in the order given: later goals depend on the earlier ones. After every change, run the verify command before moving on; do not guess. Stuck? Read the verify output first. It names the interface, neighbour or route that is wrong. Common mistake: Enabling port security on a port that is not an access port Common mistake: Setting the maximum too low for a phone plus PC Common mistake: Confusing restrict (logs) with protect (silent)
Why this matters
An access port normally accepts any device that plugs in. Port security limits the number of MAC addresses and decides what happens when a stranger appears: drop, drop and log, or shut the port.
What you will be able to do
Enable port security on an access port
Set the maximum MAC count and violation mode
Explain the three violation modes
The network
Catalyst 2960-24TT, PC — 3 devices in all, already cabled.
Fa0/1 Fa0 Fa0/2 Fa0 SW-Kolhapur Reception-1 10.68.0.11/24 Reception-2 10.68.0.12/24 Drawn from this lab: devices, cables, ports and the addresses already set.
Device Model Address already set
SW-Kolhapur Catalyst 2960-24TT configure it
Reception-1 PC 10.68.0.11 / 255.255.255.0
Reception-2 PC 10.68.0.12 / 255.255.255.0
Cabling
SW-Kolhapur Fa0/1 ↔ Reception-1 Fa0
SW-Kolhapur Fa0/2 ↔ Reception-2 Fa0
What is configured at the start
These are already configured when the lab opens — including, where this is a troubleshooting lab, the fault itself:
SW-Kolhapur vlan 18
exit
Tasks, and how each one is checked
Every task is decided by reading the live network — a neighbour in FULL, a ping that succeeds, a line in the running configuration — not by looking for a keyword you typed. The same command shows you what the lab sees.
# Task Pts How to verify it yourself
1 Both ports are access ports in VLAN 18 20 On SW-Kolhapur: show vlan brief — Fa0/1 is an access port in VLAN 18. and On SW-Kolhapur: show vlan brief — Fa0/2 is an access port in VLAN 18.
2 Fa0/1 allows exactly 1 MAC 25 On SW-Kolhapur: show port-security interface Fa0/1 — maximum 1.
3 Fa0/2 allows exactly 2 MAC 25 On SW-Kolhapur: show port-security interface Fa0/2 — maximum 2.
4 The violation mode is restrict 15 On SW-Kolhapur: show running-config contains the line(s) matching violation restrict.
5 The two desks still reach each other 15 On Reception-1: ping 10.68.0.12 must succeed.
Stuck? Ask the coach
Tell the coach what you see or what you tried. It gives you a hint, not the answer, the way a senior engineer would. Included with a free trial or any plan.
Ask the coach
Common mistakes
Enabling port security on a port that is not an access port
Setting the maximum too low for a phone plus PC
Confusing restrict (logs) with protect (silent)
Reference solution
Try it yourself first — the lab checks your work either way. This is one configuration that makes every task pass, device by device:
SW-Kolhapur interface fa0/1
switchport mode access
switchport access vlan 18
switchport port-security
switchport port-security maximum 1
switchport port-security violation restrict
exit
interface fa0/2
switchport mode access
switchport access vlan 18
switchport port-security
switchport port-security maximum 2
switchport port-security violation restrict
exit
Where this is examined
CCNA 5.0 Security Fundamentals; Security+ 3.2.
This lab practises these topics in the zNetLaB certification courses:
Port security, DHCP snooping, DAI — CCNA · Security Fundamentals
ACLs, ZBFW, 802.1X, MACsec, wireless security — CCNP Enterprise · ENCOR · Security
Access control: ACLs, AAA, remote access and VPNs — CompTIA Network+ · Network Security
Network segmentation, DMZ and firewalls — CompTIA Security+ · Security Architecture
Layer-2 attacks: MAC flooding, VLAN hopping, STP takeover — Ethical Hacking (network level) · Network Attacks and Defences
Port security — Switching and VLAN Mastery · Securing the access layer
Related labs
Where to start
The lessons are open to everyone, all guided labs are listed by track, and
plans explains what is free and what is not.
CCNA®, CCNP® and Cisco® are trademarks of Cisco Systems, Inc. zNetLaB is not affiliated with or endorsed by Cisco.