Skip to content

Data Link and Switching

These notes cover Physical Layer, Data Link Layer, Switching, Error Detection, and Flow Control Basics.

1. Switching

1.1 Concept of Switching

Switching is the process by which data is directed through network devices and links so that it can travel from a source toward its destination.

Consider a network with multiple devices connected through intermediate nodes. The network needs a way to determine how communication resources are used and how data travels between devices.

Two fundamental approaches are:

  • Circuit switching
  • Packet switching

1.2 Circuit Switching

In circuit switching, a dedicated communication path and associated resources are established between communicating endpoints before data transfer begins.

Phases of Circuit Switching

  1. Setup: Establish the circuit and reserve the required resources.
  2. Data transfer: Send data through the established circuit.
  3. Teardown: Release the reserved resources after communication ends.

Example: Traditional Telephone Networks

Imagine two people establishing a call through a traditional circuit-switched telephone network.

Once the circuit is established, the network reserves the required communication resources for that call.

Even when one person is silent, the reserved capacity may remain unavailable to other users.

Advantages

  • Predictable bandwidth when resources are reserved.
  • Relatively predictable communication performance.
  • Suitable for communication requiring a continuous, reserved connection.

Disadvantages

  • Resources may remain reserved even when no data is being transmitted.
  • Establishing a circuit takes time.
  • Less efficient for bursty traffic, where data is sent intermittently.

1.3 Packet Switching

In packet switching, data is divided into smaller units called packets, which are forwarded through shared network resources.

Different users share the same links according to their transmission needs.

Example: Internet Communication

Suppose you upload a file.

The data is divided into packets. These packets travel through the network, where routers forward them toward the destination.

The links are shared with traffic from other users instead of being exclusively reserved for your file transfer.

Advantages

  • Efficient utilization of network resources.
  • Well suited to bursty traffic, such as web browsing and file transfers.
  • Multiple users can share the same communication links.

Disadvantages

  • Packets can experience variable delay due to queueing.
  • Packets can be dropped when queues or buffers fill up.
  • Delivery order and reliability may require additional mechanisms, such as TCP.

1.4 Statistical Multiplexing

Statistical multiplexing allows multiple users to share a link dynamically according to their current traffic demands.

For example, suppose ten users share a network link, but only three are actively transmitting at a particular moment.

Packet switching allows those three users to use the available capacity without reserving fixed bandwidth for all ten users.

This generally improves utilization when traffic is intermittent.

However, if too many users transmit simultaneously, their combined traffic can exceed the link's capacity, causing queueing and packet drops.

1.5 Cause of Queueing

Suppose a router receives traffic at 100 Mbps but its outgoing link can transmit only 60 Mbps.

Incoming traffic is arriving faster than it can leave.

The router temporarily stores packets in a queue. If this continues, the queue grows until the buffer fills up. Further packets may be dropped.

This is one of the fundamental reasons congestion can occur in packet-switched networks.

1.6 Datagram Packet Routes

The Internet Protocol (IP) uses a connectionless datagram model.

Each IP packet is forwarded based on its destination address and the forwarding information available at the router.

Packets from the same communication may:

  • Follow the same route.
  • Follow different routes if routing conditions or forwarding decisions differ.
  • Arrive out of order.

Important: Packet switching does not mean every packet must follow a different route. Multiple packets commonly follow the same route.

1.7 Switching Types Comparison

Property Circuit switching Packet switching
Resource allocation Dedicated resources reserved for the circuit Resources shared dynamically
Setup Usually requires circuit establishment IP datagrams do not require a dedicated circuit
Data handling Communication uses the established circuit Data is divided into packets
Resource utilization Can be inefficient during silence Generally efficient for bursty traffic
Delay More predictable after setup when resources are reserved Can vary due to queueing
Congestion effects Depends on the circuit system and available capacity Can cause queueing and packet loss
Example Traditional circuit-switched telephone networks The Internet

1.8 TCP Connection Distinctions

TCP is connection-oriented, but it operates over IP's packet-switched network.

A TCP connection does not reserve a dedicated physical path between the sender and receiver.

TCP establishes logical communication state at the endpoints. The underlying IP packets still travel through a shared network.

Therefore:

  • Connection-oriented communication does not necessarily imply circuit switching.
  • A logical connection can operate over a packet-switched network.
  • TCP provides transport-layer reliability and ordering; it does not establish a dedicated physical circuit.

Interview Traps

Trap 1: "Packet switching means packets always take different routes." False. They may follow the same route.

