• No results found

Transport Protocols and Distributed Applications

N/A
N/A
Protected

Academic year: 2021

Share "Transport Protocols and Distributed Applications"

Copied!
31
0
0

Loading.... (view fulltext now)

Full text

(1)

Transport Protocols and

Distributed Applications

EP1100

Data Communications

and Computer Networks

Illustrations in this material are collected from

Behrouz A Forouzan, Data Communications

(2)

EP1100 Datakommunikation och datornät 3

Today’s Lecture

Transport Protocols

ƒ

End-to-end packet transmission

ƒ

TCP—connection-oriented transmission

ƒ

UDP—datagram transmission

Distributed Applications

ƒ

the Client-Server communication model

ƒ

DNS, Mail, FTP, WWW, SNMP

ƒ

DHCP

EP1100 Datakommunikation och datornät

Transport services and protocols

• Providelogical

communicationbetween app processes running on different hosts

• Transport protocols run in

end systems

ƒ send side: breaks app

messages into

segments, passes to network layer

ƒ receive side:

reassembles segments into messages, passes to app layer

• More than one transport

protocol available to apps

ƒ Internet: TCP and UDP

application transport network data link physical application transport network data link physical logica l en d-e nd tran sport

(3)

EP1100 Datakommunikation och datornät 5

Internet transport-layer protocols

• Reliable, in-order delivery

(TCP) ƒ congestion control ƒ error control ƒ flow control ƒ connection setup • Unreliable, unordered delivery: UDP ƒ no-frills extension of “best-effort” IP

• Services not available:

ƒ delay guarantees ƒ bit-rate guarantees application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical application transport network data link physical logica l en d-e nd tran sport

Multiplexing/demultiplexing

application transport network link physical P1 application transport network link physical application transport network link physical P2 P3 P1 P4

host 1 host 2 host 3

= process = socket

delivering received segments to correct socket

Demultiplexing at rcv host:

gathering data from multiple sockets, enveloping data with header (later used for demultiplexing)

(4)

EP1100 Datakommunikation och datornät 7

How demultiplexing works

• Host receives IP datagrams

ƒ each datagram has

source IP address, destination IP address

ƒ each datagram carries

one transport-layer segment

ƒ each segment has

source, destination port number

• Host uses IP addresses & port numbers to direct segment to appropriate socket

source port # dest port #

32 bits

application data (message) other header fields

TCP/UDP segment format

EP1100 Datakommunikation och datornät

Application Addressing

TCP UDP ICMP OSPF

SNMP BGP SMTP FTP HTTP DNS

IP

IEEE 802.3 IEEE 802.11 SONET/SDH PPP IP Protocol

(5)

EP1100 Datakommunikation och datornät 9

Client-Server Model

• Server uses a ”well known port number” ƒ ICANN/IANA

o Internet Corporation for Assigned Names and Numbers

o Internet Assigned Numbers Authority

• Client port numbers are assigned dynamically ƒ ”Ephemeral” ports

Some Well Known Port Numbers

Description Protocol

Name Port

Post Office Protocol ver 3 UDP/TCP

pop3 110

Post Office Protocol ver 2 UDP/TCP

pop2 109

USENET News Transfer Protocol TCP

nntp 119

Network Time Protocol UDP/TCP

ntp 123

World Wide Web HTTP UDP/TCP

www 80

Trivial File Transfer Protocol UDP tftp 69 Bootstrap client UDP/TCP bootpc 68 Bootstrap server UDP/TCP bootps 67

Domain name server UDP/TCP dns 53 Mail transfer TCP smtp 25 Terminal TCP telnet 23

File Transfer Protocol (control channel) TCP

ftp 21

File Transfer Protocol (data channel) TCP

ftp-data 20

(6)

EP1100 Datakommunikation och datornät 11

User Datagram Protocol (UDP)

• Connectionless datagram service

• Checksum computed over pseudoheader of IP header fields

ƒ Source and destination IP addresses ƒ Protocol type

ƒ Extra field of UDP total length

EP1100 Datakommunikation och datornät

Why Datagrams?

Application doesn’t need a reliable service

ƒ Periodic updates, statistics, etc

Connection-oriented service too costly

ƒ Overhead with connection management

Application does flow and error control itself

Retransmissions are useless

