Introduction to the Network Layer

 

Introduction to the Network Layer

The network layer is the third layer of the TCP/IP protocol suite, located between the transport layer and the data-link layer. Its main responsibility is to provide communication between a source host and a destination host across multiple interconnected networks.

The Internet is not a single network. It is an internetwork, formed by many LANs and WANs connected through routers and other networking devices. Therefore, when a packet is sent from one host to another, it may need to travel through several intermediate networks and routers. The network layer is responsible for making this end-to-end delivery possible.

At the source host, the network layer receives a packet from the transport layer, adds a network-layer header containing information such as the source and destination addresses, and passes the resulting datagram to the data-link layer. At the destination, the network layer receives the datagram, removes the network-layer header, and delivers the original packet to the appropriate transport-layer protocol.

An important difference from the transport layer is that routers also participate in network-layer operations. The source and destination hosts use all five TCP/IP layers, whereas a router that is simply forwarding packets normally uses the network, data-link, and physical layers.




 


Main Services of the Network Layer

The general services expected from a network-layer protocol can be summarized as follows:

ServicePurpose
PacketizingEncapsulates upper-layer data into network-layer packets/datagrams
RoutingDetermines the best path from source to destination
ForwardingMoves a packet from an incoming interface to the appropriate outgoing interface
Error ControlDetects certain errors and handles some network-layer problems
Flow ControlControls the rate of data sent toward a receiver
Congestion ControlAttempts to prevent excessive traffic from overwhelming the network
Quality of Service (QoS)Supports requirements such as delay and performance for multimedia
SecurityProvides mechanisms for protecting network-layer communication

However, not all of these services are directly implemented by the Internet network layer. For example, Internet IP does not directly provide flow control or congestion control; some functions are provided by upper layers or auxiliary protocols.


1. Packetizing

Packetizing is the first major responsibility of the network layer.

At the source:

Transport-layer packet
        ↓
Add network-layer header
        ↓
Network-layer datagram
        ↓
Data-link layer

The network-layer header contains information such as:

  • Source IP address
  • Destination IP address
  • Other information required by the network-layer protocol

At the destination, the network layer decapsulates the datagram and delivers the original payload to the appropriate upper-layer protocol.

If a packet is too large and is fragmented, the network layer is responsible for reassembling the fragments at the destination before delivering the complete payload to the upper layer.


2. Routing

Routing is the process of determining a suitable path from the source to the destination.

There may be several possible paths between two hosts:

                 Router R2
                /         \
Source ─────── R1           R4 ───── Destination
                \         /
                 Router R3

The network layer must determine which path should be used.

Routing protocols help routers exchange information about the network and construct routing tables. These routing tables are then used when packets need to be forwarded.

Simple distinction

Routing = deciding the path.


3. Forwarding

Forwarding is the actual action taken by a router when a packet arrives.

A router examines information in the packet header, usually the destination address, and consults its forwarding/routing table to determine the appropriate outgoing interface.

For example:

Packet arrives
     ↓
Read destination IP address
     ↓
Look up forwarding table
     ↓
Select outgoing interface
     ↓
Forward packet

Routing vs Forwarding

RoutingForwarding
Determines the path    Executes the forwarding decision
Uses routing strategies/protocols    Uses forwarding table
More concerned with where to go    More concerned with what to do now

A useful way to remember:

Routing decides the road; forwarding moves the packet to the next road.


 


4. Error Control

Error control can be implemented at the network layer, but the Internet network layer does not provide general error control for the data carried in the datagram.

One reason is that packets can be fragmented, making complete error checking at this layer inefficient.

However, the IP datagram contains a checksum mechanism for detecting corruption in the header.

The Internet also uses ICMP (Internet Control Message Protocol) to report certain network-layer errors, such as when a datagram is discarded or when there is an unknown or invalid header condition.

So:

IP itself does not provide reliable error control for the complete data portion of a packet.


5. Flow Control

Flow control prevents a sender from sending data faster than the receiver can handle.

In general:

Fast sender
     ↓
Too much data
     ↓
Slow receiver
     ↓
Receiver may be overwhelmed

The network layer of the Internet does not directly provide flow control. Datagrams are sent when they are ready, without the network layer checking whether the destination is ready to receive them.

Flow control is generally handled by upper-layer protocols, particularly the transport layer.


6. Congestion Control

Congestion occurs when the amount of traffic entering the network becomes greater than what the network and its routers can handle.

For example:

Many sources
     ↓
Large number of datagrams
     ↓
Router queues become full
     ↓
Packets are discarded
     ↓
More retransmissions
     ↓
Even more traffic
     ↓
Congestion becomes worse

The network layer is concerned with congestion, but congestion control is not implemented directly in the Internet network layer.

TCP, for example, implements its own congestion-control mechanisms at the transport layer.


7. Quality of Service (QoS)

Modern applications such as:

  • Video conferencing
  • Voice communication
  • Streaming
  • Real-time multimedia

may require specific network performance.

Important requirements can include:

  • Low delay
  • Low variation in delay
  • Sufficient bandwidth
  • Low packet loss

This is referred to as Quality of Service (QoS).

QoS has become increasingly important because of multimedia and real-time applications. However, many QoS provisions are implemented in upper layers rather than directly in the Internet network layer.


8. Security

The original Internet network layer was designed without strong security provisions because the Internet was initially used mainly by a small research community.

Today, security is a major concern.

A security mechanism called IPSec (IP Security) can be used to provide security for IP communication. The textbook describes IPSec as a virtual layer that can provide security for the connectionless network-layer service.


Overall View

We can visualize the role of the network layer as:

                 APPLICATION
                      ↑
                      |
                 TRANSPORT
                      ↑
                      |
              ┌───────────────┐
              │ NETWORK LAYER │
              │               │
              │ Packetizing   │
              │ Routing       │
              │ Forwarding    │
              │ Error control │
              │ Flow control  │
              │ Congestion    │
              │ QoS           │
              │ Security      │
              └───────────────┘
                      ↑
                      |
                 DATA LINK
                      ↑
                      |
                  PHYSICAL

Most important services to remember

These three as the core functions:

1. Packetizing → creates network-layer datagrams
2. Routing → determines the path
3. Forwarding → sends the packet to the next network/interface

The other services—error control, flow control, congestion control, QoS, and security—are general network-layer service requirements, but the Internet's IP layer does not directly implement all of them.

Comments

Popular posts from this blog

Computer Networks PCCST501 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Introduction to Computer Networks

Introduction to Local Area Network (LAN)