Network Layer

Network Layer is Responsible for moving packets (data) from one end of the network to the other, called end to end communications. It requires logical addresses such as IP addresses. The Internet Protocol (IP) addresses make networks easier to both set up and connect with one another. The Internet uses IP addressing to provide connectivity to millions of networks around the world.

Functions of Network layer

  1. Internetworking
  2. Host-host delivery
  3. Addressing
  4. Addressing modes
  5. Fragmenting
  6. Routing/packet Forward
  7. Address Resolution
  8. Multicasting

Internetworking: It provides internetworking. Connection between two different broadcast domain is done by Network layer.

Host-Host Delivery: Any device which are communication referred by Internet protocol address is Host-Host delivery.

Addressing: Every computer that communicates over the Internet is assigned an IP address that uniquely identifies the device and distinguishes it from other computers on the Internet. So Addressing is also one of the main function of Network layer.

Addressing modes: There are three types of addressing modes:

  • Unicast: Unicast is the addressing mode where a data is sent from one point to another point. In this case there is just one sender, and one receiver.
  • Multicast: Multicast is the addressing mode where data is sent from one or more points to a set of other points. In this case there may be one or more senders, and the information is distributed to a set of receivers (there may be no receivers, or any other number of receivers).
  • Broadcast: Broadcast is the addressing modes where data is sent from one point to all other points. In this case there is just one sender, but the information is sent to all connected receivers.

Packetizing: When data is encapsulated with Network layer header then it is known as packetizing and the data is called as packets. Structure of the packet is shown below:


  1. Version number: It gives the version number of the protocol.
  2. Header Length : We could have multiple sized headers so we need this field. Header will always be a multiple of 4bytes and so we can have a maximum length of the field as 15, so the maximum size of the header is 60 bytes ( 20 bytes are mandatory ).
  3. Type Of Service (ToS) : This helps the router in taking the right routing decisions. The structure is :
    1. First three bits : They specify the precedence’s i.e. the priority of the packets.
    2. Next three bits :
      • D bit – D stands for delay. If the D bit is set to 1, then this means that the application is delay sensitive, so we should try to route the packet with minimum delay.
      • T bit – T stands for throughput. This tells us that this particular operation is throughput sensitive.
      • R bit – R stands for reliability. This tells us that we should route this packet through a more reliable network.
    3. Last two bits: The last two bits are never used. Unfortunately, no router in this world looks at these bits and so no application sets them nowadays. The second word is meant for handling fragmentations. If a link cannot transmit large packets, then we fragment the packet and put sufficient information in the header for recollection at the destination.
  4. ID Field : The source and ID field together will represent the fragments of a unique packet. So each fragment will have a different ID.
  5. Fragmentation Offset : It is a 13 bit field that represents where in the packet, the current fragment starts. Each bit represents 8 bytes of the packet. So the packet size can be at most 64 kB.
  6. Flags :It has three bits –
    • M bit : If M is one, then there are more fragments on the way and if M is 0, then it is the last fragment
    • DF bit : If this bit is sent to 1, then we should not fragment such a packet.
    • Reserved bit : This bit is not used.
  7. Total Length : It includes the IP header and everything that comes after it.
  8. Time To Live (TTL) : Using this field, we can set the time within which the packet should be delivered or else destroyed. It is strictly treated as the number of hops. The packet should reach the destination in this number of hops. Every router decreases the value as the packet goes through it and if this value becomes zero at a particular router, it can be destroyed.
  9. Protocol : This specifies the module to which we should hand over the packet ( UDP or TCP ). It is the next encapsulated protocol.
  10. Header Checksum : This is the usual checksum field used to detect errors. Since the TTL field is changing at every router so the header checksum ( up to the options field ) is checked and recalculated at every router.
  11. Source : It is the IP address of the source node
  12. Destination : It is the IP address of the destination node.
  13. IP Options : The options field was created in order to allow features to be added into IP as time passes and requirements change. Like : security , Source Routing etc.

Address Resolution : The term address resolution refers to the process of finding an address of a computer in a network. The address is “resolved” using a protocol in which data is sent by a client process executing on the local computer to a server process executing on a remote computer. The information received by the server allows the server to uniquely identify the network system for which the address was required and therefore to provide the required address. The address resolution procedure is completed when the client receives a response from the server containing the required address.

Routing : Routers communicate with one another using routing protocols such as Routing Information Protocol (RIP) and Open version of Shortest Path First (OSPF), to learn of other networks that are present and to calculate the best way to reach each network based on a variety of criteria (such as the path with the fewest routers). Routers and other networked systems make these routing decisions at the network layer.

Fragmentation: When passing packets between different networks, it may become necessary to adjust their outbound size to one that is compatible with the layer 2 protocol that is being used. The network layer accomplishes this via a process known as fragmentation. A router’s network layer is usually responsible for doing the fragmentation. All reassembly of fragmented packets happens at the network layer of the final destination system.


Please do comment on this and let me know if there is any thing we can add in this. Thank you.