ƒ It would arrive too late if retransmitted

Multicast

ƒ TCP does not support multicast

(7)

EP1100 Datakommunikation och datornät 13

TCP: Overview

RFCs: 793, 1122, 1323, 2018, 2581

• Full duplex data

ƒ bi-directional data flow in same connection ƒ MSS: maximum segment size • Connection-oriented ƒ handshaking (exchange of control msgs) init’s sender, receiver state before data exchange • Flow controlled

ƒ sender will not overwhelm receiver • Point-to-point

ƒ one sender, one receiver • Reliable, in-order byte

steam

ƒ no “message boundaries” • Pipelined

ƒ TCP congestion and flow control set window size • Send & receive buffers

socket door TCP send buffer TCP receive buffer socket door segment application writes data application reads data

TCP segment structure

source port # dest port #

32 bits application data (variable length) sequence number acknowledgment number Receive window Urg data pnter checksum F S R P A U head

len usednot

Options (variable length)

ACK: ACK # valid RST, SYN, FIN: connection estab (setup, teardown commands) # bytes rcvr willing to accept counting by bytes of data (not segments!) Internet checksum (as in UDP)

(8)

EP1100 Datakommunikation och datornät 15

TCP reliable data transfer

TCP creates reliable and orderly service

on top of IP’s unreliable service

Pipelined segments

Cumulative ACKs

ƒ

No NACKs

ƒ

Hybrid between Go-back-N and Selective

Repeat

Retransmissions are triggered by

ƒ

timeout events

ƒ

duplicate acks

EP1100 Datakommunikation och datornät

TCP Round Trip Time and Timeout

How to set TCP

timeout value?

• Longer than RTT

ƒ but RTT varies

• Too short: premature

timeout

ƒ unnecessary

retransmissions

• Too long: slow

reaction to segment loss

ƒ lowers throughput

How to estimate RTT?

SampleRTT:measured time from segment transmission until ACK receipt

ƒ ignore retransmissions • SampleRTTwill vary, want

estimated RTT “smoother” ƒ average over several recent

measurements

How to set timeout?

• Use estimated RTT

• Add four times estimated

(9)

EP1100 Datakommunikation och datornät 17

Example RTT estimation

RTT: gaia.cs.umass.edu to fantasia.eurecom.fr 100 150 200 250 300 350 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) RT T ( m illi secon ds) SampleRTT Estimated RTT

TCP Flow Control

Receiver side of TCP

connection has a

receive buffer:

Receiver includes

value of receive

window in ACKs

Sender limits

unACKed data

ƒ guarantees receive buffer doesn’t overflow

Speed-matching

service

ƒ matching the send

rate to the receiving applications drain rate

Application process

may be slow at

reading from buffer

(10)

EP1100 Datakommunikation och datornät 19

TCP Connection Management

Three way handshake:

Step 1: client host sends TCP SYN segment to server

ƒ specifies initial seq #

ƒ no data

Step 2: server host receives SYN, replies with SYNACK segment

ƒ server allocates buffers

ƒ specifies server initial seq. #

Step 3:client receives SYNACK, replies with ACK segment, which may contain data

EP1100 Datakommunikation och datornät

TCP Congestion Control

How does sender perceive congestion?

loss event = timeout or 3 duplicate acks

TCP sender reduces rate after loss event

Mechanism

Sliding window

ƒ Window size must be variable

o To allow full utilization over paths of different length o To control the sending rate to avoid persistent congestion

Modes of varying the window size

ƒ Slow start

(11)

EP1100 Datakommunikation och datornät 21

TCP Slow Start

• When connection begins, window = 1

max segment

ƒ Example: MSS = 500 bytes & RTT = 200 ms

ƒ initial rate = 20 kb/s

• Increase rate fast until threshold

ƒ double window every RTT

ƒ done by incrementing the window for every ACK received

ƒ Slow-start threshold (ssthresh)

o Switch to congestion avoidance mode o set to 65 kB in many implementations o modified in congestion avoidance

• Initial rate is slow but ramps up

exponentially fast Host A one segment RTT Host B time two segments four segments

TCP congestion avoidance

Increase transmission rate (window size)

ƒ probing for available capacity, until loss occurs

Operation

ƒ Additive increase:increase window by 1 MSS every RTT until loss detected

