Setting a Switch Port for use by a Host
catOS set port host
Ios switchport host
Full Page from Cisco.
If you have recently migrated from a hub environment to a switch environment, startup connectivity delays may appear because a switch works much differently than a hub. A switch provides connectivity at the Data Link layer, not at the Physical layer. The switch uses a bridging algorithm to decide if packets received on a port need to be transmitted out other ports. The bridging algorithm is susceptible to physical loops in the network topology. Because of this susceptibility to loops, switches run the protocol STP that causes loops to be eliminated in the topology. The running of the STP causes all ports that are included in the spanning-tree process to become active much slower than they otherwise would, as it detects and blocks loops. A bridged network having physical loops, without STP, will break. So despite the time involved, STP is a good thing. STP running on Catalyst switches is an industry standard specification (IEEE 802.1d).
After a port on the switch has linked and joined the bridge group, it will run STP on that port. A port running STP can have 1 of 5 states: blocking, listening, learning, forwarding and disabled. STP dictates that the port starts out blocking, then immediately moves through the listening and learning phases. By default it will spend approximately 15 seconds listening and 15 seconds learning. During the listening state, the switch is trying to determine where the port fits in the spanning-tree topology. The switch especially wants to know whether this port is part of a physical loop. If it is part of a loop, then this port may be chosen to go into blocking mode. Blocking means it won't send or receive user data for the sake of eliminating loops. If the port is not part of a loop, it will proceed to the learning state which involves learning which MAC addresses live off of this port. This entire STP initialization process takes about 30 seconds.
If you are connecting a workstation or a server with a single NIC card to a switch port, this connection cannot create a physical loop. These connections are considered leaf nodes. There is no reason to make the workstation wait 30 seconds while the switch checks for loops when the workstation cannot cause a loop. So, Cisco added a feature named "portfast" or "fast-start," which means the STP for this port will assume that the port is not part of a loop and will immediately move to the forwarding state, without going through the blocking, listening, or learning states. This command does not turn STP off. It just makes STP skip a few (unnecessary in this circumstance) steps in the beginning on the selected port.
Another feature a switch may have is named EtherChannel, Fast EtherChannel, or Gigabit EtherChannel. This feature allows multiple links between the same two devices to work as if they were one fast link, with traffic load balanced among the links. A switch can form these bundles automatically with a neighbor using PAgP. Switch ports that can run PAgP usually default to a passive mode named auto mode which means that they are willing to form a bundle if the neighbor device across the link asks them to. Running the protocol in auto mode can cause a port to delay for up to 15 seconds before passing control to the spanning-tree algorithm (PAgP runs on a port before STP does). There is no reason to have PAgP running on a port connected to a workstation. Setting the switch port PAgP mode to off will eliminate this delay.
Another switch feature is the ability of a port to form a trunk. A trunk is configured between two devices when they need to carry traffic from multiple VLANs. A VLAN is what switches create to make a group of workstations appear to be on their own segment or broadcast domain. Trunk ports make these VLANs extend across multiple switches, so that a single VLAN can cover an entire campus. The truck ports do this by adding tags to the packets, indicating which VLAN the packet belongs to.
There are different types of trunking protocols. If a port can become a trunk, it may also have the ability to trunk automatically, and in some cases even negotiate what type of trunking to use on the port. DTP provides this ability to negotiate the trunking method with the other device. The precursor to DTP is a protocol named Dynamic ISL (DISL). If these protocols are running, they can delay a port on the switch from becoming active.
Usually a port connected to a workstation belongs to only one VLAN, and therefore does not need to trunk. If a port has the ability to negotiate the formation of a trunk it will usually default to the auto mode. If the port is changed to a trunking mode of off, it will further reduce the delay of a switch port becoming active.
Speed and Duplex Negotiation
Just turning on portfast and turning off PAgP (if present) is usually enough to solve an initial connectivity delay. If you need to eliminate every possible second, you could also set the port speed and duplex manually on the switch, if it is a multi-speed port (10/100). Auto-negotiation is a nice feature but turning it off could save you 2 seconds on a Catalyst 5000. (It does not help much on the Catalyst 2800 or Catalyst 2900XL.)