Trap 2: "TCP requires a dedicated circuit." False. TCP operates over packet-switched IP networks.

Trap 3: "Packet switching means there is no connection." False. TCP provides a logical, connection-oriented transport service over IP.

Trap 4: "Circuit switching is defined by not dividing data into packets." The defining characteristic is the establishment and reservation of a circuit's resources, not simply whether the data is divided into smaller units.

Placement takeaway: Circuit switching reserves communication resources; packet switching shares resources dynamically. The Internet primarily uses packet switching.

2. MAC Based Switching

2.1 Concept of MAC Address

A MAC (Media Access Control) address is a link-layer address used to identify a network interface for communication over a local network link.

A typical Ethernet MAC address is 48 bits long, or 6 bytes.

Example:

00:1A:2B:3C:4D:5E

Each pair of hexadecimal digits represents one byte.

A network interface card (NIC) commonly has a MAC address assigned to it. MAC addresses can also be configured or randomized by software, so they should not be treated as unchangeable hardware identities.

2.2 Address Type Comparison

MAC addresses and IP addresses solve different problems.

Property MAC address IP address
OSI layer Data Link, Layer 2 Network, Layer 3
Main role Local-link frame delivery Logical addressing and routing
Typical length 48 bits for Ethernet MAC addresses 32 bits for IPv4; 128 bits for IPv6
Main networking device Ethernet switch Router
Scope Relevant to local-link delivery Used to identify destinations across networks
Example 00:1A:2B:3C:4D:5E 192.168.1.10

A MAC address is used for local-link delivery, while an IP address helps identify the destination across networks.

A router primarily makes routing decisions using IP addresses. Ethernet MAC addresses are used to deliver frames to the next device on each Ethernet link.

2.3 Need for Both Addresses

Imagine a laptop wants to communicate with a server on another network.

The laptop needs to solve two different problems:

  1. Where should the IP packet ultimately go? The destination IP identifies the remote server.
  2. Which device should receive the first Ethernet frame? The destination MAC identifies the next hop on the local link, normally the default gateway.

For a remote destination, the laptop's first Ethernet frame normally has:

  • Source MAC: laptop's MAC.
  • Destination MAC: default gateway's MAC.
  • Source IP: laptop's IP.
  • Destination IP: remote server's IP.

Assuming no NAT or other address translation, the destination IP remains the remote server's IP as the packet crosses routers.

The Layer 2 frame is replaced at each routed Ethernet hop, so the source and destination MAC addresses change.

Mental Model

  • IP: Where should the packet go across networks?
  • MAC: Which device should receive the frame on this local link?

This distinction is essential for understanding routers and switches.

2.4 Ethernet Switch

An Ethernet switch is a Layer 2 device that forwards Ethernet frames based on destination MAC addresses.

Unlike a basic hub, a switch learns which MAC addresses are reachable through which ports.

It stores these mappings in a table called the:

  • MAC address table
  • MAC forwarding table
  • CAM table

These terms are commonly used for the same basic concept.

2.5 MAC Address Learning

A switch learns from the source MAC address of an incoming frame.

Suppose three devices are connected to a switch:

Device MAC address Switch port
PC A AA:AA Port 1
PC B BB:BB Port 2
PC C CC:CC Port 3

Suppose PC A sends a frame to PC B.

The frame contains:

  • Source MAC: AA:AA
  • Destination MAC: BB:BB

The switch performs the following steps:

  1. Receives the frame on Port 1.
  2. Examines the source MAC, AA:AA.
  3. Learns the mapping AA:AA → Port 1.
  4. Looks up the destination MAC, BB:BB.
  5. If BB:BB → Port 2 is already known, forwards the frame through Port 2 only.

The Two Fundamental Rules

Learning: Source MAC address → incoming port.

Forwarding: Destination MAC address → outgoing port or ports.

A switch does not learn the destination's port simply because that MAC appears as the destination in a frame.

2.6 Unknown Destination MAC

Suppose PC A sends a frame to MAC DD:DD, but the switch has no entry for DD:DD.

The switch still learns the source MAC of the incoming frame.

Since the destination is unknown, the switch performs unknown-unicast flooding.

It forwards the frame through eligible ports in the same VLAN, excluding the incoming port.

If the destination device replies, the switch can learn its MAC-to-port mapping from the reply's source MAC address.

2.7 Frame Forwarding Behaviors

