Data Link Layer
gocourse.in Maintenance

We'll be back soon

Our CDN (cdn.gocourse.in) is currently unreachable. Some images, JavaScript, or CSS files may not load properly.

Estimated downtime: ~30 minutes

Data Link Layer

kumudha

Data Link Layer

In computer networks, data must travel through multiple layers before it reaches its destination. The Data Link Layer plays a crucial role in ensuring that data is transferred reliably between devices connected on the same network.

Whether you are browsing the internet, sending emails, streaming videos, or accessing a shared printer, the Data Link Layer works behind the scenes to make communication accurate and efficient.

What is the Data Link Layer?

The Data Link Layer is the second layer (Layer 2) of the OSI (Open Systems Interconnection) Model.

It is responsible for the reliable transfer of data between two directly connected devices over a physical communication link.

The Data Link Layer sits between:
  • Network Layer (Layer 3) above it
  • Physical Layer (Layer 1) below it
Its primary responsibility is to ensure that data transmitted over a physical medium reaches the intended device accurately and efficiently.

Why Do We Need the Data Link Layer?

Imagine sending a package through a courier service.
  • The Network Layer decides the route.
  • The Physical Layer provides the road.
  • The Data Link Layer ensures the package is properly packed, labeled, checked for damage, and delivered to the correct house on the local street.
Without the Data Link Layer:
  • Data could become corrupted.
  • Frames could arrive out of order.
  • Devices could transmit simultaneously and cause collisions.
  • The receiver might become overwhelmed with too much data.

What is a Frame?

The Data Link Layer receives data packets from the Network Layer and converts them into Frames.

A Frame is the unit of data at Layer 2.

Header Contains

  • Source MAC Address
  • Destination MAC Address
  • Control Information

Trailer Contains

  • Error Detection Information (CRC)
The process of adding headers and trailers is called Framing.

Major Services Provided by the Data Link Layer

The Data Link Layer provides several important services to ensure reliable communication.

1. Framing

Framing is the process of dividing data into manageable units called frames.

Example

Suppose a file contains 10 MB of data.

Instead of sending it as one large block, the Data Link Layer breaks it into multiple frames for efficient transmission.

Benefits
  • Easier error detection
  • Better data management
  • Efficient transmission

2. Reliable Delivery

The Data Link Layer can ensure reliable communication by using:
  • Acknowledgments (ACK)
  • Retransmissions
Example

If a frame is lost during transmission:
  1. Sender transmits the frame.
  2. Receiver does not acknowledge it.
  3. Sender retransmits the frame.
This ensures successful delivery.

3. Flow Control

Sometimes the sender is faster than the receiver.

Without flow control:
  • Receiver buffers overflow
  • Frames are lost
Flow control regulates transmission speed.

Real-World Example

Imagine pouring water into a bottle.

If water is poured too quickly, it spills out.

Flow control prevents data overflow in the same way.

4. Error Detection

Transmission media can introduce errors due to:
  • Electrical noise
  • Signal attenuation
  • Interference
The Data Link Layer detects such errors using techniques like:
  • CRC (Cyclic Redundancy Check)
  • Parity Check
  • Checksum
Example

If a bit changes from:

10110110

to

10100110

the receiver can detect that an error occurred.

5. Error Correction

Some protocols can not only detect errors but also correct them.

Example

Using Forward Error Correction (FEC), the receiver can identify which bit is incorrect and restore the original data.

6. Access Control

In shared networks, multiple devices may attempt to transmit data simultaneously.

The Data Link Layer determines:
  • Which device can send data
  • When it can send
  • How collisions are avoided
Example

In Wi-Fi networks, devices follow specific rules before transmitting.

7. Half-Duplex and Full-Duplex Communication

Half-Duplex

Communication occurs in both directions, but only one direction at a time.

Example: Walkie-talkies

Device A --> Device B
OR
Device B --> Device A

Full-Duplex

Both devices can transmit simultaneously.

Example: Telephone calls

Device A <--> Device B

Sublayers of the Data Link Layer

The IEEE divides the Data Link Layer into two sublayers:

1. Logical Link Control (LLC)

The LLC sublayer provides communication services to the Network Layer.

Responsibilities
  • Error notification
  • Flow control
  • Acknowledgments
  • Link management
Benefits

It allows multiple network protocols to share the same physical medium.

2. Media Access Control (MAC)

