Introduction to TCP/IP and routing : Introduction to IP : Architecture of IP : Structure of IP packets
Previous: Netmasks, CIDR, and subnets
Next: Transport protocols

1.2.4. Structure of IP packets

IP (v4) packets have the following structure:

    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  |Type of Service|          Total Length         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Identification        |Flags|      Fragment Offset    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Time to Live |    Protocol   |         Header Checksum       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                       Source Address                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Destination Address                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Options                    |    Padding    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The most important fields:

Fragment offset

Indicates, in the case of a packet which has been fragmented, the offset of the fragment in the total packet size

Time to live

a counter which is decremented every time the packet crosses a router, or for every second it stays in the queue of router. When the counter reaches 0, the packet is dropped -- this is to avoid loops between two or more routers

Protocol

The code for the protocol being transported in the packet

Source address

The address of the source host

Destination address

The address of the destination host


Introduction to TCP/IP and routing : Introduction to IP : Architecture of IP : Structure of IP packets
Previous: Netmasks, CIDR, and subnets
Next: Transport protocols