es 101-02. module 4 transport layer protocols. last lecture(s) routing and ip addressing domain name...

59
ES 101-02. Module 4 Transport Layer Protocols

Upload: ursula-mitchell

Post on 28-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

ES 101-02. Module 4Transport Layer Protocols

Page 2: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Last Lecture(s)

• Routing and IP Addressing• Domain Name System

Page 3: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

This Lecture

• Transport Layer Services• User Datagram Protocol (UDP)• Transmission Control Protocol (TCP)

Page 4: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Transport Layer Operation

• The transport layer interfaces to applications• One application may have multiple simultaneous interfaces to

remote clients for a given application– Web servers, ftp servers, etc.

• The converse is also true, ie. the server may support multiple applications to one or more clients

• The application provides the transport layer with “Protocol Data Units” or PDUs

• These PDUs are then segmented and encapsulated in a transport layer “segment”

• The transport layer segment is then encapsulated in IP, and on, and on…

Page 5: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Transport Layer Applications

• In order to understand the operation of the transport layer, Layer 4, we must first examine the requirements of this layer, and then go through some common scenarios for the TCP/IP protocol stack– The foundation for the operation of the Internet

Page 6: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

TCP/IP Architecture

HTTP

UDPTCP

Note: We have covered IP previously.

Page 7: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Transport Layer Services

• Type of Service Indicators

• Quality of Service Indicators

• Data Transfer

• Application Programing Interface (API)

• Connection Management

• Delivery Prioritization

• Status Reporting

• Security

• Multiplexing and demultiplexing

Page 8: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Transport Layer Services (cont’d)

• The performance of the transport layer must be discussed with respect to the underlying network layer– IP in the case of the Internet

• Two types of transport layer services are available:– Reliable, sequencing

• Transmission Control Protocol (TCP)

– Unreliable, ie. no sequencing mechanism• User Datagram Protocol (UDP)

Page 9: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Packet Switching Review

• Recall that the IP layer launches packets into the network, and “hopes for the best”

• This means that packets can arrive at the destination out of sequence, or get lost– Late packets that are OK upon arrival

– Packets that get destroyed in transit due to “collisions”

• How can this happen?– Different routes

– Packet “destruction”

Note: In the TCP/IP world, packets are referred to as “datagrams”

Page 10: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Out of Order Datagram

Page 11: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Lost Datagram

Page 12: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Corruption of Packets by Routers

Page 13: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Consequences of Out-of-Sequence Transmission

Page 14: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Techniques for Reliability

• Connection-oriented transmission of packets• Error Control

– Error detection, ie. are packets damaged?• Accomplished via Cyclic Redundancy Checking

• Header corruption

• Payload corruption

– Error recovery• NACK the bad or missing packets

• Retransmit the packet again

• This requires packet sequence numbers

Page 15: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Connection-Oriented Transmission

• A “session” is established between the client and server before data transmission is initiated– Connection Establishment

• During data transmission, packets are monitored for errors– This requires packet sequence numbers

• If data is lost, retransmission is requested

• At the conclusion of the session, the connection is closed– “Log off”

Page 16: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Error Control and Recovery

• Error control refers to the detection of errors in either the header, the payload, or both

• This is accomplished by a Cyclic Redundancy Check (CRC) algorithm– The CRC is calculated upon transmission and appended to the

packet– The CRC is then re-calculated upon receipt of the packet

• If the CRC calculation does not match that which was appended upon transmission, the packet is assumed to be damaged, and is not processed further

• Re-transmission of the damaged packet is then requested

Page 17: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Requirements for Transmission over anUnreliable Network

• As stated previously, additional requirements are placed on the transport protocol if the underlying network is unreliable, and reliable transmission of data is required– Ordered Delivery– Retransmission Strategy– Duplicate Detection– Flow Control

• Results from congestion

– Connection Establishment and Termination– Crash Recovery

• Layer 4 protocols may not implement all of these features