ƒ Multiplicative decrease:cut window in half after loss

o Slow-start threshold is set to this value

ƒ

Time out reduces window to minimum

(12)

EP1100 Datakommunikation och datornät 23

Flow and congestion control combined

Receiver window—advertised by

receiver

Congestion window—TCP congestion

control

ƒ

Sliding window, moved forward by ACKs

(self-clocking)

ƒ

Window size increased for every ACK

ƒ

Window size reduced at time out and loss

Window

size Packet loss Max size

Tid

sender window = min(receiver window, congestion window)

EP1100 Datakommunikation och datornät

Fairness

Fairness and UDP

• Multimedia apps often do

not use TCP

ƒ do not want rate throttled by congestion control

• Instead use UDP

ƒ pump audio/video at constant rate, tolerate packet loss

ƒ May starve TCP

connections that react to loss

Fairness and parallel TCP connections

• Nothing prevents app from

opening parallel connections between 2 hosts.

ƒ Web browsers do this

• Example: link of rate R

supporting 9 connections; ƒ new app asks for 1 TCP, gets

rate R/10

ƒ new app asks for 11 TCPs, gets more than R/2!

(13)

EP1100 Datakommunikation och datornät 25

Summary

Principles behind transport layer services:

ƒ

multiplexing, demultiplexing

ƒ

reliable data transfer

ƒ

flow control

ƒ

congestion control

Instantiation and implementation in the

Internet

ƒ

UDP

ƒ

TCP

Technology Trends

• Transport protocols define services over Internet

ƒ TCP: reliable delivery without rate and delay guarantee ƒ UDP: best effort as given by the network

• New protocols

ƒ trade-off between reliability, delay and rate (soft QoS) ƒ support multimedia streaming services

o rate based congestion control

ƒ support for multicast (multiple receivers)

o problem with feedback must be solved

• Overlays (peer-to-peer)

ƒ sessions pair-wise between peers

ƒ a path might include multiple transport protocol sessions ƒ end-to-end semantic of TCP is lost

(14)

EP1100 Datakommunikation och datornät 27

Technology Trends

TCP trends

ƒ

improve performance over wireless links

with or without link level retransmissions

o high bit error rates

o paths with high delay variations

ƒ

improve throughput over high-capacity

paths

o eg, multi-Gb/s links between computer centers

ƒ

resource sharing with non-TCP traffic

o policy for the sharing (definition of fairness)

— TCP friendly congestion control

EP1100 Datakommunikation och datornät

Applications

• Domain Name System (DNS)

ƒ to allow symbolic names instead of numeric IP addresses

• Simple Message Transfer Protocol (SMTP)

ƒ the basic protocol of e-mail communication

• File Transfer Protocol (FTP)

• Hypertext Transfer Protocol (HTTP): for Web browsing • Simple Network Management Protocol (SNMP)

ƒ To manage network devices

• Dynamic Host Configuration Protocol (DHCP)

ƒ Autoconfiguration

(15)

Domain Name System (DNS)

DNS

Translate host name to IP address

ƒ

www.ee.kth.se

Î

130.237.43.45

3 generations of translations

ƒ

HOSTS.TXT

ƒ

DNS

(16)

EP1100 Datakommunikation och datornät 31

Hierarchical Name Space

• www.ee.kth.se, ftp.internic.net, google.com, ...

• Internet Corporation for Assigned Names and Numbers

(ICANN)

ƒ distribution of IP addresses and domain names

o ensures that a domain name maps to correct IP address

ƒ autonomous system ("AS") numbers ƒ protocol ports and parameter numbers.

EP1100 Datakommunikation och datornät

Hierarchy of Name Servers

• Root servers

ƒ List of all top level domains http://data.iana.org/TLD/tlds-alpha-by-domain.txt

• Country Code Top Level Domains, cc-TLD

ƒ .uk, .de, .jp, .us, .se, et c.

• Generic Top Level Domains, gTLD

ƒ .aero, .asia, .biz, .cat, .com, .coop, .edu, .gov, .info, .jobs, .mobi, .int, .mil, .museum, .name, .net, .org, .pro, .tel and .travel

o .gov for the United States Government .mil for the United States Military

o .edu for accredited postsecondary institutions

(17)

EP1100 Datakommunikation och datornät 33

Name Lookup (Resolution)

