The third layer of the OSI model is the network layer. It is the first completely independent of the physical environment level, allowing two or more nodes to retransmit data no matter what physical network they are connected to. This permits different networks to be interconnected.
The network layer finds out the easiest, shortest, and time-efficient way out between the sender and the receiver to exchange data using routing protocols, switching, error detection and addressing techniques. It performs this task by using a logical network addressing and subnetting design of the network. For logical addressing, a unique 32 bit IP (Internet Protocol) address is used. It is logical because the destination IP changes every time the packet enters a different broadcast domain.
The transmission of data based on network addresses is called routing. The source and the destination addresses contained inside each frame are examined to check if the data has reached its final destination. If it is, the network layer formats the data into packets and delivers them up to the transport layer. Otherwise, the layer updates the destination address and pushes the frame back down to the lower layers.
The network layer contains hardware devices such as routers, bridges, switches and firewalls. IP, IPX and AppleTalk are the examples of this layer.