Page 18: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

This Lecture

• Transport Layer Services• User Datagram Protocol (UDP)• Transmission Control Protocol (TCP)

Page 19: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

User Datagram Protocol (UDP)

• Before we discuss TCP which is a connection-oriented, reliable, sequencing protocol, we will discuss UDP– Connectionless

• There is no connection establishment or termination

– Error detection• Header only, to prevent misrouted packets

• UDP is very efficient, and is widely used for applications that do not require reliability, but do require multiplexing– Identification of each communication link

• UDP is essentially IP with sockets• But first, we must understand sockets…

Page 20: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

UDP Application Example

• The Simple Network Management Protocol (SNMP) utilizes UDP

• SNMP consists of two parts:– Management station– Management Information Base (MIB) in all networked devices

• The devices send a “health” message to the management station at 10 second intervals

• Device health is displayed graphically to a network administrator in the Network Operations Center (NOC)

• If a device shows that it has failed, the NOC operator takes a corrective action

Do we care if an update is lost or misordered?

Page 21: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

UDP Overview

• Documented in RFC 768• Communication occurs via “ports” and “sockets”• Unreliable delivery, ie. operates over IP

– Connectionless service– Lost datagrams are possible– Out of sequence datagrams are possible

• Very efficient protocol– No connection establishment or closure– “Fire and forget” protocol

Page 22: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

UDP Ports

• UDP essentially adds a port addressing capability to IP• Each packet is tagged with unique source and destination

identifiers known as a “ports”• The combination of a port number and a device IP address is

unique– This combination is known as a “socket”

• Different applications use different port values• UDP Client/Server operation

– Server listens passively– Client “knows” port numbers, and initiates (requests) information

transfer– Server responds to client request

Page 23: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

UDP Header

Page 24: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Multiplexing

• UDP accomplishes multiplexing/demultiplexing by keeping track of sockets at each end of the link

• Each connection is therefore uniquely identified• This technique supports many concurrent

connections– Interleaving of PDUs, ie. multiplexing

Page 25: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Multiplexing of Concurrent Applications

Page 26: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

UDP Process Identification

Page 27: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Well Known UDP Ports

Page 28: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Socket Schematic

Page 29: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Checksum

• 16-bit “ones complement”– Includes information from the IP header, UDP header, data, and

padding octets• Must end up with an even number of octets

• A “pseudo-header” is pre-pended to the UDP header to calculate the checksum only for the UDP header– Avoids misrouting to the wrong process

• This information protects against misrouted datagrams– Header/address corruption

Page 30: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

UDP Header

Page 31: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

This Lecture

• Transport Layer Services• User Datagram Protocol (UDP)• Transmission Control Protocol (TCP)

Page 32: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Transmission Control Protocol Overview

• Documented in RFC 793• Why is TCP necessary?

– UDP adds little reliability to the IP connectionless service

• TCP provides additional reliability over UDP– Error free– Assured delivery– In sequence packets, or segments– No duplication of segments

So, what services does TCP provide?

Page 33: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

TCP Services

• Multiplexing

• Connection-oriented– Connection establishment

– Crash recovery

– Connection termination

• Reliable– Sequence numbers provided

– Mechanisms for error detection/recovery at the byte level

• Flow Control

Page 34: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Multiplexing

• TCP accomplishes multiplexing/demultiplexing by keeping track of ports and sockets at each end of the link

• This process is identical to the technique for UDP with the exception that many concurrent data “streams” must be supported

Page 35: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

TCP Header

Page 36: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

TCP Connections

Page 37: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

TCP Connections (cont’d)

Page 38: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Well Known TCP Ports

Page 39: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Connection Establishment

• TCP clients must have a reliable way to “connect” to servers– This is done using a three-way handshake

• The server passively “listens” on a well known port• A connection request is made when the client issues a

“SYN” packet to the appropriate port number• The server “connects” and then assigns a different port

