Layer 2
A network bridge, operating at the Media Access Control (MAC) sublayer of the data link layer, may interconnect a small number of devices in a home or office. This is a trivial case of bridging, in which the bridge learns the MAC address of each connected device. Single bridges also can provide extremely high performance in specialized applications such as storage area networks.
Bridges may also interconnect using a spanning tree protocol that allows the best path to be found within the constraint that it is a tree. In contrast to routers, bridges must have topologies with only one active path between two points. The older IEEE 802.1D spanning tree protocol could be quite slow, with forwarding stopping for 30-90 seconds while the spanning tree would reconverge. A Rapid Spanning Tree Protocol was introduced as IEEE 802.1w, but the newest edition of IEEE 802.1D-2004, adopts the 802.1w extensions as the base standard.
While “layer 2 switch” remains more of a marketing than a technical term, the products that were introduced as “switches” tended to use microsegmentation and full duplex to prevent collisions among devices connected to Ethernets. By using an internal Forwarding Plane much faster than any interface, they give the impression of simultaneous paths among multiple devices.
Once a bridge learns the topology through a spanning tree protocol, it forwards data link layer frames using a layer 2 forwarding method. There are four forwarding methods a bridge can use, of which the second through fourth method were performance-increasing methods when used on “switch” products with the same input and output port speeds:
1. Store and forward : The switch buffers and, typically, performs a checksum on each frame before forwarding it on.
2. Cut through : The switch reads only up to the frame’s hardware address before starting to forward it. There is no error checking with this method.
3. Fragment free : A method that attempts to retain the benefits of both “store and forward” and “cut through”. Fragment free checks the first 64 bytes of the frame, where addressing information is stored. This way the frame will always reach its intended destination. Error checking of the actual data in the packet is left for the end device in Layer 3 or Layer 4 (OSI), typically a router.
4. Adaptive switching : A method of automatically switching between the other three modes.
Note that cut-through switches have to fall back to store and forward if the outgoing port is busy at the time the packet arrives. While there are specialized applications, such as storage area networks, where the input and output interfaces are the same speed, this is rarely the case in general LAN applications. In LANs, a switch used for end user access typically concentrates lower speed (e.g., 10/100 Mbps) into a higher speed (at least 1 Gbps). Alternatively, a switch that provides access to server ports usually connects to them at a much higher speed than is used by end user devices.