Unit4DC_TransportLayer &NetworkLayer.pdf

SonaShaiju1 51 views 75 slides Oct 31, 2025
Slide 1
Slide 1 of 75
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75

About This Presentation

The Network Layer (Layer 3) is responsible for transferring data from one device to another across multiple networks. It uses IP addresses to identify devices and relies on routing to choose the best path for data packets to travel. The Transport Layer (Layer 4), on the other hand, ensures reliable ...


Slide Content

Unit 4: Transport Layer & Network Layer
Function of Network Layer; Packet Switching concepts; Connection oriented Vs
connectionless services; Peer to peer Protocol ; Point to Point Protocols;
Datagram - Virtual Circuit; Routing concepts; Routing Tables: Non-Adaptive or
static routing, Adaptive Algorithms ;User datagram protocol (UDP);
Transmission control protocol (TCP) ; Congestion control.

Network Layer in OSI Model
Network Layer is the third layer from the bottom (Layer 3) and the fifth layer from
the top in the OSI (Open Systems Interconnection) Model. It is responsible for
ensuring end-to-end packet delivery across multiple interconnected networks.

Function of Network Layer
Functions of Network Layer:
1.Logical Addressing: Gives each device a unique IP address to identify it on the network.

2.Packetization: Breaks data into small packets for easy transmission.

3.Host-to-Host Delivery: Sends packets from the source device to the correct destination device.

4.Forwarding: Passes packets through routers to reach the right network.

5.Routing: Finds the best path for packets to travel across different networks.

6.Fragmentation and Reassembly: Splits large packets into smaller ones to fit the network and joins
them again at the destination.

7.Subnetting: Divides a large network into smaller parts for better management.

8.Network Address Translation (NAT): Converts private IP addresses to public ones for internet access
and saves IP space.

How the Network Layer Works

1.Every device gets a unique IP address to identify it on the network.

2.Data from the transport layer is packed into packets with the sender’s and receiver’s IP addresses.

3.Routers check the destination address and choose the best path to send the packets.

4.Packets move step by step through routers until they reach the destination.

5.If a packet is too large, it is broken into smaller parts (fragments).

6.At the destination, all fragments are joined together to form the original data.

7.If any problem occurs (like destination not reachable), ICMP (Internet Control Message Protocol) sends an error message back
to the sender.


ICMP
used by network devices, like routers, to
send error messages and status
information about network
communication.

ICMP (Internet Control Message Protocol)
Main Functions:
1.Error Reporting:
Informs the sender if a problem occurs — for example, if a destination is unreachable.

2.Network Testing:
Used by tools like PING and TRACEROUTE to check whether a device is reachable and how long packets
take to travel.

3.Flow Control:
Helps control data flow by sending messages like “Source Quench” when the network is overloaded.

4.Diagnostics:
Helps administrators detect and fix network problems.

Protocols at the Network Layer
●IP (Internet Protocol )(IPv4 / IPv6): Main protocol for addressing and routing.

●ICMP( Internet Control Message Protocol): Sends error and status messages.

●ARP(Address Resolution Protocol): Finds MAC address from IP address.

●RARP(Reverse Address Resolution Protocol): Finds IP address from MAC
address.

●NAT(Network Address Translation): Converts private IPs to public IPs.

1.What IPv4 and IPv6?list out the differences?

Advantages
●Supports end-to-end communication.

●Allows subnetting for better network management.

●Finds efficient routes for data transfer.

●Connects different types of networks.
Limitations
●No flow control → may cause congestion.

●Limited error control → relies on upper layers.

●Routers may drop packets under heavy load.

●Fragmentation adds extra processing work.

Packet Switching
Packet Switching sends data in small units called packets.

Each packet has a header (control info) and payload (data).

Packets travel independently through the network using Store-and-Forward method.

They may take different paths to reach the destination.

At the end, packets are reassembled into the original message.

No fixed path is needed — this makes communication efficient and flexible.

Types of Delays in Packet Switching
1.Transmission Delay:
Time taken to send all bits of a packet onto the link.

2.Propagation Delay:
Time for the signal to travel through the medium (depends on distance and speed).

3.Queueing Delay:
Time a packet waits in a queue before being transmitted (depends on traffic).

4.Processing Delay:
Time to check for errors and process the packet at routers or destination.

5.End-to-End Delay:
Total time for a packet to go from source to destination.
End-to-End Delay=Processing + Queueing + Transmission + Propagation\text{End-to-End Delay} =

Advantages of Packet Switching
●Efficient bandwidth use: No fixed path — bandwidth is shared effectively.

●Low delay: Data is sent immediately without waiting for a full path.

