The Internet Protocol (IP) is a network-layer (Layer 3) protocol that contains addressing information and some control information that enables packets to be routed.
IP has two primary responsibilities:
1.providing connectionless, best-effort delivery of datagrams through an internetwork;
2. providing fragmentation and reassembly of datagrams to support data links with different maximum-transmission unit (MTU) sizes.
IP Packet FormatAn IP packet contains several types of information:
- Version—Indicates the version of IP currently used.
- IP Header Length (IHL)—Indicates the datagram header length in 32-bit words.
- Type-of-Service—Specifies how an upper-layer protocol would like a current datagram to be handled, and assigns datagrams various levels of importance.
- Total Length—Specifies the length, in bytes, of the entire IP packet, including the data and header.
- Identification—Contains an integer that identifies the current datagram. This field is used to help piece together datagram fragments.
- Flags—Consists of a 3-bit field of which the two low-order (least-significant) bits control fragmentation. The low-order bit specifies whether the packet can be fragmented. The middle bit specifies whether the packet is the last fragment in a series of fragmented packets. The third or high-order bit is not used.
- Fragment Offset—Indicates the position of the fragment's data relative to the beginning of the data in the original datagram, which allows the destination IP process to properly reconstruct the original datagram.
- Time-to-Live—Maintains a counter that gradually decrements down to zero, at which point the datagram is discarded. This keeps packets from looping endlessly.
- Protocol—Indicates which upper-layer protocol receives incoming packets after IP processing is complete.
- Header Checksum—Helps ensure IP header integrity.
- Source Address—Specifies the sending node.
- Destination Address—Specifies the receiving node.
- Options—Allows IP to support various options, such as security.
- Data—Contains upper-layer information.