Layer 2 is the Data Link layer. This layer uses a Media Access Controller (MAC) to generate the frames that will be transmitted. As the name suggests, the MAC controls the physical transmission media. The wireless transmission media used for Wi-Fi® or 802.11 has different requirements from the wired transmission media used for Ethernet or 802.3, and therefore needs a different MAC and PHY. Note the upper layer software is not aware of or affected by the physical interface.
When transmitting data, this layer adds a header containing the source and destination MAC addresses to the packet received from the Network layer (layer 3). The frame it creates will then be forwarded to the Physical layer.
When receiving data, this layer is used to determine if the frame received by the host contains the host’s MAC address. If it does, the data is forwarded up to the Network layer.
Every host on the network has at least one MAC address. Laptops typically have two: one for the wired LAN and one for the wireless LAN. Home routers also typically have two MACs: one for the local network and one for the Internet.
Most switches are referred to as “layer 2” devices because they route frames based on their MAC addresses.
Ethernet and WiFi Frame Format
As you probably guessed, the Data Link layer adds more than just the source and destination MAC addresses to the packet. Note that the MAC for Ethernet and WiFi are different and generate different frames.
For more information on Ethernet Frames:
http://en.wikipedia.org/wiki/Ethernet_frame
For more information on WiFi Frames:
http://technet.microsoft.com/en-us/library/cc757419%28v=ws.10%29.aspx