CS Atlas GATE 2027
Computer Networks course
0 / 90 complete

Computer Networks/Phase 2 · Data Link Layer

Lesson 2.1 · Item 24 of 90

Role of the data link layer: hop-to-hop delivery and MAC addresses

Read at your own pace. Try the questions before opening the answers.

On this page

Recall warm-up

  1. Circuit switching total time formula?
    Stuck? Peek at 1.3.4 Circuit vs packet switching: delay numericals
    • Circuit: setup + M/R + h·Tp.
    • Message switching: h·(M + H)/B + h·Tp.
    • Packet switching: (⌈M/p⌉ + h − 1)·(p + H)/B + h·Tp.
    • Optimal p ≈ √(M·H/(h − 1)); in MCQs evaluate each option.

    Read lesson 1.3.4

  2. N packets over h equal links: total time?
    Stuck? Peek at 1.3.2 Propagation, queuing and processing delay; multi-hop pipelining
    • Tp = d / v, v = 2 × 10⁸ m/s default; independent of size and rate.
    • Nodal delay = d_proc + d_queue + Tt + Tp.
    • One packet, h equal links: h·Tt + h·Tp.
    • N packets, h equal links: (N + h − 1)·Tt + h·Tp (+ (h − 1)·d_proc).
    • Unequal links: first packet ΣTt + ΣTp, then + (N − 1) × max Tt.
    • Traffic intensity L·a/R → 1: queues explode.

    Read lesson 1.3.2

  3. Which address changes at every hop — link-layer or network-layer?
    Stuck? Peek at 1.1.3 Encapsulation, headers, PDU names, addresses and devices per layer
    • Encapsulation: payload + header (+ trailer at data link); decapsulation in reverse.
    • PDUs: message (app) → segment (transport) → packet/datagram (network) → frame (data link) → bits.
    • Addresses: link (per hop, changes) · network (end to end, fixed) · which-program id · names.
    • Devices: hub/repeater 1 · bridge/switch 2 · router 3 · gateway/host up to 7.
    • Efficiency = data / (data + all headers + trailer).

    Read lesson 1.1.3

The Hook

A long-distance bus trip is planned city to city, but each leg is driven by a different local driver who only knows the next stop. The network layer plans the whole trip; the data link layer is that local driver. Our message, now a packet, must be carried across one link at a time — and on a shared link, the right neighbour must pick it up.

Predict First

A packet travels laptop → switch → router → … → server. At the first link, whose address must be on the outside of the wrapper: the server's, or the next box's?

,

The next box's. The frame on each link carries the link-layer address of the next hop (and of the sender on that link). The server's address lives inside, in the network header, and stays unchanged. Each hop builds a fresh frame.

Core Concept

What the data link layer does

The data link layer moves a frame from one node to the next directly connected node — hop to hop. Its jobs:

  • Framing: marking where each frame starts and ends in the bit stream.
  • Link addressing: naming the sender and receiver on this link.
  • Error detection (Ch 2.2): noticing damaged bits.
  • Medium access control (Ch 2.3): deciding who may send on a shared link.
  • Optionally error control and flow control on the link (names only for now).
Networkpacket: plans the whole route
Data linkframe: one hop at a time
Physicalbits as signals
The data link layer sits between route planning and signals.

Hop-to-hop delivery

Across a path of h links there are h separate data-link conversations. At every router, the incoming frame is opened (decapsulated), the packet goes up to the network layer, and a new frame with new link addresses is built for the next link.

LaptopRouter R1Router R2Serverframe 1: src Laptop, dst R1opens frame, keeps packetframe 2: src R1, dst R2frame 3: src R2, dst Server
Same packet inside, three different frames outside.

MAC addresses

MAC address (link-layer / hardware address): a 48-bit address burned into each network interface card, written as 6 bytes in hex, e.g. 3C:22:FB:0A:91:7E.
  • 2⁴⁸ ≈ 2.8 × 10¹⁴ possible addresses.
  • The first 24 bits identify the manufacturer (vendor prefix); the last 24 bits are numbered by that vendor — 2²⁴ = 16,777,216 per prefix.
  • A MAC address is flat: it says which card, not where it is. That is why a different, location-based address is needed to cross networks (Phase 3).
048162447
vendor prefix (24 bits)24 bits
card number (24 bits)24 bits
A MAC address: 48 bits = 12 hex digits = 6 bytes.

Framing (Foundation)

