vLab: Layer 2 (Data Link Layer)
Layer 2, called the Data Link Layer, is responsible for exchanging data via so called frames between two directly connected hosts. On sending Layer 2 hands over a frame to the Physical Layer which encodes its as signals and sends it over the chosen medium. Layer 1 on the receiver side decodes the signals again and hands over the frame to Layer 2.
As mediums can be shared (e.g. wireless), multiple devices can receive a frame sent over the medium. Therefore a frame needs additional information in order to enable hosts to check whether they were actually addressed by that frame.
As a result, recipients of data frames each have a unique address that enables addressing individual receivers on the same physical link, e.g. a MAC address with Ethernet. That address is then included in the Layer 2 header as source and destination address.
Sending at the same time can also lead to a collision where the signals sent over the medium collide, rendering both messages useless. The Data Link Layer also implements mechanisms to detect and or avoid such collisions.
Learn more about the Data Link Layer mechanisms and protocols in our free Massive Open Online Course: iLabX – The Internet Masterclass
There you also have the opportunity to do some experiments on Layer 2 using your own computer and our virtual network environment: the vLab