CN Unit 2 imp q
CN Unit 2 imp q
The Data Link Layer in networking is responsible for framing, which is the process of packaging data into
frames to facilitate reliable communication between nodes on a network. Each frame is distinguishable,
containing control information such as sender and receiver addresses, and error-checking bits to ensure data
integrity.
Framing is the process by which the data-link layer organizes data into frames to make transmission
manageable and distinguishable. The physical layer transmits raw bits, but framing ensures that these bits
are grouped so each frame can be recognized independently. This includes adding sender and destination
addresses to define communication endpoints.
Frames are usually smaller sections of data, reducing error impact—if an error occurs, only the affected
frame needs retransmission, not the entire message.
Frame Size: Frames can be fixed or variable in size. Fixed-size frames, as seen in ATM networks, do not
require boundaries. Variable-size frames, common in LANs, need a method to mark frame boundaries.
Character-Oriented Framing: In this approach, frames are composed of 8-bit characters (ASCII). A
special 1-byte flag at both ends of the frame marks its boundaries, aiding in start and end identification for
each frame.
Types of Framing
Framing can be categorized into Byte-Oriented (or Character-Oriented) Framing and Bit-Oriented
Framing. Each has unique approaches to ensure that frames are correctly interpreted by both the sender and
the receiver.
In byte-oriented framing, data is packed in units called characters or bytes. This approach is commonly
used when the data consists of 8-bit characters, such as those in ASCII encoding.
1. Structure:
o A byte-oriented frame includes a header, data section, and a trailer.
o The header typically contains the source and destination addresses and other control
information, while the trailer contains error detection bits.
2. Frame Boundaries:
o A flag byte (usually 1 byte in size) is added at the beginning and end of each frame to mark
boundaries. This flag separates frames and prevents data confusion.
3. Byte Stuffing:
o When the data to be transmitted includes a byte with the same pattern as the flag, byte
stuffing is used.
o In byte stuffing, an extra byte, known as the escape (ESC) character, is added before any
byte that resembles a flag. This ensures that the actual data is not mistakenly interpreted as a
frame boundary.
o If the ESC character itself appears in the data, an additional ESC character is added to signify
that it is part of the data and not a flag.
4. Complications:
o Byte-oriented protocols are well-suited for ASCII-based text data. However, they face
challenges with multimedia data (audio, video, etc.), where encoding is not limited to 8-bit
characters.
o Furthermore, in systems that use larger character sets, such as Unicode (16-bit or 32-bit),
byte-oriented framing becomes less efficient, leading to a trend toward bit-oriented protocols.
Bit-Oriented Framing
In bit-oriented framing, frames are constructed from sequences of bits rather than bytes, making it highly
adaptable for various types of data, including text, images, and multimedia.
1. Structure:
o Similar to byte-oriented frames, bit-oriented frames include header information, a data
section, and optionally, a trailer for error detection.
o This approach does not rely on bytes as structural units, allowing for greater flexibility with
data encoding.
2. Frame Boundaries:
o To mark the start and end of a frame, an 8-bit flag pattern (01111110) is used as a delimiter.
This pattern signals the beginning and the end of a frame.
3. Bit Stuffing:
o Bit stuffing is used to avoid misinterpretation of data that contains the flag pattern.
o When the sender encounters five consecutive 1s in the data, it inserts an extra 0 bit to ensure
that the pattern does not match the flag. This prevents confusion between actual data and
frame delimiters.
o At the receiver’s end, the extra stuffed 0 is removed, preserving the original data pattern.
4. Advantages:
o Bit-oriented framing is not dependent on character encoding standards and can accommodate
varied data types.
o The flexibility of bit-oriented framing allows it to support both low-level text and multimedia
data with greater efficiency.
Summary
Framing is essential for differentiating messages and ensuring reliable data transmission at the data-link
layer. Byte-oriented framing relies on characters and requires byte stuffing, which can be challenging with
multimedia. Bit-oriented framing uses bit sequences and bit stuffing, making it versatile and efficient for
various data types. Together, these protocols form the backbone of data-link layer communication,
supporting both error detection and frame synchronization to maintain robust and consistent data transfer
across networks.
2. WIRELESS LAN - 802.11
Wireless LAN (WLAN) is a widely used technology for providing wireless connectivity, allowing devices
to connect without cables. WLANs are commonly found in colleges, offices, and public places, driven by
the rapid growth in wireless communication technology. The IEEE 802.11 standard governs WLANs,
covering both physical and data-link layers. Often referred to as "wireless Ethernet," WLAN is also known
as WiFi, a term popularized in the United States. WiFi Alliance, a global nonprofit, certifies devices that
meet WiFi standards.
BSS serves as the fundamental building block of WLAN, comprising wireless stations and optionally
an access point (AP).
Types of BSS:
o Ad Hoc Architecture: Stations form a network without an AP, communicating directly
within the BSS.
o Infrastructure BSS: Includes an AP, allowing for broader network access.
ESS is made up of multiple BSSs connected via a distribution system (wired or wireless).
It includes two types of stations:
o Mobile stations: Regular stations within a BSS.
o Stationary stations: APs connected to a wired LAN.
Communication between a station in a BSS and one outside occurs via the AP.
The IEEE 802.11 MAC frame includes nine fields, of which key fields are:
Frame Control (FC): Identifies frame type and other control information.
Duration/ID: Defines transmission duration or ID.
Addresses: Contains up to four address fields depending on frame type.
Sequence Control: Manages fragmentation and order of frames.
Frame Body: Contains payload information.
Frame Check Sequence (FCS): Ensures error detection.
Frame Types:
Addressing Mechanism
IEEE 802.11 uses four addressing fields depending on the values of To DS and From DS:
This structure supports seamless communication within and across WLANs, enabling robust connectivity
solutions.
3. BLUETOOTH
Bluetooth is a wireless technology designed for creating short-range networks among diverse devices, such
as phones, computers, and peripherals, allowing them to communicate seamlessly. It operates on a concept
of forming spontaneous networks, known as ad hoc networks. When Bluetooth-enabled devices come
within range, they detect each other automatically and can form a network, or piconet. Originally developed
by Ericsson and named after the Danish king Harald Blaatand (Bluetooth), it’s now widely used in
numerous applications, from wireless peripherals to medical monitoring.
1. Piconet: This is the core Bluetooth network structure, where up to eight devices—one primary and
up to seven secondary devices—can communicate. The primary device controls the synchronization,
and communication can be one-to-one or one-to-many. Devices not actively communicating stay in
a parked state, waiting to be activated by the primary device.
2. Scatternet: Multiple piconets can link together to form a larger, interconnected network called a
scatternet. In this setup, a device may serve as a secondary device in one piconet and act as a primary
device in another, effectively bridging the two networks.
Bluetooth devices are equipped with short-range radio transmitters, enabling a maximum data rate of 1
Mbps over the 2.4 GHz ISM band. Since this frequency range is shared with other devices, Bluetooth may
experience interference, particularly with IEEE 802.11b Wi-Fi networks.
Bluetooth’s protocol stack is divided into various layers, with L2CAP (Logical Link Control and
Adaptation Protocol) being equivalent to the LLC layer in traditional LANs. It’s responsible for handling
data transfer, with specific functions for:
Baseband Layer
The Baseband Layer corresponds to the MAC layer in traditional LANs, utilizing TDMA (Time-Division
Multiple Access) for communication slots, each lasting 625 microseconds. Bluetooth uses a TDD-TDMA
scheme, allowing half-duplex communication through time slots assigned alternately for sending and
receiving data.
Bluetooth supports two link types, based on the priority of latency or data integrity:
SCO (Synchronous Connection-Oriented) Link: Prioritizes low latency, ensuring timely data
delivery for applications like audio, though it sacrifices error correction.
ACL (Asynchronous Connectionless) Link: Prioritizes data integrity, resending corrupted packets
but with slightly higher latency.
Bluetooth frames come in one-slot, three-slot, or five-slot formats. A slot is the basic time unit of 625
microseconds, with different frame types offering varying data capacities. Each frame includes:
Access Code: Used for synchronization and identifying the primary device.
Header: Contains subfields for addressing, type, flow control, acknowledgment, sequencing, and
error correction.
Payload: Carries the main data, which can be up to 2740 bits.
The radio layer of Bluetooth operates in the 2.4 GHz ISM band, divided into 79 channels of 1 MHz each. It
employs Frequency Hopping Spread Spectrum (FHSS) to reduce interference, hopping 1600 times per
second.
2.7.8 Modulation
Bluetooth uses Gaussian Frequency Shift Keying (GFSK) for signal modulation. A frequency deviation
above or below the carrier frequency represents bits 1 and 0, respectively. This efficient modulation
enhances Bluetooth’s data transmission reliability and reduces the chance of data loss.
4. ARP
The Address Resolution Protocol (ARP) is a crucial protocol in the Network layer of the OSI model. Its
primary role is to map a device's logical address (IP address) to its physical address (MAC address) to
facilitate communication over the network. Here’s a detailed explanation of ARP's operation, components,
and functionality:
1. Introduction to ARP
Most applications use IP addresses to identify devices on a network. However, the actual
communication on a local network happens using MAC (Media Access Control) addresses, which
are unique identifiers at the Data Link layer (Layer 2) of the OSI model.
ARP bridges this gap by translating IP addresses into MAC addresses. This ensures that a device can
locate the hardware address (MAC address) corresponding to an IP address on the local network
before initiating communication.
When a device needs to send data to another device, it checks its local cache to see if the IP address-
to-MAC address mapping is already available. If not, ARP initiates a process to discover the MAC
address.
ARP works by sending a broadcast request packet to all devices in the local network. The request
asks, "Who has IP address X.X.X.X?" This broadcast packet contains the sender's IP and MAC
addresses and the target’s IP address.
ARP Request: The ARP request is sent in a broadcast frame so that all devices in the network
receive it. Each device checks if the requested IP address matches its own.
ARP Reply: Only the device with the matching IP address responds. It sends an ARP reply directly
(unicast) to the requester, containing both its IP address and MAC address.
After receiving the ARP reply, the source device now has the necessary MAC address of the
destination device. This information is then used to encapsulate the data packet at the Data Link
layer for transmission.
4. Caching Mechanism
ARP uses a caching mechanism to store IP-to-MAC address mappings temporarily. Once a mapping
is obtained, it is cached to reduce the frequency of ARP requests, enhancing efficiency.
Each entry in the ARP cache has a limited lifetime and is periodically refreshed. If an IP-to-MAC
mapping is not used for a set period, it is removed from the cache to free up space.
6. Types of ARP
Proxy ARP: A device (usually a router) responds to an ARP request on behalf of another device,
useful in segmented networks.
Gratuitous ARP: A device sends an ARP request for its own IP address to check for IP conflicts or
to update other devices’ ARP tables.
Inverse ARP (InARP): Allows a device to determine another device's IP address when only its
MAC address is known. Commonly used in Frame Relay networks.
7. Advantages of ARP
Efficiency in Address Resolution: Quickly retrieves the MAC address, enabling smooth
communication at the Data Link layer.
Seamless Device Communication: Devices can communicate without manual configuration of
MAC addresses.
Reduced Network Traffic: By caching resolved addresses, ARP minimizes the need for repeated
broadcasts.
Vulnerability to ARP Spoofing: Malicious actors can impersonate another device by sending false
ARP replies, leading to Man-in-the-Middle attacks.
Scalability Challenges: In large networks, frequent ARP broadcasts can increase network traffic,
affecting performance.
Limited Lifetime of Cache Entries: The ARP cache entries need periodic refreshing, which can
introduce delays if entries are not available.
ARP is essential for efficient IP-to-MAC address translation, making it fundamental in both IPv4
networks and local Ethernet-based LANs. It ensures that packets are routed correctly at the Data
Link layer, bridging the IP layer with the physical layer.
10. Conclusion
ARP is a simple yet vital protocol that enables network communication by linking logical IP
addresses to physical MAC addresses. While it provides crucial functionality in local network
environments, network administrators should implement security measures like Dynamic ARP
Inspection (DAI) to mitigate vulnerabilities associated with ARP-based attacks.
Diagram of ARP Request and Reply: In a typical ARP interaction, Device A (IP: X) broadcasts an ARP
request, asking for the MAC address of Device B (IP: Y). Device B responds with its MAC address,
allowing Device A to communicate with Device B at the Data Link layer.
This detailed explanation of ARP covers its purpose, functioning, packet format, and importance in modern
networks, providing a complete overview suitable for a comprehensive 15-mark answer.
5. STOP AND WAIT PROTOCOL
Introduction
The Stop-and-Wait Protocol is a fundamental data transmission method that provides essential flow and
error control. It is often used in situations where simplicity is prioritized, ensuring that each frame is
acknowledged before sending the next one. This protocol is widely applicable for simple data link control
tasks, where reliable data delivery is essential.
The protocol operates on a basic principle: after sending each frame, the sender pauses and waits for an
acknowledgment from the receiver. If the acknowledgment is received within a set time, the sender
transmits the next frame. Otherwise, it retransmits the previous frame, assuming the data was either lost or
corrupted.
Conclusion
The Stop-and-Wait Protocol is a straightforward but effective method for ensuring reliable data
transmission. It provides fundamental flow and error control by transmitting frames sequentially and using
acknowledgments for each frame. While this simplicity is advantageous in low-latency or small-scale
networks, the protocol’s limitations in efficiency and throughput make it unsuitable for high-latency or high-
volume data networks. In these cases, more advanced protocols, like sliding window mechanisms, offer
better alternatives.
6. ERROR DETECTION - CHECKSUM, CRC AND. PARITY CHECK
Introduction
Error detection techniques play a critical role in ensuring data integrity across networks and communication
channels. These methods identify whether data has been corrupted during transmission, allowing the system
to request a retransmission or take corrective action. Three primary techniques—Checksum, Cyclic
Redundancy Check (CRC), and Parity Check—are widely used due to their simplicity and effectiveness.
1. Checksum
The checksum method is an error-detection technique primarily used in network protocols (like TCP/IP) to
verify data integrity.
Process:
o Data is divided into fixed-sized segments (e.g., 16 or 32 bits).
o All segments are added together using binary addition.
o The sum, called the “checksum,” is then appended to the data and sent to the receiver.
o At the receiver end, the data segments are added again, and the result is compared with the
transmitted checksum.
o If the values match, the data is assumed to be correct; if not, an error is detected.
Example:
Suppose the data is divided into four 8-bit segments:
o Data segments: 1001 0101, 1100 1100, 0111 0010, and 0011 1010
o Sum: 1001 0101 + 1100 1100 + 0111 0010 + 0011 1010 = 10110 0001
o The carry (1) is added back, resulting in the checksum: 0110 0001.
Advantages:
o Simple to implement.
o Effective for detecting small errors (single-bit errors).
Disadvantages:
o Less effective for detecting certain error types (e.g., if errors occur in multiple segments).
Process:
o Data is represented as a binary polynomial.
o A predefined generator polynomial (e.g., 1011 for a 4-bit CRC) is used to divide the data
polynomial.
o The remainder of this division becomes the CRC value, appended to the data before
transmission.
o At the receiver end, the same generator polynomial divides the received data.
o If the remainder (CRC) is zero, the data is assumed to be error-free; otherwise, an error is
detected.
Example:
Suppose we have data bits 11010011101100 and a 4-bit generator polynomial 1011.
o Data is padded with three zero bits to match the generator length, becoming
11010011101100000.
o Division is performed using XOR operations, resulting in a remainder, which is the CRC.
o The remainder (e.g., 0010) is then appended to the data.
Advantages:
o Highly reliable and can detect burst errors (i.e., errors affecting multiple bits).
o Used in protocols like Ethernet and Bluetooth due to its high detection rate.
Disadvantages:
o Complex to implement in software without hardware support.
o Slightly slower compared to parity checks due to division calculations.
3. Parity Check
Parity Check is the simplest form of error detection, often used for single-bit error detection in memory
systems and simple communications.
Process:
o An additional bit (parity bit) is added to the data to make the total number of 1s in the data
even (even parity) or odd (odd parity).
o If using even parity, the parity bit is set to 1 if the total number of 1s in the data is odd (to
make it even).
o If using odd parity, the parity bit is set to 1 if the total number of 1s in the data is even (to
make it odd).
o At the receiver, the parity bit is checked by counting the number of 1s.
o If the parity doesn’t match, an error is detected.
Example:
o For an 8-bit data 10011010 using even parity:
The total number of 1s is 4 (even), so the parity bit is set to 0 to maintain even parity.
Data sent: 100110100.
If one bit flips during transmission, the parity will be odd, indicating an error.
Advantages:
o Extremely simple and fast to implement.
o Useful for single-bit error detection.
Disadvantages:
o Ineffective for detecting burst errors or errors involving an even number of bit flips.
o Limited application in high-reliability systems due to low detection accuracy.
Comparison of Checksum, CRC, and Parity Check
Conclusion
Error detection mechanisms are essential in maintaining data integrity during transmission. While Checksum
provides a simple approach to error detection suitable for networking, CRC offers higher reliability and can
detect burst errors, making it ideal for more complex systems. Parity Check, while basic, is useful for low-
complexity systems that require minimal error detection capabilities. Each method has strengths and
weaknesses, and the choice of technique depends on the application’s requirements for complexity,
reliability, and efficiency.