Kahibaro
Discord Login Register

3.5 Network Layer

Role of the Network Layer

The Network layer is the third layer in the OSI model. Its core responsibility is to move data from one network to another, across multiple intermediate devices, and to make sure the data can reach a device that is not directly connected to the sender.

At this layer, data is handled as packets. A packet contains a header with addressing information and the payload that comes from the upper layers. Unlike the Data Link layer, which focuses on communication between directly connected devices, the Network layer focuses on communication between devices that can be several hops apart.

The Network layer decides where packets should go, which path they should take, and how they are forwarded from one router to the next until they arrive at the destination network.

Logical Addressing

A key function of the Network layer is logical addressing. Logical addresses identify devices in a way that is independent of the physical network technology.

At this layer, each device is given an address that is valid within a larger internetwork. In modern networks this is typically an IP address. This address does not care about which exact cable or wireless link is used, but instead identifies the host in a global or local addressing scheme.

Logical addressing serves two important purposes. It identifies the individual host, and it identifies the network that host belongs to. This allows devices and routers to quickly understand whether a destination is on the same network or on a different one and to decide whether packets must be forwarded through routers.

Logical addresses can change as a device moves between networks, while lower layer identifiers such as MAC addresses typically remain constant. This separation between logical and physical identifiers is an important characteristic of the Network layer.

Important: The Network layer uses logical addresses to identify devices and their networks, and this addressing is independent of the underlying physical medium.

Routing Between Networks

The Network layer is responsible for routing, which is the process of selecting paths for packets to travel through multiple networks. When a packet leaves a source device, it may pass through several routers before it reaches the final destination. Each router examines the Network layer header and decides where to send the packet next.

Routing at this layer is based on destination logical addresses. Each router maintains a routing table which describes known networks and how to reach them. Using this table, the router forwards packets toward the next device that is closer to the destination network.

The Network layer does not guarantee that the chosen path is the only possible one. Different routes may exist between two points, and routers may select paths based on various criteria such as metrics and policies, which are covered in routing specific chapters. The key idea here is that the Network layer sees the network as a set of interconnected networks and devices and chooses the next hop accordingly.

Because the Network layer focuses on moving packets across multiple networks, it hides the complexity of the underlying links from the Transport and Application layers. Upper layers simply see that they can send data to a remote logical address, without needing to know which path that data will take.

Forwarding and Next Hop Decisions

Forwarding is the act of taking a packet that arrives on one interface of a router and sending it out of another interface, based on the information in the Network layer header.

When a packet reaches a router, the router performs a lookup in its routing table. The router does not usually know the complete end to end path. Instead, it knows which next device is the best step toward the destination. This device is called the next hop.

Forwarding involves three main actions. The router inspects the destination logical address in the packet header. It searches its routing table for the most appropriate entry that matches this destination. It then sends the packet to the next hop via the appropriate outgoing interface.

The Network layer also allows routers to connect different types of networks. For example, a router can forward packets between a wired Ethernet network and a wireless network, or between networks that use different Data Link layer technologies. The forwarding decision always depends on logical addressing, not on the specific Data Link layer format.

Fragmentation and Reassembly

Not all networks can carry packets of the same maximum size. Some links allow large packets, while others can only carry smaller frames. When a packet is too large to be transmitted over a particular link, the Network layer may need to split it into smaller pieces so that it can pass through. This process is called fragmentation.

Each fragment carries part of the original packet data, along with additional information that allows the destination to reassemble the original packet. The fragments travel independently through the network and may take different paths. At the receiving end, the Network layer collects all fragments that belong to the same original packet and combines them back into a complete unit. This is called reassembly.

Fragmentation and reassembly are important because they allow communication between networks with different maximum transmission units, often referred to as MTU. Flexibility at the Network layer ensures that data can still flow across heterogeneous networks without upper layers having to adjust to each link limitation.

Key point: If a packet is larger than the MTU of a link, fragmentation may occur at the Network layer, and the destination performs reassembly to reconstruct the original packet.

Connectionless Packet Delivery

The Network layer typically provides a connectionless service. In a connectionless model, each packet is treated independently, without establishing a dedicated path in advance. There is no continuous connection like a phone call. Instead, each packet contains enough information to be routed on its own.

This approach has some important consequences. Different packets belonging to the same application flow may follow different paths through the network. They may arrive out of order or with different delays, and some packets may even be lost. The Network layer does not guarantee reliable delivery, ordering, or error recovery. These responsibilities, when needed, are usually handled by higher layers.

Because there is no need to reserve resources for a path, connectionless operation allows networks to scale more easily and to adapt to failures or congestion. Routers can change their forwarding decisions when network conditions change, without informing the endpoints that a new path is being used.

Basic Network Layer Functions Summary

The main functions of the Network layer can be summarized around addressing, path selection, and packet handling across multiple networks.

First, the layer provides logical addressing that identifies both hosts and their networks. This addressing makes it possible to distinguish local communication from communication that must cross routers.

Second, the layer performs routing by selecting appropriate paths through intermediate routers. Each router makes independent forwarding decisions based on routing information and logical addresses.

Third, the Network layer handles packet forwarding from one interface to another, and it manages issues such as fragmentation and reassembly when packets cross links with different size limits.

Finally, the Network layer generally delivers packets in a connectionless and best effort manner. It focuses on moving packets across complex internetworks rather than providing reliability or flow control, which belong to higher layers.

Views: 47

Comments

Please login to add a comment.

Don't have an account? Register now!