Data Link Layer

Layer 2 creating Ethernet frames and managing MAC address-based local network transmission

The Data-Link layer or Layer 2 focuses on creation of Ethernet [[Frames]] from bits and their transmission via a MAC Address. On a local level, this helps us define where a frame will be sent or received. Data-Link frames stay within their LAN.


The Ethernet Frame

The data-link layer utilizes ethernet frames to transmit layer 1 data into logical form to direct said data to a switch or other device locally. It’s a post card, an encapsulating unit of data(PDU) for addressing who(MAC) our data is going to. MAC addresses will be stripped and added depending on whether the data needs to be routed or retained on the local network.

Preamble - A sequence of binary data to aid in clock synchronization. Handshake Start frame Delimiter - indicates the end of the preamble and beginning of the frame Destination MAC Address - MAC address of where frame is being sent Source MAC Address - MAC address indicating device sending frame Type - Specifies type of protocol in the payload or length of payload (IPV4/6, ARP) Payload - The data being transmitted. Between 46-1500 bytes Frame Check Sequence(FCS)- Error checking. Aids identifying errors during transmission

![[Ethernet Frame.png]] VLAN tagging is often added if subnets are present Data is the most important field of the frame while remainder can be treated as metadata


Where we are

At layer 2, data was received from layer 1 in binary format and is translated into human readable, logical data for transmitting. An ethernet frame is created with a destination and source address to either send to a device locally or to prepare the transmission for routing outside the LAN via [[Network Fundamentals]] layer(3).