Internet Protocol version 4 (IPv4) is the core protocol of the Transmission Control Protocol (TCP)/IP protocol suite. It works at the Internet layer of the TCP/IP model. This layer corresponds to the network layer in the OSI model. At the IP layer, information is divided into data units, and address and control information is added to allow datagrams to be routed.
IP provides unreliable and connectionless data transmission services. Unreliable transmission means that IP does not ensure that IP datagrams successfully arrive at their destination. IP only provides best effort delivery. Once an error occurs, for example, a router exhausts the buffer, IP discards the excess datagrams and sends ICMP messages to the source. The upper-layer protocols, such as TCP, are responsible for resolving reliability issues.
Connectionless transmission means that IP does not maintain status information for subsequent datagrams. Every datagram is processed independently, meaning that IP datagrams may not be received in the same order they are sent. If a source sends two consecutive datagrams A and B in sequence to the same destination, each datagram is possibly routed over a different path, and therefore B may arrive ahead of A.
A network ID uniquely identifies a network segment or a group of network segments. A network ID can be obtained by converting an IP address and subnet mask into binary numbers and performing an AND operation on the numbers.
A host ID uniquely identifies a device on a network segment. A host ID can be obtained by converting an IP address and subnet mask into binary numbers, reversing the post-conversion subnet mask, and performing an AND operation on the numbers.
If multiple devices on a network segment have the same network ID, they belong to the same network, regardless of their physical locations.
IPv4 shields the differences at the data link layer and provides a uniform format for datagrams transmitted at the upper layer.