1 chapter 24-25 internetworking part 4 (transport protocols, udp and tcp, protocol port numbers)

42
1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

Upload: maude-montgomery

Post on 25-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

1

Chapter 24-25Chapter 24-25

Internetworking

Part 4(Transport Protocols, UDP and TCP, Protocol

Port Numbers)

Page 2: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

2

Transport ProtocolTransport Protocol

Separate layer of protocol stackConceptually between

ApplicationIP

Page 3: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

3

TerminologyTerminologyIP

Provides computer-to-computer communicationSource and destination addresses are computersCalled machine-to-machine

Transport ProtocolsProvide application-to-application communicationNeed extended addressing mechanism to identify

applicationsCalled end-to-end

Page 4: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

4

Transport Protocol Functionality

Transport Protocol Functionality

Identify sending and receiving applicationsOptionally provide

ReliabilityFlow controlCongestion control

Note: not all transport protocols provide above facilities

Page 5: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

5

Two main Transport Protocols available Two main Transport Protocols available

Transmission Control Protocol (TCP)User Datagram Protocol (UDP)Major differences

Interface to applicationsFunctionality

Page 6: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

Other Transport ProtocolsOther Transport Protocols

Datagram Congestion Control Protocol (DCCP)

DCCP is useful for applications with timing constraints on the delivery of data that may become useless to the receiver if reliable in-order delivery combined with congestion avoidance is used. Such applications include streaming media, multiparty online games and Internet telephony.

6

Page 7: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

Other Transport ProtocolsOther Transport Protocols

Stream Control Transmission Protocol (SCTP)

Serving in a similar role as the popular protocols TCP and UDP. SCTP provides some of the same service features of both, ensuring reliable, in-sequence transport of messages with congestion control.

SCTP is transaction-oriented and supports multi-streaming.

7

Page 8: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

8

User Datagram Protocol (UDP)

User Datagram Protocol (UDP)

Provides unreliable transferRequires minimal

OverheadComputationCommunication

Best for LAN applications

Page 9: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

9

UDP DetailsUDP Details

Connectionless service paradigmMessage-oriented interface

Each message encapsulated in IP datagramUDP header identifies

Sending applicationReceiving application

Page 10: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

10

Identifying An ApplicationIdentifying An Application

Cannot extend IP addressNo unused bits

Cannot use OS-dependent quantityProcess IDTask numberJob name

Must work on all computer systems

Page 11: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

11

Identifying an Application (continued)

Identifying an Application (continued)

Invent new abstractionUsed only with TCP/IPIdentifies sender and receiver unambiguously

TechniqueEach application assigned unique integerCalled protocol port number

Page 12: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

12

Protocol PortsProtocol Ports

ServerFollows standardAlways uses same port numberUses lower port numbers

ClientObtains unused port from protocol softwareUses higher port numbers

Page 13: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

13

Protocol PortsProtocol Ports

The port numbers are divided into three ranges: the Well Known Ports, the Registered Ports, and the Dynamic and/or Private Ports.

Well Known Ports: 0 through 1023. For privileged users.

Registered Ports: 1024 through 49151. For normal users.

Dynamic and/or Private Ports: 49152 through 65535

Page 14: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

14

Well known Port number samples

Well known Port number samples

ftp-data 20/tcp File Transfer [Default Data] ftp-data 20/udp File Transfer [Default Data]ftp 21/tcp File Transfer [Control]ftp 21/udp File Transfer [Control]ssh 22telnet 23DNS 53http 80pop3 110

Page 15: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

15

Protocol Port ExampleProtocol Port Example

Domain name server application is assigned port 53Application using DNS obtains port 28900UDP datagram sent from application to DNS server has

Source port number 28900Destination port number 53

When DNS server replied, DP datagram hasSource port number 53Destination port number 28900

Page 16: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

16

Transmission Control Protocol (TCP)

Transmission Control Protocol (TCP)

Major transport protocol used in InternetHeavily usedCompletely (?) reliable transfer

Page 17: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

17

TCP FeaturesTCP Features

Connection-oriented servicePoint-to-pointFull-duplex communicationStream interfaceStream divided into segments for transmissionEach segment encapsulated in IP datagramUses protocol ports to identify applications

Page 18: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

18

TCP Feature SummaryTCP Feature Summary

TCP provides a completely reliable (no data duplication or loss), connection-oriented, full-duplex stream transport service that allows two application programs to form a connection, send data in either direction, and then terminate the connection.

Page 19: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

19

Relationship Between TCP And Other Protocols

Relationship Between TCP And Other Protocols

TCP on one computer uses IP to communicate with TCP on another computer

Page 20: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

20

Apparent ContradictionApparent Contradiction

