My new domain network Management

TCP/IP Transport Layer

Introduction to transport layer


The primary duties of the transport layer, Layer 4 of the OSI model, are to transport and regulate the flow of information from the source to the destination, reliably and accurately. End-to-end control and reliability are provided by sliding windows, sequencing numbers, and acknowledgments.

To understand reliability and flow control, think of someone who studies a foreign language for one year and then they visit the country where that language is used. In conversation, words must be repeated for reliability and to speak slowly so that the meaning of the conversation is not lost, this is flow control.

The transport layer provides transport services from the source host to the destination host. It establishes a logical connection between the endpoints of the network. Transport services segment and reassemble several upper-layer applications onto the same transport layer data stream. This transport layer data stream provides end-to-end transport services.

The transport layer data stream is a logical connection between the endpoints of a network. Its primary duties are to transport and regulate the flow of information from source to destination reliably and accurately. The primary duty of Layer 4 is to provide end-to-end control using sliding windows and to provide reliability in sequencing numbers and acknowledgments. The transport layer defines end-to-end connectivity between host applications. Transport services include the following basic services:

  • Segmentation of upper-layer application data
  • Establishment of end-to-end operations
  • Transport of segments from one end host to another end host
  • Flow control provided by sliding windows
  • Reliability provided by sequence numbers and acknowledgments

TCP/IP is a combination of two individual protocols. IP operates at Layer 3, and is a connectionless protocol that provides best-effort delivery across a network. TCP operates at Layer 4, and is a connection-oriented service that provides flow control as well as reliability. By pairing these protocols, a wider range of services is provided. Together, they are the basis for an entire suite of protocols called the TCP/IP protocol suite. The Internet is built upon this TCP/IP protocol suite.

Flow control


As the transport layer sends data segments, it tries to ensure that data is not lost. A receiving host that is unable to process data as quickly as it arrives could be a cause of data loss. The receiving host is then forced to discard it. Flow control avoids the problem of a transmitting host overflowing the buffers in the receiving host. TCP provides the mechanism for flow control by allowing the sending and receiving host to communicate. The two hosts then establish a data-transfer rate that is agreeable to both
Session establishment, maintenance, and termination overview

Multiple applications can share the same transport connection in the OSI reference model. Transport functionality is accomplished on a segment-by-segment basis. In other words, different applications can send data segments on a first-come, first-served basis. The segments that arrive first will be taken care of first. These segments can be routed to the same or different destinations. This is referred to as the multiplexing of upper-layer conversations.

One function of the transport layer is to establish a connection-oriented session between similar devices at the application layer. For data transfer to begin, both the sending and receiving applications inform the respective operating systems that a connection will be initiated. One node initiates a connection that must be accepted by the other. Protocol software modules in the two operating systems communicate with each other by sending messages across the network to verify that the transfer is authorized and that both sides are ready.

The connection is established and the transfer of data begins after all synchronization has occurred. During transfer, the two machines continue to communicate with their protocol software to verify that data is received correctly.

Figure shows a typical connection between the sending and receiving systems. The first handshake requests synchronization. The second and third handshakes acknowledge the initial synchronization request, as well as synchronizing connection parameters in the opposite direction. The final handshake segment is an acknowledgment used to inform the destination that both sides agree that a connection has been established. After the connection has been established, data transfer begins.

Congestion can occur during data transfer for two reasons. First, a high-speed computer might be capable of generating traffic faster than a network can transfer it. Second, if many computers simultaneously need to send datagrams to a single destination, that destination can experience congestion, although no single source caused the problem.

When datagrams arrive too quickly for a host or gateway to process, they are temporarily stored in memory. If the traffic continues, the host or gateway eventually exhausts its memory and must discard additional datagrams that arrive.

Instead of allowing data to be lost, the transport function can issue a “not ready” indicator to the sender. Acting like a stop sign, this indicator signals the sender to stop sending data. When the receiver can handle additional data, the receiver sends a “ready” transport indicator. When this indicator is received, the sender can resume the segment transmission.