●Reliable: Missing packets can be detected and resent.

●Fault-tolerant: If one path fails, packets take another route.

●Cost-effective: Cheaper and easier to maintain than circuit switching.
Disadvantages of Packet Switching
●Out-of-order delivery: Packets may arrive in the wrong order.

●Needs sequence numbers: To reassemble packets correctly.

●Complex routers: Routers must handle dynamic routing decisions.

●Possible delays: Queuing and rerouting may slow transmission.

●Not ideal for continuous data: Less efficient for long, steady data streams (like voice calls).

Types of Packet Switching
1. Connection-Oriented Packet Switching (Virtual Circuit)
●A logical path is set up before data transfer.

●All packets follow the same route and arrive in order.

●Each connection has a Virtual Circuit ID.

Phases:
1.Setup Phase: Path is created between sender and receiver.

2.Data Transfer Phase: Packets are sent through the fixed path.

3.Tear Down Phase: Connection is closed after data transfer.

2. Connectionless Packet Switching (Datagram)
●Each packet is sent independently with full address info.

●Packets may take different routes and reach out of order.

●No setup or fixed path is required.

Example: Internet (IP-based communication)

How IP-based Communication Works:
1.Data is broken into packets.
When you send an email or open a webpage, your data is divided into small parts called packets.

2.Each packet gets an IP address.
The sender and receiver IP addresses are attached to every packet.

3.Packets travel across the Internet.
Routers and switches direct these packets through the best available paths.

4.Packets are reassembled at the destination.
The receiver’s computer collects and puts the packets together to recreate the original message.
Example:
When you open www.google.com, your computer sends a request to Google’s server using IP-based communication.
●Your IP (e.g., 192.168.1.5) identifies your device.

●Google’s IP (e.g., 142.250.182.14) identifies Google’s server.

●Data travels between these IPs through routers using TCP/IP protocols.

Feature Connection-Oriented
(Virtual Circuit)
Connectionless (Datagram)
Path Setup Path is established before
sending data
No path setup required
Packet Order Packets arrive in order Packets may arrive out of
order
Reliability Built into the service Ensured by higher-layer
protocols (like TCP)
Routing Fixed route for all packets Each packet may take a
different route
Examples ATM UDP

Peer-to-Peer (P2P) protocol
A P2P (peer-to-peer) protocol is a set of rules that govern communication and resource sharing in a
decentralized network where participants (peers) connect and share resources directly with each other,
bypassing a central server.
●PPP is a protocol used to send data directly between two devices over a serial link.

●It is widely used for internet connections, such as DSL, modems, or VPNs.

Key Features:
1.Data Encapsulation: Wraps network layer data (like IP) into frames for transmission.

2.Error Detection: Checks for errors during transmission.

3.Authentication: Verifies the identity of the connected devices.

Point-to-Point Protocol (PPP)

PPP is a Data Link Layer protocol used to establish a direct
connection between two nodes — for example, between your
computer and an Internet Service Provider (ISP).

Feature Explanation
Point-to-point connection Connects exactly two devices (like PC ↔
ISP).
Framing Defines how data is encapsulated into
frames for transmission.
Authentication Supports PAP (Password Authentication
Protocol) and CHAP (Challenge
Handshake Authentication Protocol) to
verify user identity.
Error detection Includes a Frame Check Sequence (FCS)
field for detecting transmission errors.
Full-duplex communication Allows simultaneous sending and receiving
of data.
Encapsulation Wraps network layer packets (like IP) inside
PPP frames for transmission.
Connection termination Gracefully closes the link when
communication ends.

Datagram Switching
●Each packet (called a datagram) is treated as a separate unit.

●No connection is required before sending data.

●Each packet has a header with full destination information.

●Routers read the header and send packets on the best path available.

●Packets may take different routes and arrive out of order.

Advantages
●Scalable: Can handle a large amount of network traffic.

●Flexible: Supports different packet sizes and data rates.

●Simple routing: No need for a fixed path; packets are routed dynamically.

●Low latency: No setup delay before transmission.
Disadvantages
●More errors: No guaranteed delivery or correction.

●No QoS: All traffic is treated equally, no priority.

●Possible congestion: Packets may overload some network paths.

Virtual Circuit Switching
●A path is set up between the source and destination before data is sent.

●All packets follow the same route during the communication.

●To the user, it appears like a dedicated physical connection, but the path may be shared
by others.

●Setup phase is required before data transfer.

●After data transfer, the virtual circuit is cleared.

Advantages
● Reliable delivery: Packets are delivered in order with fewer errors.

●Low error rate: Has built-in error checking.

