All You Want To Know About The Network Layer Of The TCP/IP Reference Model
Howdy fellas !!
Until now , we have been exploring the in-depth insights of the Application and Transport layer of TCP/IP model in detail. Now we gonna shift our focus into the next important layer in this model i.e. Network layer.
Network layer is responsible for carrying the packet of data from the source all the way to destination. In short, we can say that it is responsible for host-to-host delivery.
The network layer basically ensures that each packet gets from its point of origin to its final destination.
Network Layer lies in between the transport and data link layer. Datalink layer mainly move the frames (of data) from one end of the wire to the other end. Thus we can say that this layer the last layer associating with the end to end transmission of packets.
If any two systems are connected to the same link, there is usually no need for a network layer. However, if the two systems are attached to different networks (links) with connecting devices between the networks (links), there is often a need for the network layer to accomplish source-to-destination delivery
Location of the Network Layer in the TCP/IP model
network layer is present in between the transport layer and the data link layer(refer the diagram below).It receives services from the data link layer and provides services to the transport layer.
Some Important Functions Performed By The Network Layer
Before learning the high level functions performed by the Network Layer, let us first understand the basic properties and duties of the Network Layer :
Internetworking : This is the main duty of network layer. It provides the logical connection between different types of networks.When independent networks or links are connected to create internetworks (network of networks) or a large network, the connecting devices (called routers or switches) route or switch the packets to their final destination.
Addressing : Addressing is necessary to identify each device on the Internet uniquely. If a packet passes the network boundary, we need another addressing system to help distinguish the source and destination systems. The network layer generally adds a header to the packet coming from the upper layer.
This is similar to a telephone system. The addresses used in the network layer should uniquely and universally define the connection of a computer.
Routing : In a network, there are multiple routes available from a source to a destination and one of them is to be chosen. The network layer decides the root to be taken. This is called as routing .
Packetizing : The network layer encapsulates the packets received from upper-layer protocol and makes new packets. This is called as packetizing. It is done by a network layer protocol called IP (Internetworking protocol).
Fragmenting : The datagram can travel through different networks. Each router decapsulates the IP datagram from the received frame. Then the datagram is processed and encapsulated in another frame.
The other important functions associated (not directly ) with the network layer are:
- Multicasting
- Address resolution
- Routing protocols
The internetworking protocol (IP) needs the support of another protocol ICMP (Internet Control Message Protocol) to achieve the host-to-host delivery. Thus in order to deliver packets between different hosts, it is indeed important to choose a correct (congestion-less path).
Further the network layer must know about the topology of the communication subnet i.e. the set of all routers(or any other networking device). The routes should be chosen in such a way that overloading of some routers and idle operation of others should be avoided.
TCP/IP supports the Internetworking Protocol. IP in turn mainly uses four supporting protocols i.e. ARP, RARP, ICMP, and IGMP. Each of these protocols is described in greater detail in the subsequent posts.
Implementation of Connection less Service in Network Layer
In the connectionless service, the packets from sending host H1 are injected into the subnet individually and each packet is routed independently. No advanced connection establishment is required. The packets are called datagrams and the subnet is called as datagram subnet.
Working
Process P1 on host H1 wants to send a long message to process P2 on host H2 (refer to the diagram for clarity). Let this message be broken into four packets 1,2,3 and 4 at the network layer. Then all these packets are sent to router A. Every router has its internal table which tells it where to send packets for each possible destination.
C has two outgoing lines E and D. So every packet coming to router C should be sent to either D or E, even if the ultimate destination is F. Finally based on the traffic conditions,each packet will be sent in a separate path accordingly.
Implementation of Connection Oriented Service in Network Layer
For the connection-oriented service, a path from source to the destination needs to be established before sending any data packet. This connection is called Virtual Circuit (VC) and the subnet is called the Virtual Circuit Subnet.
Here all the packets will follow the same path which was established before communication. When the connection is opened, the virtual circuit is also terminated.
In the connection-oriented service, each packet carries an identifier. This identifier can tell us about the virtual circuit (VC) that this packet belongs to.
Internal Specifications of the Network Layer
Basically there will be two types of services in the network layer i.e. connection-oriented and connectionless service.In the connection-oriented service, a connection is called as virtual circuit.
It is similar to a physical connection between the sender host and the destination host. In the connectionless organization, the independent packets are called datagrams. They are analogous to telegrams.
Virtual Circuits
The principle behind the virtual circuits is to choose only one route from source to destination. When a connection is established, it is used for sending all the traffic over this connection.When the connection is released, the virtual circuit is terminated.
Features of virtual circuits
In virtual circuits every router will have to maintain and update a table. Each packet must have a virtual circuit number field in its header in addition to sequence number , checksum etc. It is necessary to setup a VC before communication. The users are charged for connect time as well as for the amount of data transported.
Datagram
Each packet sent is routed independently. Different packets of the same message can follow different routes. The datagram sub nets have to do more work but they are more robust and deal with failures and congestion more easily as compared to virtual circuit subnets.
With a datagram. the routes from source to destination are not decided in advance.The datagram networks are sometimes referred to as connectionless networks.
The term connectionless here means that the switch (packet switch) does not keep information about the connection state. There are no setup or teardown phases.
Features of a datagram
The routers do not have to maintain any tables. Each datagram must contain full destination address. These addresses can be very long. When a packet comes in, the router finds an available outgoing line and sends the packet out on that line.
So that it can reach the destination. A switching datagram network uses a routing table that is based on the destination address.
Delay in packet delivery
There may be a greater delays in any datagram network than in a virtual-circuit network. Although since there are no setup and termination phases, each packet may experience a wait at a switch before it is forwarded.
In addition, since not all packets in a message necessarily travel through the same switches, the delay will not be uniform for the packets of a message.
Stay tuned for more exciting applications of this layer in the subsequent posts.
Aric is a tech enthusiast , who love to write about the tech related products and ‘How To’ blogs . IT Engineer by profession , right now working in the Automation field in a Software product company . The other hobbies includes singing , trekking and writing blogs .