At the end of data transfer, the sending host sends a signal that indicates the end of the transmission. The receiving host at the end of the data sequence acknowledges the end of transmission and the connection is terminated.

Three-way handshake


TCP is a connection-oriented protocol. TCP requires connection establishment before data transfer begins. For a connection to be established or initialized, the two hosts must synchronize their Initial Sequence Numbers (ISNs). Synchronization is done through an exchange of connection establishing segments that carry a control bit called SYN, for synchronize, and the ISNs. Segments that carry the SYN bit are also called “SYNs". This solution requires a suitable mechanism for picking an initial sequence number and a slightly involved handshake to exchange the ISNs.

The synchronization requires each side to send its own initial sequence number and to receive a confirmation of exchange in an acknowledgment (ACK) from the other side. Each side must also receive the INS from the other side and send a confirming ACK. The sequence is as follows:

  1. A→B SYN—(A) initial sequence number is X, ACK number is 0, SYN bit is set, but ACK bit is not set.
  2. B→A ACK—(A) sequence number is X + 1, (B) initial sequence number is Y, and SYN and ACK bit are set.
  3. A→B ACK—(B) sequence number is Y + 1, (A) sequence number is X + 1, the ACK bit is set, but the SYN bit is not set.

This exchange is called the three-way handshake.

A three-way handshake is necessary because sequence numbers are not tied to a global clock in the network and TCP protocols may have different mechanisms for picking the ISN. The receiver of the first SYN has no way of knowing whether the segment was an old delayed one, unless it remembers the last sequence number used on the connection. Recalling that number is not always possible Therefore, the receiver must ask the sender to verify this SYN.


Windowing


Data packets must be delivered to the recipient in the same order in which they were transmitted to have a reliable, connection-oriented data transfer. The protocol fails if any data packets are lost, damaged, duplicated, or received in a different order. An easy solution is to have a recipient acknowledge the receipt of each packet before the next packet is sent.

If the sender must wait for an acknowledgment after sending each packet, throughput would be low. Therefore, most connection-oriented, reliable protocols allow more than one packet to be outstanding on the network at one time. Because time is available after the sender finishes transmitting the data packet and before the sender finishes processing any received acknowledgment, this interval is used for transmitting more data. The number of data packets the sender is allowed to have outstanding without having received an acknowledgment is known as the window size, or window.

TCP uses expectational acknowledgments. Expectational acknowledgements mean that the acknowledgment number refers to the packet that is next expected. Windowing refers to the fact that the window size is negotiated dynamically during the TCP session. Windowing is a flow-control mechanism. Windowing requires that the source device receive an acknowledgment from the destination after transmitting a certain amount of data. The receiving TCP process reports a “window” to the sending TCP. This window specifies the number of packets, starting with the acknowledgment number, that the receiving TCP process is currently prepared to receive.

With a window size of three, the source device can send three packets to the destination. The source device must then wait for an acknowledgment. If the destination receives the three packets, it sends an acknowledgment to the source device, which can now transmit three more packets. If the destination does not receive the three packets, because of overflowing buffers, it does not send an acknowledgment. Because the source does not receive an acknowledgment, it knows that the packets should be retransmitted, and that the transmission rate should be slowed.

TCP window sizes are variable during the lifetime of a connection. Each acknowledgement contains a window advertisement that indicates the number of bytes the receiver can accept. TCP also maintains a congestion-control window. This window is normally the same size as the window of the receiver. However, this window is cut in half when a packet is lost, perhaps as a result of network congestion. This approach permits the window to be expanded or contracted as necessary to manage buffer space and processing. A larger window size allows more data to be processed.

As shown in Figure
, the sender sends three packets before expecting an ACK. If the receiver can handle a window size of only two packets, the window drops packet three, specifies three as the next packet, and specifies a new window size of two. The sender sends the next two packets, but still specifies a window size of three. This means that the sender will still expect a three packet acknowledgement from the receiver. The receiver replies by requesting packet five and again specifying a window size of two.