Frame type Switch behavior
Known unicast Forward through the port associated with the destination MAC
Unknown unicast Flood through eligible ports except the incoming port
Broadcast Flood through eligible ports except the incoming port

The Ethernet broadcast MAC address is:

FF:FF:FF:FF:FF:FF

A broadcast frame is intended for all relevant devices in the local broadcast domain.

Flooding is not the same as ordinary forwarding. It is used when the destination is unknown or when the frame is intended for all devices in the broadcast domain.

In VLAN-aware networks, flooding is limited to the relevant VLAN and eligible ports.

2.8 Device Movement

MAC tables are dynamic rather than permanent.

Switches generally learn entries automatically and age them out after a period without activity.

If a device moves to a different port and transmits a frame from that port, the switch can update its MAC-to-port mapping.

This allows switches to adapt to changes in network connectivity without requiring every mapping to be configured manually.

2.9 Networking Device Comparison

Device Primary function Typical information used
Hub Repeats incoming signals to other ports No MAC-based forwarding table
Layer 2 switch Forwards Ethernet frames within a local network MAC addresses
Router Forwards packets between networks IP addresses and routing information

A Layer 3 switch can also perform routing, so a switch is not necessarily restricted to Layer 2 in every implementation.

A router also performs Layer 1 and Layer 2 operations on its interfaces. The distinction is that it makes its inter-network forwarding decisions at Layer 3.

2.10 Router Forwarding Details

Suppose a packet travels through this path:

PC → Router 1 → Router 2 → Server

For an ordinary routed Ethernet path:

Hop Ethernet source MAC Ethernet destination MAC
PC to Router 1 PC's MAC Router 1's receiving-interface MAC
Router 1 to Router 2 Router 1's outgoing-interface MAC Router 2's receiving-interface MAC
Router 2 to Server Router 2's outgoing-interface MAC Server's MAC

At each router:

  1. The incoming frame is received.
  2. The router processes the Layer 2 framing and extracts the IP packet.
  3. It examines the destination IP and consults its routing/forwarding information.
  4. It selects the outgoing interface and next hop.
  5. It prepares a new Layer 2 frame for the outgoing link.
  6. The frame is transmitted over that link.

The IP packet's destination IP normally remains the final server's IP. The MAC addresses change from one Ethernet hop to the next.

Real forwarding hardware may process these operations in highly optimized ways, but this is the correct conceptual model.

Interview Traps

Trap 1: "A switch learns the destination MAC's port from an incoming frame." False. It learns from the source MAC and incoming port.

Trap 2: "An unknown destination causes the switch to drop the frame." Not normally. An unknown unicast is flooded through eligible ports, except the incoming port.

Trap 3: "A laptop sending to a remote server puts the remote server's MAC in the first Ethernet frame." Normally false. It uses the default gateway's MAC.

Trap 4: "A switch forwards every frame to every port." False. Known-unicast frames are selectively forwarded.

Trap 5: "The IP packet's destination MAC remains the same across routers." False. The Layer 2 header is replaced at each routed link.

Placement takeaway: Switches learn from source MAC addresses and forward using destination MAC addresses. IP determines the routed destination, while MAC addresses provide next-hop delivery over the local link.

3. Error Detection

3.1 Need for Error Detection

Data can become corrupted while travelling through a communication channel.

For example, the sender transmits:

10110010

But the receiver gets:

10100010

A bit has changed during transmission.

The receiver sees the received bits, but it does not automatically know what the original data was.

To detect corruption, the sender adds extra information calculated from the original data. The receiver uses that information to check whether the received data is consistent.

This extra information is called redundancy or check information.

3.2 Error Handling Concepts

These are different concepts.

  • Error detection: Determines that corruption may have occurred.
  • Error correction: Identifies and corrects certain errors.
  • Retransmission: Sends the data again when a transmission error or loss is detected.

Checksum and CRC are primarily error-detection techniques. Neither automatically repairs arbitrary corrupted data.

3.3 Checksum Algorithm

A checksum is a value calculated from data and transmitted along with it.

A common Internet checksum uses one's-complement addition.

We'll use small 4-bit words for a worked example. Actual Internet checksums commonly use 16-bit words.

Sender Calculation

Suppose the data consists of two words:

  • Word 1: 0101 = decimal 5
  • Word 2: 0011 = decimal 3

Step 1: Add the data words.

  0101
+ 0011
------
  1000

Step 2: Invert every bit.

The one's complement of 1000 is 0111.

Therefore:

Item Bits
Data word 1 0101
Data word 2 0011
Checksum 0111

