Any electronic device which is capable of sharing data with other devices is called a node. A set of such nodes is called a network and the links or wires which connect these nodes are referred to as the communication channels. Any network containing more than one smaller network is called the internet.
Protocol is simply a set of rules to perform some specific task. For example, setting some rules to manage any organization is nothing but the management protocol of that organization.
Internet Protocol is one of the inevitable protocols in a device. When a device shares some data or information with one or more devices, the data passes through some layers present in the device. These layers are implemented on software level and each layer contains different protocols. Each layer is assigned some specific tasks to perform on data. One of these layers is Network layer which consists of the IP.
The main responsibilities of IP are routing, congestion control, host to host connection establishment and fragmentation of data.
- Routing means deciding the path for data packets to travel to destination, as there may be intermediary devices (usually routers) connected between the hosts.
- Congestion control refers to keeping control of the amount of data sent by the communication channel to receiver and the amount depends on the capability of channel as well as the buffer size of destination host.
- Fragmentation is the process of splitting the data packets into smaller packets because maximum size of IP datagram is 65535, but the data link layer protocol generally imposes a limit that is much smaller. This limit is called the MTU(Maximum Transfer Unit). Fragmentation can be done at the sender or at intermediate routers. The same datagram can be fragmented several times. Reassembly of original datagram is only done at destination hosts.
- IP is responsible for a host to host connection between the source and destination which is done with the help of IP addresses of the nodes.
IP provides an unreliable, connectionless, best-effort service which is also referred as the datagram service. This leads to an out-of-sequence delivery of packets and the issue of duplicate packets.
- IP does not provide any guarantee to deliver the packet to its destination which means the packet may get lost in its way and IP does not support any flow control or error recovery algorithm. That's why this protocol is unreliable.
- A connectionless protocol is a form of data transmission in which the data goes out automatically without determining whether the receiver is ready, or even whether a receiver exists. IP follows this characteristic that's why it is connectionless.
- IP is Best-Effort service because it does not take guarantees on the service i.e. no features to retransmit the lost and/or corrupted data packets.
Current version of IP is IPv4 but a more advance version is IPv6 which is not very popular now due to inconveniences of adapting a change in all the existing networking devices
At each layer some additional data(information) is added in the original data(payload) as a header or trailer. Format of the IPv4 datagram is:
The size of header lies between 20 bytes(when option are 0 bytes) to 60 bytes(when options are 40 bytes). The size of the datagram lies between 20 bytes to 2^16 bytes(65536).