Configure STP Mode Rapid PVST with PortFast on a Cisco Switch

Spanning Tree Protocol (STP) is essential in preventing network loops in a Layer 2 topology. Rapid Per VLAN Spanning Tree Plus (Rapid PVST+) enhances convergence times compared to traditional STP and operates per VLAN, improving efficiency in VLAN-based environments.

PortFast is an STP enhancement that allows access ports (connected to end devices like PCs) to bypass the listening and learning states, transitioning directly to the forwarding state. This is particularly useful for minimizing delay during device boot-up.

STP

  1. Configure STP mode PVST on a Cisco Switch
  2. Configure STP mode Rapid PVST on a Cisco Switch
  3. Configure STP mode Rapid PVST with PortFast on a Cisco Switch

Use Case

In this topology, we aim to:

  • Configure Rapid PVST on three Cisco switches (S1, S2, and S3).
  • Enable PortFast on interfaces connecting to PCs (Fa0/1 and Fa0/2 on S3).

This configuration ensures:

  1. Rapid convergence of the STP process across the network.
  2. Direct transition to the forwarding state on access ports, improving connectivity times for end devices (PC1 and PC2).

Network Topology

STP mode Rapid PVST with PortFast on a Cisco Switch Topology
STP mode Rapid PVST with PortFast on a Cisco Switch Topology

The topology consists of three switches (S1, S2, and S3) interconnected via GigabitEthernet ports (Gig0/1 and Gig0/2). Two PCs (PC1 and PC2) are connected to FastEthernet interfaces (Fa0/1 and Fa0/2) on switch S3.


Configuration Steps

1. Configure Rapid PVST on Switches

Rapid PVST must be enabled globally on all switches to allow faster STP convergence.

For each switch (S1, S2, S3), follow these steps:

  1. Enter privileged EXEC mode:
    Switch> enable
    
  2. Enter global configuration mode:
    Switch# configure terminal
    
  3. Set the hostname for the switch:
    Switch(config)# hostname <Switch_Name>
    

    Example:

    S1(config)# hostname S1
    
  4. Enable Rapid PVST:
    Switch(config)# spanning-tree mode rapid-pvst
    

2. Enable PortFast on Access Ports

PortFast should only be enabled on interfaces connected to end devices (e.g., PCs). On S3, configure PortFast on interfaces Fa0/1 and Fa0/2:

  1. Enter the interface configuration mode for each port:
    S3(config)# interface fastEthernet 0/1
    
  2. Enable PortFast:
    S3(config-if)# spanning-tree portfast
    
  3. Exit the interface configuration mode:
    S3(config-if)# exit
    
  4. Repeat the above steps for Fa0/2:
    S3(config)# interface fastEthernet 0/2
    S3(config-if)# spanning-tree portfast
    S3(config-if)# exit
    

Final Configuration

  • Switch S1 Configuration
    Switch> enable
    Switch# configure terminal
    S1(config)# hostname S1
    S1(config)# spanning-tree mode rapid-pvst
    
  • Switch S2 Configuration
    Switch> enable
    Switch# configure terminal
    S2(config)# hostname S2
    S2(config)# spanning-tree mode rapid-pvst
    
  • Switch S3 Configuration
    Switch> enable
    Switch# configure terminal
    S3(config)# hostname S3
    S3(config)# spanning-tree mode rapid-pvst
    S3(config)# interface fastEthernet 0/1
    S3(config-if)# spanning-tree portfast
    S3(config-if)# exit
    S3(config)# interface fastEthernet 0/2
    S3(config-if)# spanning-tree portfast
    S3(config-if)# exit
    

Verification Commands

  1. Verify the spanning-tree mode:
    S1# show spanning-tree
    

    Look for the mode set as rapid-pvst.

  2. Check PortFast status on specific interfaces:
    S3# show running-config interface fastEthernet 0/1
    

    Verify the spanning-tree portfast configuration.

  3. Confirm that all ports are in the forwarding state:
    S3# show spanning-tree interface
    

Conclusion

By enabling Rapid PVST with PortFast, the network is optimized for faster convergence and reduced latency for connected devices. This configuration ensures stability and efficiency, particularly in VLAN-based topologies.