The sender transmits both data words and the checksum.

Receiver Calculation (Correct Data)

The receiver adds the two data words and the checksum.

  0101
  0011
+ 0111
------
  1111

The result is all ones, so the checksum passes.

Why does this work? The checksum was formed by inverting the original sum. Adding the original sum and its one's complement produces all ones when there is no overflow in this example.

Receiver Calculation (Corrupted Data)

Suppose the first word changes during transmission:

  • Sent: 0101
  • Received: 0100
  • Checksum: 0111

The receiver now calculates:

  0100
  0011
+ 0111
------
  1110

The result is not 1111, so the receiver detects an inconsistency.

This demonstrates the basic mechanism: the sender calculates a check value from the original data, and the receiver checks the received data against it.

Carry Wraparound

In actual one's-complement checksum arithmetic, if addition produces a carry beyond the word size, the carry is wrapped around and added to the least significant end.

Our small example does not produce an overflow, so wraparound is unnecessary there.

Limitations of Checksums

Checksums cannot detect every possible corruption.

Different data patterns can produce the same checksum. For example, some changes in the data can cancel each other out in the arithmetic calculation.

Therefore:

  • A failed checksum detects an inconsistency.
  • A passed checksum means no error was detected by that check.
  • A passed checksum does not prove that the data is unchanged.

3.4 Cyclic Redundancy Check

CRC is an error-detection technique widely used in link-layer communication, including Ethernet.

Instead of calculating an arithmetic sum, CRC uses binary modulo-2 division.

The sender and receiver use an agreed-upon generator bit pattern, called the generator polynomial.

The XOR Operation

CRC's modulo-2 division uses XOR instead of ordinary subtraction.

A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0

XOR has no carry or borrow.

For example:

  1101
⊕ 1011
------
  0110

CRC Sender Calculation

Suppose:

  • Data = 1101
  • Generator = 1011

The generator has four bits, so its degree is three.

Step 1: Append three zeros.

Original data:  1101
Append zeros:   1101000

Why append three zeros? The generator's degree is three, so the CRC remainder will contain three bits. The zeros create space for that remainder.

Step 2: Divide using XOR.

Perform binary long division using the generator 1011. Whenever the current leading bit is 1, XOR the current four-bit group with 1011.

1101 ⊕ 1011 = 0110
Bring down 0 → 1100

1100 ⊕ 1011 = 0111
Bring down 0 → 1110

1110 ⊕ 1011 = 0101
Bring down 0 → 1010

1010 ⊕ 1011 = 0001

The final remainder is three bits long:

001

The leading zero in the last four-bit result is ignored when extracting the three-bit remainder.

Step 3: Attach the remainder to the original data.

Replace the three placeholder zeros with the calculated remainder.

Original data: 1101
CRC remainder: 001
Codeword:      1101001

The sender transmits 1101001.

CRC Receiver Calculation

The receiver divides the received codeword 1101001 by the same generator 1011.

If the codeword arrives correctly, the remainder is:

000

The CRC check passes.

If transmission changes a bit, the receiver will generally get a nonzero remainder and detect the error.

The generator is the same at both ends because the sender and receiver need to perform compatible calculations.

Why CRC Is Effective

CRC can detect many common error patterns, including many burst errors, where a group of neighboring bits changes during transmission.

The error patterns a CRC can guarantee to detect depend on the chosen generator polynomial and the length of the corruption.

CRC is generally stronger than a simple checksum for many structured bit-error patterns, which makes it useful for Ethernet frame integrity checking.

However, a zero remainder does not guarantee that the data is unchanged. Some error patterns can transform one valid codeword into another valid codeword.

3.5 Ethernet FCS

Ethernet uses a CRC-based field called the Frame Check Sequence (FCS).

Ethernet's FCS uses CRC-32.

The receiver checks the frame's FCS to detect corruption. If the frame fails the check, the receiving Ethernet interface generally discards it.

CRC itself does not repair the frame or automatically request retransmission. Whether retransmission happens depends on the relevant protocol or mechanism.

3.6 Checking Methods Comparison

Property Checksum CRC
Calculation Addition and complement in common Internet checksums XOR-based modulo-2 division
Check value Checksum Remainder
Common use TCP, UDP, IPv4 header Ethernet FCS
Error detection Detects many errors but has arithmetic weaknesses Strong detection of many common bit-error patterns
Detects every possible error? No No
Automatically corrects corruption? No No

