<Jeremy's IT Lab> Day10: IPv4 Header

2025. 3. 21. 23:44CS/CCNA

728x90

IPv4 Header

https://en.wikipedia.org/wiki/IPv4

 Version (4 bits)

-> Identified the version of IP used

-> 0100 or 0110

 

Length (4 bits)

-> total length of the header

-> Identifies the length of the header in 4-byte increment (e.i. value of 5 = 20 bytes)

-> Minimum val is 5 (20 bytes)

-> Maximum val is 15 (60 bytes)

 

DSCP field (6 bits), Differentiated Services Code Point

-> Used for QoS(Quality of Service)

-> Used to prioritize delay-senstive data (streaming, video, etc)

 

ECN field (2 bits), Explicit Congestion Notification

-> Provides end-to-end notification of NW congestion without dropping packets

-> Optional feature

 

Total Length field (16 bits)

-> total length of the packet (L3 header + L4 segment)

-> Measured in byes (not 4-byte increments)

-> Min val of 20(= IPv4 header without encapsulation data)

-> Max val of 65,535 (maximum 16-bit value)

 

Identification field (16 bits)

-> when fragments too large, identify which packet the fragment belongs to

-> All fragments of the same packet will have their own IPv4 header with the same value in this field

->Packets are fragmented if larger than the MTU(Maximum Transmission Unit), (usually 1500 bytes)

->Fragments are reassembled by the receiving host

 

Flag field (3 bits)

-> Used to contro/identify fragments

-> Bit 0: Reserved, always set to 0 (Unfragmented packets will always have their MF bit set to 0)

-> Bit 1: Don't Fragment (DF bit), used to indicate a packt that should not be fragmented

-> Bit 2: More Fragment (MF bit), set to 1 if there are more fragments in the packet, set to 0 for the last fragment

 

Fragment Offset field (13 bits)

-> Used to indicate the position of the fragment within the original, unfragmented IP packet

-> Allows fragmented packets to be reassembled even if the fragments arrive out of order.

 

Time to live field (8 bits)

-> A router will drop a packet with a TTL of 0

-> Used to prevent infinite loops

-> Originally designed to indicate the packet's maximum lifetime in sec

-> In practice, indicates a 'hop count': each time the packet arrives at a router, the router decreases the TTL by 1

-> Recommended default TTL 64

 

Protocol field (8 bits)

-> Indicates the protocol of the encapsulated L4 PDU

-> Val of 6 : TCP

-> Val of 17: UDP

-> Val of 1: ICMP

-> Val of 89: OSPE (dynamic routing protocol)

 

Header Checksum field (16 bits)

-> caculated checksum used to check for erros in the IPv4 header

-> When a router receives a packet, it calculates the checksum of the header and compares it to the one in this field of the header

-> If they do not match, the router drops the packet

-> Used to check for errors only in the IPv4 header

-> IP relies on the encapsulated protocol to detect errors in the encapsulated data

-> Both TCP and UDP have their own checksum field to detect errors in the encapsulated data

 

Source/Destination IP Address fields (32 bits each)

-> Source = IPv4 adrs of the sender's packet

-> Destination = IPv4 adrs ot the receiver's packet

 

Options fields (0 - 320 bits)

-> Rarely used.

-> IHL field is greater than 5, it means that Options are present

 

 


Ancronym:

  • DSCP : Differentiated Services Code Point
  • IHL : Internet Header Length
  • ECN : Explicit Congestion Notification
  •  MTU : Maximum Transmission Unit
  • TTL :  Time to Live