In this tutorial we’ll learn exactly how the network layer implements the host-to-host communication service. We’ll see that unlike the transport and application layers, 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 the most interesting!) in the protocol stack.
How The Network Layer Works
The figure below shows a simple network with two hosts, H1 and H2, and several routers on the path between H1 and H2.
Suppose 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 datagram to its nearby router, R1.
At the receiving host, H2, the network layer receives the datagram from its nearby router R2, extracts the transport-layer segments, and delivers the segments up to the transport layer H2.
The primary role of the routers is to forward datagrams from the input links to output links. Note that the routers shown in the above figure are shown in 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.
What Will You Learn In This Tutorial
The network layer is also one of the most complex layers in the protocol stack, and so we’ll have a lot of ground to cover here. We’ll begin our study with an overview of the network layer and the services it can provide. We’ll then examine two broad approaches towards structuring network layer packet delivery – the datagram and the virtual-circuit model – and see the fundamental role that addressing plays in delivering a packet to its destination host.
In this tutorial 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 thorough this chapter.
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 forward 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 functions. We’ll see that the job of a routing algorithm is to determine 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 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 will end this tutorial with a discussion of broadcast and multicast routing.