Understand how switches operate, learn VLAN segmentation, implement trunking, and configure port security to control access.
-
MAC Address Table: Switch learns MAC addresses on ports and forwards frames accordingly
-
Forwarding Methods:
-
Store-and-Forward ✅ (Default)
-
Cut-Through
-
-
Collision Domains: Switch breaks collision domains per port
-
Broadcast Domain: VLANs define broadcast boundaries
-
Purpose: Logically segment LANs for security and efficiency
-
Default VLAN: VLAN 1
-
VLAN Range: 1–4094
Switch(config)#vlan 10
Switch(config-vlan)#name HR
Switch(config)#interface fa0/1
Switch(config-if)#switchport access vlan 10
Switch#show vlan brief
-
802.1Q: Trunking protocol adds tags to frames
-
Trunk Ports: Allow multiple VLANs
Switch(config)#interface g0/1
Switch(config-if)#switchport mode trunk
Switch#show interfaces trunk
Router(config)#interface g0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 192.168.10.1 255.255.255.0
Switch(config)#interface g0/1
Switch(config-if)#switchport mode trunk
-
Purpose: Prevent Layer 2 loops by blocking redundant links
-
STP States:
-
Blocking
-
Listening
-
Learning
-
Forwarding
-
Disabled
-
Switch#show spanning-tree
-
Prevent unauthorized devices from connecting to switch ports
-
Sticky MAC: Automatically learns MAC and stores in config
-
Violation Modes:
-
Protect (drops traffic)
-
Restrict (logs violations)
-
Shutdown (default; disables port)
-
Switch(config)#interface fa0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security maximum 1
Switch(config-if)#switchport port-security violation shutdown
Switch(config-if)#switchport port-security mac-address sticky
Switch#show port-security
Switch(config)#vlan 20
Switch(config-vlan)#name SALES
Switch(config)#interface range fa0/2-3
Switch(config-if-range)#switchport access vlan 20
Switch(config)#interface g0/1
Switch(config-if)#switchport mode trunk
Router(config)#interface g0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.20.1 255.255.255.0
-
What does STP prevent?
-
A) MAC address flooding
-
B) IP conflicts
-
C) Layer 2 loops ✅
-
D) VLAN tagging
-
-
What command sets a switchport to trunk?
-
A) switchport vlan trunk
-
B) switchport mode trunk ✅
-
C) switchport encapsulation 802.1Q
-
D) switchport trunk enable
-
-
What happens when port security violation occurs (default)?
-
A) Log only
-
B) Disable port ✅
-
C) Drop frame silently
-
D) Reboot switch
-
-
VLANs segment Layer 2 networks logically
-
Trunking allows VLANs to traverse links
-
STP ensures loop-free topologies
-
Port security helps mitigate unauthorized access