Kapitel 22 UDP och TCP Kapitel 23 Congestion

  • Slides: 85
Download presentation
Kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and Qo. S översiktligt. )

Kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and Qo. S översiktligt. )

PART V Transport Layer

PART V Transport Layer

Position of transport layer

Position of transport layer

Transport layer duties

Transport layer duties

Chapters Chapter 22 Process-to-Process Delivery Chapter 23 Congestion Control and Qo. S

Chapters Chapter 22 Process-to-Process Delivery Chapter 23 Congestion Control and Qo. S

Chapter 22 Process-to-Process Delivery: UDP and TCP

Chapter 22 Process-to-Process Delivery: UDP and TCP

Note: The transport layer is responsible for process-to-process delivery.

Note: The transport layer is responsible for process-to-process delivery.

Figure 22. 1 Types of data deliveries

Figure 22. 1 Types of data deliveries

Virtual Connection at the Transport Layer Client Host Router Application TCP, UDP IP Physical

Virtual Connection at the Transport Layer Client Host Router Application TCP, UDP IP Physical Protocol stack in the host Server Host TCP, UDP IP IP Physical Protocol stack in the router IP Physical Protocol stack in the host

Client-Server Paradigm • Used most often in Internet process-to-process communication, for example, email, web,

Client-Server Paradigm • Used most often in Internet process-to-process communication, for example, email, web, file transfer, etc. • The client process initiates the communication. • The server process waits for the client to initiate communication, and responds by sending the information required. Example: Web server, email server, ftp server, etc. • A firewall often stops external clients from accessing internal servers, except certain web • Opposite: Peer-to-peer communication, where a program can act both as client (taking initiative) and server (responding to other).

Multiplexing and Demultiplexing Sender processes Web Email TCP MP 3 UDP IP IP datagrams

Multiplexing and Demultiplexing Sender processes Web Email TCP MP 3 UDP IP IP datagrams Receiver processes Web Email TCP UDP IP IP datagrams MP 3

22. 2 UDP Port Numbers User Datagram Applications

22. 2 UDP Port Numbers User Datagram Applications

Note: UDP is a connectionless, unreliable protocol that has no flow and error control.

Note: UDP is a connectionless, unreliable protocol that has no flow and error control. It uses port numbers to multiplex data from the application layer.

Table 22. 1 Well-known ports used by UDP Port Protocol Description 7 Echo 9

Table 22. 1 Well-known ports used by UDP Port Protocol Description 7 Echo 9 Discard 11 Users 13 Daytime 17 Quote 19 Chargen 53 Nameserver 67 Bootps Server port to download bootstrap information 68 Bootpc Client port to download bootstrap information 69 TFTP Trivial File Transfer Protocol 111 RPC Remote Procedure Call 123 NTP Network Time Protocol 161 SNMP Simple Network Management Protocol 162 SNMP Simple Network Management Protocol (trap) Echoes a received datagram back to the sender Discards any datagram that is received Active users Returns the date and the time Returns a quote of the day Returns a string of characters Domain Name Service

Figure 22. 10 User datagram format

Figure 22. 10 User datagram format

Note: The calculation of checksum and its inclusion in the user datagram are optional.

Note: The calculation of checksum and its inclusion in the user datagram are optional.

Note: UDP is a convenient transport-layer protocol for applications that provide flow and error

Note: UDP is a convenient transport-layer protocol for applications that provide flow and error control. It is also used by multimedia applications.

22. 3 TCP Port Numbers Services Sequence Numbers Segments Connection Transition Diagram Flow and

22. 3 TCP Port Numbers Services Sequence Numbers Segments Connection Transition Diagram Flow and Error Control Silly Window Syndrome

Table 22. 2 Well-known ports used by TCP Port Protocol Description 7 Echo 9

Table 22. 2 Well-known ports used by TCP Port Protocol Description 7 Echo 9 Discard 11 Users 13 Daytime 17 Quote 19 Chargen 20 FTP, Data 21 FTP, Control 23 TELNET 25 SMTP 53 DNS 67 BOOTP 79 Finger 80 HTTP Hypertext Transfer Protocol 111 RPC Echoes a received datagram back to the sender Discards any datagram that is received Active users Returns the date and the time Returns a quote of the day Returns a string of characters File Transfer Protocol (data connection) File Transfer Protocol (control connection) Terminal Network Simple Mail Transfer Protocol Domain Name Server Bootstrap Protocol Remote Procedure Call

