Reference table

IPv4 Header

  • #ip

IPv4 Header structure.

                          IPv4 Header
       Each row is 32 bits (4 bytes), sent left to right.

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   ┌───────┬───────┬───────────┬───┬───────────────────────────────┐
   │Version│  IHL  │   DSCP    │ECN│          Total Length         │
   ├───────┴───────┴───────────┴───┼─────┬─────────────────────────┤
   │         Identification        │Flags│     Fragment Offset     │
   ├───────────────┬───────────────┼─────┴─────────────────────────┤
   │  Time to Live │    Protocol   │        Header Checksum        │
   ├───────────────┴───────────────┴───────────────────────────────┤
   │                       Source IP Address                       │
   ├───────────────────────────────────────────────────────────────┤
   │                    Destination IP Address                     │
   ├───────────────────────────────────────────────────────────────┤
   │                  Options + Padding (if any)                   │
   └───────────────────────────────────────────────────────────────┘

                     Header length: 20–60 bytes
  • Version: 4.
  • IHL: header length in 32-bit words; 5 means 20 bytes.
  • DSCP / ECN: traffic classification / congestion notification.
  • Identification, Flags, Fragment Offset: fragmentation and reassembly.
  • TTL: hop limit; each router decrements it.
  • Protocol: payload type, e.g. ICMP = 1, TCP = 6, UDP = 17.
  • Header Checksum: protects the IPv4 header only.