PXE vs STP

We have an old Cisco 2950 switch that was lying around not being used for anything, and decided that we needed it for lab purposes.  Part of it’s duties would be a place to plug in computers that were going to be imaged.

Before I go any further, let me point out that I recognize that this is a 100 MB switch, and that a 1 GB switch would be better suited for this task.  Working at a non-profit though, sometimes you just have to take whatever you can get.  Plus, speed is not a high priority here.  We normally just set a computer (or 2 or 3) up to image, let it run, and come back to check on it later.

We are currently using FOG for imaging.  FOG is great, and relies on the ability of the computer to be able to PXE boot from the FOG server.  The problem however was that computers that were plugged into this 2950 were not PXE booting.  We knew it was the switch because we had used another unmanaged switch in that past, and it worked fine.

A coworker did some digging into this, and realized that the computer was timing out before it was able to pull an IP address from DHCP.  If you are familiar with Cisco switches, you know that when you plug in a computer it takes a while for that port light to turn from orange to green.  A little more digging by both of us, and we basically found two things that contribute to this delay.

The first culprit is Spanning Tree Protocol.  As you probably know, STP is the protocol that allows for redundant links from one swtich to another.  If one goes down, the other will kick in.  STP detects these redundant links, and disables one of them so that there are not switching loops.  When you are waiting for that port light to turn from orange to green, the switch is checking things out to make sure that there aren’t any switching loops going on before it enables that port.  You can however get around this with PortFast.

PortFast basically tells the switch not to bother checking for redundant links to other switches.  It’s pretty easy to enable as well.  After it is enabled, the switch will throw a warning that this port should only be connected to a single host.  No worries here, because this is exactly what we are doing.

Now for the second culprit, the switchport mode.  Generally, when we think of these ports we either think of them as being access ports or trunk ports.  Cisco has another mode called dynamic desirable that we sometimes forget about.  And on this particular switch, unless you specify something else, dynamic desirable is what is turned on by default.

Think of dynamic desirable mode as auto-negotiation for trunking.  Basically, when the port first comes on, it will listen to see what’s connected, and if there’s another trunk port on the other end it configures the port to be a trunk port.  This waiting and listening contributes to the time it takes for that port light to turn from orange to green.  It’s a simple matter of setting the port to be an access port to eliminate this delay.  Cisco actually recommends that you do this for any port where you use PortFast as well.  As always, don’t forget to save your config when you are done.