Figure 22. 7 Connection establishment

Figure 22. 7 Connection establishment

Figure 22. 8 Connection termination

Figure 22. 8 Connection termination

Connection-oriented vs. Conectionless • A connection-oriented service requires both sender and receiver to create

Connection-oriented vs. Conectionless • A connection-oriented service requires both sender and receiver to create a connection before any data is transferred ○ TCP provides connection oriented service to the applications, allowing a byte stream to be delivered in order, allthough IP is a connectionless service. • A connectionless service does not create a connection first but simply sends the data ○ UDP provides connectionless service to the applications. UDP packets are called datagrams.

Figure 22. 11 Stream delivery

Figure 22. 11 Stream delivery

Figure 22. 12 Sending and receiving buffers

Figure 22. 12 Sending and receiving buffers

Figure 22. 13 TCP segments

Figure 22. 13 TCP segments

Example: Connection-oriented Service • An analogy to the connection-oriented service is telephone conversation

Example: Connection-oriented Service • An analogy to the connection-oriented service is telephone conversation

Example: Connectionless Service • An analogy to connectionless service is the delivery of the

Example: Connectionless Service • An analogy to connectionless service is the delivery of the mail

Data-link vs. Transport Layer • Data link layer ○ Responsibile for reliability between two

Data-link vs. Transport Layer • Data link layer ○ Responsibile for reliability between two directly connected points • Transport layer ○ Resposibe for reliability over the internetwork Duties of the data-link layer Network 1 Network 3 Network 2 Internetwork Duties of the data-link layer Duties of the transport layer

Reliable vs. Unreliable • Transport layer can offer ○ Unreliable service (UDP) • No

Reliable vs. Unreliable • Transport layer can offer ○ Unreliable service (UDP) • No guarantee that the packet will be delivered to the destination • Useful especially for transmitting audio and video files where waiting for acknowledgement can be annoying for the user ○ Reliable service (TCP) • Connection establishment • Connection maintenance • Connection termination

User Datagram Protocol (UDP) • No reliability or connection management! • Serves solely as

User Datagram Protocol (UDP) • No reliability or connection management! • Serves solely as a labeling mechanism for demultiplexing at the receiver end • Use predominantly by protocols that do no require the strict service guarantees offered by TCP (e. g. real-time multimedia protocols) • Additional intelligence built at the application layer if needed

Transmission Control protocol (TCP) • Provides a connection-oriented end-to-end (user-to-user) reliable byte stream service

Transmission Control protocol (TCP) • Provides a connection-oriented end-to-end (user-to-user) reliable byte stream service in both directions (full duplex) • Divides a byte stream into a sequence of segments and sends them to the destination via IP • Uses the destination port, source port to identify the application to which the segment is sent (multiplexing the sessions) • Uses sliding window like scheme for flow control and congestion control

Connection Management • Two way handshake protocol is not enough because of potential delays

Connection Management • Two way handshake protocol is not enough because of potential delays in either A’s request or B’s responce, as shown below. Possibility of confusion exists. A B A sends a t 1 connection request A sends connection t 2 request again A receives the acknowledgement and establishes a t 4 connection t 3 A and B exchange data and eventually disconnect time B receives connection request B establishes a connection and sends an acknowledgement B receives connection t 5 request B establishes a connection and sends an acknowledgement time

Three-way Handshake Protocol for Connection Establishment A A sends a connection request with seq.

Three-way Handshake Protocol for Connection Establishment A A sends a connection request with seq. no. x t 1 A sends connection request t 2 again with seq. no. y A receives the acknowledgement y+1 and t 4 sends acknowledgement z+1 A does not send an acknowledgement and no connection is established B t 3 B sends acknowledgement y+1 and seq. no. z The connection is established t 5 B sends acknowledgement x+1 and seq. no. w t 6 time

Connection Establishment and Termination Active open SYN Send connection request SYN+ACK Server does passive