Acknowledgment


Reliable delivery guarantees that a stream of data sent from one device is delivered through a data link to another device without duplication or data loss. Positive acknowledgment with retransmission is one technique that guarantees reliable delivery of data. Positive acknowledgment requires a recipient to communicate with the source and send back an acknowledgment message when the data is received. The sender keeps a record of each data packet (TCP segment), that it sends and expects an acknowledgment. The sender also starts a timer when it sends a segment and will retransmit a segment if the timer expires before an acknowledgment arrives.

Figure shows the sender transmitting data packets 1, 2, and 3. The receiver acknowledges receipt of the packets by requesting packet 4. Upon receiving the acknowledgment, the sender sends packets 4, 5, and 6. If packet 5 does not arrive at the destination, the receiver acknowledges with a request to resend packet 5. The sender resends packet 5 and then receives an acknowledgment to continue with the transmission of packet 7.

TCP provides sequencing of segments with a forward reference acknowledgment. Each datagram is numbered before transmission. At the receiving station, TCP reassembles the segments into a complete message. If a sequence number is missing in the series, that segment is retransmitted. Segments that are not acknowledged within a given time period will result in a retransmission.


Transmission Control Protocol (TCP)


Transmission Control Protocol (TCP) is a connection-oriented Layer 4 protocol that provides reliable full-duplex data transmission. TCP is part of the TCP/IP protocol stack. In a connection-oriented environment, a connection is established between both ends before the transfer of information can begin. TCP is responsible for breaking messages into segments, reassembling them at the destination station, resending anything that is not received, and reassembling messages from the segments. TCP supplies a virtual circuit between end-user applications.

The protocols that use TCP include:

  • FTP (File Transfer Protocol)
  • HTTP (Hypertext Transfer Protocol)
  • SMTP (Simple Mail Transfer Protocol)
  • Telnet

The following are the definitions of the fields in the TCP segment:

  • Source port – Number of the calling port
  • Destination port – Number of the called port
  • Sequence number – Number used to ensure correct sequencing of the arriving data
  • Acknowledgment number – Next expected TCP octet
  • HLEN – Number of 32-bit words in the header
  • Reserved – Set to zero
  • Code bits – Control functions, such as setup and termination of a session
  • Window – Number of octets that the sender is willing to accept
  • Checksum – Calculated checksum of the header and data fields
  • Urgent pointer – Indicates the end of the urgent data
  • Option – One option currently defined, maximum TCP segment size
  • Data – Upper-layer protocol data
User Datagram Protocol (UDP)

User Datagram Protocol (UDP) is the connectionless transport protocol in the TCP/IP protocol stack. UDP is a simple protocol that exchanges datagrams, without acknowledgments or guaranteed delivery. Error processing and retransmission must be handled by higher layer protocols.

UDP uses no windowing or acknowledgments so reliability, if needed, is provided by application layer protocols. UDP is designed for applications that do not need to put sequences of segments together.

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)

The following are the definitions of the fields in the UDP segment:

  • 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
TCP and UDP port numbers


Both TCP and UDP use port (socket) numbers to pass information to the upper layers. Port numbers are used to keep track of different conversations crossing the network at the same time.

Application software developers agree to use well-known port numbers that are issued by the Internet Assigned Numbers Authority (IANA). Any conversation bound for the FTP application uses the standard port numbers 20 and 21. Port 20 is used for the data portion and port 21 is used for control. Conversations that do not involve an application with a well-known port number are assigned port numbers randomly from within a specific range above 1023. Some ports are reserved in both TCP and UDP, but applications might not be written to support them. Port numbers have the following assigned ranges:

  • Numbers below 1024 are considered well-known ports numbers.
  • Numbers above 1024 are dynamically assigned ports numbers.
  • Registered port numbers are those registered for vendor-specific applications. Most of these are above 1024.

End systems use port numbers to select the proper application. The source host dynamically assigns originating source port numbers. These numbers are always greater than 1023

Cisco Systems, Inc.

0 comments:

Post a Comment