Remember from earlier chapters that switches operate at Layer 2 of the Open Systems Interconnection (OSI) model.
The technology upon which Layer 2 switches operate is the same as that provided by Ethernet bridges. The basic operation of a switch involves the following:
Discovering MAC AddressesLike a bridge, a switch monitors all frames that pass through it to learn the MAC addresses of each device connected to its ports. This information is stored in a database called a filter table . The switch consults the filter table each time it receives a frame to determine whether to forward the frame to a different port or to drop it. When the switch is initially booted up, the filter table is empty. Forwarding or filtering decisions cannot be made with an empty database, so initially each incoming frame is forwarded through all the switch's ports. This is called flooding the frame . As flooding occurs, the switch begins to learn the MAC addresses and associate them with one of its ports. This address-learning process is a continual operation of the switch. Each MAC database entry is stored in memory and is valid only for a preset interval. If a new frame does not refresh the entry, the entry is discarded. Filtering and ForwardingEach time the switch receives a frame, it examines the destination MAC address. If this address exists in the MAC database, the frame is forwarded only through the switch port associated with the address. This process frees all the segments connected to different ports of the excess bandwidth taken by the frame. This is known as frame filtering . Whenever the destination MAC address is unknown, the frame is flooded to all switch ports. This is undesirable because it wastes bandwidth. Preventing LoopsBoth bridges and switches introduce the possibility of creating a bridged network with multiple paths to a single destination. Typically, this type of redundancy is considered favorable, but for switches and bridges it can cause problems in the form of bridging loops , which occur when circular connections exist in a bridged network. Figure 6.1 illustrates a bridged network with bridging loops. Figure 6.1. Switches and bridges can create loops if improperly positioned.
For example, if someone sends a broadcast message from segment 2, the message would be forwarded to physical segment 3 by bridges B and C. Bridge A would then receive two broadcasts and forward both broadcasts to physical segment 1. Bridge D would have forwarded this broadcast to physical segment 1 as well. Subsequently, bridge D will receive the two broadcasts forwarded by bridge A and forward these frames to physical segment 2. This continuous forwarding of broadcast packets wastes bandwidth. With more complex bridged networks, the broadcast packets can be forwarded exponentially, leading to what is termed a broadcast storm . This occurs when so many broadcasts are being continuously forwarded that they consume all the available bandwidth. The Spanning Tree Protocol, which implements an algorithm that removes all circular connections in a bridged network, eliminates bridging loops. Spanning Tree ProtocolThe Spanning Tree Protocol creates a loop-free network topology by placing connections that create loops in a blocking state. It is important to note that this protocol does not eliminate loops but rather only blocks the connections that create the loops. Loops in a network often provide needed redundancy in the case of a physical connection being disconnected. The Spanning Tree Protocol maintains the benefits of redundancy while eliminating the disadvantages of looping. To illustrate how the Spanning Tree Protocol functions, we will use the bridged network shown earlier in Figure 6.1. The Spanning Tree Protocol selects a root bridge in the network (in this case, bridge A).
Next, every other bridge selects one of its ports with the least path cost to the root bridge. The least path cost is the sum of the cost to traverse every network between the indicated bridge and the root bridge. The root path cost can be determined in multiple ways; in this case, we have arbitrarily assigned costs to each path. Next, designated bridges are determined. A designated bridge is the bridge on each LAN with the lowest aggregate root path cost. It's the only bridge on a LAN allowed to forward frames. Figure 6.2 illustrates our network with the root path cost assigned to each bridge interface. Figure 6.2. The root path cost for each bridge interface.
By applying the Spanning Tree Protocol, we block the connection between bridge C and physical segments 2 and 3, because bridge D and bridge B both have lower aggregate root path costs to the root bridge (bridge A). We also block the connection between bridge D and physical segment 2, because bridge B has a lower root path cost than bridge D. Figure 6.3 illustrates our bridged network after the Spanning Tree Protocol has been applied. Note that the connections between bridge C and physical segments 2 and 3 are blocked, as well as the connection between bridge D and physical segment 2. Figure 6.3. A bridged network with Spanning Tree Protocol.
We now have no circular routes in our network, but we maintain redundancy, because the Spanning Tree Protocol is applied whenever a bridge is powered up or a topology change occurs. Therefore, if the connection between bridge B and physical segment 2 is broken, the Spanning Tree Protocol would run and the connection between bridge D and physical segment 2. |