number for the session– There can be up to 216 concurrent sessions– This port is “open” until session termination, after which it can be

reassigned

Page 40: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Connection Establishment (cont’d)

• TCP utilizes a three-way handshake

• To initiate a connection, the originator sets the SYN and Sequence Number (SN) fields in the TCP header– SN is set to the initial number of the first octet in the segment, SN = X

• The destination then responds with a TCP message (header) with the SYN and ACK bits set, SN = Y, and the Acknowledgement Number (AN) set equal to AN = X + 1– This acknowledges the first SYN packet, and acknowledges that the

next octet to be received is X+1

Page 41: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Connection Establishment (cont’d)

• The originator then responds with a message with the acknowledgement number set: – AN = Y + 1

– This is the last packet in the three way handshake

– The connection is then established

Page 42: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Passive/Active Connection RequestThree Way Handshake

Page 43: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Data Transfer

• After connection establishment, TCP transfers application data by packaging it in a TCP “segment”, or data packet

• Sequence numbers are indirectly provided for every octet (byte) in the segment

• When packets arrive at the destination, they are reassembled in the correct order– Missing and duplicate information is detected and corrected

• Sequence numbers are independent of each “flow”

Page 44: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

TCP Header

Page 45: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Data Byte Numbering

Page 46: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Acknowledgement

Page 47: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Error Recovery

Page 48: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Data Sequence Numbers

• The TCP technique of providing sequence numbers that represent each octet in the segment allows detection of missed octets, assuming the CRC check is OK– Number of octets in a TCP message can be 232

– Each TCP header contains the sequence number of the first octet in the segment

• This sequence number cannot be repeated during the lifetime of the session transmission– Recall that each session can have different sequence numbers,

since this is a connection-oriented approach• 216 concurrent sessions

Page 49: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Checksum - TCP

• Operates in the same fashion as UDP– Header Only

– Avoids misrouting to the wrong process

• However, when used in conjunction with the payload octet sequence numbering and error recovery, reliability of transmission is assured

Page 50: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Checksum – TCP

Page 51: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Flow Control

• Flow control is accomplished by using a credit allocation scheme

• The credit is equal to the number of octets in the “send window”– This is the total number of octets that can be outstanding

(unacknowledged) before requiring an acknowledgement

• The credit allocation approach allows the destination device to adjust the origin transmission window– This essentially controls the “flow” in bytes/second that the sender

can launch into the network

Why is flow control necessary?

Page 52: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Buffer Overflows

• If a router or switch on the network receives more information than it can process per unit of time, it buffers the information until it can get to it

• If the network gets congested, the offered load is greater than the routers can buffer

• When this happens, the routers overwrite their buffers, causing the loss of data (packets)

• So, it is necessary for devices attached to the network to be able to “slow down” the transmission process

Page 53: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Flow Control Schematic

Page 54: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Crash Recovery

• Sometimes, the a device “stalls” or fails– This could be either the server, client, or the network

• When this happens, the other “party” to the conversation does not know what is going on– The receiver may be waiting forever to get the next chunk of

information

• There must therefore be a mechanism to force the transmitter to respond– Are you still there?

How is this done?

Page 55: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Push and Reset Flags

• This is accomplished via the Push and RST flags in the TCP header

• The push and reset flags are used to allow the originator to force data accumulated in the buffer to be sent– Allows use as an “end of block” flag

• If a segment is misrouted, the receiver sends a TCP header back with the RST flag set– Example: Delayed or duplicate SYNs

Page 56: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

TCP Header

SN

AN

ACK SYN

Page 57: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Closing the Connection

• When all data has been transmitted, it is necessary to close the connection

• Otherwise, all of the ports would eventually be used up– No further sessions could be established

Page 58: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Closing the Connection

Page 59: ES 101-02. Module 4 Transport Layer Protocols. Last Lecture(s) Routing and IP Addressing Domain Name System

Next Lecture(s)

• HTTP and URLs• HTML Overview• HTML Editors