Link Layer

Link Layer

PCBWay

Link layer appears below the network layer in the protocol stack.

We know that network layer provides a communication service between any two network hosts. Between the two hosts, datagrams travel over a series of communication links, some wires and some wireless, starting at the source host, passing through a series of packet switches (switches and routers) and ending at the destination host.

As we continue down the protocol stack, from the network layer to the link layer, we naturally wonder :

  • How packets are sent across the individual links that make up the end-to-end communication path.
  • How are the network-layer datagrams encapsulated in the link layer frames for transmission over a single link?
  • Are different link layer protocols used in the different links along the communication path?
  • How are transmission conflicts in broadcast links resolved?
  • Is there addressing at the link layer and, if so, how does the link layer addressing operate with the network layer addressing.
  • And what exactly is the difference between a switch and a router?

We’ll answer these and other important questions in this tutorial.

Understanding Link Layer with Example

It will be convenient, in this tutorial, to refer to any device that runs a link layer protocol as a node. Nodes include hosts, routers, switches, and WiFi access points.

We’ll also refer to the communication channels that connect adjacent nodes along the communication path as links. In order for a datagram to be transferred from source host to destination host, it must be move over each of the individual links in the end-to-end path.

As an example, in the company network shown in the figure below (5.1), consider sending a datagram from one of the wireless hosts to one of the servers.

Link Layer

This datagram will actually pass through six links:

  1. a WiFi link between sending host and a WiFi access point,
  2. an Ethernet link between the access point and a link layer switch;
  3. a link between the link layer switch and the router,
  4. a link between two routers;
  5. an Ethernet link between the router and a link layer switch; &
  6. finally an Ethernet link between the switch and the server.

Over a given link, a transmitting node encapsulates the datagram in a link layer frame and transmits the frame into the link.

In order to gain further insight into the link layer and how it relates to the network layer, let’s consider a transportation analogy. Consider a travel agent who is planning a trip for a tourist traveling from Princeton, New Jersey, to Lausanne, Switzerland. The travel agent decides that it is most convenient for the tourist to:

  1. take a limousine from Princeton to JFK airport,
  2. then a plane from JFK airport to Geneva’s airport, and
  3. finally a train from Geneva’s airport to Lausanne’s train station.

Once the travel agent makes the three reservations,

  1. it is the responsibility of the Princeton limousine company to get the tourist from Princeton to JFK;
  2. it is the responsibility of the airline company to get the tourist from JFK to Geneva; and
  3. it is the responsibility of the Swiss train service to get the tourist from Geneva to Lausanne.

Each of the three segments of the trip is “direct” between two “adjacent” locations. Note that the three transportation segments are managed by different companies and use entirely different transportation modes (limousine, plane and train).

Although the transportation modes are different, they each provide the basic service of moving passengers from one location to an adjacent location. In this transportation analogy:

  1. The tourist is a datagram,
  2. Each transportation segment is a link,
  3. The transportation mode is a link layer protocol, and
  4. The travel agent is a routing protocol.