The receiver must find frame boundaries in a raw bit stream. One classic method marks each frame with a flag pattern 01111110 and uses bit stuffing: inside the frame, after five consecutive 1s the sender inserts a 0, so the flag can never appear inside data; the receiver removes the stuffed 0s. Other methods use special flag bytes with escape bytes ("byte stuffing") or a length field.
011111010five 1sstuffed 0
Bit stuffing: data 01111110 is sent as 011111010.

Putting it together

  • The data link layer carries frames one hop at a time.
  • MAC addresses are flat 48-bit card names; they change with every hop.
  • Framing marks frame boundaries (bit stuffing keeps the flag out of the data).

Visual

LayerUnitAddressScopeChanges per hop?
Networkpacketnetwork-layer (logical)end to endno
Data linkframeMAC (48-bit hardware)one linkyes
Two addresses, two scopes.

Worked Examples

Easy

How many hex digits and how many bytes are in a MAC address? How many different MAC addresses exist?

Show the full solution

48 bits = 12 hex digits = 6 bytes. 2⁴⁸ = 281,474,976,710,656 addresses.

Medium

A packet goes from host A through routers R1 and R2 to host B. How many different frames carry it, and which MAC addresses are in the frame between R1 and R2?

Show the full solution

Three links → 3 frames. Between R1 and R2: source = R1's outgoing interface MAC, destination = R2's incoming interface MAC. Neither A's nor B's MAC appears there.

GATE

(Foundation skill) With the flag 01111110 and bit stuffing, what bit string is transmitted for the data 0111111111100?

Show the full solution

Insert a 0 after every run of five 1s: 0 11111 0 11111 0 00 → 011111011111000.

GATE Traps

  • The MAC destination in a frame is the next hop, not the final server (unless they are on the same link).
  • MAC addresses are flat identifiers, not locations — they cannot be aggregated for routing.
  • 48 bits, not 32: 12 hex digits.

Memory Hook

"MAC = name tag on the card; it says who, not where."

Connect the Dots

We can now carry a frame to the next box. Next (Ch 2.2): a scratch on the cable or a burst of radio noise flips some bits on the way — how can the receiver notice that the frame is damaged?

Self-Test

  1. NAT

    How many bits are in a MAC address?

    Write your answer before opening the key.

  2. MCQ

    In the frame on the link from router R1 to router R2, the destination MAC address is that of:

    1. the original source host
    2. the final destination host
    3. R2's interface
    4. R1's interface
  3. MSQ

    Which are data link layer jobs?

    1. Framing
    2. Choosing a route across many networks
    3. Detecting damaged bits on a link
    4. Deciding who may send on a shared link
  4. MCQ

    Bit stuffing the data 11111111 (flag 01111110) gives:

    1. 111110111
    2. 11111111
    3. 111111011
    4. 011111111

Rule Card

  • Data link layer = hop-to-hop delivery of frames to the next directly connected node.
  • Jobs: framing, link addressing, error detection, medium access (+ error/flow control).
  • MAC address: 48 bits, 6 bytes, 12 hex digits; 24-bit vendor prefix; flat.
  • A new frame (new MAC addresses) is built on every link; the packet inside is unchanged.
  • Foundation: bit stuffing inserts a 0 after five consecutive 1s.

Concept Ledger

  • data link layer role
  • hop-to-hop (node-to-node) delivery
  • MAC address (48-bit, hex)
  • vendor prefix
  • framing (Foundation): flags, bit stuffing
  • error control / flow control (names)

Answer Vault

Try the questions first. Open when you are ready to check.

Warm-up answers

  1. setup + M/R + h·T_p.
  2. (N + h − 1)·T_t + h·T_p.
  3. The link-layer address.

Self-test answers

  1. 48 — 6 bytes × 8 = 48 bits.
  2. C — Each frame is addressed to the next hop on its link.
    • A: The source host is not on this link.
    • B: The final host appears only in the network header.
    • D: R1 is the sender on this link.
  3. ACD — Framing, error detection and medium access are link-layer jobs.
    • B: Route choice is the network layer.
  4. A — After five 1s insert a 0: 11111 0 111.
    • B: No stuffing applied.
    • C: Stuffed after six 1s instead of five.
    • D: Stuffing goes after the run, not before it.

Flashcards

  1. MAC address size?
    Reveal answer48 bits (6 bytes, 12 hex digits).
  2. Destination MAC on an intermediate link?
    Reveal answerThe next hop's interface.
  3. Bit stuffing rule?
    Reveal answerInsert a 0 after five consecutive 1s.

Exam shortcuts

  • Frames per path = number of links h; MAC addresses change on every link. — routers in between (a switch inside a LAN keeps the frame's MAC addresses unchanged).

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.