Ethernet Frame Headers and Trailer
8 Bytes |
6 Bytes |
6 Bytes |
2 Bytes |
46-1500 Bytes |
4 Bytes |
Preamble and SFD |
Destination MAC |
Source MAC |
Type/Length |
Data |
FCS |
- Preamble is a 7 bytes long sequence consisting of alternating 1s and 0s that indicates the start of the frame. The start frame delimiter (SFD) is a 1 byte long sequence that signals the end of the preamble and the start of the frame data. It is represented by the 10101011 pattern
- Destination MAC address
- Source MAC address
- Type/Length: The value in this field implies the protocol from the upper layer, which is represented in hexadecimal digits.
- 0x0800 IPv4
- 0x86DD IPv6
- 0x0806 ARP
- Data
- FCS (Frame Check Sequence) This field is used for error detection. Its value is calculated using a mathematical algorithm called Cyclic Redundancy Check (CRC) based on the data in the frame. When the receiving device receives the frame, it performs the same calculation on the data and compares the resulting value with the FCS value in the frame. If the two values match, the data is deemed accurate. Otherwise, the frame is discarded.
IPv4 packet header
4 Bits |
4 Bits |
8 Bits |
16 Bits |
16 Bits |
Version |
IHL |
DS |
Total Length |
-Identification |
3 Bits |
13 Bits |
8 Bits |
8 Bits |
16 Bits |
Flag |
–Fragment Offset– |
–TTL– |
Protocol |
Header Checksum |
32 Bits |
32 Bits |
Source IP Address |
Detination IP Address |
- Version: Indecate the version of IP packet.
- IHL (Internet Header Length): The value in this filed ranges from 5 to 15, but it has to be mutiplied by 4 to determine the length in bytes, therefore the length in byets rangs from 20 bytes to 60 bytes.
- DS (Differenticated Service): It was formerly called Type of Service (Tos) and consists of two parts which are DSCP (Differentiated Service Code Point) and ECN (Explicit Congestion Notafication).
- DSCP is 6 bits long, it indicates the priority of the packet. The bigger the value is, the higher the priority it has.
- ECN is 2 bits long, it has 3 kinds of values. The router could detect the congestion of the network and set the value to notify the receiver to adjust the rate of transmition or avoid more traffic due to the congestion of the netwrok.
- 00-NOT-ECT (Not ECN Capable Transport)
- 01-ECT (ECN Capable Transport)
- 10-CE (Congestion Experienced)
- Total Length.
- Minimum Length is 20 bytes (Header without data)
- Maximum Length is 65535 (2^16)
- Identification: Uniquely identify the group of fragment of a sigle ip datagram.
- Flag
- First bit 0 reserved
- Second bit DF (Don’t fragment) denotes this is the last fragment, no more fragment is needed.
- Last bit MF (More fragment) denotes there are more fragments will be transmitted.
- Fragment Offset: The value in this field indicates the position that in relation to the first fragment. Since fragments can be transmitted out of order, the destination device may need to reassemble them in the correct order once it receives all the fragments.
- TTL (Time to Live): In order to prevent packets from being forwarded indefinitely, every packet has a lifespan designated by a TTL value. The value is reduced by 1 each time the packet arrives at a router, and the router will discard the packet when the value reaches 0. This helps ensure that packets do not circulate endlessly in the network.
- Protocol: Upper layer protocols.
- Header Checksum: Error check by the router.
IPv6 Header
The length of IPv6 header is fixed 40 bytes.
4 Bits |
8 Bits |
20 Bits |
16 Bits |
8 Bits |
8 Bits |
Version |
Traffic Class |
Flow Label |
Payload Length |
Next Header |
Hop Limit |
128 Bits 16 Bytes |
128 Bits 16 Bytes |
Source IP Address |
Destination IP Address |
- Version
- Traffic Class: Same as the DS in IPv4
- Flow Label: Same as Identification in IPv4
- Payload Length: Total length of data without header
- Next Header: The protocol on the upper layer
- Hop Limit: Same as the TTL in IPv4