IP offers best-effort (unreliable) deliveryTCP uses IPTCP provides completely reliable transferHow is this possible?

Page 21: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

21

Achieving ReliabilityAchieving Reliability

Reliable connection startupReliable data transmissionGraceful connection shutdown

Page 22: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

22

Reliable Data TransmissionReliable Data Transmission

Positive acknowledgment Receiver returns short message when data arrivesCalled acknowledgment

RetransmissionSender starts timer whenever message is

transmittedIf timer expires before acknowledgment arrives,

sender retransmits message

Page 23: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

23

Illustration of RetransmissionIllustration of

Retransmission

Page 24: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

24

How Long Should TCP WaitBefore Retransmitting?

How Long Should TCP WaitBefore Retransmitting?

Time for acknowledgment to arrive depends onDistance to destinationCurrent traffic conditions

Multiple connections can be open simultaneously

Traffic conditions change rapidly

Page 25: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

25

Important PointImportant Point

The delay required for data to reach a destination and an acknowledgment to return depends on traffic in the internet as well as the distance to the destination. Because it allows multiple application programs to communication with multiple destinations concurrently, TCP must handle a variety of delays that can change rapidly

Page 26: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

26

Solving the Retransmission Problem

Solving the Retransmission Problem

Keep estimate of round trip time on each connection

Use current estimate to set retransmission timer

Known as adaptive retransmissionKey to TCP’s success

Page 27: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

27

Illustration of Adaptive Retransmission

Illustration of Adaptive Retransmission

Timeout depends on current round-trip estimate

Page 28: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

28

TCP Flow ControlTCP Flow Control

ReceiverAdvertises available buffer spaceCalled window

SenderCan send up to entire window before Ack arrives

Page 29: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

29

Window AdvertisementWindow Advertisement

Each acknowledgment carries new window information

Called window advertisementCan be zero (called closed window)

Interpretation: I have received up through X, and can take Y more octets

Page 30: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

30

Flow control and lost segments

Flow control and lost segments

If a segment is lost, the window does not advance until the segment is retransmitted and the sender receives the acknowledgment for the segment. When the receiver gets a segment out of order, it can send an acknowledgment for the highest received data byte without sending individual acknowledgments for the intermediate data.

Page 31: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

31

Illustration of Window Advertisement

Illustration of Window Advertisement

Page 32: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

32

Startup and ShutdownStartup and Shutdown

Connection startupMust be reliable

Connection shutdownMust be graceful

Difficult

Page 33: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

33

Why Startup/Shutdown Difficult

Why Startup/Shutdown Difficult

Segments can beLostDuplicatedDelayedDelivered out of orderEither side can crashEither side can reboot

Need to avoid duplicate “shutdown” message from affecting later connection

Page 34: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

34

TCP’s Startup/Shutdown Solution

TCP’s Startup/Shutdown Solution

Uses three-message exchangeKnown as 3-way handshakeNecessary and sufficient for

Unambiguous, reliable startupUnambiguous, graceful shutdown

SYN used for startupFIN used for shutdown

Page 35: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

35

Illustration of 3-Way Handshake

Illustration of 3-Way Handshake

Page 36: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

36

Congestion ControlCongestion Control

Congestion Packet loss Retransmission more Congestion ….. Congestion Collapse

Solution: If Packet loss, back off!Send only one message (even if large window)If successful, stepwise increase sent data until

full window is used again

Page 37: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

37

TCP Segment FormatTCP Segment Format

All TCP segments have same formatDataAcknowledgmentSYN (startup)FIN (shutdown)

Segment divided into two partsHeaderPayload area (zero or more bytes of data)

Page 38: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

38

TCP Segment Format (continued)

TCP Segment Format (continued)

Header containsProtocol port numbers to identify

Sending applicationReceiving application

Bits to specify items such asSYNFINACK

Fields for window advertisement, acknowledgment, etc.

Page 39: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

39

Illustration of TCP Segment

Illustration of TCP Segment

Sequence number specifies where in stream data belongs

Few segments contain options

Page 40: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

40

SummarySummary

Transport protocols fit between applications and Internet Protocol

Two transport protocols in TCP/IP suiteUser Datagram Protocol (UDP)Transmission Control Protocol (TCP)

UDPUnreliableMessage-oriented interface

Page 41: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

41

Summary (continued)Summary (continued)

TCPMajor transport protocol used in InternetComplete reliabilityStream-oriented interfaceUses adaptive retransmission

Page 42: 1 Chapter 24-25 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)

42

Summary (continued)Summary (continued)

Protocol portsIntegersUsed to identify sending and receiving

applicationsAllow unambiguous, simultaneous

communication with multiple applications