Data Link Layer: Functions & Framing Techniques
Data Link Layer: Functions & Framing Techniques
Data Link Layer – Framing – Flow control – Error control – Data-Link Layer
Protocols – HDLC – PPP - Media Access Control – Ethernet Basics – CSMA/CD –
Virtual LAN – Wireless LAN (802.11) - Physical Layer: Data and Signals -
Performance – Transmission media- Switching – Circuit Switching.
[Link] LINK LAYER
The Data-link layer is the second layer from the bottom in the OSI (Open System
Interconnection) network architecture model. It is responsible for the node-to-node
delivery of data. Its major role is to ensure error-free transmission of information. DLL is
also responsible to encode, decode and organize the outgoing and incoming data. This is
considered the most complex layer of the OSI model as it hides all the underlying
complexities of the hardware from the other above layers.
Logical Link Control (LLC):This sublayer of the data link layer deals with multiplexing,
the flow of data among applications and other services, and LLC is responsible for
providing error messages and acknowledgments as well.
Media Access Control (MAC):MAC sublayer manages the device’s interaction, responsible
for addressing frames, and also controls physical media access.
The data link layer receives the information in the form of packets from the Network
layer, it divides packets into frames and sends those frames bit-by-bit to the underlying
physical layer.
1. Framing: The packet received from the Network layer is known as a frame in the Data
link layer. At the sender’s side, DLL receives packets from the Network layer and divides
them into small frames, then, sends each frame bit-by-bit to the physical layer. It also
attaches some special bits (for error control and addressing) at the header and end of the
frame. At the receiver’s end, DLL takes bits from the Physical layer organizes them into
the frame, and sends them to the Network layer.
2. Addressing: The data link layer encapsulates the source and destination’s MAC
address/ physical address in the header of each frame to ensure node-to-node delivery.
MAC address is the unique hardware address that is assigned to the device while
manufacturing.
3. Error Control: Data can get corrupted due to various reasons like noise, attenuation,
etc. So, it is the responsibility of the data link layer, to detect the error in the transmitted
data and correct it using error detection and correction techniques respectively. DLL
adds error detection bits into the frame’s header, so that receiver can check received data
is correct or not.
4. Flow Control: If the receiver’s receiving speed is lower than the sender’s sending
speed, then this can lead to an overflow in the receiver’s buffer and some frames may get
lost. So, it’s the responsibility of DLL to synchronize the sender’s and receiver’s speeds
and establish flow control between them.
5. Access Control: When multiple devices share the same communication channel there
is a high probability of collision, so it’s the responsibility of DLL to check which device has
control over the channel and CSMA/CD and CSMA/CA can be used to avoid collisions and
loss of frames in the channel.
Types of framing
There are two types of framing:
1. Fixed-size: The frame is of fixed size and there is no need to provide boundaries to the
frame, the length of the frame itself acts as a delimiter.
● Drawback: It suffers from internal fragmentation if the data size is less than
the frame size
● Solution: Padding
2. Variable size: In this, there is a need to define the end of the frame as well as the
beginning of the next frame to distinguish. This can be done in two ways:
1. Length field – We can introduce a length field in the frame to indicate the
length of the frame. Used in Ethernet(802.3). The problem with this is that
sometimes the length field might get corrupted.
2. End Delimiter (ED) – We can introduce an ED(pattern) to indicate the end of
the frame. Used in Token Ring. The problem with this is that ED can occur in
the data. This can be solved by:
1. Character/Byte Stuffing: Used when frames consist of characters. If data
contains ED then, a byte is stuffed into data to differentiate it from ED.
Let ED = “$” –> if data contains ‘$’ anywhere, it can be escaped using ‘\O’
character.
–> if data contains ‘\O$’ then, use ‘\O\O\O$'($ is escaped using \O and \O is
escaped using \O).
Variable frame length: The length of frames can vary depending on the data being
transmitted, which can lead to inefficiencies in transmission. To address this issue,
protocols such as HDLC and PPP use a flag sequence to mark the start and end of each
frame.
Bit stuffing: Bit stuffing is a technique used to prevent data from being interpreted as
control characters by inserting extra bits into the data stream. However, bit stuffing can
lead to issues with synchronization and increase the overhead of the transmission.
Synchronization: Synchronization is critical for ensuring that data frames are transmitted
and received correctly. However, synchronization can be challenging, particularly in
high-speed networks where frames are transmitted rapidly.
Error detection: Data Link Layer protocols use various techniques to detect errors in the
transmitted data, such as checksums and CRCs. However, these techniques are not
foolproof and can miss some types of errors.
Efficiency: Efficient use of available bandwidth is critical for ensuring that data is
transmitted quickly and reliably. However, the overhead associated with framing and
error detection can reduce the overall efficiency of the transmission.
[Link] CONTROL
Data-link layer uses the techniques of error control simply to ensure and confirm that all
the data frames or packets, i.e. bit streams of data, are transmitted or transferred from
sender to receiver with certain accuracy. Using or providing error control at this data link
layer is an optimization, it was never a requirement. Error control is basically process in
data link layer of detecting or identifying and re-transmitting data frames that might be
lost or corrupted during transmission. In both of these cases, receiver or destination does
not receive correct data frame and sender or source does not even know anything about
any such loss regarding data frames. Therefore, in such type of cases, both sender and
receiver are provided with some essential protocols that are required to detect or identify
such types of errors as loss of data frames. The Data-link layer follows a technique known
as re-transmission of frames to detect or identify transit errors and also to take necessary
actions that are required to reduce or remove such errors. Each and every time an error
is detected during transmission, particular data frames are retransmitted and this
process is known as ARQ (Automatic Repeat Request).
Ways of doing Error Control : There are basically two ways of doing Error control as
given below :
Various Techniques for Error Control : There are various techniques of error control as
given below :
Techniques of Error Control
The main difference between Go Back ARQ and Selective Repeat ARQ is that in Go Back
ARQ, the sender has to retransmit the whole window of frame again if any of the frame is
lost but in Selective Repeat ARQ only the data frame that is lost is retransmitted.
High-level Data Link Control (HDLC) is a group of communication protocols of the data
link layer for transmitting data between network points or nodes. Since it is a data link
protocol, data is organized into frames. A frame is transmitted via the network to the
destination that verifies its successful arrival. It is a bit - oriented protocol that is
applicable for both point - to - point and multipoint communications.
Transfer Modes
HDLC supports two types of transfer modes, normal response mode and asynchronous
balanced mode.
● Normal Response Mode (NRM) − Here, two types of stations are there, a
primary station that send commands and secondary station that can
respond to received commands. It is used for both point - to - point and
multipoint communications.
● Asynchronous Balanced Mode (ABM) − Here, the configuration is balanced, i.e. each
station can both send commands and respond to commands. It is used for only point - to
- point communications.
●
HDLC Frame
HDLC is a bit - oriented protocol where each frame contains up to six fields. The structure
varies according to the type of frame. The fields of a HDLC frame are −
● Flag − It is an 8-bit sequence that marks the beginning and the end of the
frame. The bit pattern of the flag is 01111110.
● Address − It contains the address of the receiver. If the frame is sent by the
primary station, it contains the address(es) of the secondary station(s). If it
is sent by the secondary station, it contains the address of the primary
station. The address field may be from 1 byte to several bytes.
● Control − It is 1 or 2 bytes containing flow and error control information.
● Payload − This carries the data from the network layer. Its length may vary
from one network to another.
● FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The
standard code used is CRC (cyclic redundancy code).
PPP Frame
PPP is a byte - oriented protocol where each field of the frame is composed of one or
more bytes. The fields of a PPP frame are −
● Flag − 1 byte that marks the beginning and the end of the frame. The bit
pattern of the flag is 01111110.
● Address − 1 byte which is set to 11111111 in case of broadcast.
● Control − 1 byte set to a constant value of 11000000.
● Protocol − 1 or 2 bytes that define the type of data contained in the payload
field.
● Payload − This carries the data from the network layer. The maximum
length of the payload field is 1500 bytes. However, this may be negotiated
between the endpoints of communication.
● FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The
standard code used is CRC (cyclic redundancy code)
Byte Stuffing in PPP Frame − Byte stuffing is used is PPP payload field whenever the flag
sequence appears in the message, so that the receiver does not consider it as the end of
the frame. The escape byte, 01111101, is stuffed before every byte that contains the same
byte as the flag byte or the escape byte. The receiver on receiving the message removes
the escape byte before passing it onto the network layer.
A media access control is a network data transfer policy that determines how data is
transmitted between two computer terminals through a network cable. The media access
control policy involves sub-layers of the data link layer 2 in the OSI reference model.
The essence of the MAC protocol is to ensure non-collision and eases the transfer of data
packets between two computer terminals. A collision takes place when two or more
terminals transmit data/information simultaneously. This leads to a breakdown of
communication, which can prove costly for organizations that lean heavily on data
transmission.
This network channel through which data is transmitted between terminal nodes to
avoid collision has three various ways of accomplishing this purpose. They include:
● Carrier sense multiple access with collision avoidance (CSMA/CA)
● Carrier sense multiple access with collision detection (CSMA/CD)
● Demand priority
● Token passing
Demand Priority
The demand priority is an improved version of the Carrier sense multiple access
with collision detection (CSMA/CD). This data control policy uses an ‘active hub’ in
regulating how a network is accessed. Demand priority requires that the network
terminals obtain authorization from the active hub before data can be transmitted.
Another distinct feature of this MAC control policy is that data can be transmitted
between the two network terminals at the same time without collision. In the Ethernet
media, demand priority directs that data is transmitted directly to the receiving network
terminal.
Token Passing
This media access control method uses free token passing to prevent a collision. Only a
computer that possesses a free token, which is a small data frame, is authorized to
transmit. Transmission occurs from a network terminal that has a higher priority than
one with a low priority.
Token passing flourishes in an environment where a large number of short data frames
are transmitted. This media access control policy is highly efficient in avoiding a collision.
Possession of the free token is the only key to transmitting data by a network node. Each
terminal holds this free token for a specific amount of time if the network with the high
priority does not have data to transmit, the token is passed to the adjoining station in
the network.
Media access control regulates how a network is accessed by computer terminals and
transmits from one terminal to the other without collision. This is achieved through
CSMA/CD, CSMA/CA, demand priority, or Token passing.
Virtual Local Area Networks or Virtual LANs (VLANs) are a logical group of computers
that appear to be on the same LAN irrespective of the configuration of the underlying
physical network. Network administrators partition the networks to match the
functional requirements of the VLANs so that each VLAN comprise of a subset of ports
on a single or multiple switches or bridges. This allows computers and devices in a VLAN
to communicate in the simulated environment as if it is a separate LAN.
Features of VLANs
● A VLAN forms sub-network grouping together devices on separate physical
LANs.
● VLAN's help the network manager to segment LANs logically into different
broadcast domains.
● VLANs function at layer 2, i.e. Data Link Layer of the OSI model.
● There may be one or more network bridges or switches to form multiple,
independent VLANs.
● Using VLANs, network administrators can easily partition a single switched
network into multiple networks depending upon the functional and
security requirements of their systems.
● VLANs eliminate the requirement to run new cables or reconfiguring
physical connections in the present network infrastructure.
● VLANs help large organizations to re-partition devices aiming improved
traffic management.
● VLANs also provide better security management allowing partitioning of
devices according to their security criteria and also by ensuring a higher
degree of control connected devices.
● VLANs are more flexible than physical LANs since they are formed by logical
connections. This aids is quicker and cheaper reconfiguration of devices
when the logical partitioning needs to be changed.
Types of VLANs
● Protocol VLAN − Here, the traffic is handled based on the protocol used. A
switch or bridge segregates, forwards or discards frames the come to it
based upon the traffics protocol.
● Port-based VLAN − This is also called static VLAN. Here, the network
administrator assigns the ports on the switch / bridge to form a virtual
network.
● Dynamic VLAN − Here, the network administrator simply defines network
membership according to device characteristics.
[Link] LAN (802.11)
Wireless LANs are those Local Area Networks that use high frequency radio waves
instead of cables for connecting the devices in LAN. Users connected by WLANs can move
around within the area of network coverage. Most WLANs are based upon the standard
IEEE 802.11 or WiFi.
IEEE 802.11 Architecture
The components of an IEEE 802.11 architecture are as follows
1) Stations (STA) − Stations comprise all devices and equipments that are connected to
the wireless LAN. A station can be of two types:
● Wireless Access Pointz (WAP) − WAPs or simply access points (AP) are
generally wireless routers that form the base stations or access.
● Client. − Clients are workstations, computers, laptops, printers,
smartphones, etc.
Each station has a wireless network interface controller.
2) Basic Service Set (BSS) −A basic service set is a group of stations communicating at
physical layer level. BSS can be of two categories depending upon mode of operation:
● Infrastructure BSS − Here, the devices communicate with other devices
through access points.
● Independent BSS − Here, the devices communicate in peer-to-peer basis in
an ad hoc manner.
3) Extended Service Set (ESS) − It is a set of all connected BSS.
4) Distribution System (DS) − It connects access points in ESS.
Advantages of WLANs
● They provide clutter free homes, offices and other networked places.
● The LANs are scalable in nature, i.e. devices may be added or removed from
the network at a greater ease than wired LANs.
● The system is portable within the network coverage and access to the
network is not bounded by the length of the cables.
● Installation and setup is much easier than wired counterparts.
● The equipment and setup costs are reduced.
Disadvantages of WLANs
● Since radio waves are used for communications, the signals are noisier with
more interference from nearby systems.
● Greater care is needed for encrypting information. Also, they are more
prone to errors. So, they require greater bandwidth than the wired LANs.
● WLANs are slower than wired LANs.
Data-Link Layer
This layer is responsible for the error-free transfer of data frames.
It defines the format of the data on the network.
It provides a reliable and efficient communication between two or more devices.
It is mainly responsible for the unique identification of each device that
resides on a local network.
*List out the functions of the Data Link Layer(Apr/May 2021)(2)
Functions of the Data-link layer
Physical Addressing: The Data link layer adds a header to the frame that contains a
destination address. The frame is transmitted to the destination address mentioned in
the header.
Flow Control: Flow control is the main functionality of the Data-link layer. It is the
technique through which the constant data rate is maintained on both the sides so that
no data get corrupted. It ensures that the transmitting station such as a server with higher
processing speed does not exceed the receiving station, with lower processing speed.
Error Control: Error control is achieved by adding a calculated value CRC (Cyclic
Redundancy Check) that is placed to the Data link layer's trailer which is added to the
message frame before it is sent to the physical layer. If any error seems to occur, then the
receiver sends the acknowledgment for the retransmission of the corrupted frames.
Access Control: When two or more devices are connected to the same communication
channel, then the data link layer protocols are used to determine which device has
control over the link at a given time.
Network Layer
It is a layer 3 that manages device addressing, tracks the location of devices on the
network.
It determines the best path to move data from source to the destination based on the
network conditions, the priority of service, and other factors.
The Data link layer is responsible for routing and forwarding the packets.
Routers are the layer 3 devices, they are specified in this layer and used to provide the
routing services within an internetwork.
The protocols used to route the network traffic are known as Network layer protocols.
Examples of protocols are IP and Ipv6.
Session Layer
It is a layer 3 in the OSI model.
The Session layer is used to establish, maintain and synchronizes the interaction
between communicating devices.
Functions of Session layer:
Dialog control: Session layer acts as a dialog controller that creates a dialog between
two processes or we can say that it allows the communication between two processes
which can be either half-duplex or full-duplex.
Synchronization: Session layer adds some checkpoints when transmitting the data in
a sequence. If some error occurs in the middle of the transmission of data, then the
transmission will take place again from the checkpoint. This process is known as
Synchronization and recovery.
Presentation Layer
A Presentation layer is mainly concerned with the syntax and semantics of the
information exchanged between the two systems.
It acts as a data translator for a network.
This layer is a part of the operating system that converts the data from one
presentation format to another format.
The Presentation layer is also known as the syntax layer.
Application Layer
An application layer serves as a window for users and application processes to access
network service.
It handles issues such as network transparency, resource allocation, etc.
An application layer is not an application, but it performs the application layer
functions.
This layer provides the network services to the end-users.
Functions of Application layer:
File transfer, access, and management (FTAM): An application layer allows a user
to access the files in a remote computer, to retrieve the files from a computer and to
manage the files in a remote computer.
Mail services: An application layer provides the facility for email forwarding and
storage.
Directory services: An application provides the distributed database sources and is
used to provide that global information about various objects.
[Link] MEDIA
Transmission media is a communication channel that carries the information from the
sender to the receiver. Data is transmitted through the electromagnetic signals.
The main functionality of the transmission media is to carry the information in the form
of bits through LAN(Local Area Network).
It is a physical path between transmitter and receiver in data communication.
In a copper-based network, the bits in the form of electrical signals.
In a fiber based network, the bits in the form of light pulses.
1. Guided Media:
It is also referred to as Wired or Bounded transmission media. Signals being transmitted
are directed and confined in a narrow pathway by using physical links.
Features:
High Speed
Secure
Used for comparatively shorter distances
There are 3 major types of Guided Media
Advantages
High Bandwidth
Better noise Immunity
Easy to install and expand
Inexpensive
Disadvantages:
Single cable failure can disrupt the entire network
(iii) Optical Fiber Cable –
It uses the concept of reflection of light through a core made up of glass or plastic.
The core is surrounded by a less dense glass or plastic covering called the cladding. It is
used for transmission of large volumes of data.
Advantages:
Increased capacity and bandwidth
Light weight
Less signal attenuation
Resistance to corrosive materials
Disadvantages:
Difficult to install and maintain
High cost
Fragile
unidirectional, i.e., will need another fiber, if we need bidirectional communication
2. Unguided Media:
It is also referred to as Wireless or Unbounded transmission media. No physical
medium is required for the transmission of electromagnetic signals.
Features:
Signal is broadcasted through air
Less Secure
Used for larger distances
There are 3 major types of Unguided Media:
(i) Radiowaves –
These are easy to generate and can penetrate through buildings. The sending and
receiving antennas need not be aligned. Frequency Range:3KHz – 1GHz. AM and FM
radios
andcordless phones use Radio waves for transmission.
Further Categorized as (i) Terrestrial and (ii) Satellite.
(ii) Microwaves –
It is a line of sight transmission i.e. the sending and receiving antennas need to be
properly aligned with each other. The distance covered by the signal is directly proportional
to the height of the antenna. Frequency Range:1GHz – 300GHz. These are majorly used for
mobile phone communication and television distribution.
(iii) Infrared –
Infrared waves are used for very short distance communication. They cannot penetrate
through obstacles. This prevents interference between systems. Frequency
Range:300GHz – 400THz. It isused in TV remotes, wireless mouse, keyboard, printer, etc.