Switch Operation

To understand the operation of a switch, we will assume that there are no provisions for programming the switch. The switch we will discuss will only modify its operation through a learning process.

Assume our switch has four identical ports. When power is applied to the switch it will behave just like a repeating hub. A data stream received on any one of its ports will be replicated, without modification, onto all other ports except for the arrival port. There will be no subsequent transmission on the port from which the data was received. In this situation the switch is functioning just like a repeating hub. There is, however, one difference. Switches operate at the data link layer and act upon frames. In the general case, a complete Ethernet frame, regardless of length, is received before being transferred to the switch's output ports. Therefore, data latency is introduced that varies with the length of the received frame. A repeating hub operates at the physical layer and acts upon symbols. A received symbol is transferred to the repeating hub's output ports usually within a few bit times. The data latency through a repeating hub is short and independent of the length of the incoming frame.

Let's assume that station A on port 1 is attempting a unicast (one to one) message to station B located at port 2. With a repeating hub or an unlearned switch, all stations on all ports are going to hear this transmission to station B even though they are not part of the conversation. This creates unnecessary traffic on the network that prevents other stations from initiating transmissions since they must defer to this traffic. Only when silence is sensed on the network will a deferring station initiate a transmission. Unlike a repeating hub, a learning switch will note the source address of the transmission from station A on port 1 and will enter into its table the fact that station A resides on port 1. However, at this time the switch does not know where station B resides and, therefore, must send the transmission to all other ports. This is called flooding. Not until station B initiates a transmission will the switch learn that station B resides on port 2. Once station A and B's port assignments are entered into the switch's table, all subsequent unicast transmissions between these two stations will only appear on ports 1 and 2. All other ports will not know a transmission is occurring allowing other stations, not located on ports 1 and 2, to initiate a simultaneous transmission. This is why switches offer improved throughput over repeating hubs.

What happens if station B is physically moved to port 3? If station A again initiates a transmission to station B, the transmission will fail since it will only be delivered to port 2 where the switch thinks station B resides. In order for station B to be found again, it must initiate a transmission. If it does, the switch will note a change in port assignment for station B and change its table accordingly. But what if station B never reports in? Perhaps this station speaks only when spoken to. There is no way for the switch to learn the new location of station B. That is why the switch's table must be aged.

Aging is the process of unlearning. Periodically the switch checks to see if all stations in its table have initiated a transmission within the aging limit. If a particular station has not, it will be removed from the table. In the example above, station B's entry would be erased. Therefore, when station A initiates a transmission to station B, the switch, finding no entry in its table for station B, will flood all ports allowing station B to hear station A. If station B responds to station A by initiating a transmission, the switch will learn station B's new port assignment and note it in its table. This aging process usually occurs every four to five minutes, so it may take a while to learn locations of devices that are quiet.