SwitchingAn electrical switch directs current to one of several wires. Once the connection is made, the switch appears as part of the wire - it (ideally) introduces no resistance, no attenuation, no delay. A networking switch is designed to behave in much the same way. Its primary feature is speed - like an electrical switch, it is designed to appear much like a wire when relaying data signals.
Switches must implement a normal path selection algorithm; they just do it faster. Layer 2 switches bridge; layer 3 switches route. Normal bridges and routers will receive an entire packet, analyze its headers, make a forwarding decision, then transmit the packet. The packet is stored in RAM while being processed. These RAM buffers can become bottlenecks in a busy network. Switches use specialty silicon chips than can forward packets directly from source to destination without passing through RAM buffers.Consider a typical Ethernet switch, which acts much like a standard IEEE 802.1d bridge. The difference is that as soon as an incoming packet's header has been received, a forwarding decision is immediately made, before the packet is completely received. If the destination Ethernet segment is idle, the packet begins transmission there immediately. As bits are received they are shunted through the switch fabric to the destination interface. On a 10 Mbps Ethernet, the net delay is perhaps one or two microseconds, as opposed to several milliseconds for a typical bridge. This is termed cut-through switching.
ATM switches provide a good example of layer 3 switching. When a connection is setup, a routing decision is made based the ATM NSAP address. A virtual path identifier (VPI) is assigned and used in the header of subsequent cells for that connection. The switch fabric is configured to transmit cells bearing that VPI directly to the destination interface.