●QoS support: Can prioritize certain types of data.

●Efficient bandwidth use: Uses a fixed path efficiently.

Disadvantages
●Less scalable: Not ideal for very large networks.

●Setup delay: Needs time to establish the path before sending data.

●Fixed data rate: Not suitable for variable-size packets or changing speeds.

Similarities
●Both are packet-switching techniques — data is divided into small packets.

●Both can handle multiple transmissions at the same time.

●Both have error checking (using checksum or parity).

●Both can handle variable packet sizes.

●Both can fragment large data into smaller packets.

Datagram Switching Virtual Circuit Switching
Connectionless – no setup needed. Connection-oriented – setup required
before sending.
Packets take different paths. All packets follow the same path.
Packets may arrive out of order. Packets arrive in correct order.
Each packet has a full header with
destination info.
Only the first packet needs full header;
others use the same path info.
Less reliable, no guaranteed delivery. More reliable, ensures delivery.
High efficiency, but more delay. Lower efficiency, but less delay.
Cheaper and easier to implement. Costly and complex due to setup and
resource reservation.

Routing
●Routing means finding the best path for data to travel from source to destination.

●It works like Google Maps for data packets, showing the fastest and most efficient
route.

●Routers make routing decisions to send data through the best available path.

●Good routing helps in:

○Faster data delivery (low latency)

○Better performance

○Efficient use of bandwidth

Router
●A router is a device that connects different networks and forwards data packets between them.

●It acts like a traffic manager, choosing the best route for data to reach its destination.

●The router checks each packet’s IP address and decides where to send it next using routing tables and
protocols.

●Routers work at Layer 3 (Network Layer) of the OSI model.

●They also support features like:

○?????? Firewall protection

○?????? VPN (Virtual Private Network)

○?????? Quality of Service (QoS)

How Routing Works
Routing helps data packets find their way from source to destination through the best possible
path.
Steps in Routing
Step 1: A data packet is created with details like source IP, destination IP, and control
information.
Step 2: When a router receives the packet, it reads the destination IP and checks its routing
table for possible paths.
Step 3: The router uses routing protocols and metrics (like distance, cost, and congestion) to
choose the best path.
Step 4: The router forwards the packet to the next router or device.
This process continues as the packet hops through the network.
Step 5: The final router delivers the packet to the destination device on the local network.

Routing Table
●A routing table is a set of rules or paths that helps routers decide where to send data
packets in a network.

●It acts like a map for the router, showing the best path for each destination.

●Stored in the router’s memory (RAM) and updated automatically or manually.

How It Works
1.When a router receives a packet, it checks the routing table.

2.The router finds the destination IP address and the best route to reach it.

3.The packet is then sent to the next hop (another router or device) until it reaches its
destination.

Types of Routing
There are three main types of routing in computer networks:
1. Static Routing 2. Dynamic Routing 3. Default Routing

1. Static Routing
●Uses fixed, manually set paths by the network administrator.

●Packets always follow the same route.

●Does not change automatically when the network changes.
Advantages:
●Simple and easy to configure.

●No overhead from routing algorithms.

●Gives better control over routing paths.
Disadvantages:
●Not suitable for large networks.

●Must be manually updated for any change.

2. Dynamic Routing
●Uses routing algorithms and protocols to find the best path automatically.

●Adjusts to network changes like congestion or link failure.

●Common protocols: RIP(Routing Information Protocol), OSPF(Open Shortest Path
First), BGP(Border Gateway Protocol)
Advantages:
●Automatically adapts to changes.

●Scalable and reduces manual work.
Disadvantages:
●Higher overhead due to routing updates.

●Can be slower than static routing.

Transport layer
The transport layer is responsible for end-to-end communication between two devices — ensuring that data is
delivered accurately, in order, and without loss or duplication.
Function

1. Segmentation and Reassembly:Breaks large messages from the application layer into smaller segments for
transmission and reassembles them at the destination.
2. End-to-End Communication :Provides direct communication between sender and receiver processes (e.g.,
between two applications on different devices).
3. Connection Control
- Connection-oriented (like TCP): sets up, maintains, and ends connections.
- Connectionless (like UDP): sends data without setup.
4. Flow Control:Ensures the sender does not send data faster than the receiver can handle.
5. Error Control:Detects and retransmits lost or corrupted segments to ensure reliable delivery.
6. Reliable or Unreliable Delivery
- TCP: Reliable, ordered, error-checked delivery.
- UDP: Fast, but unreliable delivery.
7. Connection Termination:Gracefully closes the connection after data transfer is complete.

Transport Layer
●The Transport Layer is:

○2nd layer in the TCP/IP model

