CN Unit 3-4
CN Unit 3-4
The Data Link Layer (DLL) is the second layer in the OSI (Open System Interconnection) model of
computer networking. It is responsible for the node-to-node delivery of data frames between devices
on the same network segment. This layer ensures error-free transmission of data and manages the
flow of data between devices connected to the same physical link.
The Data Link Layer plays a crucial role in ensuring reliable and efficient data transfer between
devices on the same network. It provides the necessary mechanisms to manage errors, flow control,
and access to the shared communication channel.
Key functions:
1. Framing: The DLL takes packets from the Network Layer and encapsulates them into
frames, which are then sent bit-by-bit to the Physical Layer. At the receiver’s end,
the DLL assembles the received bits into frames and hands them over to the
Network Layer.
2. Addressing: The DLL provides layer-2 hardware addressing, which is unique for each
device on the network. This ensures that data is delivered to the correct device.
3. Error Control: The DLL detects and corrects errors that may occur during transmission. It
adds error detection bits to the frame’s header and trailer to ensure reliable
data transfer.
4. Flow Control: The DLL ensures that the sender and receiver are synchronized to prevent
buffer overflows and data loss. It manages the flow of data by controlling
the speed of transmission.
5. Access Control: The DLL manages access to the shared communication channel, preventing
collisions and ensuring that only one device transmits at a time. This is
achieved through protocols like CSMA/CD and CSMA/CA.
Protocols Used in the Data Link Layer: Ethernet, IEEE 802.11 (WiFi), ATM, PPP, SLIP.
The design issues of the Data Link Layer (DLL) are primarily related to ensuring reliable and
efficient communication between devices on the same network. These issues includes
Acknowledged and Connectionless Services: The sender sends frames, and the receiver
acknowledges each frame received.
Acknowledged and Connection-Oriented Services: A logical connection is established
between sender and receiver before data transmission, and each frame is numbered
for error detection
2. Framing: The DLL encapsulates data packets from the Network Layer into frames, which
are then transmitted to the Physical Layer. Each frame has a header, payload,
and trailer.
3. Error Control: The DLL detects and corrects errors that occur during transmission. This
includes error detection and correction techniques such as adding error
detection bits to the frame’s header and trailer.
4. Flow Control: The DLL regulates the flow of data to prevent the sender from sending frames
faster than the receiver can handle. This ensures that the receiver does not
overflow its buffer and lose frames.
ARQ
1. Stop-and-Wait ARQ: This protocol sends one frame at a time and waits for an
acknowledgement from the receiver before sending the next frame. If
the acknowledgement does not arrive within a specified time
(timeout), the sender retransmits the frame.
2. Go-Back-N ARQ: This protocol allows the sender to send multiple frames before receiving
an acknowledgement for the first frame. If an acknowledgement is not
received within the time period, all frames starting from that frame are
retransmitted.
3. Selective Repeat ARQ: This protocol also allows the sender to send multiple frames before
receiving an acknowledgement for the first frame. However, only
the erroneous or lost frames are retransmitted, while correct frames
are received and buffered.
The main function of ARQ protocols is to ensure reliable data transmission by automatically
retransmitting packets that are found to be corrupted or lost during transmission. The sender waits
for a specified time (timeout) for an acknowledgement from the receiver. If the acknowledgement
does not arrive within this time, the sender assumes the frame is lost or corrupted and retransmits
it. This is repeated until the correct frame is transmitted.
Error Detection
1. Parity Bits: Parity bits are an error detection technique where an extra bit is added to a
data unit to make the total number of 1 bits either even (even parity) or odd
(odd parity).
Even parity: If the number of 1 bits in the original data is even, the parity bit is
set to 0. If the number of 1 bits is odd, the parity bit is set to 1.
Odd parity: If the number of 1 bits in the original data is odd, the parity bit is set
to 0. If the number of 1 bits is even, the parity bit is set to 1.
2. Single Bit Error Correction: Single bit error correction uses additional redundant bits to
detect and correct single-bit errors. The most common
technique is Hamming codes, which add extra parity bits to the
data.
Sender: The sender calculates the parity bits based on specific
combinations of the data bits.
Receiver: The receiver recalculates the parity bits and compares
them to the received parity bits. This allows the receiver to
determine the exact bit position that is in error.
3. Cyclic Redundancy Check (CRC): CRC is a polynomial-based error detection technique. The
sender divides the data by a predetermined binary number
called the generator polynomial. The remainder of this
division is appended to the end of the data as the CRC bits.
How CRC works
Sender side: The sender divides the data by a predetermined binary number called
the generator polynomial. The remainder of this division is appended to
the end of the data as the CRC bits.
Receiver side: The receiver divides the incoming data by the same generator
polynomial. If the remainder is 0, the data is accepted as error-free. A
non-zero remainder indicates an error.
Key Points
CRC Bits: The remainder of the division of the data by the generator polynomial,
appended to the end of the data.
Error Detection: CRC detects errors by comparing the calculated CRC bits with the
received CRC bits.
Error Correction: CRC does not correct errors but can be used in combination with
other error correction techniques.
High-Level Data Link Control (HDLC) is a communication protocol used for transmitting data
between devices in telecommunication and networking. Developed by the International
Organization for Standardization (ISO), it is defined in the standard ISO/IEC 13239:2002. HDLC
ensures reliable data transfer, allowing one device to understand data sent by another. It can
operate with or without a continuous connection between devices, making it versatile for various
network configurations.
1. Normal Response Mode (NRM): Here, two types of stations are involved, a primary station
that sends commands and secondary stations that respond
to received commands. It is used for both point-to-point and
multipoint communications.
2. 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.
1. I-Frame (Information Frame): I-frames carry user data from the network layer and
include flow and error control information piggybacked
on user data.
2. S-Frame (Supervisory Frame): S-frames do not contain an information field and are used
for flow and error control when piggybacking is not
required.
3. U-Frame (Unnumbered Frame): U-frames are used for various miscellaneous functions,
such as link management, and may contain an
information field if required.
HDLC is widely used in various network protocols and applications, including: X.25 Protocol Stack,
Frame Relay Protocol, ISDN Protocol Stack and Cisco HDLC.
Difference between Flow control and Error control
Focuses on maintaining proper data flow from Focuses on detecting and correcting errors in
sender to receiver data transmission
Ensures the receiver can handle the data rate Ensures the data received is error-free and
and buffer size reliable
Implemented to prevent data loss and congestion Implemented to detect and correct errors in data
frames
Used to manage the rate of data transmission Used to ensure data integrity and reliability
Ensures the sender waits for acknowledgment Ensures the receiver can detect and correct
before sending more data errors in data frames
Framing
Framing in Data Link Layer (DLL) is a crucial process that ensures the reliable transfer of data
between two devices connected through a physical link. It involves dividing a stream of data into
manageable frames, each containing control information that enables the recipient to correctly
interpret the data payload.
1. Frame Structure: A frame typically consists of a header, data payload, and trailer. The
header contains the source and destination addresses, while the trailer
includes error-checking codes and other control information.
2. Frame Transmission: The sender divides the data into frames and adds the necessary
control information. The frames are then transmitted over the
physical link.
3. Frame Reassembly: At the receiving end, the frames are reassembled into the original data
stream. The receiver checks each frame for errors and drops any frames
that fail the error-checking process.
Types of Framing
Character-Oriented Framing: This method uses special character to mark the beginning and
end of a frame. It is easy to implement but can be inefficient
for high-speed transmissions.
Bit-Oriented Framing: This method involves inserting extra bits into the data payload to
mark the beginning and end of a frame. It is efficient but can be more
complex to implement.
Network Layer
The Network Layer is the third layer of the OSI (Open Systems Interconnection) model and is
responsible for logical addressing, routing, and forwarding of data packets across networks. It
plays a crucial role in enabling communication between different networks and devices by ensuring
that data packets are properly addressed, routed, and delivered to their intended destinations.
The Network Layer operates on a wider scale compared to the Data Link Layer, which focuses on
communication between directly connected devices within a single network. It relies on the
Transport Layer to provide reliable end-to-end data delivery and error control mechanisms.
Key functions:
1. Logical Addressing: The Network Layer uses logical addresses, such as IP addresses, to
identify devices and establish communication between different
networks.
2. Routing: It determines the optimal path for data transmission by conducting routing tasks
and forwarding packets to the appropriate destination.
ICMP (Internet Control Message Protocol): Used for error reporting and diagnostic
functions.
Design issues in Network Layer
1. Store and Forward Packet Switching: This mechanism involves storing packets in routers
until they are fully received and then forwarding
them to the next hop. This ensures that packets are
delivered in the correct order and that errors are
detected and corrected.
2. Services Provided to Transport Layer: The Network Layer provides services to the
Transport Layer, including connection-oriented and
connectionless services. These services must not
depend on router technology and must use uniform
numbering patterns for network addresses.
5. Routing and Addressing: The Network Layer is responsible for routing and addressing,
which involves selecting the best path for data transmission and
ensuring that packets are delivered to the correct destination. This
includes maintaining the address at the frame header of both
source and destination and performing addressing to detect
various devices in the network.
Routing
Routing is the process of identifying the best path to transmit data packets from the source to the
destination. This involves selecting the most efficient path through the network, taking into account
factors such as network congestion, available bandwidth, and network topology.
1. Packet Forwarding: The Network Layer receives data packets from the Transport Layer
and breaks them down into smaller packets. Each packed is given a
header that includes the source and destination IP addresses.
2. Routing Table: The router maintains a routing table that contains entries for each network
it knows about. Each entry includes the network ID, the path to reach that
network (exit interface and next hop), and the cost or distance of that path
(metrics).
3. Path Selection: When a packet is received, the router checks its routing table to determine
the best path to forward the packet. The router uses administrative distance
and metrics to select the best path. If multiple paths are available, the router
uses load balancing to distribute the packets across the paths.
4. Packet Transmission: The router forwards the packet to the next hop on the selected path.
This process continues until the packet reaches its destination.
Types of Routing
Static Routing: In static routing, the administrator manually configures the routing table
with static routes. This method is simple but can be inflexible and prone to
errors.
Dynamic Routing: In dynamic routing, the router uses protocols such as RIP, OSPF, and
EIGRP to dynamically update the routing table. These protocols calculate
the path distance and update the routing table accordingly.
Routing algorithms in computer networks determine the best path for data packets to travel from
the source to the destination. There are several types of routing algorithms, which can be
categorized based on various criteria. Here are the main types of routing algorithms:
1. Shortest Path Algorithm The Shortest Path Algorithm is a type of adaptive routing
algorithm that determines the least-cost path between the source
and destination nodes based on the cost associated with each link.
Steps:
Each link is assigned a cost based on factors such as distance, bandwidth, traffic, and latency.
The algorithm calculates the total cost of each path from the source to the destination.
The path with the lowest total cost is selected as the shortest path.
2. Flooding Algorithm Flooding is a non-adaptive routing algorithm that sends a copy of the
packet out on each link except the one it arrived on.
Steps:
When a packet arrives at a router, it sends a copy of the packet to all its neighbors.
Each router decrements a hop count in the packet header.
Steps:
Each router maintains a routing table with the distance to each destination node.
The routing table is updated based on the cost of the links and the distance to the destination.
The router selects the path with the lowest distance to the destination.
Cons: May not handle large networks well and can be prone to routing loops.
Steps:
The network is divided into smaller sub-networks based on the network topology.
Packets are routed within each sub-network based on the routing table.
5. Link State Routing Algorithm Link State Routing is a type of adaptive routing algorithm
that uses a centralized node to maintain a map of the
network topology.
Steps:
Each router maintains a link state packet (LSP) that contains information about the links and
their costs.
The LSPs are shared with other routers.
The centralized node calculates the shortest path based on the LSPs.
Cons: Requires a centralized node and can be prone to single points of failure.
IPv4
IPv4 (Internet Protocol version 4) is the first version of the Internet Protocol as a standalone
specification. It is one of the core protocols of standards-based internetworking methods in the
Internet and other packet-switched networks. IPv4 is used for routing data packets across the
internet and is the most widely used protocol for internet communication.
IPv4 Addressing
IPv4 uses a 32-bit address space, which allows for a maximum of approximately 4.3 billion unique
addresses. These addresses are typically written in dotted decimal notation, with four numbers
separated by dots, such as 192.0.2.1.
IPv4 Subnetting
IPv4 subnetting is the process of dividing a larger network into smaller subnets. This is done by
setting the subnet mask, which determines how many bits are used for the network portion of the
address and how many bits are used for the host portion.
IPv4 Routing
IPv4 routing is the process of forwarding data packets between networks. This is done by routers,
which use the destination IP address to determine where to send the packet.
IPv4 is being gradually replaced by IPv6, which has a larger address space and other
improvements. However, IPv4 is still widely used and will likely continue to be used for some time.
IPv4 and IPV are two different protocols used for routing data packets across the internet. IPV
stands for Inactivated Poliovirus Vaccine, which is a vaccine used to prevent polio.
Transport Layer
The Transport Layer is the fourth layer of the OSI model and the second layer of the TCP/IP model.
It is responsible for ensuring the reliable and efficient transfer of data between devices on a
network. The Transport Layer provides several services to ensure that data is delivered correctly
and efficiently:
1. End-to-End Delivery: The Transport Layer ensures that data is delivered from the
source to the destination without any errors or loss.
2. Reliable Delivery: The Transport Layer provides reliable delivery by ensuring that data
is not lost or corrupted during transmission. It also ensures that data
is delivered in the correct order.
3. Flow Control: The Transport Layer controls the flow of data to prevent the sender from
overwhelming the receiver. It ensures that the receiver can handle the data
being sent.
4. Multiplexing: The Transport Layer allows multiple applications to share the same
network connection by multiplexing data from different applications.
5. Addressing: The Transport Layer uses port numbers to identify the destination
application and ensure that data is delivered to the correct application.
6. Segmentation and Reassembly: The Transport Layer breaks down large data streams
into smaller segments and reassembles them at the
destination.
7. Connection Control: The Transport Layer provides both connectionless and connection-
oriented services. Connectionless services are used for applications
that do not require a connection to be established before data is
sent, while connection-oriented services are used for applications
that require a connection to be established before data is sent.
8. Error Control: The Transport Layer detects and corrects errors that occur during data
transmission.
The Transport Layer uses several protocols to ensure reliable and efficient data transfer. Some of
the most common protocols used in the Transport Layer include:
2. UDP (User Datagram Protocol): UDP is a connectionless protocol that provides best-
effort delivery of data.