This serie will focus on the Layer 2, and explore :
1. The Data link layer
2. The Ethernet Family and 802.x
3. Wifi detailed and wiresharked
4. Bluetooth tethering, using bridging and using routing
5. Spanning Tree Protocol, using a Linux STP switch and a Cisco STP Switch
The Layer 2 : Data Link Layer
The Layer 2 is the Data link layer in the OSI model. Some examples : Ethernet (multipoint), PPP, HDLC, ADCCP ( point to point ).
Some protocols that use layer2 : ARP, ATM, STP.
The Data Link layer is concerned with moving data across the physical links ( layer1) in the network ( layer3 ).
Typical layer2 appliances are bridges and switches. ( Where Hubs are layer1, and Routers are layer3 ).
The Data link layer is sometimes subdivided into MAC sublayer and LLC sublayer : MAC is the Media Access Control, LLC si the Logical Link Control :
quote : « The data link layer provides a reliable link between two directly connected nodes, by detecting and possibly correcting errors that may occur in the physical layer. »
The data link layer performs these five tasks :
. Layer2 addressing
. Frame Synchronization
. Errors detection in the physical layer
. Flow control
. MultI Access
Error Detection : The data link layer checks for errors occuring during transmission. A cyclic redundancy check (CRC) field is often employed to allow the receiving station to detect for transmission errors.
Flow control : The data link layer ensures emitting and receiving station's speed, for the receiving station not to get flooded.
Multi Access : in the case of shared medium, it is necessary to avoid collisions of trafic. Example : CSMA/CD for ethernet.
As an exemple, the ethernet frame ends with a 32-bit FCS ( a 32 bit CRC which is used to detect any link local corruption of data )
In case of corrupt data, the frame is dropped ( there is no acknowledgement or resend at layer 2 : it is layer 4 rôle ).
quote : « Framing: Data-link layer takes packets from Network Layer and encapsulates them into Frames. Then, sends each Frame bit-by-bit on the hardware. At receiver’s end Data link layer picks up signals from hardware and assembles them into frames. «
The packet from layer3 is encapsulated in a frame, that is sent bit-by-bit to the Layer 1 ( hardware layer ).
It is to be noted that layer 1 does not send this 'bit-sequence' per-se, but does some more encoding, to enable better performance ( see bandwidth vs throughput ).
Let's see the most common type of frame, an ethernet v2 frame :
The Preamble and Start of Frame Delimiter provide Frame Synchronization
Ethertype identifies the Data type ( IP, ARP, Netbios, .. )
FCS ( frame Check Sequence ) provides Error Detection