○4th layer in the OSI model

●It provides end-to-end communication between source and destination hosts
(not just hop-to-hop).

●The data unit in this layer is called a segment.

Main Responsibilities
1.Reliable Data Transfer – Ensures messages are delivered correctly.

2.Segmentation and Reassembly – Breaks messages into smaller parts (segments) and
reassembles them at the receiver.

3.Port Addressing – Adds source and destination port numbers to identify the correct
application.

4.Flow and Error Control – Manages data rate and detects errors.

5.Connection Control – Establishes, maintains, and terminates connections.

Working of Transport Layer
At Sender Side:
●Receives data from the Application Layer.

●Divides data into segments.

●Adds port numbers (source & destination).

●Passes it to the Network Layer.

At Receiver Side:
●Gets segments from the Network Layer.

●Reassembles data into the original message.

●Reads port numbers to deliver data to the correct Application Layer process.

1. Process-to-Process Delivery
●Ensures data is delivered to the correct application/process on the host.

●Uses Port Numbers (16-bit address) to identify applications.

●Example: Web uses port 80, Email uses port 25.

2. End-to-End Connection Between Hosts
●Provides a logical connection between source and destination hosts.

●TCP – Reliable, connection-oriented (uses handshake).

●UDP – Unreliable, connectionless (faster, used in streaming & games).

TCP: Secure & reliable
UDP: Fast but no delivery guarantee

3. Multiplexing and Demultiplexing
●Multiplexing (many → one):
Combines data from several processes into one stream for transmission.

●Demultiplexing (one → many):
Separates received data and delivers it to the correct process using port
numbers.

4. Congestion Control
●Prevents or reduces network overload.

●Uses techniques like:

○Leaky Bucket algorithm

●Ensures smooth and fair data flow between multiple users.

Analogy: Like traffic control on a busy road.

5. Data Integrity and Error Correction
●Ensures data is not corrupted during transmission.

●Uses:

○Checksums for error detection.

○ACK/NACK messages to confirm delivery.

●Maintains accuracy and reliability of data.

Goal: Deliver correct data to the correct process.

6. Flow Control
●Manages data transfer speed between sender and receiver.

●Prevents data loss if the sender is faster than the receiver.

●Uses Sliding Window Protocol to control data flow.

●Receiver tells sender how much data it can handle.

Common Transport Layer Protocols
●TCP (Transmission Control Protocol)

●UDP (User Datagram Protocol)

●SCTP (Stream Control Transmission Protocol)

●DCCP (Datagram Congestion Control Protocol)

User Datagram Protocol (UDP)
User Datagram Protocol (UDP)
●UDP is a Transport Layer protocol used for fast and simple communication.

●It is connectionless, meaning it sends data without setting up a connection first.

●No guarantee of delivery, order, or error checking.

●Used where speed matters more than reliability.

Examples of UDP Applications
●Video streaming

●Voice over IP (VoIP)

●DNS (Domain Name System)

UDP Header

The UDP header is 8 bytes long and very simple.

It contains all the basic information needed to send data.

The rest of the packet is actual data.

Port numbers range from 0 to 65535 (0 is reserved).

Port numbers help identify which process or service the data belongs to.

Fields in UDP Header
Field Size Description
Source Port 2 Bytes Identifies the sender’s port
number.
Destination Port 2 Bytes Identifies the receiver’s port
number.
Length 2 Bytes Total length of UDP header
+ data.
Checksum 2 Bytes Used for error detection in
the header and data.

Transmission Control Protocol (TCP)
●TCP is a connection-oriented Transport Layer protocol.

●It ensures reliable and ordered delivery of data between devices.

●Works with IP to send data across networks.
Key Features of TCP
●Connection setup: Uses a three-way handshake (SYN, SYN-ACK, ACK).

●Connection termination: Uses a four-step handshake (FIN, ACK, FIN, ACK).

●Error checking: Uses ACKs and checksums to detect errors and retransmit lost data.

●Flow control: Adjusts data transmission to prevent overflow at the receiver.

●Congestion control: Uses algorithms like Slow Start and Fast Retransmit to avoid network
congestion.

Connection Setup (Three-Way
Handshake)
When two computers want to start communication
using TCP, they first agree to connect.
Steps:
1.SYN → Sender says: “I want to connect.”

2.SYN-ACK → Receiver says: “Okay, I am
ready.”

3.ACK → Sender says: “Great, let’s start
sending data.”

This creates a reliable connection.
So it is called a 3-way handshake.

Connection Termination (Four-Step
Handshake)
When communication is finished, both sides close
the connection.
Steps:
1.FIN → Sender says: “I am done. I want to
close.”

