How do I... Speed up the switch port initialization process?

When connecting a PC to a Cisco switch, it may sometimes take 30 seconds or more before the PC can communicate on the network. But with a few simple steps, you can shave off 30 seconds or more. In this Cisco Routers and Switches article, David Davis tells you how.

This article is also available as a TechRepublic download.
This article was originally published on May 18, 2006.

When connecting a PC to a Cisco switch, it may sometimes take 30 seconds or more before the PC can communicate on the network. When you're waiting for something to work, 30 seconds can seem like an eternity. Let's look at how you can speed up the switch port initialization process.

Understand the phases of switch port initialization

When you connect a device to an enabled switch port, the switch port goes through four phases by default. Let's take a closer look.

Spanning Tree Protocol (STP) initialization
STP is the IEEE 802.1d protocol, and it prevents loops in a LAN. Testing this switch port is necessary; disabling STP can create a loop on a LAN. If a hub, switch, or router connected to this port, STP would be very important. On the other hand, if a PC, printer, server, or laptop connected to this port (and remains connected ), the STP initialization process isn't necessary.

During the STP initialization phase, the port goes through the five phases of STP: blocking, listening, learning, forwarding, and disabled. This process takes about 15 seconds. However, if you know that a client will remain connected to this port, you can disable the process.

Testing for Ether Channel configuration
The next process the switch port goes through is testing for Ether Channel, which is the bonding together of switch ports to create larger aggregate Ethernet connections. Ether Channel also provides redundancy if one of the channels goes down. This process, which uses the Port Aggregation Protocol (PAgP), takes about 15 seconds.

Testing for trunk configuration
Next, the switch tests to see if the port is a trunk port. Trunking delivers data for multiple VLANs across a single switch port. While testing for a trunk port doesn't take that long, you can disable it to save a few more seconds.

Auto-negotiation of switch port speed and duplex
Finally, the switch port goes through auto-negotiation of the speed and duplex. For example, a switch port may support 1000-Mb (1Gb) Full Duplex, but a client PC may only support 100-Mb Full Duplex. The switch and the client work this out to negotiate the fastest speed that both can support.

You can hard-code this process to save time on the switch port initialization. However, this isn't always the best option because you may never know the speed that a client supports. This auto-negotiation doesn't take that long, so it may be worth it when compared to hard-coding the speed and duplex of every switch port.

Now that we've reviewed the different phases of switch port initialization, let's look at how you can lessen the time this process takes.

Reduce switch port initialization
time

On a Cisco IOS-based switch, you can save 30 seconds or more on new port initialization time by following these steps:

  1. Put the switch port in Access Mode. This disables trunk negotiation and prevents the port from going through Ether Channel negotiation. This shaves about 15 seconds off of the switch port initialization.
  2. Configure PortFast. This saves the port from going through STP negotiation and cuts another 15 seconds from the switch port initialization.

Here's an example:

Switch(config)# int fa0/21
Switch(config-if)# switchport mode access       
Switch(config-if)# spanning-tree portfast       
%Warning: Only enable PortFast on ports connected to a single host. 
Connecting hubs, concentrators, switches, bridges, etc. to this 
interface when you've PortFast can cause temporary bridging loops. 
Use with CAUTION.

%This has configured PortFast on FastEthernet0/21 but will only 
have an effect when the interface is in a non-trunking mode. 
Switch(config-if)# no shutdown 
Switch(config-if)#

You can also configure this on a range of ports. Here's an example:

Switch(config)# int range fastEthernet 0/1 - 24
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# spanning-tree portfast 

As a shortcut to entering these two commands, you can use the following command:

Switch(config-if-range)# switchport host

This will configure both the switchport mode access and spanning-tree portfast commands for you.

Optionally, you could manually configure the switch port's speed and duplex, saving a few more seconds. Here's an example:

Switch(config-if)#  speed 100
Switch(config-if)# duplex full

Disabling STP initialization, trunk negotiation, and Ether Channel negotiation can shave 30 seconds off the switch port initialization process. In addition, you can easily do this for all ports on the switch using the interface range command.

Miss a column?

Check out the Cisco Routers and Switches Archive, and catch up on David Davis' most recent columns.

Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!

David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.