IP Datagram

Screen_Shot_2013-10-18_at_2.26.23_PM.png
The IPv4 Datagram has a number of components that we will discuss below.

Version Number
4 bits specify the IP protocol version. In this case, the value for this field is 4

Header Length
This field tells us how many options there are and where the actual data starts in the datagram. 4 bits represents how many 32 bit words are in the header of the datagram

Type of Service
These 8 bits are necessary so that we can differentiate between different types of IP datagrams (low delay, high throughput, or reliability)

Datagram length
We have 8 bits to specify how many bytes of data are in the datagram. Therefore, we can theoretically support 65,535 bytes

Identifier, Flags, Fragment Offset
These fields deal with IP datagram fragmentation

Time to Live
This is the amount of hops the packet has left before it is forcibly dropped. This field helps us to prevent loops in routing

Protocol
This field is important when the datagram arrives at its final destination and we need to know which transport layer port we need to pass this into

Header Checksum
The checksum is to serve the purpose of an error detection code for the IP datagram. The checksum is computed for the entire datagram and checked on the receiving end. If the two don't match, then the datagram is discarded

Source and Destination IP Addresses
These are pretty self explanatory. They're just the IP addresses of the source and destination routers

Options
This field gives us the option to extend our IP header. However, they are rarely used but they add a variable component to IP datagrams.

Data
The payload is the reason that the IP datagram even exists and it contains whatever data we wish to transfer from one host to another. Most of the time, the payload is the TCP/UDP segment but it can also carry ICMP messages