Fundamentals 34 min read

Understanding the Network Layer: Routing, Forwarding, and IP Protocols

This article provides a comprehensive overview of the OSI network layer, explaining its role in host‑to‑host communication, the mechanisms of packet forwarding and routing selection, router architecture, queueing strategies, and the details of IPv4 and IPv6 protocols, including migration techniques.

ITPUB
ITPUB
ITPUB
Understanding the Network Layer: Routing, Forwarding, and IP Protocols

Network Layer Overview

The network layer (OSI layer 3) sits between the transport and link layers and provides transparent host‑to‑host packet delivery.

Core Functions

Forwarding : Routers move a packet from an input link to the appropriate output link based on a forwarding table (data plane).

Routing Selection : Routing algorithms compute the end‑to‑end path for a packet (control plane).

Two planes are involved: the data plane (forwarding) and the control plane (routing).

Forwarding Table and Longest‑Prefix Match

Each router maintains a forwarding table that maps destination address prefixes to output interfaces. When a packet arrives, the router performs a longest‑prefix match on the destination address to select the correct output link.

Router Architecture

A router consists of four main components:

Input Port : Performs line termination, data‑link processing, and lookup/forwarding to determine the output port.

Switching Fabric : Connects input ports to output ports (internal network).

Output Port : Sends packets onto the physical link after switching.

Routing Processor : Executes routing protocols, maintains routing tables, and performs network management.

Input Port Details

Input ports keep a local copy of the routing table, enabling distributed forwarding without involving the central routing processor, which reduces bottlenecks. In low‑capacity routers the routing processor may handle forwarding directly.

In many devices the routing processor is the CPU and the input port is essentially the NIC.

Switching Fabric Types

Memory Switching : Packets are copied to memory via CPU interrupts; the routing processor looks up the forwarding entry and copies the packet to the output buffer.

Bus Switching : Packets are tagged and sent over a shared bus directly to output ports; only one packet can be processed at a time.

Network Interconnect Switching : Uses a crossbar‑like, non‑blocking interconnect that allows simultaneous transfers on different paths.

When using memory switching, the total throughput must be less than half the memory bandwidth (B/2).

Queueing and Packet Scheduling

Both input and output ports maintain queues. Congestion occurs when the arrival rate exceeds the processing rate, leading to head‑of‑line (HOL) blocking and packet loss.

Input Queue

If the switching fabric cannot keep up, packets wait in the input queue before being forwarded.

Output Queue

When many packets target the same output port, they accumulate in the output queue, potentially exhausting buffer memory. Common drop policies include drop‑tail and selective packet removal.

TCP congestion control is heavily influenced by router queue management policies such as tail‑drop.

Scheduling Disciplines

FIFO (First‑In‑First‑Out) : Packets are transmitted in arrival order; overflow results in dropping the tail packet.

Priority Queuing : Packets are classified into priority classes; higher‑priority queues are served first, with FIFO within each class.

Round‑Robin (Weighted Fair Queuing) : Serves each class in a cyclic order, skipping empty queues (work‑conserving).

IP Protocol

After forwarding, packets are handed to the IP protocol, which provides addressing, routing, and fragmentation.

IPv4 Addressing

IPv4 uses 32‑bit addresses written as four decimal octets (e.g., 156.197.1.1). The address space is divided into network and host portions and classified into classes A–E.

IPv4 address classes
IPv4 address classes

IPv4 Header Fields

Version (4 bits)

Internet Header Length (4 bits)

DSCP (6 bits) and ECN (2 bits)

Total Length (16 bits)

Identification (16 bits)

Flags (3 bits) – DF, MF

Fragment Offset (13 bits)

TTL (8 bits)

Protocol (8 bits)

Header Checksum (16 bits)

Source Address (32 bits)

Destination Address (32 bits)

Options (variable)

Fragmentation occurs when a packet exceeds the MTU of a link; fragments are reassembled at the destination before the transport layer.

IPv6 Overview

IPv6 expands the address space to 128 bits, represented as eight 16‑bit groups separated by colons. The fixed header is 40 bytes and includes Version, Traffic Class, Flow Label, Payload Length, Next Header, Hop Limit, Source and Destination Addresses.

IPv6 removes the IPv4 identification, flags, and header checksum fields, moving optional data to extension headers.

IPv6 Extension Headers

Extension headers follow the main IPv6 header and can be of arbitrary length, providing functions such as routing, fragmentation, and security (IPSec).

Key IPv6 Features

Larger address space (2^128 addresses)

Simplified fixed‑size header

Stateless and stateful address autoconfiguration

Hierarchical allocation (IANA → RIR → ISP)

Built‑in IPSec support

Anycast addressing

Transition from IPv4 to IPv6

Because IPv4 address space is exhausted, networks must adopt IPv6 while maintaining IPv4 compatibility (dual‑stack). The most common migration technique is tunneling, where an IPv6 packet is encapsulated inside an IPv4 packet to traverse IPv4‑only segments.

A tunnel consists of an IPv6 endpoint, an IPv4 router, and another IPv6 endpoint; the IPv6 packet becomes the payload of an IPv4 packet.

Other strategies such as a coordinated “flag day” are impractical due to the massive scale of the Internet.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

IPv6RoutingIPv4queueingnetwork layerpacket forwardingIP protocolrouter architecture
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.