Request/response

A client is assigned a

set of DNS servers

DNS servers remember

previous lookups

(18)

EP1100 Datakommunikation och datornät 35

Simple Mail Transfer Protocol (SMTP)

SMTP delivers mail to a user’s mailbox

ƒ

Normally via an outgoing SMTP mail server

EP1100 Datakommunikation och datornät

SMTP Mail Format

Plain text

MIME encoding of

non-text data

ƒ

Multipurpose

Internet Mail

Extension

Mail From: [email protected] RCPT TO: [email protected] From: Alice

To: Bob

Date: 2004-02-19 08:01 Subject: Important mail

(19)

EP1100 Datakommunikation och datornät 37

User Mail Delivery

POP, IMAP, WWW, ...

File Transfer Protocol (FTP)

• File transfers between computers • TCP

ƒ Normally two connections ƒ Data and control (ports 20 and 21)

(20)

World Wide Web

EP1100 Datakommunikation och datornät

World Wide Web

• Distributed system

ƒ CERN 1989

ƒ Tim Berners-Lee and Robert Cailliau

• Hypertext

(21)

EP1100 Datakommunikation och datornät 41

Uniform Resource Locator

• Identifies the location for a document on the Internet and a method to access it

ƒ Method: eg, http, https, ftp ƒ Host: host name within a domain

o default is www, eg www.kth.se ƒ Port: default is port 80; often omitted ƒ Path to a subdirectory

o www.ee.kth.se/lcn

• The file name is appended to the URL ƒ www.ee.kth.se/lcn/index.html

ƒ Default is index.html or index.htm

Hypertext Transfer Protocol (HTTP)

• Methods

ƒ GET – request a document ƒ HEAD – request information about ƒ POST – send information from

client

ƒ PUT – send document

ƒ TRACE – echos incoming request ƒ CONNECT

(22)

EP1100 Datakommunikation och datornät 43

Hypertext Markup Language (HTML)

<HTML> <HEAD> <TITLE> My Web Page </TITLE> </HEAD> <BODY> <H1>

Welcome to My Web Page! </H1>

<P>

This is my web page. It has a

<A href=“http://www.somewhere.com/ anotherpage.html”>

link to another web page. </A>

</P> </BODY> </HTML>

EP1100 Datakommunikation och datornät

Persistent and Non-persistent Connections

One TCP connection per HTTP

request/response

Setting up a TCP connection is

costly (slow)

With persistent connections, the

server leaves the TCP connection

open

ƒ

More request/responses over same

(23)

EP1100 Datakommunikation och datornät 45

Non-Static Pages

Run a program on the server to create the

page

ƒ ”Server-side includes” (SSI)

o HTML ”macros” evaluated by the web server — ”.shtml” extension

ƒ Dynamic pages

o CGI, PHP, ASP, ...

Get a program from the server and run it on

the client

ƒ Active pages

o Java, JavaScript, ...

Extensible Markup Language (XML)

<?xml version="1.0" encoding=“ISO-8859-1"?>

<?xml-stylesheat type=“text/xsl” href=“contact.xsl”> <Contacts name=“Job contacts“>

<Contact> <Name><G. Persson></Name> <Phone>+4686981222</Phone> <Email>[email protected]</Email> </Contact> <Contact> <Name><B. Gates></Name> <Phone>+14029981234</Phone> <Email>[email protected]</Email> </Contact>

• For creating specific markup languages

• Data description

• Presentation of the data through style sheets ƒ CSS, XSL

(24)

EP1100 Datakommunikation och datornät 47

XML Example: RSS

“Real Simple Syndication”

ƒ

Atom is a similar and on the IETF

standardization track

Syndication: providing automated

updates with RSS/Atom/…

News sites, blogs, …

News readers (aggregators) check

feeds for updates

ƒ

“Live Bookmarks”

EP1100 Datakommunikation och datornät

Network Management

• Simple Network Management Protocol (SNMP)

• To monitor and control network devices (interface cards, routers, etc.)

• Elements:

ƒ manager: machine with special software (client) ƒ agents: small software in each managed device (server) ƒ management information base (MIB) : the set of

managable objects in each device

• Processes:

ƒ the manager gets and sets parameters from the MIB ƒ agents notify the manager of significant events • UDP, port 161

(25)

