Ethernet Frames
In this post I will discuss Ethernet frames, how they are structured, their sizing, and how they can be modified to optimize network traffic for a specific application.
What is an Ethernet Frame
An Ethernet frame is the final encapsulation of data before it is sent over the physical media of a network (copper/fiber/wireless). It consists of a header, the payload, and a CRC as a trailer. Below are some high level characteristics of an Ethernet frame.
- Layer 2 protocol
- Used to encapsulate data before transmission on the wire
- Standard size 1500 bytes
Frame Structure
Preamble | SFD | Destination MAC | Source MAC | Length | Payload | CRC |
7 Bytes | 1 Bytes | 6 Bytes | 6 Bytes | 2 Bytes | 46-1500 Bytes (Standard) | 4 Bytes |
- PREAMBLE – 7 Byte pattern of alternative 0’s and 1’s which indicates starting of the frame and allow sender and receiver to establish bit synchronization. Initially, PRE (Preamble) was introduced to allow for the loss of a few bits due to signal delays. But today’s high-speed Ethernet don’t need Preamble to protect the frame bits. PRE (Preamble) indicates the receiver that frame is coming and allow the receiver to lock onto the data stream before the actual frame begins.
- Start of frame delimiter (SFD) – This is a 1-Byte field which is always set to 10101011 which indicates the end of the preamble and start of the frame. Sometimes SFD is considered the part of the preamble, which is why you may see the preamble described as 8 Bytes in many places.
- Destination MAC – This is 6-Byte field which contains the MAC address of machine for which data is destined.
- Source MAC – This is a 6-Byte field which contains the MAC address of source machine. As Source Address is always an individual address (Unicast), the least significant bit of first byte is always 0.
- Length – 2 Byte field which indicates the length of the payload which is default set to 1500. This is what value needs to change to make a jumbo frame.
- Payload – This is the place where actual data is inserted. For example if an IP packet is being encapsulated, the IP header and data would be stored here. If the data length is less than minimum length of 46 bytes, then padding 0’s is added to meet the minimum possible length. If the data length is greater than the MTU, it will fragment the payload into multiple frames where each frame contains a part of the payload that is less than or equal to the MTU of the layer 2 network it is traversing.
- Cyclic Redundancy Check (CRC) – 4 Byte field that contains a 32-bits hash of data, which is generated over the Destination Address, Source Address, Length, and Data field. If the checksum computed by destination is not the same as sent checksum value, data received is corrupted. This is a way of ensuring proper data transmission on the other end.
Jumbo Frames
In the post linked here I discuss jumbo frames in detail and their use case.
MTU Size and Ethernet Frames
When setting a custom MTU for a network, for example to allow jumbo framing it can be confusing if you need to take into account the Ethernet header and trailer when setting MTU. For example if your layer 3 protocol and data total 9000 Bytes do you need to set your MTU to 9026 to account for the Ethernet header and trailer?
No
The overhead (header and trailer) of Ethernet is considered a service of layer 2 so when setting MTU, it is specifying the maximum size of the payload of the Ethernet Frame. This means that you need to account for header/trailers of your higher level protocol such as TCP/IP because all of it will be in the payload of the Ethernet frame