Internet Protocol (IP)

The Internet Protocol (IP) is a network layer (layer 3 in the OSI model or the Internet layer in the TCP/IP model) protocol which contains addressing information and some control information to enable packets to be controlled. IP is well documented in RFC 791 and is the basic communication protocol in the Internet protocol suite.

IP specifies the exact format of all data as it passes across the Internet. IP software performs the routing function, choosing the path over which data will be sent. IP includes a set of rules that enbody the idea of unreliable packet delivery. IP is an unreliable and connectionless datagram protocol.

The service is called unreliable because delivery is not guaranteed. The service is called connectionless because each packet is treated independently from all others. If reliability is important, IP must be paired with a reliable protocol such as TCP. However, IP does its best to get a transmission through to its destination, but carries no guarantees.

IP transports the datagram in packets, each of which is transported separately. Datagrams can travel along different routes and can arrive out of sequence or be duplicated. IP does not keep track of the routes taken and has no facility for reordering datagrams once they arrive at their destination.

In short, the packet may be lost, duplicated, delayed or delivered out of order. IP is a connectionless protocol designed for a packet switching network which uses the datagram mechanism. This means that each datagram is separated into segments (packets) and is sent independently following a different route to its destination.

This implies that if a source sends several datagrams to the same destination, they could arrive out of order. Even though IP provides limited functionality, it should not be considered a weakness. Since datagram processing occurs in software, the content of an IP datagram is not constrained by any hardware.

Packets in the IP layer are called datagrams. Each IP datagram consists of a header (20 to 60 bytes) and data. The IP datagram header consists of a fixed 20-byte section and a variable options section with a maximum of 40 bytes.

The Internet header length is the total length of the header, including any option fields, in 32-bit words. The minimum value for the Internet header length is 5 (five 32-bit words or 20 bytes of the IPv4 header). The maximum permitted length of an IP datagram is 65 536 bytes.

However, such large packets would not be practical, particularly on the Internet where they would be heavily fragmented. RFC 791 states that all hosts must accept IP datagrams up to 576 bytes.

An IPv4 datagram consists of three primary components. The header is 20 bytes long and contains a number of fields. The option is a variable length set of fields, which may or may not be present.

Data is the encapsulated payload from the higher level, usually a whole TCP segment or UDP datagram. The datagram header contains the source and destination IP addresses, fragmentation control, precedence, a checksum used to detect transmission errors, and IP options to record routing information or gathering timestamps.