Connection Establishment and Termination Active open SYN Send connection request SYN+ACK Server does passive open Accept connection request Send acceptance ACK DATA Start connection The three-way handshake TCP segments are labeled with SYN. The length of data in the first two is 0 • 3 -way handshake used for connection establishment • Randomly chosen sequence number is conveyed to the other end • Similar FIN, FIN+ACK exchange used for connection termination

TCP’s Segments • TCP treats data as a sequence of bytes to be divided

TCP’s Segments • TCP treats data as a sequence of bytes to be divided and sent in segments. • The size of the segment depends on the underlying physical network and on the number of bytes the sender is allowed to send (window size) • Rather than numbering each segment, TCP stores the sequence number of the data byte in the segment • The source and the destination each have separate sequence numbers • The acknowledgement numbers are equal to the next expected sequence number

Window Management in TCP • Sliding window scheme is used with variable window ○

Window Management in TCP • Sliding window scheme is used with variable window ○ The window can change depending on the traffic in the network (TCP provides congestion control) • The size of the window is expressed in bytes instead of packets • The window size depends on the receiver’s capabilites and the congestion in the network

TCP Sliding Window segment 1 100 bytes of data numbered from 1 to 100

TCP Sliding Window segment 1 100 bytes of data numbered from 1 to 100 acknowledge 801 segment 2 100 bytes of data numbered from 701 to 800, ack 101 acknowledge 101 segment 1 100 bytes of data numbered from 101 to 200, ack 801 acknowledge 901 segment 3 100 bytes of data numbered from 801 to 900, ack 201 acknowledge 201 segment 2

Example 1 Imagine a TCP connection is transferring a file of 6000 bytes. The

Example 1 Imagine a TCP connection is transferring a file of 6000 bytes. The first byte is numbered 10010. What are the sequence numbers for each segment if data are sent in five segments with the first four segments carrying 1000 bytes and the last segment carrying 2000 bytes? Solution The following shows the sequence number for each segment: Segment 1 ==> sequence number: 10, 010 (range: 10, 010 to 11, 009) Segment 2 ==> sequence number: 11, 010 (range: 11, 010 to 12, 009) Segment 3 ==> sequence number: 12, 010 (range: 12, 010 to 13, 009) Segment 4 ==> sequence number: 13, 010 (range: 13, 010 to 14, 009) Segment 5 ==> sequence number: 14, 010 (range: 14, 010 to 16, 009)

Note: The bytes of data being transferred in each connection are numbered by TCP.

Note: The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number.

Note: The value of the sequence number field in a segment defines the number

Note: The value of the sequence number field in a segment defines the number of the first data byte contained in that segment.

Note: The value of the acknowledgment field in a segment defines the number of

Note: The value of the acknowledgment field in a segment defines the number of the next byte a party expects to receive. The acknowledgment number is cumulative.

Figure 22. 14 TCP segment format

Figure 22. 14 TCP segment format

Figure 22. 15 Control field

Figure 22. 15 Control field

Table 22. 3 Description of flags in the control field Flag Description URG The

Table 22. 3 Description of flags in the control field Flag Description URG The value of the urgent pointer field is valid. ACK The value of the acknowledgment field is valid. PSH Push the data. RST The connection must be reset. SYN Synchronize sequence numbers during connection. FIN Terminate the connection.

Figure 22. 16 Three-step connection establishment

Figure 22. 16 Three-step connection establishment

Figure 22. 17 Four-step connection termination

Figure 22. 17 Four-step connection termination

Table 22. 4 States for TCP State Description CLOSED There is no connection. LISTEN

Table 22. 4 States for TCP State Description CLOSED There is no connection. LISTEN The server is waiting for calls from the client. SYN-SENT A connection request is sent; waiting for acknowledgment. SYN-RCVD A connection request is received. ESTABLISHED Connection is established. FIN-WAIT-1 The application has requested the closing of the connection. FIN-WAIT-2 The other side has accepted the closing of the connection. TIME-WAIT Waiting for retransmitted segments to die. CLOSE-WAIT The server is waiting for the application to close. LAST-ACK The server is waiting for the last acknowledgment.

Figure 22. 18 State transition diagram

Figure 22. 18 State transition diagram

