Layer 2 (data-link) Switching
Layer 2 switches use the MAC address, and are very fast since they are just sorting physical addresses.
If the layer 2 switch does not know where to send its frame, it broadcasts the frame from all its ports to the network to learn the correct destination. When the frame's reply is returned, the switch learns the location of the new address and adds the information to the switching table.
Layer3 addresses are determined by the equipment manufacturer.
Layer 3 (Network) Switching
Layer 3 switches use the network or IP address, and are capable to identifying the network locations as well as the physical address. A location can be a LAN workstation, or even a location within the computer's memory (port)
Layer 3 switches are smarter than layer2 devices incorporating routing functions to calculate the best path for delivering packets, however; they are not as fast as the layer2 switches.
Layer3 addresses are determined by the network administrator.
Layer 4 (Transport) Switching
Layer4 switches make use of the application protocols (HTTP, FTP, etc) to deliver the packets to appropriate application software, thus making decisions based not only on the MAC or the IP address, but the application a packet is targeted to
Layer4 switches allow for priorities to be established for network traffic based on application.
Implications of layer2 and layer3 switching
Although layer2 switches use microsegmentation to satisfy the demands for more bandwidth and increased performance, network designers are now faced with increasing demands for intersubnet communication. Every time a user accesses servers and other resources which are located on different subnets, the traffic must go through a Layer3 device.