Understanding VLANs and Spanning Tree Protocol in Networking

Benefits of VLANs with Switches

Administrative Advantages

  • **Virtual LANs based on Diverse Criteria:** Create VLANs based on workgroup, protocol, or service, not just physical location.
  • **Simplified Device Moves:** Easily move devices to new VLANs by modifying port assignments.
  • **Controlled Broadcast Traffic and Collision Domains:** Manage broadcast traffic and create collision domains based on logical criteria.
  • **Enhanced Security:** Isolate traffic within a VLANs for improved security.
  • **Network Traffic Load Balancing:** Distribute traffic logically rather than physically for optimized performance.

Advantages Over Routers

  • **Easier Administration:** Switches are simpler to manage compared to routers.
  • **Cost-Effectiveness:** Switches are generally less expensive than routers.
  • **Higher Performance:** Switches introduce less latency, resulting in better performance.

When Routers Are Still Necessary

  • **WAN Traffic Filtering:** Routers are essential for filtering traffic on Wide Area Networks.
  • **Inter-Network Routing:** Routers are required for routing traffic between separate networks.
  • **Inter-VLAN Routing:** Routers are needed to route packets between different VLANs.

VLAN Configuration Commands

TaskCommand(s)
Define a VLAN
(Optional name; must be unique)
switch(config)#vlan <1-4094>
switch(config-vlan)#name WORD1-4094
Delete a VLAN
(Ports become inactive and need reassignment)
switch(config)#no vlan <1-4094>
Assign Ports to a VLAN
(VLAN created automatically if it doesn’t exist)
switch(config-if)#switchport access vlan <1-4094>
Show VLAN List
switch#show vlan
switch#show vlan brief
Show Specific VLAN Information
switch#show vlan id <1-4064>

VLAN Configuration Example

Creating VLAN 12 named IS_VLAN and assigning port 0/12:

switch#config t
switch(config)#vlan 12
switch(config-vlan)#name IS_VLAN
switch(config-vlan)#interface fast 0/12
switch(config-if)#switchport access vlan 12

Spanning Tree Protocol: An Overview

Benefits of Spanning Tree Algorithm

  • **Elimination of Bridging Loops:** Prevents network loops for stable connectivity.
  • **Redundant Paths:** Provides backup paths for increased network resilience.
  • **Dynamic Role Configuration:** Automatically assigns roles to switches for efficient operation.
  • **Automatic Recovery:** Recovers from topology changes or device failures without manual intervention.
  • **Optimal Path Identification:** Determines the best path between network devices.

Spanning Tree Roles

RoleCharacteristics
Root BridgeThe master bridge; single in the network; determined by lowest Bridge ID (BID); broadcasts configuration messages; all ports forward messages.
Designated BridgeForwards packets; selected automatically; only one per segment to prevent loops.
Backup BridgeListens and builds bridge database but doesn’t forward; takes over if root or designated bridge fails.

Spanning Tree Port States

Port StateDescription
DisabledPowered on but inactive; doesn’t participate in network communication.
BlockingInitial state; receives packets but doesn’t process them; backup bridge ports are always in this state.
ListeningTransition state; allows network to stabilize after changes.
LearningReceives packets and builds bridge database (MAC address to port mapping).
ForwardingRoot and designated bridges; can receive and forward packets.

Spanning Tree Port Types

Port TypeDescription
Root PortDesignated switch port with lowest cost to root bridge; single per designated switch; always forwarding.
Designated PortSingle port per segment; allows sending and receiving frames; selected based on lowest cost to root bridge; always forwarding.
Blocking PortAny port that’s not a root or designated port; prevents loops; always blocking.

Spanning Tree Port Selection Criteria

  1. **Lowest Cost to Root Bridge:** Determines root/designated port based on path cost (e.g., 10 Mbps = 1000, 100 Mbps = 19, 1 Gbps = 4, 10 Gbps = 2).

If costs are equal, bridge ID (priority and MAC address) is compared. Lowest bridge ID wins. If bridge IDs are equal, lowest MAC address wins. If two ports on a switch have the same cost, the port with the lowest port ID (priority and port number) becomes the designated port.

Spanning Tree Enhancements

  • **Port Fast:** Allows ports without connected switches to immediately transition to forwarding state, preventing unnecessary delays.
  • **Uplink Fast:** Enables quick recovery by using an alternate path if the root port or link fails.