network layer of osi model

Network layer – OSI model

The network layer is the third layer in the OSI model. It uses the services of the data link layer and provides services to the transport layer.

The role of the network layer is to route the packet from source to destination hope by hope.  Source and destination may be directly connected or may connect via may intermediate sub-networks. Upon receiving the packet from the transport layer, the network layer chooses the outgoing link towards the destination.

For example, we use the internet in our home via wifi connection.  One side wifi router connects to the laptop and the other side connects to the internet service provider.

Our laptop and wifi router both having the network layer. When a user enters an URL address in a web browser address bar and hit the enter key, application layer protocol HTTP ( web browser uses HTTP) sends a request to the transport layer. The transport layer sends the request message to the network layer of the laptop.

The Laptop network layer sends the message to the wifi router over the wireless medium. The network layer of WiFi Router checks destination IP and finds that it belongs to a web server on the Internet. The wifi router sends the message to the ISP over the DSL line.

Till now there is only a single outgoing link. But on ISP (Internet service provider), there can be multiple outgoing links. One suitable link is chosen.

Functions of network Layer:

Interworking of networks: The network layer connects to different types of networks.  The networks could be VLANs or any other network. Like in our example, the IP layer is doing interworking between internal LAN and the public internet.

Fragmentation and assembly of user data:   Fragmentation is the process of breaking a larger packet into smaller packets before sending it to the underlying network.  Assembly is the process to build the original packet from the fragment on the receiver side.  The network layer has to do the fragmentation to fulfill the underlying network data unit caring capacity.  The frames may travel via multiple paths, but network layers wait for all segments and deliver the complete message to the transport layer after assembly.

Addressing: The network layer does the end to end logical addressing.  Before sending a packet to the underlying data link layer, the network layer adds a header in front of user data. The header has source and destination logical addresses. Two addresses may be directly connected or maybe multiple hopes apart.

Network Interworking:  Interwoking means connecting different types of networks to each other.  The different types of networks could be VLANs, Public and Private networks, and Networks with the different subnet masks.  The IP layer only looks for the destination IP address for network hope, so that king of IP does not matter for forwarding packet from any type of network to any other type of network.