2.ACK → Receiver says: “Okay, I got it.”

3.FIN → Receiver also says: “I am also done
now.”

4.ACK → Sender says: “Okay, closing
complete.”

This safely closes the connection.

How TCP Works
1.Breaks large data into small packets.

2.Packets may take different routes but are reassembled in order at the destination.

3.Ensures every packet arrives safely using ACKs.
Features of TCP
●Segment Numbering: Assigns numbers to data bytes and segments for proper tracking.

●Connection-Oriented: Sender and receiver stay connected until transmission is complete; data order is
preserved.

●Full Duplex: Data can flow both ways simultaneously, improving efficiency.

●Flow Control: Limits data transfer rate to match the receiver’s capacity using a sliding window.

●Error Control: Detects and manages lost, corrupted, duplicate, or out-of-order segments.

●Congestion Control: Adjusts data flow based on network congestion levels.

Advantages of TCP
●Reliable delivery of data.

●Error checking and recovery included.

●✅ Maintains data order.

●✅ Widely used and well-standardized (IETF).

●✅ Works with IP to connect devices across networks.


Disadvantages of TCP
●❌ Heavyweight: May be too large for small or low-resource networks.

●❌ Slower: Multiple layers can reduce network speed.

●❌ Limited to TCP/IP suite: Cannot work with other protocols like Bluetooth.

●❌ Old design: Few modifications in the last 30 years.

Basis TCP UDP
Type Connection-oriented (needs a
connection)
Connectionless (no setup needed)
Reliability Reliable delivery Not guaranteed
Error Checking Extensive (ACKs, flow control) Basic (checksums only)
Acknowledgment Yes No
Sequencing Packets arrive in order No sequencing (handled by app if
needed)
Speed Slower Faster
Retransmission Lost packets are retransmitted No retransmission
Header Size 20–60 bytes 8 bytes
Common Protocols HTTP, HTTPS, FTP, SMTP, TelnetDNS, DHCP, TFTP, SNMP, RIP,
VoIP
Applications Email, web browsing, secure
communication
Real-time apps: VoIP, video/music
streaming, gaming

Congestion Control in Computer Networks
●Congestion happens when too much data is sent at once, causing delays, packet loss, or network slowdown (like a
traffic jam).

●Congestion control uses techniques to prevent, detect, and manage congestion.

●Goal: Smooth data flow, fair bandwidth, and efficient network use.

Benefits of Congestion Control
●Network Stability: Prevents overload, keeps network smooth.

●Lower Latency & Packet Loss: Data delivered faster, fewer retransmissions.

●Higher Throughput: More data transferred successfully.

●Fair Bandwidth Allocation: No user monopolizes resources.

●Better User Experience: Faster access to websites and apps.

●Avoids Network Collapse: Prevents total breakdowns.

Leaky Bucket Algorithm
●Purpose: Controls network traffic by sending packets at a constant rate.

●How it works:

1.Incoming packets are placed into a bucket (queue).

2.The bucket leaks (sends) packets at a fixed, steady rate.

3.Bursty traffic is smoothed into uniform flow.

●If the bucket overflows: Extra packets are discarded.

Advantage: Smooths traffic and prevents congestion.
Limitation: Too rigid; can waste bandwidth if traffic is bursty.

Token Bucket Algorithm
●Purpose: Controls network traffic flexibly, allowing bursts when needed.

●How it works:

1.Tokens are generated and added to the bucket at a fixed rate.

2.Each packet requires one token to be sent.

3.If tokens are available → packet is transmitted immediately.

4.If no tokens → packet waits until a token is available.

Advantage: Handles variable traffic efficiently without unnecessary packet drops.
Limitation: Slightly more complex than Leaky Bucket.

CONGESTION CONTROL
Congestion control is a method used in the Transport Layer (especially in TCP) to avoid too
much data being sent into the network at the same time.
If many devices send too much data quickly, the network becomes overloaded (congested) and
packets get lost or delayed.
So TCP controls and adjusts the rate of sending data to avoid congestion and keep the
network running smoothly.

Advantages of Congestion Control
●Maintains stable and reliable network operation.

●Reduces delays and unnecessary retransmissions.

●Minimizes data loss during high traffic.

●Optimizes use of network resources efficiently.

●Scales well as network size and traffic grow.

●Adapts dynamically to changing traffic conditions.

Disadvantages of Congestion Control
●Adds complexity to network design and management.

●Introduces processing overhead.

●Performance can be sensitive to network conditions.

●May struggle with resource prioritization during critical situations.

●Effectiveness depends on modern network infrastructure.
Tags