The Network Layer

The Network Layer

We know that the transport layer provides many forms of process-to-process communication by relying on the network layers host-to-host communication service. We also know that the transport layer does so without any knowledge about how the network layer in fact implements this service. So perhaps you are now wondering, what is under the hood of the host-to-host communication service, what makes it tick?

In this section we'll study precisely how the network layer implements the host-to-host communication service. Well see that unlike the transport layer, there is a piece of the network layer in each and every host and router in the network. Because of this, network-layer protocols are among the most challenging (and therefore among the most interesting) in the protocol stack.

The network layer is also one of the most complicated layers in the protocol stack, and so well have a lot of ground to cover here. Well begin our study with an overview of the network layer and the services it can provide. Well then revisit the two broad approaches towards structuring network-layer packet delivery - the datagram and the virtual-circuit model - that we first encountered back in "Computer Networks and the Internet" and see the fundamental role that addressing plays in delivering a packet to its destination host.

In this section, we'll make an important distinction between the forwarding and routing functions of the network layer. Forwarding involves the transfer of a packet from an incoming link to an outgoing link within a single router. Routing involves all of a network's routers, whose collective interactions via routing protocols determine the paths that packets take on their trips from source to destination node. This will be an important distinction to keep in mind as you progress through this section.

In order to deepen our understanding of packet forwarding, we'll look "inside" a router - at its hardware architecture and organization. We'll then look at packet forwarding in the Internet, along with the celebrated Internet Protocol (IP). We'll investigate network-layer addressing and the IPv4 datagram format. We'll then explore network address translation (NAT), datagram fragmentation, the Internet Control Message Protocol (ICMP), and IPv6.

We'll then turn our attention to the network layer's routing function. We'll see that the job of a routing algorithm is to find out good paths (equivalently, routes) from senders to receivers. We'll first study the theory of routing algorithms, concentrating on the two most prevalent classes of algorithms: link-state and distance-vector algorithms. Since the complexity of routing algorithms grows considerably as the number of network routers increases, hierarchical routing approaches will also be of interest. We'll then see how theory is put into practice when we cover the Internet's intra-autonomous system routing protocols (RIP, OSPF, and IS-IS) and its inter-autonomous system routing protocol, BGP. We'll close this section with a discussion of broadcast and multicast routing.

Introduction

Figure 1 illustrates a simple network with two hosts, H1 and H2, and many routers on the path between H1 and H2. Assume that H1 is sending information to H2, and consider the role of the network layer in these hosts and in the intervening routers. The network layer in H1 takes segments from the transport layer in H1, encapsulates each segment into a datagram (that is, a network-layer packet), and then sends the datagrams to its nearby router, R1. At the receiving host, H2, the network layer receives the datagrams from its nearby router R2, extracts the transport-layer segments, and delivers the segments up to the transport layer at H2. The primary role of the routers is to forward datagrams from input links to output links. Note that the routers in Figure 1 are shown with a truncated protocol stack, that is, with no upper layers above the network layer, because (except for control purposes) routers do not run application- and transport-layer protocols such as those we examined in "Application Layer" and "Transport Layer".

The network layer

Forwarding and Routing

The role of the network layer is thus deceptively simple - to move packets from a sending host to a receiving host. To do so, two important network-layer functions can be identified:

●  Forwarding. When a packet arrives at a router's input link, the router must move the packet to the appropriate output link. For instance, a packet arriving from Host H1 to Router R1 must be forwarded to the next router on a path to H2. In "What's Inside a Router", we'll look inside a router and examine how a packet is really forwarded from an input link at a router to an output link.

●  Routing. The network layer must determine the route or path taken by packets as they flow from a sender to a receiver. The algorithms that calculate these paths are referred to as routing algorithms. A routing algorithm would determine, for instance, the path along which packets flow from H1 to H2.

