Switching & VLAN Fundamentals
Understanding switch operations, VLAN configuration, and network management
Switching Fundamentals
How switches operate and forward frames in a network
- Switches use MAC addresses to forward frames at Layer 2
- MAC Address Table stores MAC address-to-port mappings
- Switches learn source MACs and forward based on destination MACs
- Unknown unicasts are flooded to all ports except the source
| Feature | Function |
|---|---|
| Fast Port Speeds | Up to 100Gbps depending on model |
| Fast Internal Switching | Uses bus or shared memory for performance |
| Large Frame Buffers | Temporary storage for frame processing |
| High Port Density | More ports for LAN connectivity at lower cost |
- Collision Domains: Each switch port is its own collision domain
- Broadcast Domains: VLANs create separate broadcast domains
- Alleviated Congestion: Microsegmentation reduces network congestion
- Security: Port security and VLANs enhance network security
Switch Boot Process
How Cisco switches initialize and load the operating system
POST - Power-On Self-Test
Switch loads POST program from ROM to check CPU, DRAM, and flash memory components
Boot Loader
Small program in ROM runs after POST completion to initialize the boot process
CPU Initialization
Boot loader initializes CPU registers controlling memory mapping and speed
Flash File System
Boot loader initializes the flash file system on the system board
IOS Loading
Boot loader locates and loads default IOS into memory, transferring control to IOS
Switch# configure terminal
Switch(config)# boot system flash:c2960-lanbasek9-mz.150-2.SE.bin
Switch(config)# exit
Switch# copy running-config startup-config
Switch LED Indicators
Understanding switch status through LED indicators
System LED (SYST)
Shows system power and functionality status
RPS LED
Redundant Power Supply status indicator
Port Status LED (STAT)
Default mode showing port connection status
Port Duplex LED (DUPLX)
Shows port duplex mode when selected
| LED Color | System LED | Port Status LED | Port Duplex LED | Port Speed LED |
|---|---|---|---|---|
| Green | System operational | Link present | Full duplex | Speed detected |
| Amber | System malfunction | No link/blocked | Half duplex | Speed not detected |
| Blinking Green | POST in progress | Activity present | N/A | N/A |
| Off | No power | No link | No connection | No connection |
Switch Management & Configuration
Configuring switches for remote management and basic operations
- Configure SVI (Switch Virtual Interface) for management
- Assign IP address and subnet mask to SVI
- Configure default gateway for remote management
- Use console cable for initial configuration
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)# ip default-gateway 172.17.99.1
Duplex Configuration
- Full-duplex: Simultaneous transmit/receive
- Half-duplex: One direction at a time
- Microsegmentation: Each port is its own collision domain
S1(config-if)# duplex full
S1(config-if)# speed 100
S1(config-if)# mdix auto
- Automatically detects cable type (straight-through/crossover)
- Eliminates need for different cable types
- Enabled by default on Catalyst 2960/3560 switches
- Requires speed and duplex set to auto
S1# show controllers ethernet-controller phy | include Auto-MDIX
Switch Verification & Troubleshooting
Essential commands for monitoring and troubleshooting switches
| Task | IOS Command |
|---|---|
| Display interface status | show interfaces [interface-id] |
| Display startup configuration | show startup-config |
| Display running configuration | show running-config |
| Display flash file system | show flash |
| Display system status | show version |
| Display command history | show history |
| Display IP interface info | show ip interface [interface-id] |
| Display MAC address table | show mac-address-table or show mac address-table |
Common Interface Status Scenarios
- Interface up, line protocol down: Encapsulation mismatch, error-disabled port, or hardware issue
- Both interface and line protocol down: Cable not attached or interface problem
- Interface administratively down: Manually disabled with shutdown command
Common Media Errors
| Error Type | Description |
|---|---|
| Input Errors | Total errors including runts, giants, CRC, frame, overrun |
| Runts | Packets smaller than minimum size (e.g., < 64 bytes for Ethernet) |
| Giants | Packets larger than maximum size (e.g., > 1518 bytes for Ethernet) |
| CRC Errors | Checksum mismatch between calculated and received |
| Collisions | Ethernet collisions requiring retransmission |
| Late Collisions | Collisions occurring after 512 bits transmitted |
SSH Configuration
Secure remote management using SSH instead of Telnet
Verify SSH Support
Check if switch IOS supports cryptographic features (look for "k9" in filename)
Configure IP Domain
Set the domain name for the network
Generate RSA Key Pair
Create encryption keys (automatically enables SSH)
Configure User Authentication
Create local username and password
Configure VTY Lines
Enable SSH on virtual terminal lines
S1(config-line)# transport input ssh
S1(config-line)# login local
Enable SSH Version 2
Use more secure SSH version
SSH (Secure)
- TCP port 22
- Encrypted communication
- Secure authentication
- Protects against eavesdropping
- Recommended for management
Telnet (Insecure)
- TCP port 23
- Clear text communication
- Passwords visible to sniffers
- Vulnerable to attacks
- Should be disabled
VLAN Fundamentals
Virtual LANs for network segmentation and security
- Logical connections between similar devices
- Segments devices into groups on same switches
- Isolates broadcast, multicast, and unicast traffic
- Each VLAN has unique IP addressing range
- Creates smaller broadcast domains
| Benefit | Description |
|---|---|
| Smaller Broadcast Domains | Dividing LAN reduces broadcast domains |
| Improved Security | Only same VLAN users can communicate |
| Improved IT Efficiency | Groups devices with similar requirements |
| Reduced Cost | One switch supports multiple VLANs |
| Better Performance | Small broadcast domains reduce traffic |
| Simpler Management | Similar groups need similar resources |
VLAN Types
Different VLAN categories and their purposes
- VLAN 1 is the default VLAN
- Default Native VLAN
- Default Management VLAN
- Cannot be deleted or renamed
- Cisco recommends assigning default features to other VLANs
Switch# show vlan brief
VLAN Name Status Ports
---- ---------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
- Dedicated to user-generated traffic
- Email and web traffic
- VLAN 1 is default data VLAN
- All interfaces assigned to VLAN 1 by default
- Used for trunk links only
- Frames not tagged on 802.1Q trunk
- Legacy device compatibility
- VLAN 1 is default native VLAN
- Used for SSH/Telnet VTY traffic
- Should not carry end user traffic
- Typically the SVI for Layer 2 switch
- Enhanced security separation
- Separate VLAN for voice traffic
- Assured bandwidth requirement
- High QoS priority
- Delay less than 150ms required
- Entire network must support voice
VLAN Configuration
Creating and managing VLANs on Cisco switches
| Normal Range (1-1005) | Extended Range (1006-4095) |
|---|---|
| Small to medium businesses | Service Providers |
| 1002-1005 reserved for legacy | Stored in running-config |
| 1, 1002-1005 auto-created | Fewer VLAN features |
| Stored in vlan.dat file | Requires VTP configuration |
| VTP synchronization |
S1(config)# vlan 20
S1(config-vlan)# name student
S1(config-vlan)# end
- Create VLAN first, then name it
- Default name: vlanXXXX (e.g., vlan0020)
- Changes saved to vlan.dat file
S1(config)# interface fa0/18
S1(config-if)# switchport mode access
S1(config-if)# switchport access vlan 20
S1(config-if)# end
- Set port to access mode first
- Assign to specific VLAN
- End device needs VLAN IP information
S1(config-vlan)# name student
S1(config-vlan)# vlan 150
S1(config-vlan)# name VOICE
S1(config-vlan)# exit
S1(config)# interface fa0/18
S1(config-if)# switchport mode access
S1(config-if)# switchport access vlan 20
S1(config-if)# mls qos trust cos
S1(config-if)# switchport voice vlan 150
S1(config-if)# end
- Access port supports one data VLAN + one voice VLAN
- QoS required for voice traffic prioritization
- Newer switches auto-create VLANs if missing
VLAN Verification & Management
Verifying VLAN configurations and making changes
S1# show vlan brief
S1# show vlan id 20
S1# show vlan name student
S1# show vlan summary
S1# show interfaces fa0/18 switchport
| Command Option | Purpose |
|---|---|
brief |
VLAN name, status, ports per line |
id vlan-id |
Specific VLAN ID information |
name vlan-name |
Specific VLAN name information |
summary |
VLAN summary information |
S1(config)# interface fa0/18
S1(config-if)# no switchport access vlan
S1(config-if)# end
# Verify return to VLAN 1
S1# show vlan brief
S1# show interfaces fa0/18 switchport
- Re-enter switchport access vlan command to change
- Use "no switchport access vlan" to return to VLAN 1
- Verify with show vlan brief or show interfaces switchport
S1(config)# no vlan 20
# Delete all VLANs
S1# delete flash:vlan.dat
S1# delete vlan.dat
S1# reload
VLAN Trunking
Extending VLANs across multiple switches
- Point-to-point link between network devices
- Allows multiple VLAN traffic
- Extends VLANs across entire network
- Supports all VLANs by default
- Uses 802.1Q trunking protocol
| Field | Function |
|---|---|
| Type (TPID) | 2-byte field with hex 0x8100 |
| User Priority | 3-bit QoS priority value |
| CFI | 1-bit for token ring compatibility |
| VLAN ID (VID) | 12-bit identifier (supports 4096 VLANs) |
- 4-byte header added to frames
- FCS recalculated when tag added/removed
- Tag removed when sent to end devices
S1(config)# interface fa0/1
S1(config-if)# switchport mode trunk
S1(config-if)# switchport trunk native vlan 99
S1(config-if)# switchport trunk allowed vlan 10,20,30,99
S1(config-if)# end
Native VLAN Facts:
- Typically VLAN 1 by default
- Both ends must match
- Designed for legacy devices
- Frames not tagged on native VLAN
Voice VLAN Tagging:
- VoIP phone acts as 3-port switch
- CDP informs phone of voice VLAN
- Phone tags its own voice traffic
- Sets CoS (QoS at Layer 2)
Dynamic Trunking Protocol (DTP)
Cisco proprietary protocol for automatic trunk negotiation
- Cisco proprietary protocol
- On by default on Catalyst switches
- Dynamic-auto default on 2960/2950
- Can be turned off with nonegotiate
- Best practice: set static trunk/access
S1(config-if)# switchport nonegotiate
| Mode | Description |
|---|---|
| access | Permanent access mode |
| dynamic auto | Becomes trunk if neighbor is trunk/desirable |
| dynamic desirable | Actively seeks to become trunk |
| trunk | Permanent trunking mode |
S1# show dtp interface fa0/1
# Sample output:
TOS/TAS/TNS: ACCESS/AUTO/ACCESS
TOT/TAT/TNT: NATIVE/NEGOTIATE/NATIVE
Hello timer: 11/RUNNING
FSM state: S2:ACCESS
Enabled: yes
| Dynamic Auto | Dynamic Desirable | Trunk | Access | |
|---|---|---|---|---|
| Dynamic Auto | Access | Trunk | Trunk | Access |
| Dynamic Desirable | Trunk | Trunk | Trunk | Access |
| Trunk | Trunk | Trunk | Trunk | Limited Connectivity |
| Access | Access | Access | Limited Connectivity | Access |