Professional Documents
Culture Documents
Telecommunication Networks
P C Gupta
P C Gupta 1
Contents
P C Gupta 2
OSI Transport Layer
• Transport layer provides end-to-end transport service of
required quality in cost effective manner.
• It relieves the applications of concerns about network
technology being used.
• Transport service is can be
– connection-oriented.
– connectionless.
Gupta
P C Gupta 3
TCP/UDP Layer
• TCP/UDP layer is equivalent of Transport layer of OSI. It
layer is present in the end systems only.
– TCP/UDP protocol interactions are between two end systems.
• It consists of two different protocols:
– Transmission control protocol (TCP) - connection oriented.
– User datagram protocol (UDP) – connectionless.
TCP/UDP TCP/UDP
IP IP IP IP
DLL DLL DLL DLL
Phy Phy Phy Phy
Gupta
P C Gupta 4
TCP/UDP Layer - Addressing
Application
process
IP address
P C Gupta 5
TCP/UDP Layer - Addressing
Client
process
Server
process
IP address
P C Gupta 6
Transmission Control Protocol (TCP)
Gupta
P C Gupta 7
Transmission Control Protocol (TCP)
TCP TCP
buffer buffer
Gupta
P C Gupta 9
TCP Ports
TCP port
Server process Client process
Gupta
P C Gupta 10
10
Format of TCP Segment
0 31 bits
Source port number Destination port number
Sequence number
Acknowledgement number
UAPRSF
Header Header
Reserved R C S S Y I Window size
length GKHT NN
TCP checksum Urgent pointer
Data
Gupta
P C Gupta 11
11
Format of TCP Segment
User data
Gupta
P C Gupta 12
12
Format of TCP Segment
U A P R S F
R C S S Y I
G K H T N N
Gupta
P C Gupta 14
14
Format of TCP Segment
Gupta
P C Gupta 15
15
Format of TCP Segment
Urgent pointer
• It points to last byte of urgent data when URG flag is set.
– Urgent data is inserted at the beginning of user data field.
Last byte of urgent data is byte number (S+U).
Header length
• Header length in multiples of 4 bytes.
TCP checksum
• It is used for error detection. It covers TCP header, user
data and pseudo IP header.
Options
• Commonly used option is to specify Maximum Segment
Size (MSS). MSS is maximum number of user data bytes
in a TCP segment.
Source port number Destination port number
Sequence number
Header Acknowledgement number
U A P R S F
Header
Reserved R C S S Y I Window size
length G K H T N N
TCP checksum Urgent pointer
TCP options (if any) + Pad
User data
Gupta
P C Gupta 17
17
Pseudo IP Header
Source IP address
Destination IP address
Zeroes Protocol TCP segment length
1 1 2 bytes
Gupta
P C Gupta 18
18
TCP Operation
Gupta
P C Gupta 19
19
TCP Connection Establishment
A B
Ack:
Seq: 270
Ack: 271
Seq: 478
Ack: 479
Seq: 271
Ack: 271
Synchronized Seq: 479
Gupta
P C Gupta 20
20
TCP Connection Establishment
A B
Ack:
Seq: 270
Ack: 271
Seq: 478
Ack: 479
Seq: 271
Ack: 271
Synchronized Seq: 479
• A replies with
– ACK flag,
– Ack number 479,
– Sequence number 271
• With this hand shake, the acknowledgement and
sequence numbers are synchronized.
Gupta
P C Gupta 21
21
TCP Data Transfer
A B
Ack: 479 Ack: 271
Seq: 271 Seq: 479
Ack: 281
Seq: 479
Ack: 479
Seq: 281
Ack: 295
Seq: 479
Ack: 479
Seq: 295
Gupta
P C Gupta 22
22
TCP Data Transfer
A B
Retransmission
time out
Gupta
P C Gupta 23
23
Disconnection Phase
Gupta
P C Gupta 24
24
Disconnection Phase
A B
Ack: 295
Ack: 479 Seq: 479
Seq: 295
Ack: 296
Seq: 479
Ack: 479
Seq: 296
A to B connection Ack: 296
is closed Seq: 479
Ack: 480
Seq: 296
Ack: 296
Seq: 480
B to A connection
is closed
Gupta
P C Gupta 25
25
Flow Control
• TCP implements end-to-end sliding window flow control.
– Flow control is based on volume of user data in bytes.
– Window size can be from 0 to 65535 bytes.
– Window size (called rwnd, receiver window) is controlled
by the receiving end.
A B
SYN, Seq=45, W=8
Connection
establishment SYN, ACK, Ack=46, Seq=71, W=4
phase
ACK, Ack=72, Seq=46, W=8
User’s data
Window bytes
Window at A just
after connection 46 47 48 49 50 51
establishment
First byte that Last byte that
can be sent can be sent
Gupta
P C Gupta 26
26
Sliding Window Flow Control
Left Right
edge edge
46 47 48 49 50 51
Gupta
P C Gupta 27
27
Sliding Window Flow Control
a. Current window at A
Window size = 4
46 47 48 49 50 51 52 53 54
Gupta
P C Gupta 28
28
Fast Retransmission
Gupta
P C Gupta 29
29
Fast Retransmission
A B
Ack = 271
Seq = 271 (10 bytes)
Seq = 281 (10 bytes) Lost
Seq = 291 (10 bytes)
Seq = 301 (10 bytes)
Ack = 271
3 duplicate
acknowledgements are
detected
Missing TCP segment
[Seq = 271] is retransmitted
Ack = 311
Gupta
P C Gupta 30
30
SYN Flooding Attack in TCP
• When a server receives TCP connection request, it
– responds with SYN, ACK flags,
– creates half-open connection state (reserves buffer) &
– waits for ACK flag from the client.
• An attacker can take advantage of half open connection
state for launching SYN flooding attack on the server.
P C Gupta 31
SYN Flooding Attack in TCP
P C Gupta 32
SYN Flooding Attack in TCP
P C Gupta 33