The terms forwarding and routing are frequently used interchangeably by authors discussing the network layer. We'll use these terms much more exactly in this blog. Forwarding refers to the router-local action of transferring a packet from an input link interface to the appropriate output link interface. Routing refers to the network-wide process that determines the end-to-end paths that packets take from source to destination. Using a driving analogy, consider the trip from Pennsylvania to Florida undertaken by our traveler back in "How Do Packets Make Their Way Through Packet-Switched Networks". During this trip, our driver passes through many interchanges en route to Florida. We can think of forwarding as the process of getting through a single interchange: A car enters the interchange from one road and determines which road it should take to leave the interchange. We can think of routing as the process of planning the trip from Pennsylvania to Florida: Before embarking on the trip, the driver has consulted a map and chosen one of many paths possible, with each path consisting of a series of road segments connected at interchanges.

Every router has a Forwarding table. A router forwards a packet by examining the value of a field in the arriving packet's header, and then using this value to index into the router's forwarding table. The result from the forwarding table indicates to which of the router's outgoing link interfaces the packet is to be forwarded. Depending on the network-layer protocol, this value in the packet's header could be the destination address of the packet or an indication of the connection to which the packet belongs. Figure 2 provides an example. In Figure 2, a packet with a header field value of 0111 arrives to a router. The router indexes into its forwarding table and determines that the output link interface for this packet is interface 2. The router then internally forwards the packet lo interface 2. In "What's Inside a Router" we'll look inside a router and examine the forwarding function in much greater detail.

Routing algorithms determine values in forwarding tables

You might now be wondering how the forwarding tables in the routers are configured. This is a crucial issue, one that exposes the important interplay between routing and forwarding. As shown in Figure 2, the routing algorithm determines the values that are inserted into the routers forwarding tables. The routing algorithm may be centralized (e.g., with an algorithm executing on a central site and downloading routing information to each of the routers) or decentralized (i.e., with a piece of the distributed routing algorithm running in each router). In either case, a router receives routing protocol messages, which are used to configure its forwarding table. The distinct and different purposes of the forwarding and routing functions can be further illustrated by considering the hypothetical (and unrealistic, but technically feasible) case of a network in which all forwarding tables are configured directly by human network operators physically present at the routers. In this case, no routing protocols would be required. Of course, the human operators would need to interact with each other to ensure that the forwarding tables were configured in such a way that packets reached their intended destinations. Its also likely that human configuration would be more error-prone and much slower to respond to changes in the network topology than a routing protocol. We're thus fortunate that all networks have both a forwarding and a routing function.

While we're on the topic of terminology, it's worth mentioning two other terms that are frequently used interchangeably, but that we will use more carefully. We'll reserve the term packet switch to mean a general packet-switching device that transfers a packet from input Iink interface to output link interface, according to the value in a field in the header of the packet. Some packet switches, called link-layer switches, base their forwarding decision on the value in the link-layer field. Other packet switches, called routers, base their forwarding decision on the value in the network-layer field. (To fully appreciate this important distinction, you might want to review "Messages, Segments, Datagrams, and Frames" where we discuss network-layer datagrams and link-layer frames and their relationship). Since our focus in this section is on the network layer, we use the term router in place of packet switch. Well even use the term router when talking about packet switches in virtual-circuit networks (soon to be discussed).

Connection Setup

We just said that the network layer has two important functions, forwarding and routing. But we'll soon see that in some computer networks there is actually a third important network-layer function, namely, connection setup. Recall from our study of TCP that a three-way handshake is required before data can flow from sender to receiver. This allows the sender and receiver to set up the needed state information (for instance, sequence number and initial flow-control window size). In an analogous manner, some network-layer architectures - for instance, ATM and frame-relay, but not the Internet - require the routers along the chosen path from source to destination to handshake with each other in order to set up state before network-layer data packets within a given source-to-destination connection can begin to flow. In the network layer, this process is referred to as connection setup. Well examine connection setup in "Virtual Circuit and Datagram Networks".


Tags

network layer, router, transport layer, segments, datagram, routing algorithms, forwarding table, packet switch

Copy Right

The contents available on this website are copyrighted by TechPlus unless otherwise indicated. All rights are reserved by TechPlus, and content may not be reproduced, published, or transferred in any form or by any means, except with the prior written permission of TechPlus.