Link Layer and Local Area Networks Study Notes

Chapter 6: The Link Layer and LANs

Goals and Roadmap of the Link Layer

  • Primary Goals:

    • Understand the principles behind link layer services, including:

      • Error detection and correction mechanisms.

      • Sharing a broadcast channel, specifically multiple access protocols.

      • Link layer addressing.

      • Local Area Networks (LANs) such as Ethernet and Virtual Local Area Networks (VLANs).

    • Examine datacenter networks.

    • Explore the instantiation and implementation of various link layer technologies.

  • Roadmap of Content:

    • A day in the life of a web request.

    • Introduction to the Link Layer.

    • Error detection and correction.

    • Multiple access protocols.

    • LANs (Addressing, ARP, Ethernet, Switches, VLANs).

    • Link virtualization (MPLS).

    • Data center networking.

Link Layer: Introduction and Terminology

  • Terminology:

    • Nodes: These include hosts and routers within the network.

    • Links: Communication channels that connect adjacent nodes along a communication path. These can be:

      • Wired links.

      • Wireless links.

      • Local Area Networks (LANs).

    • Frame: A layer-2 packet which encapsulates a network-layer datagram.

  • Responsibility: The link layer has the specific responsibility of transferring a datagram from one node to a physically adjacent node over a communication link.

  • Context and Heterogeneity:

    • A datagram may be transferred by different link protocols over different links along its path (e.g., WiFi on the initial link, then Ethernet on the subsequent link).

    • Each link protocol provides different services; for instance, some may provide reliable data transfer while others do not.

The Transportation Analogy

  • The travel of a datagram across a network is compared to a trip from Princeton to Lausanne.

  • Path Segments:

    • Limo: From Princeton to JFK airport.

    • Plane: From JFK to Geneva.

    • Train: From Geneva to Lausanne.

  • Mapping to Networking:

    • Tourist: Corresponds to the datagram.

    • Transport Segment: Corresponds to the communication link.

    • Transportation Mode: Corresponds to the link-layer protocol.

    • Travel Agent: Corresponds to the routing algorithm.

Link Layer Services

  • Framing and Link Access:

    • Encapsulation of the network-layer datagram into a frame.

    • Addition of headers and trailers.

    • Channel access management if the medium is shared.

    • MAC (Medium Access Control) Addresses: Used in frame headers to identify source and destination nodes; these are distinct from IP addresses.

  • Reliable Delivery between Adjacent Nodes:

    • This is often unnecessary on low bit-error links (such as fiber or twisted pair).

    • It is critical for wireless links, which exhibit high error rates.

    • Note: Both link-level and end-to-end reliability are used because link-layer reliability reduces the need for expensive end-to-end retransmissions by fixing errors locally.

  • Flow Control: Pacing between the adjacent sending and receiving nodes to prevent the receiver from being overwhelmed.

  • Error Detection:

    • Errors can be caused by signal attenuation or noise.

    • The receiver detects errors and may signal for retransmission or simply drop the frame.

  • Error Correction: The receiver identifies and corrects bit errors without requiring a retransmission.

  • Full vs. Half Duplex:

    • Half-Duplex: Nodes at both ends of a link can transmit, but not simultaneously.

    • Full-Duplex: Nodes at both ends can transmit and receive at the same time.

Host Link-Layer Implementation

  • Location: The link layer is implemented in every single host.

  • Hardware Component: Typically implemented on-chip or in a Network Interface Card (NIC), which handles both link and physical layer functions.

  • Integration: The link layer hardware attaches directly to the host's system buses (e.g., PCI).

  • Composition: It represents a combination of hardware, software, and firmware.

  • Interface Communication:

    • Sending Side: Encapsulates the datagram in a frame and adds error checking bits, reliable data transfer (RDT) bits, flow control information, etc.

    • Receiving Side: Looks for errors, extracts the datagram, and passes it to the upper layers (Network layer).

Error Detection and Correction (EDC)

  • Definition:

    • DD: Data bits protected by error checking, which may include header fields.

    • EDCEDC: Error Detection and Correction bits (redundancy).

  • Reliability: Error detection is not 100%100\% reliable. Protocols may rarely miss some errors. However, a larger EDCEDC field generally yields better detection and correction capabilities.

  • Parity Checking:

    • Single Bit Parity: Detects a single bit error by adding a parity bit such that the total number of 11's is even (or odd).

    • Two-Dimensional Bit Parity: Can both detect and correct single bit errors by calculating parity for rows and columns.

      • In a grid of data bits di,jd_{i,j}, row parity and column parity are appended.

      • The intersection of a row parity error and a column parity error identifies the specific bit flipped.

  • Internet Checksum:

    • Goal: Detect errors (flipped bits) in a transmitted segment.

    • Sender Side:

      1. Treat segments as a sequence of 1616-bit integers.

      2. The checksum is the addition (one's complement sum) of the segment contents.

      3. The checksum value is stored in the UDP checksum field.

    • Receiver Side:

      1. Compute the checksum of the received segment.

      2. Compare with the received checksum field value. If they are not equal, an error is detected.

Cyclic Redundancy Check (CRC)

  • Overview: A more powerful error-detection coding, widely used in Ethernet and 802.11802.11 WiFi. It can detect all burst errors less than r+1r + 1 bits.

  • Variables:

    • DD: Data bits (viewed as a binary number).

    • GG: Bit pattern (generator) of r+1r+1 bits, specified by a standard.

    • RR: The calculated rr CRC bits.

  • Algorithm (Sender):

    • The goal is to calculate RR such that the sequence of bits ⟨D,R⟩\langle D, R \rangle is exactly divisible by GG using modulo 22 arithmetic.

    • The formula is based on: D⋅2r⊕R=nGD \cdot 2^r \oplus R = nG

    • This implies: R=remainder[D⋅2rG]R = \text{remainder} \left[ \frac{D \cdot 2^r}{G} \right]

  • Algorithm (Receiver):

    • The receiver divides the bit string ⟨D,R⟩\langle D, R \rangle by the known generator GG.

    • If the remainder is non-zero, an error has occurred.

  • Modulo 2 Arithmetic: In this context, addition is equivalent to bitwise XOR, and there are no carries or borrows.