Updated April 20, 2023
Introduction to Network Layer
To solve the problem of delivery through several links the network layer was designed. The network layer is responsible for a host to host delivery and for routing the packets through the routers. The network layer is m designed as a packet-switched network. i.e. the packet at a source is divided into manageable packets called as datagrams. Individual datagrams are then transferred from source to destination. At the destination, the received datagrams are assembled before recreating the original message. The packet-switched was designed as a connectionless service, but recently there is a tendency to change this to connection orientated Service.
Packet Switching at Network Layer
Given below are the packet switching :
1. Connectionless Service
When the Internet was started, the network layer was designed to provide connectionless service, in which network layer protocol treats each packet independently. Packets in the message may or may not travel the same path to their destination. The network layer is only responsible for delivering the packet from source to destination. Switch in this type of network are called routers.
Each packet is routed based on information contained in its header source and destination address. Source address defines where it comes from, and destination address defines where it should go. The router routes the packet based on the destination address. Source address may be used to send error messages to the source of the packet is discarded.
2. Connection Orientated Service
In connection orientated packet-switched network, the forwarding decision is based on the label of the packet.
To create connection orientated service, three phases are used namely the setup phase, data transfer phase, and teardown phase.
a. Setup phase: In the setup phase, the source and destination address of the sender and receiver is used to make for the entries for connection-orientated service. Request packet and acknowledgment be packet need to be exchanged between the sender and receiver.
Request packet: The request packet is sent from source to destination.
It works as follows:
- Source X sends a request packet to router R1.
- Router R1 receives the request packet and bided on the information it sends this packet to Router R3.
- Router R3 receives the request packet. Router R3 sends this packet to R4.
- R4 receives the packet.
- Destination Y receives the setup packet and if it is ready to receive a packet from X, it assigns a label to an incoming packet that comes from X. This label lets the destination that packet comes from X and not other sources.
Acknowledgment packet: A special packet is called an acknowledge packet which completes entries into the switching table.
It works as follows:
- Destination Y sends the acknowledgment packet to router R4, which carries both source and destination address so the router knows which encryption the table is to be completed. This packet carries the label.
- Router R4 sends this acknowledge packet to router R3.
- Router R3 sends to R1.
- Finally, R1 sends this source X that contains the incoming labels in the table.
- Source uses this as the outgoing label for the data packet both be sent to destination Y.
b. Data transfer phase: T is the second phase in connection-orientated service. After all, routers have created their routing table for a specific virtual circuit then the network layer packets belonging to one message can be sent one after another.
c. Teardown phase: In the teardown phase, after sending all packets to destination Y, source X sends the special packet i.e. teardown packet to destination Y. In response to source X, destination Y sends the confirmation packet to X. All routers delete the corresponding entry from their tables.
Network Layer Services
Given below are services:
1. Packetizing
The first duty of the network layer is to encapsulate the data coming from the upper layer in a datagram. This is done by adding a header to the data that contains the logical source and destination address of the packet, information about fragmentation, protocol ID of the protocol that has requested the service, data length, and possibly some options. The network layer also includes the checksum which is calculated over the datagram header.
2. Finding the logical address of the next-hop
The prepared datagram contains the source and destination address of the packet. The datagrams may have to pass through various many networks to reach their final destination. If the destination computer is jot connected to the same network as the source and, the datagram should be delivered to the next router. The network layer at the source computer needs to consult the routing table to find the logical address of the next hop.
3. Finding the MAC address of the next-hop
The network layer does not actually deliver the datagram to the next hop, it is the duty of the data link layer. The data links layer needs to the MAC address of the next-hop to do the delivery. To find a MAC address of the next-hop, the network layer could use another table to map the next-hop logical address to the MAC address.
4. Fragmentation
The datagram prepared at the network layer may be larger than the limit. The datagram needs to be fragmented into smaller units before being passed to the data link layer. Fragmentation needs to preserve the information at the header of the datagram.
Network Layer Issues
Given below are the issues related to the network layer:
1. Error control
Error control means the process of including a mechanism for detecting corrupt, lost, or duplicate datagrams. It also includes a mechanism for correcting the error after that have been detected. The network layer does not provide the real error control mechanism.
2. Flow control
Flow control regulates the amount of data a source can send without overwhelming the receiver. To control the flow of data, the receiver needs to send some feedback to the sender both inform the latter it is overwhelmed with data. The network layer does not directly provide any flow control.
3. Congestion control
Congestion in the network layer is a situation in which too many datagrams are present bin an area of the internet. It may occur if the number of datagrams sends by a source to a destination are beyond the capacity of the network or router. If congestion continues, sometimes a situation may reach a point that collapses the systems and no datagram is delivered.
Conclusion
In this article, we saw the network layer with its working to see the delivery of packets from source to destination. We have also seen the services provided by the network layer and its issues.
Recommended Articles
This is a guide to Network Layer. Here we discuss the introduction, packet switching, network layer services and issues respectively. You may also have a look at the following articles to learn more –