Important Protocol Detail

  • IPv4: Has a checksum for its header.
  • TCP: Uses a checksum covering TCP information, data, and a pseudo-header.
  • UDP: Uses a checksum covering UDP information, data, and a pseudo-header, with protocol-specific rules for whether it is mandatory.
  • Ethernet: Uses a CRC-based FCS.

Interview Traps

Trap 1: "A checksum passing proves the data was not corrupted." False. Some errors can produce the same checksum.

Trap 2: "CRC uses ordinary binary subtraction." False. CRC uses modulo-2 division based on XOR.

Trap 3: "A zero CRC remainder means the receiver corrected the data." False. It means the codeword passes the CRC check.

Trap 4: "CRC automatically retransmits a corrupted frame." False. CRC detects errors; retransmission is a separate mechanism.

Placement takeaway: A checksum uses arithmetic-based checking, while CRC uses XOR-based modulo-2 division. Both detect many errors but cannot guarantee detection of every possible corruption.

4. Flow Control Basics

4.1 Concept of Flow Control

Flow control is a mechanism that prevents a sender from overwhelming a receiver with data.

Suppose a sender can transmit 500 MB/s, but the receiver can process only 100 MB/s.

The sender is producing data much faster than the receiver can process it.

If the sender keeps transmitting at full speed, the receiver's buffer may fill up, causing incoming data to be discarded.

Flow control regulates how much data the sender transmits so the receiver can handle it.

4.2 Concept of Buffers

A buffer is temporary storage used to hold data while it waits to be processed.

Suppose a receiver has a buffer that can hold 1,000 units.

If data arrives faster than the receiver processes it, the buffer gradually fills up.

The receiver needs a way to communicate how much more data it can accept.

This is the motivation behind receiver flow control.

4.3 Flow Control Mechanism

The basic process is:

  1. The sender transmits data.
  2. The receiver stores and processes incoming data.
  3. The receiver communicates how much additional data it can accept.
  4. The sender limits its transmission according to the receiver's capacity and protocol rules.

This feedback helps prevent the receiver's buffer from overflowing.

4.4 Stop and Wait Protocol

Stop-and-Wait is a simple approach to controlling transmission.

The sender transmits one unit of data and waits for an acknowledgment before sending the next unit.

Conceptually:

Sender                   Receiver
  |                          |
  |-------- Data 1 --------->|
  |<----- Acknowledgment ----|
  |                          |
  |-------- Data 2 --------->|
  |<----- Acknowledgment ----|

Advantages

  • Simple to implement and understand.
  • Limits how much unacknowledged data can be in flight.

Disadvantages

  • The sender spends time waiting for acknowledgments.
  • It can use network capacity inefficiently, especially when the round-trip time is large.

Stop-and-Wait is useful for understanding the fundamental trade-off between controlling transmission and keeping the communication link busy.

4.5 Sliding Window

Sliding Window allows the sender to transmit multiple units of data before waiting for acknowledgments, within a permitted window.

For example, instead of sending one packet and waiting, the sender might transmit several packets before requiring further acknowledgment progress.

This can improve throughput because the link remains busy while acknowledgments are travelling back.

The window limits how much data can be in flight. In protocols that support dynamic window advertisement, the allowed amount can change according to the receiver's capacity.

We will study sliding-window mechanics, sequence numbers, acknowledgments, and TCP's behavior in detail in the Transport Layer.

4.6 Control Types Comparison

This is one of the most important distinctions in Computer Networks.

Flow Control: Receiver Limitation

Imagine the network is fast, but the receiving server is busy and its receive buffer is nearly full.

The sender must limit the data sent according to the receiver's available capacity.

The problem is that the receiver cannot keep up.

Congestion Control: Network Limitation

Imagine the receiver is powerful and ready to process data, but multiple senders are competing for a slow router link.

The router's queue fills up and packets are dropped.

The problem is that the network path cannot handle the offered traffic.

Both problems can occur simultaneously.

Property Flow control Congestion control
Main concern Receiver capacity Network capacity
What is protected? Receiver and its buffers Network links, routers and queues
Example Receiver buffer nearly full Router queue fills because of competing traffic
Key question Can the receiver accept more data? Can the network safely carry more traffic?

4.7 TCP Receive Window

TCP uses a receive-window mechanism to communicate the receiver's available capacity.

rwnd stands for the receiver-advertised window.

Suppose the receiver advertises:

rwnd = 4,000 bytes

This indicates that the receiver currently has capacity for up to 4,000 additional bytes within the TCP receive window.

