IP is the core of the TCP/IP protocol suite. IP provides the fundamental mechanism using which data is delivered between devices which may or may not be in the same network.
While sending datagrams, an addressing mechanism is needed to send the datagrams accurately. In order to achieve this, IP uses a technique for host addressing. The addressing of devices (to which the datagrams are delivered) needs to be unique as this system needs to work across networks.
When a datagram is sent from one network to another, which are distant and not directly connected, the delivery is indirect. IP supports this functionality by routing the datagram through intermediate devices (routers). It uses Internet Control Message Protocol (ICMP) and routing protocols like Routing Information Protocol (RIP) and Border Gateway Protocol (BGP) to achieve this.
IP provides security to networks by encapsulating the data into an IP datagram. This makes sure it is received and interpreted by the intended recipient.
IP uses a specific formatting and packaging prior to transmission. IP accepts data from the transport layer protocols above it in the OSI layer--UDP and TCP--and passes them to the data layers. This format and package is only decipherable by the recipient.
Since the frame size of each physical and data link network using IP may be different, IP fragments datagrams into pieces, so that they can each be carried on the local network. This helps with network reliability.
IP reassembles the datagrams received into the full IP datagram (as they may be fragmented) for the receiving device and passes it on to the higher layers for interpretation.