Ethernet, IPv4 and IPv6 headers

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
  1. 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
  2. Destination MAC address
  3. Source MAC address
  4. 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
  5. Data
  6. 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
  1. Version: Indecate the version of IP packet.
    • 0100 IPv4
    • 0110 IPv6
  2. 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.
  3. 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)
  4. Total Length.
    • Minimum Length is 20 bytes (Header without data)
    • Maximum Length is 65535 (2^16)
  5. Identification: Uniquely identify the group of fragment of a sigle ip datagram.
  6. 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.
  7. 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.
  8. 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.
  9. Protocol: Upper layer protocols.
    • ICMP(1)
    • TCP(6)
    • UDP(17)
  10. 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
  1. Version
    • 0110 IPv6
  2. Traffic Class: Same as the DS in IPv4
  3. Flow Label: Same as Identification in IPv4
  4. Payload Length: Total length of data without header
  5. Next Header: The protocol on the upper layer
  6. Hop Limit: Same as the TTL in IPv4

Leave a Comment

Your email address will not be published. Required fields are marked *