Please enable JavaScript.
Coggle requires JavaScript to display documents.
Chapter 9 Transport layer (Transport layer Protocols (TCP Features…
Chapter 9 Transport layer
Transport layer Protocols
Role of the transport layer
The transport layer is responsible for
establishing a temporary communication session between two applications and delivering data between them.
Transport Layer Responsibilities
Tracking Individual Conversations
At the transport layer, each
set of data flowing between a source application and a destination application
is known as a
conversation
A host may have multiple applications that are communicating across the network simultaneously. Each of these applications communicates with one or more applications on one or more remote hosts. It is the responsibility of the transport layer to maintain and track these multiple conversations.
Segmenting Data and Reassembling Segments
Transport layer protocols have services that segment the application data into blocks that are an appropriate size
Transport layer protocols have services that segment the application data into blocks that are an appropriate size
The protocols at the transport layer describe how the transport layer header information is used to reassemble the data pieces into streams to be passed to the application layer.
Identifying the Applications
To pass data streams to the proper applications, the transport layer must identify the target application
To accomplish this, the transport layer assigns each application an identifier called a port number. Each software process that needs to access the network is assigned a port number unique to that host.
The transport layer moves data between applications on devices in the network.
Conversation Multiplexing
Segmenting the data into smaller chunks enables many different communications, from many different users, to be interleaved (multiplexed) on the same network.
Transport Layer Reliability
The transport layer is responsible for managing reliability requirements of a conversation.
TCP/IP provides two transport layer protocols, Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)
TCP
TCP is considered a reliable, full-featured transport layer protocol, which ensures that all of the data arrives at the destination.
This requires additional fields in the TCP header which increases the size of the packet and also increases delay.
With TCP, there are three basic operations of reliability:
Numbering and tracking
data segments transmitted to a specific host from a specific application
Acknowledging received data
Retransmitting any unacknowledged data
after a certain period of time
UDP
UDP is a simpler transport layer protocol that does not provide for reliability. It therefore has fewer fields and is faster than TCP.
UDP is known as a best-effort delivery protocol. In the context of networking, best-effort delivery is referred to as unreliable because there is no acknowledgment that the data is received at the destination.
Applications that stream stored audio and video use TCP. For example, if your network suddenly cannot support the bandwidth needed to watch an on-demand movie, the application pauses the playback. During the pause, you might see a “buffering...” message while TCP works to re-establish the stream. Once all the segments are in order and a minimum level of bandwidth is restored, your TCP session resumes and the movie begins playing.
TCP Features
Reliable Delivery
ensuring that each segment that the source sends arrives at the destination.
Establishing a Session
TCP is a connection-oriented protocol. A connection-oriented protocol is one that negotiates and establishes a permanent connection (or session) between source and destination devices prior to forwarding any traffic
Through session establishment, the devices negotiate the amount of traffic that can be forwarded at a given time, and the communication data between the two can be closely managed.
Same-Order Delivery
Because networks may provide multiple routes that can have different transmission rates, data can arrive in the wrong order. By numbering and sequencing the segments, TCP can ensure that these segments are reassembled into the proper order.
Flow Control
When TCP is aware that these resources are overtaxed, it can request that the sending application reduce the rate of data flow.
TCP Header
TCP segment has 20 bytes of overhead in the header encapsulating the application layer data
Sequence number
(32 bits) - Used for data reassembly purposes.
Header length
(4 bits) - Known as ʺdata offsetʺ. Indicates the length of the TCP segment header.
Control bits
(6 bits) - Includes bit codes, or flags, which indicate the purpose and function of the TCP segment.
Window size
(16 bits) - Indicates the number of bytes that can be accepted at one time.
Urgent
(16 bits) - Indicates if data is urgent.
UDP Features
The pieces of communication in UDP are called
datagrams
, as shown in the figure. These datagrams are sent as best-effort by the transport layer protocol. UDP has a low overhead of 8 bytes.
UDP Header
Port Numbers
TCP and UDP manage these multiple simultaneous conversations by using header fields that can uniquely identify these applications. These unique identifiers are the port numbers.
Socket Pairs
The combination of the source IP address and source port number, or the destination IP address and destination port number is known as a socket
Sockets enable multiple processes, running on a client, to distinguish themselves from each other, and multiple connections to a server process to be distinguished from each other.
The socket is used to identify the server and service being requested by the client.
Port Number Groups
Well-known Ports (Numbers 0 to 1023) - These numbers are reserved for services and applications. They are commonly used for applications such as web browsers, email clients, and remote access clients. By defining these well-known ports for server applications, client applications can be programmed to request a connection to that specific port and its associated service.
Registered Ports (Numbers 1024 to 49151) - These port numbers are assigned by IANA to a requesting entity to use with specific processes or applications. These processes are primarily individual applications that a user has chosen to install, rather than common applications that would receive a well-known port number. For example, Cisco has registered port 1985 for its Hot Standby Routing Protocol (HSRP) process.
Dynamic or Private Ports (Numbers 49152 to 65535) - Also known as ephemeral ports, these are usually assigned dynamically by the client’s OS when a connection to a service is initiated. The dynamic port is then used to identify the client application during communication.
The netstat Command
Netstat is an important network utility that can be used to verify active connections
enter the command netstat to list the protocols in use, the local address and port numbers, the foreign address and port numbers, and the connection state.
TCP and UDP
TCP Communications process
TCP Server Processes
An active server application assigned to a specific port is considered to be open, which means that the transport layer accepts and processes segments addressed to that port. Any incoming client request addressed to the correct socket is accepted, and the data is passed to the server application. There can be many ports open simultaneously on a server, one for each active server application.
TCP Connection Establishment
A TCP connection is established in three steps (
Handshake
)
Step 1 - The initiating client requests a client-to-server communication session with the server.
Step 2 - The server acknowledges the client-to-server communication session and requests a server-to-client communication session.
Step 3 - The initiating client acknowledges the server-to-client communication session.
TCP Session Termination
Step 1 - When the client has no more data to send in the stream, it sends a segment with the FIN flag set.
Step 2 - The server sends an ACK to acknowledge the receipt of the FIN to terminate the session from client to server.
Step 3 - The server sends a FIN to the client to terminate the server-to-client session.
Step 4 - The client responds with an ACK to acknowledge the FIN from the server.
The control bits field
The six bits in the Control Bits field of the TCP segment header are also known as flags. A flag is a bit that is either set to on or off.
Reliability and Flow Control
TCP Reliability - Ordered Delivery
TCP segments may arrive at their destination out of order. Sequence numbers are assigned in the header of each packet to reassembled into the original order. The sequence number represents the first data byte of the TCP segment.
During session setup, an initial sequence number (ISN) is set. This ISN represents the starting value of the bytes for this session that is transmitted to the receiving application. As data is transmitted during the session, the sequence number is incremented by the number of bytes that have been transmitted. This data byte tracking enables each segment to be uniquely identified and acknowledged. Missing segments can then be identified.
The receiving TCP process places the data from a segment into a receiving buffer. Segments are placed in the proper sequence order and passed to the application layer when reassembled
The ISN does not begin at one but is effectively a random number. This is to prevent certain types of malicious attacks
TCP Flow Control - Window Size and Acknowledgments
TCP also provides mechanisms for flow control, the amount of data that the destination can receive and process reliably. Flow control helps maintain the reliability of TCP transmission by adjusting the rate of data flow between source and destination for a given session. To accomplish this, the TCP header includes a 16-bit field called the window size.
The window size is the number of bytes that the destination device of a TCP session can accept and process at one time. In this example, PC B’s initial window size for the TCP session is 10,000 bytes. Starting with the first byte, byte number 1, the last byte PC A can send without receiving an acknowledgment is byte 10,000. This is known as PC A’s send window. The window size is included in every TCP segment so the destination can modify the window size at any time depending on buffer availability.
This is known as the MSS (Maximum Segment Size).
UDP Communication
UDP Datagram Reassembly
When UDP datagrams are sent to a destination, they often take different paths and arrive in the wrong order. UDP does not track sequence numbers the way TCP does. UDP has no way to reorder the datagrams into their transmission order,
Therefore, UDP simply reassembles the data in the order that it was received and forwards it to the application. If the data sequence is important to the application, the application must identify the proper sequence and determine how the data should be processed.
TCP or UDP
TCP
:
SMTP
Telnet
HTTP
FTP
UDP
There are three types of applications that are best suited for UDP:
Live video and multimedia applications - Can tolerate some data loss, but require little or no delay. Examples include VoIP and live streaming video.
Simple request and reply applications - Applications with simple transactions where a host sends a request and may or may not receive a reply. Examples include DNS and DHCP.
Applications that handle reliability themselves - Unidirectional communications where flow control, error detection, acknowledgments, and error recovery is not required or can be handled by the application. Examples include SNMP and TFTP.