Cyber Services / All lessons / CCNA — Networking / Day 4 — Switching & VLAN

Day 4 — Switching & VLAN

Module 4 of 12 · 8 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Switching & VLAN Fundamentals

Understanding switch operations, VLAN configuration, and network management

Switching Concepts
VLAN Configuration
Network Management

Switching Fundamentals

How switches operate and forward frames in a network

Frame Forwarding
  • 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
Switch Benefits
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
Network Domains
  • 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

1

POST - Power-On Self-Test

Switch loads POST program from ROM to check CPU, DRAM, and flash memory components

2

Boot Loader

Small program in ROM runs after POST completion to initialize the boot process

3

CPU Initialization

Boot loader initializes CPU registers controlling memory mapping and speed

4

Flash File System

Boot loader initializes the flash file system on the system board

5

IOS Loading

Boot loader locates and loads default IOS into memory, transferring control to IOS

# Boot system command example
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

Switch Management Access
  • 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# configure terminal
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
Port Configuration

Duplex Configuration

  • Full-duplex: Simultaneous transmit/receive
  • Half-duplex: One direction at a time
  • Microsegmentation: Each port is its own collision domain
S1(config)# interface FastEthernet 0/1
S1(config-if)# duplex full
S1(config-if)# speed 100
S1(config-if)# mdix auto
Auto-MDIX Feature
  • 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
# Verify Auto-MDIX status
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
Network Access Layer Issues

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

1

Verify SSH Support

Check if switch IOS supports cryptographic features (look for "k9" in filename)

S1# show ip ssh
2

Configure IP Domain

Set the domain name for the network

S1(config)# ip domain-name example.com
3

Generate RSA Key Pair

Create encryption keys (automatically enables SSH)

S1(config)# crypto key generate rsa
4

Configure User Authentication

Create local username and password

S1(config)# username admin secret ccna123
5

Configure VTY Lines

Enable SSH on virtual terminal lines

S1(config)# line vty 0 15
S1(config-line)# transport input ssh
S1(config-line)# login local
6

Enable SSH Version 2

Use more secure SSH version

S1(config)# ip ssh version 2
SSH vs Telnet

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

VLAN Definitions
  • 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
VLAN Benefits
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

Default VLAN
  • 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
# Show VLAN brief
Switch# show vlan brief
VLAN Name Status Ports
---- ---------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Data VLAN
  • Dedicated to user-generated traffic
  • Email and web traffic
  • VLAN 1 is default data VLAN
  • All interfaces assigned to VLAN 1 by default
Native VLAN
  • Used for trunk links only
  • Frames not tagged on 802.1Q trunk
  • Legacy device compatibility
  • VLAN 1 is default native VLAN
Management VLAN
  • Used for SSH/Telnet VTY traffic
  • Should not carry end user traffic
  • Typically the SVI for Layer 2 switch
  • Enhanced security separation
Voice VLAN
  • 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

VLAN Ranges
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
VLAN Creation
S1# configure terminal
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
Port Assignment
S1# configure terminal
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
Data and Voice VLAN Configuration
S1(config)# vlan 20
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

VLAN Verification Commands
# Show VLAN information
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
VLAN Port Changes
# Remove VLAN assignment
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
VLAN Deletion
# Delete specific VLAN
S1(config)# no vlan 20

# Delete all VLANs
S1# delete flash:vlan.dat
S1# delete vlan.dat
S1# reload
Caution: Before deleting a VLAN, reassign all member ports to a different VLAN.

VLAN Trunking

Extending VLANs across multiple switches

Trunk Definition
  • 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
802.1Q Tagging
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
Trunk Configuration
# Configure trunk port
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

DTP Characteristics
  • 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
# Disable DTP negotiation
S1(config-if)# switchport nonegotiate
Switchport Modes
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
DTP Verification
# Check DTP status
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
DTP Negotiation Results
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
Modules (12) ← CCNA — Networking