EP1100 Datakommunikation och datornät 49

Dynamic Host Configuration Protocol

• IP address

ƒ Static or dynamic (leasing)

• Subnet mask

• IP address of default router (”gateway”)

• IP address of DNS server Internet DNS Gateway Subnet DHCP Mail

NAT and Private Network Addresses

• Network Address Translation

• NAT box gets a global address via DHCP

• Changes address fields in all packets going to/from private network Internet 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 Private networks DNS DHCP Gateway NAT Private network ISP

(26)

Voice over IP

EP1100 Datakommunikation och datornät

Voice over IP

Voice calls over IP networks

ƒ

”IP-telephony”, ”Voice over packet”,

...

Integration

ƒ

Voice and data in the same network

ƒ

Applications may integrate different

media

(27)

EP1100 Datakommunikation och datornät 53

VoIP Protocols

Signalling

ƒ Keep track of users, call set up and tear-down, etc.

ƒ Session Initiation Protocol (SIP), H.323

Media

ƒ Transport voice calls in IP packets

ƒ Real-Time Transport Protocol (RTP)

Support

ƒ Name-address translation, AAA (Authentication,

Accounting, Authorization), Quality of service, ...

ƒ DNS, TRIP, COPS, Diameter, ...

Session Initiation Protocol (SIP)

Establishing session

ƒ

VoIP calls

ƒ

Instant messaging

ƒ

Presense

ƒ

Event notification

Tracking users

(28)

EP1100 Datakommunikation och datornät 55

Simple Session Directly Between Parties

EP1100 Datakommunikation och datornät

SIP Distributed Architecture

Redirect Server Location Server Registrar Server User Agent Proxy Server Gateway PSTN SIP Components Proxy Server From http://www.vovida.org/document/protocol.html

(29)

EP1100 Datakommunikation och datornät 57

SIP Call Setup

From http://www.vovida.org/document/protocol.html 302 (Moved Temporarily) INVITE 200 (OK) 200 (OK) ACK INVITE 302 (Moved Temporarily) ACK INVITE 180 (Ringing) 180 (Ringing) 180 (Ringing) 200 (OK) ACK ACK ACK RTP MEDIA PATH BYE BYE BYE 200 (OK) 200 (OK) 200 (OK) Call Teardown Media Path Call Setup INVITE Location/Redirect Server

Proxy Server Proxy Server User Agent User Agent

INVITE

Real-Time Transport Protocol (RTP)

• Runs over UDP

ƒ When used in SIP: Established using Session Description Protocol (SDP), attached to SIP INVITE method and 1xx responses.

• Designed for adaptive (elastic) applications, which can

adjust sender/receiver to varying traffic conditions

• Each RTP packet contains:

ƒ Sequence number

ƒ Timestamp (time when sent)

ƒ Synchronization Source Identifier (SRC) ƒ Payload – sound samples

o Example: 8-bit samples, sampling rate 8000 Hz, packet

(30)

EP1100 Datakommunikation och datornät 59

RTCP—RTP Control Protocol

Reports packet losses and delay between RTP

endpoints

Sender Report (SR)

ƒ Sender counts (packets sent, bytes sent)

ƒ Timestamp

Receiver Report (RR)

ƒ Receiver counts (packets received, lost)

ƒ Jitter (variations in inter-packet delay)

ƒ Last SR timestamp received

ƒ Delay since last SR (time between receiving SR and

sending RR)

EP1100 Datakommunikation och datornät

Peer-to-Peer (P2P) Architectures

• Hosts communicate directly with each other

ƒ Community of hosts ƒ P2P network

• File sharing

ƒ Napster, Gnutella, KaZaA, BitTorrent, … ƒ Content-location problem

ƒ Major part of traffic on the Internet today ƒ Copyright issues

• IP telephony

ƒ Skype

o Only for locating and addressing parties o Calls are point-to-point using UDP or TCP (!)

(31)

EP1100 Datakommunikation och datornät 61

Summary

Transport protocols

ƒ TCP: how to achieve

reliable transfer over IP o retransmission o congestion control ƒ UDP: an unreliable transport protocol

Distributed

applications

ƒ the client-server model ƒ Applications o DNS o SMTP o FTP o SNMP o HTTP o DHCP

o Voice over IP (SIP) o RTP

References

Related documents