The MAC sublayer controls access to the transmission medium.

Responsibilities
  • MAC addressing
  • Collision handling
  • Channel access control
Example

When several computers are connected to the same network, MAC determines which device can transmit first.

Functions of the Data Link Layer

The Data Link Layer performs several critical functions.

1. Framing

Creates frames from packets received from the Network Layer.

2. Physical Addressing

Every device on a local network has a unique MAC address.

Example:

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

The Data Link Layer uses these addresses to deliver frames to the correct device.

3. Error Detection and Recovery

Detects transmission errors and requests retransmission when necessary.

4. Flow Control

Ensures sender and receiver operate at compatible speeds.

5. Medium Access Control

Prevents collisions in shared communication channels.

Devices That Operate at the Data Link Layer

Several networking devices work primarily at Layer 2.

1. Switch

A Switch is the most common Layer 2 device.

Functions

Learns MAC addresses
Forwards frames
Reduces collisions
Improves network performance

Example

In an office network, a switch connects computers, printers, and servers.

2. Bridge

A Bridge connects multiple LAN segments.

Functions

Filters traffic
Reduces congestion
Improves efficiency

Example

A bridge can separate heavy traffic areas from less busy areas of a network.

3. Network Interface Card (NIC)

Every computer connected to a network uses a NIC.

Functions
  • Provides a MAC address
  • Sends and receives frames
  • Connects devices to the network

4. Wireless Access Point (WAP)

A WAP connects wireless devices to a wired network.

Functions
  • Manages wireless communication
  • Controls wireless access
  • Supports Wi-Fi standards

5. Layer 2 Switch

A specialized switch that performs only Data Link Layer operations.

Functions
  • Maintains MAC address tables
  • Forwards frames efficiently
  • Supports VLANs

Common Data Link Layer Protocols

The Data Link Layer uses various protocols to manage communication.

1. Ethernet

Ethernet is the most widely used LAN protocol.

Features
  • Uses MAC addressing
  • Supports high-speed communication

Defined by IEEE 802.3
Example

Office and home wired networks.

2. Token Ring

A network protocol where a special token circulates among devices.

Only the device holding the token can transmit data.

Advantage

Reduces collisions.

3. FDDI (Fiber Distributed Data Interface)

Uses fiber-optic cables for high-speed communication.

Features
  • High reliability
  • Long-distance support
  • Fault tolerance

4. PPP (Point-to-Point Protocol)

Used for direct communication between two devices.

Common Uses
  • Broadband connections
  • Dial-up Internet
  • WAN links

5. HDLC (High-Level Data Link Control)

A bit-oriented protocol providing reliable communication.

Features
  • Error control
  • Synchronization
  • Efficient framing

6. SDLC (Synchronous Data Link Control)

Developed by IBM as part of its network architecture.

Features
  • Reliable communication
  • Structured frame format
  • Multipoint support

7. SLIP (Serial Line Internet Protocol)

One of the earliest protocols for transmitting IP packets over serial links.

Limitation

Lacks advanced error handling and authentication.

8. LCP (Link Control Protocol)

A component of PPP used to:
  • Establish links
  • Configure connections
  • Maintain communication
  • Terminate connections

9. LAP (Link Access Procedure)

A family of protocols based on HDLC.

Used in telecommunication networks.

10. NCP (Network Control Protocol)

An early protocol used in ARPANET before TCP/IP became standard.

Real-World Applications of the Data Link Layer

The Data Link Layer is present in nearly every network technology.

Local Area Networks (LANs)

Ethernet networks use the Data Link Layer for reliable communication between computers.

Wi-Fi Networks

The Data Link Layer controls wireless communication and collision avoidance.

Network Switching

Switches use MAC addresses to forward frames correctly.

Point-to-Point Connections

PPP enables communication between two directly connected devices.

Data Centers

Modern switches rely heavily on Data Link Layer mechanisms for high-speed communication.

Advantages of the Data Link Layer

  • Provides reliable communication
  • Detects transmission errors
  • Controls data flow
  • Reduces collisions
  • Uses MAC addressing for local delivery
  • Supports efficient frame transmission

Limitations of the Data Link Layer

  • Works only between directly connected devices
  • Cannot determine end-to-end routing
  • Limited to local network communication
  • Performance depends on underlying hardware

Our website uses cookies to enhance your experience. Learn More
Accept !