Chapter 4 OSI Transport Layer
CCNA Exploration version 4.0
Objectives
Explain the role of Transport Layer protocols and services in supporting communications across data networks Analyze the application and operation of TCP mechanisms that support reliability Analyze the application and operation of TCP mechanisms that support reassembly and manage data loss. Analyze the operation of UDP to support communicate between two processes on end devices
Hc vin mng Bch Khoa - Website: www.bkacad.com
Application data
IP Protocol Field = 17
Application data
IP Protocol Field = 6
Hc vin mng Bch Khoa - Website: www.bkacad.com
Extra: Logical Connection
Connectionoriented
Connectionless
Connectionless
Hc vin mng Bch Khoa - Website: www.bkacad.com
Extra: TCP Operation
IP is best effort delivery. The transport layer (TCP) is responsible reliability and flow control
from source to destination.This is accomplished using:
sliding windows (flow control) sequencing numbers and acknowledgments (reliability) synchronization (establish a virtual circuit)
Hc vin mng Bch Khoa - Website: www.bkacad.com 5
Roles of Transport Layer
Hc vin mng Bch Khoa - Website: www.bkacad.com
Transport Layer Role and Services
The functions
1. Enables multiple applications to
communicate over the network at the same time on a single device 2. Ensures that, if required, all the data is received reliably and in order by the correct application 3. Employs error handling mechanisms
Hc vin mng Bch Khoa - Website: www.bkacad.com
Transport Layer Role and Services
Primary responsibilities
4.1.1
1. Tracking the individual communication
between applications on the source and destination hosts 2. Segmenting data and managing each piece 3. Reassembling the segments into streams of application data 4. Identifying the different applications
Hc vin mng Bch Khoa - Website: www.bkacad.com 8
Transport Layer Role and Services
Hc vin mng Bch Khoa - Website: www.bkacad.com
Separating Multiple Communications
4.1.2
Hc vin mng Bch Khoa - Website: www.bkacad.com
10
Extra: Multiplexing
Different applications can send data segments on a first-come, first-served basis. The segments that arrive first will be taken care of first. This is referred to as the multiplexing of upper-layer conversations.
Hc vin mng Bch Khoa - Website: www.bkacad.com 11
Segmentation
Hc vin mng Bch Khoa - Website: www.bkacad.com
12
Q/A
Conversation vs Session ?
Hc vin mng Bch Khoa - Website: www.bkacad.com
13
Controlling the Conversation
4.1.2.1
Hc vin mng Bch Khoa - Website: www.bkacad.com
14
Controlling the Conversation The primary functions
1. Segmentation and Reassembly 2. Conversation Multiplexing
Other functions: Connection-oriented conversations Reliable delivery Ordered data reconstruction Flow control
Hc vin mng Bch Khoa - Website: www.bkacad.com 15
Controlling the Conversation
4.1.2.2
Hc vin mng Bch Khoa - Website: www.bkacad.com
16
Transport Layer Role and Services
4.1.3
Hc vin mng Bch Khoa - Website: www.bkacad.com
17
Transport Layer Role and Services
4.1.3
At the Transport layer the 3 basic operations of reliability are:
1.Tracking transmitted data 2.Acknowledging received
data 3.Retransmitting any unacknowledged data
Hc vin mng Bch Khoa - Website: www.bkacad.com
18
TCP and UDP
4.1.4
Web, email, file transfer
DNS, Video streaming, VoIP
Hc vin mng Bch Khoa - Website: www.bkacad.com 19
TCP Header format:
Hc vin mng Bch Khoa - Website: www.bkacad.com
20
TCP Header format: Port number
Source Port 16 bits. Destination Port 16 bits.
Hc vin mng Bch Khoa - Website: www.bkacad.com
21
TCP Header format: Sequence
Sequence Number: 32 bits
The sequence number of the first data octet in this segment (except when SYN is present).
Hc vin mng Bch Khoa - Website: www.bkacad.com 22
TCP Header format: Acknowledgment
Acknowledgment Number: 32 bits
This field contains the value of the next sequence number the sender of the segment is expecting to receive.
Hc vin mng Bch Khoa - Website: www.bkacad.com 23
TCP Header format: Code bits
Control Bits: 8 bits URG: Urgent pointer field is valid ACK: Acknowledgment field significant PSH: This segment requests a push RST: Reset the connection SYN: Synchronize sequence numbers FIN: No more data from sender
Hc vin mng Bch Khoa - Website: www.bkacad.com 24
Example: code bits
Hc vin mng Bch Khoa - Website: www.bkacad.com
25
TCP Header format: Window
Window: 16 bits
The number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept.
Hc vin mng Bch Khoa - Website: www.bkacad.com 26
TCP Header format: Window
Urgent Pointer: 16 bits
Points to the first data octet following the urgent data. Only significant when the URG control bit is set.
Hc vin mng Bch Khoa - Website: www.bkacad.com
27
TCP Header format: Data
Hc vin mng Bch Khoa - Website: www.bkacad.com
28
User Datagram Protocol (UDP)
Error processing and retransmission must be handled by higher layer protocols
Hc vin mng Bch Khoa - Website: www.bkacad.com
29
UDP header fields
Source port Number of the calling port Destination port Number of the called port Length Number of bytes including header and data Checksum Calculated checksum of the header and data fields Data Upper-layer protocol data The protocols that use UDP include: - TFTP (Trivial File Transfer Protocol) - SNMP (Simple Network Management Protocol) - DHCP (Dynamic Host Control Protocol) - DNS (Domain Name System)
Hc vin mng Bch Khoa - Website: www.bkacad.com 30
Port Addressing
4.1.5
Hc vin mng Bch Khoa - Website: www.bkacad.com
31
Q/A
4.1.5
Source Port ? Socket ?
Hc vin mng Bch Khoa - Website: www.bkacad.com
32
Port and TCP port
Reserved for services and applications. They are commonly used for These port numbers are assigned to user processes or applications.
When not used for a server resource, these ports may also be used dynamically selected by a client as its source port.
applications such as HTTP (web server) POP3/SMTP (e-mail server) and Telnet
These are usually assigned dynamically to client applications when
Hc vin mng Bch Khoa - Website: www.bkacad.com
initiating a connection. It is not very common for a client to connect to a service using a Dynamic or Private Port
33
UDP port
Hc vin mng Bch Khoa - Website: www.bkacad.com
34
TCP and UDP Common Port
Hc vin mng Bch Khoa - Website: www.bkacad.com
35
TCP and UDP port numbers
Hc vin mng Bch Khoa - Website: www.bkacad.com
36
Extra: Sockets
The socket interface is one of several application programming
interfaces (APIs) to the communication protocols. A socket is a special type of file handle, which is used by a process to request network services from the operating system. A socket address is the triple:
<protocol, local-address, local-process>
For example, in the TCP/IP suite: <tcp, 193.44.234.3, 12345>
Hc vin mng Bch Khoa - Website: www.bkacad.com
37
Netstat command
4.1.5.3
Hc vin mng Bch Khoa - Website: www.bkacad.com
38
Segmentation and Reassembly.
4.1.6.1
Hc vin mng Bch Khoa - Website: www.bkacad.com
39
Q/A
What is benefit of segmentation ?
Dividing application data into pieces both
ensures that data is transmitted within the limits of the media and that data from different applications can be multiplexed on to the media.
Hc vin mng Bch Khoa - Website: www.bkacad.com 40
Lab 4.1.6.2
Hc vin mng Bch Khoa - Website: www.bkacad.com
41
The TCP Protocol Communicating with Reliability
Hc vin mng Bch Khoa - Website: www.bkacad.com
42
TCP Making Conversations Reliable
The key distinction between TCP and UDP is reliability.
4.2.1
Hc vin mng Bch Khoa - Website: www.bkacad.com
43
TCP Server Processes
Each application process running on the server is configured to use a port number: default or manually ports. An individual server cannot have two services assigned to the same port number within the same Transport layer services
4.2.2
Hc vin mng Bch Khoa - Website: www.bkacad.com
44
TCP Connection Establishment and Termination
4.2.3
Hc vin mng Bch Khoa - Website: www.bkacad.com
45
3-way handshake
4.2.4
Hc vin mng Bch Khoa - Website: www.bkacad.com
46
3-way handshake
Hc vin mng Bch Khoa - Website: www.bkacad.com
47
3-way handshake
Hc vin mng Bch Khoa - Website: www.bkacad.com
48
TCP Session Termination
4.2.5
Hc vin mng Bch Khoa - Website: www.bkacad.com
49
TCP Session Termination
4.2.5
Hc vin mng Bch Khoa - Website: www.bkacad.com
50
TCP Session Termination
Hc vin mng Bch Khoa - Website: www.bkacad.com
51
Lab 4.2.5.2
Hc vin mng Bch Khoa - Website: www.bkacad.com
52
Managing TCP Sessions
Hc vin mng Bch Khoa - Website: www.bkacad.com
53
TCP Segment Reassembly
4.3.1
Hc vin mng Bch Khoa - Website: www.bkacad.com
54
TCP Acknowledgement with Windowing
4.3.2
Expectational Acknowledgement ?
Hc vin mng Bch Khoa - Website: www.bkacad.com
55
TCP Retransmission
Retransmission for lost data employed by TCP. If the ACK is not received within a timeout interval, the data is retransmitted.
4.3.3
Hc vin mng Bch Khoa - Website: www.bkacad.com
56
TCP Congestion Control Minimizing Segment Loss
Flow control
4.3.4.1
Flow Control ?
Hc vin mng Bch Khoa - Website: www.bkacad.com
57
TCP Congestion Control Minimizing Segment Loss
Reducing window size
4.3.4.2
Hc vin mng Bch Khoa - Website: www.bkacad.com
58
Extra: Flow Control
Flow control avoids the problem of a transmitting host overflowing the buffers in the receiving host.
Hc vin mng Bch Khoa - Website: www.bkacad.com 59
Extra: Flow Control
Hc vin mng Bch Khoa - Website: www.bkacad.com
60
Windowing and Acknowledgment
The purpose of windowing is to improve flow control and reliability.
Hc vin mng Bch Khoa - Website: www.bkacad.com 61
Simple Windowing
Stop-and-Wait windowing protocol.
Hc vin mng Bch Khoa - Website: www.bkacad.com 62
Sliding Windows
Initial Window size Usable Window Can send ASAP Working Window size Octets sent Usable Window Not ACKed Can send ASAP ASAP=As Soon As Possible
Hc vin mng Bch Khoa - Website: www.bkacad.com
63
Host A - Sender
1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4
Host B - Receiver
5 6 7 8 9 10 11 12 13
10
11
12
13
Window size = 6 Octets sent Not ACKed
1 2 3 4 5 6
1 2 3
13
Usable Window Can send ASAP
7 8 9 10 11 12
ACK 4 4 5
10
11
12
13
10
11
12
13 1 2 3 4 5 6 7 8 9 10 11 12 13
10
11
12
13
ACK 6 6 7
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 1 13 2 3 4 5 6 7 8 9 10 11 12 13
8 9
1 2 3 4 5 6 7 8 9 10 11 12 13
Hc vin mng Bch Khoa - Website: www.bkacad.com
64
The UDP Protocol Communicating with Low overhead
Hc vin mng Bch Khoa - Website: www.bkacad.com
65
UDP Low overhead vs. Reliability
4.4.1
Hc vin mng Bch Khoa - Website: www.bkacad.com
66
UDP Datagram Reassembly
UDP simply reassembles the data in the order that it was received and forwards it to the application.
Hc vin mng Bch Khoa - Website: www.bkacad.com
67
UDP Server Processes and Requests
Like TCP-based applications, UDP-based server applications are assigned Well Known or Registered port numbers.
Hc vin mng Bch Khoa - Website: www.bkacad.com
68
UDP Client Processes
4.4.4.1
Hc vin mng Bch Khoa - Website: www.bkacad.com
69
Lab 4.4.4.2
Hc vin mng Bch Khoa - Website: www.bkacad.com
70
Extra: Denial of Service (DoS) Attacks
DoS attacks are a common method
that hackers utilize to halt system response. One type of DoS is known as SYN flooding. SYN flooding exploits the normal three-way handshake and causes targeted devices to ACK to source addresses that will not complete the handshake.
C:/> netstat SYN_RECV
Hc vin mng Bch Khoa - Website: www.bkacad.com
71
Lab: Observing TCP and UDP using Netstat
Hc vin mng Bch Khoa - Website: www.bkacad.com
72
Summary
Hc vin mng Bch Khoa - Website: www.bkacad.com
73
Hc vin mng Bch Khoa - Website: www.bkacad.com
74