A form of Ethernet switch that switches packets by looking at their physical addresses (MAC addresses). These switches operate at the data-link layer (or layer 2) of the Open Systems Interconnection (OSI) reference model.
They essentially perform a bridging function between LAN segments because they forward frames based on their destination address without any concern for the network protocol being used. Thus, Layer 2 switches are essentially multiport bridges that operate near wire speed and have extremely low latency.
Layer 2 switches can be installed transparently into networks. They do not interfere with communication between hosts and routers. Once installed, a Layer 2 switch learns about its connected hosts and networks by examining the source addresses of frames it receives. It builds a cache (database) of these MAC addresses and the ports on the switch to which they are mapped.
When a frame arrives at a port of the switch, the switch examines its destination MAC address and then forwards the frame to the port to which the destination host is connected. If the frame’s source address is unfamiliar, the switch sends the frame to all its other ports except the one through which the frame entered.
Layer 2 switches are often used to create virtual LANs (VLANs), in which the logical segmenting of the network differs from its physical segmentation. Using Layer 2 switches is functionally equivalent to flattening a network into a number of smaller switching domains.
Use Layer 2 switches for segmenting your Ethernet network into smaller collision domains to improve network performance. Layer 2 switches are generally used in combination with routers to create larger networks. Layer 2 switches are used for creating LAN segments, while the routers provide higher-level functions such as providing wide area access or protocol translation. An alternative is to use a Layer 3 switch, which combines the functionality of an Ethernet switch and a router in one package.