Note: A sliding window is used to make transmission more efficient as well as

Note: A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. TCP’s sliding windows are byte-oriented.

Figure 22. 19 Sender buffer

Figure 22. 19 Sender buffer

Figure 22. 20 Receiver window

Figure 22. 20 Receiver window

Figure 22. 21 Sender buffer and sender window

Figure 22. 21 Sender buffer and sender window

Figure 22. 22 Sliding the sender window

Figure 22. 22 Sliding the sender window

Figure 22. 23 Expanding the sender window

Figure 22. 23 Expanding the sender window

Figure 22. 24 Shrinking the sender window

Figure 22. 24 Shrinking the sender window

Note: In TCP, the sender window size is totally controlled by the receiver window

Note: In TCP, the sender window size is totally controlled by the receiver window value (the number of empty locations in the receiver buffer). However, the actual window size can be smaller if there is congestion in the network.

Figure 22. 25 Lost segment

Figure 22. 25 Lost segment

Figure 22. 26 Lost acknowledgment

Figure 22. 26 Lost acknowledgment

Chapter 23 Congestion Control and Quality of Service

Chapter 23 Congestion Control and Quality of Service

23. 1 Data Traffic Descriptor Traffic Profiles

23. 1 Data Traffic Descriptor Traffic Profiles

Figure 23. 1 Traffic descriptors

Figure 23. 1 Traffic descriptors

Figure 23. 2 Constant-bit-rate traffic

Figure 23. 2 Constant-bit-rate traffic

Figure 23. 3 Variable-bit-rate traffic

Figure 23. 3 Variable-bit-rate traffic

Figure 23. 4 Bursty traffic

Figure 23. 4 Bursty traffic

23. 2 Congestion Network Performance

23. 2 Congestion Network Performance

Figure 23. 5 Incoming packet

Figure 23. 5 Incoming packet

Figure 23. 6 Packet delay and network load

Figure 23. 6 Packet delay and network load

Figure 23. 7 Throughput versus network load

Figure 23. 7 Throughput versus network load

23. 3 Congestion Control Open Loop Closed Loop

23. 3 Congestion Control Open Loop Closed Loop

23. 4 Two Examples Congestion Control in TCP Congestion Control in Frame Relay

23. 4 Two Examples Congestion Control in TCP Congestion Control in Frame Relay

Note: TCP assumes that the cause of a lost segment is due to congestion

Note: TCP assumes that the cause of a lost segment is due to congestion in the network.

Note: If the cause of the lost segment is congestion, retransmission of the segment

Note: If the cause of the lost segment is congestion, retransmission of the segment does not remove the cause—it aggravates it.

Figure 23. 8 Multiplicative decrease

Figure 23. 8 Multiplicative decrease

23. 5 Quality of Service Flow Characteristics Flow Classes

23. 5 Quality of Service Flow Characteristics Flow Classes

Figure 23. 12 Flow characteristics

Figure 23. 12 Flow characteristics

Figure 23. 24 Traffic conditioner

Figure 23. 24 Traffic conditioner

23. 6 Techniques to Improve Qo. S Scheduling Traffic Shaping Resource Reservation Admission Control

23. 6 Techniques to Improve Qo. S Scheduling Traffic Shaping Resource Reservation Admission Control

Figure 23. 13 FIFO queue

Figure 23. 13 FIFO queue

Figure 23. 14 Priority queuing

Figure 23. 14 Priority queuing

Figure 23. 15 Weighted fair queuing

Figure 23. 15 Weighted fair queuing

Figure 23. 16 Leaky bucket

Figure 23. 16 Leaky bucket

Figure 23. 17 Leaky bucket implementation

Figure 23. 17 Leaky bucket implementation

Note: A leaky bucket algorithm shapes bursty traffic into fixed-rate traffic by averaging the

Note: A leaky bucket algorithm shapes bursty traffic into fixed-rate traffic by averaging the data rate. It may drop the packets if the bucket is full.

Figure 23. 18 Token bucket

Figure 23. 18 Token bucket

Note: The token bucket allows bursty traffic at a regulated maximum rate.

Note: The token bucket allows bursty traffic at a regulated maximum rate.