As the receive buffer becomes more occupied, the advertised window may decrease. As the application reads data and frees buffer space, it may increase.

TCP uses sequence numbers, acknowledgments and window boundaries to regulate outstanding data. It is not simply a rule to send exactly 4,000 bytes and then stop.

4.8 TCP Window Limits

TCP sending is constrained by both receiver flow control and congestion control.

  • rwnd = receiver-advertised window.
  • cwnd = congestion window maintained by the sender.

Conceptually:

Effective sending window = min(rwnd, cwnd)

Example:

  • rwnd = 8,000 bytes
  • cwnd = 3,000 bytes

The sender is constrained to 3,000 bytes of unacknowledged data in flight by these window limits.

This relationship is a useful conceptual model. Actual TCP behavior also depends on sequence numbers, acknowledgments, retransmissions, and other protocol details.

4.9 Mechanism Disambiguation

These mechanisms address different problems.

  • Error detection: Checks whether data may have been corrupted during transmission.
  • Flow control: Regulates the amount of data transmitted so the receiver is not overwhelmed.

A receiver might detect a corrupted frame using CRC, while TCP flow control separately regulates the amount of outstanding data.

Neither mechanism replaces the other.

Interview Traps

Trap 1: "Flow control and congestion control are the same." False. Flow control addresses receiver capacity; congestion control addresses network capacity.

Trap 2: "A large receive window means the network has high bandwidth." False. The receive window describes receiver-side capacity, not the network's bandwidth.

Trap 3: "Stop-and-Wait is always the most efficient approach." False. Waiting after every unit can leave the link idle.

Trap 4: "TCP's receive window is the same as its congestion window." False. rwnd represents receiver capacity, while cwnd represents the sender's congestion-control limit.

Placement takeaway: Flow control prevents a receiver from being overwhelmed. Congestion control protects the network from excessive traffic. TCP's rwnd and cwnd represent separate constraints.

5. Final Revision Sheet

Essential Definitions

Term Meaning
Circuit switching Establishes a circuit with reserved communication resources
Packet switching Transfers packets over shared network resources
Statistical multiplexing Dynamically shares link capacity among users
MAC address Link-layer address used for local-link delivery
MAC table Maps learned MAC addresses to switch ports
Unknown-unicast flooding Sends an unknown-destination unicast frame through eligible ports except the incoming port
Checksum Arithmetic-based check value used to detect inconsistencies
CRC Error-detection method based on modulo-2 division
FCS Ethernet's Frame Check Sequence, based on CRC-32
Flow control Prevents the sender from overwhelming the receiver
Congestion control Regulates sending to avoid overwhelming the network

Essential Rules

  1. The Internet primarily uses packet switching.
  2. TCP is connection-oriented but does not reserve a dedicated physical circuit.
  3. A switch learns from the source MAC and forwards based on the destination MAC.
  4. Unknown-unicast and broadcast frames are flooded through eligible ports, excluding the incoming port.
  5. A remote destination's IP packet normally retains its destination IP across routed hops, while the Ethernet MAC addresses change at each hop.
  6. A checksum uses arithmetic; CRC uses XOR-based modulo-2 division.
  7. A successful checksum or CRC check does not prove that corruption was impossible.
  8. CRC detects errors but does not inherently repair data or request retransmission.
  9. Flow control protects the receiver; congestion control protects the network.
  10. TCP's effective sending window is constrained by both rwnd and cwnd.

Layer Mapping

Concept Primary OSI layer
MAC addressing Layer 2 — Data Link
Ethernet switching Layer 2 — Data Link
Ethernet FCS / CRC Layer 2 — Data Link
IP routing Layer 3 — Network
TCP receive-window flow control Layer 4 — Transport
TCP congestion control Layer 4 — Transport

Remember that practical devices can implement functions spanning multiple layers. The table identifies the primary layer associated with each concept.

Final Mental Model

Think of these topics as solving four different networking problems:

  • Switching: How should communication resources be used to carry data?
  • MAC addressing: How does a frame reach the appropriate device on a local link?
  • Error detection: How can the receiver identify possible corruption?
  • Flow control: How can the sender avoid overwhelming the receiver?

These concepts form the foundation for understanding routing, ARP, TCP, congestion control, and the full journey of a request across the Internet.

Level 2 complete. These notes are intended to serve as your full reference for the concepts covered in the four sessions, with definitions, worked examples, distinctions, and interview traps preserved.