B Fundamentals

download B Fundamentals

of 213

Transcript of B Fundamentals

  • 8/3/2019 B Fundamentals

    1/213

    1HPN Fundamentals

    Fundamentals of Communication Systems

    1. Layering and the Internet

    2. Application Layer in a Nutshell

    3. Transport Layer in a Nutshell

    4. IP and Routing in a Nutshell

    5. Link Layer in a Nutshell

    6. Physical Layer in a Nutshell

    This section summarizes and harmonizes material which basically should be

    known from Bachelor courses (or similar).

    Copyright 2011/2012 Computer Science 4, University of Bonn

  • 8/3/2019 B Fundamentals

    2/213

    2HPN Fundamentals

    1. Layering and the Internet

    Copyright 2011/2012 Computer Science 4, University of Bonn

    1.1 What is the Internet?

    1.2 How does the Internet work?

    1.4 Delays, Losses, etc.

    1.3 Layers

    1.5. Protocol Architecture in Real Life: Introducing WireShark

  • 8/3/2019 B Fundamentals

    3/213

    3HPN Fundamentals

    1.1 What is the Internet?

    Copyright 2011/2012 Computer Science 4, University of Bonn

  • 8/3/2019 B Fundamentals

    4/213

    4HPN Fundamentals

    The first Internet

    Router

    Router

    The first internetwork became reality in October 1977:

    Packet Radio Network in San Francisco

    ARPANET across the USA

    SATNET via satellite across the Atlantic to London.

    Packet Radio

    Network

    SATNET

    ARPANET

    Packet Switching may be used for forwarding packets across ... a specific network

    a network of networks (internetwork, internet).

    Copyright 2011/2012 Computer Science 4, University of Bonn

  • 8/3/2019 B Fundamentals

    5/213

    5HPN Fundamentals

    A nuts and bolts view

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

    millions of connected computing devices:

    hosts(end systems)

    running network apps Web, VoIP, email, games, e-commerce,

    file sharing

    communication links

    fiber, copper, radio, satellite

    different transmission rates andproperties

    routers

    forward packets (chunks of data)

  • 8/3/2019 B Fundamentals

    6/213

    6HPN Fundamentals

    A closer look at network structure

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

    network edge: applications and hosts

    access networks

    network core: interconnected routers

    network of networks

  • 8/3/2019 B Fundamentals

    7/213

    7HPN Fundamentals

    Network edge and services

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

    end systems (hosts): run application programs

    e.g. Web, email

    at edge of network

    communication services provided toapps:

    reliable data delivery from source to

    destination

    best effort (unreliable) data delivery

    client/server model client host requests and receives

    service from always-on server

    e.g. Web browser/server; email

    client/server

    peer-peer model: minimal (or no) use of dedicated

    servers

    e.g. Skype, BitTorrent

    client/server

    peer-peer

  • 8/3/2019 B Fundamentals

    8/213

    8HPN Fundamentals

    Access networks and physical media

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

    How to connect end systems to edge router?residential access nets

    institutional access networks (school,

    company)

    mobile access networks

  • 8/3/2019 B Fundamentals

    9/213

    9HPN Fundamentals

    Dial-up Modem and Digital Subscriber Line (DSL)

    Copyright 2011/2012 Computer Science 4, University of Bonn

    telephone

    network Internet

    home

    dial-up

    modem

    ISP

    modemhome

    PC

    central

    officeDial-up Modem

    uses existing telephony infrastructure

    home is connected to central office

    up to 56Kbps direct access to router

    cant surf and phone at same time:

    not always on

    telephonenetwork

    DSL

    modemhome

    PC

    home

    phone

    Internet

    DSLAM

    Existing phone line:0-4KHz phone; 4-50KHz

    upstream data; 50KHz-

    1MHz downstream data

    splitter

    central

    office

    Digital Subscriber Line (DSL)

    also uses existing telephone infrastructure

    up to 1 Mbps upstream

    up to 8 Mbps downstream

    Source: Jim Kurose, Keith Ross: Computer Networking: A TopDown Approach - 5th edition, Addison-Wesley, April 2009.

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

  • 8/3/2019 B Fundamentals

    10/213

    10HPN Fundamentals

    Internet Access via (Wireless) Local Area Networks

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Local Area Networks

    typically used in companies, universities,

    etc

    10 Mbs, 100Mbps, 1Gbps, 10Gbps

    Ethernet

    Wireless access networks

    shared wireless access network connects

    end system to router

    via base station aka access point

    100 Mbps

    100 Mbps

    100 Mbps1 Gbps

    server

    Ethernet

    switch

    Institutional

    router

    To Institutions

    ISP

    basestation

    mobilehosts

    router

  • 8/3/2019 B Fundamentals

    11/213

    11HPN Fundamentals

    Typical home network components

    Copyright 2011/2012 Computer Science 4, University of Bonn

    wirelessaccesspoint

    wirelesslaptops

    router/firewall

    cablemodem

    to/fromcable

    headend

    Ethernet

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

  • 8/3/2019 B Fundamentals

    12/213

    12HPN Fundamentals

    Element of a wireless network

    Copyright 2011/2012 Computer Science 4, University of Bonn

    network

    infrastructure

    wireless hosts

    r laptop, PDA, IP phone

    r run applications

    r may be stationary (non-mobile) or mobile

    m wireless does notalways mean mobility

    Source: Jim Kurose, Keith Ross: Computer Networking: A TopDown Approach - 5th edition, Addison-Wesley, April 2009.

  • 8/3/2019 B Fundamentals

    13/213

    13HPN Fundamentals

    Element of a wireless network (2)

    Copyright 2011/2012 Computer Science 4, University of Bonn

    network

    infrastructure

    base station

    r typically connected to wirednetwork

    r relay - responsible for

    sending packets betweenwired network and wirelesshost(s) in its area

    m e.g., cell towers, 802.11access points

    m handoff: mobile changesbase station providingconnection into wirednetwork

    Source: Jim Kurose, Keith Ross: Computer Networking: A TopDown Approach - 5th edition, Addison-Wesley, April 2009.

  • 8/3/2019 B Fundamentals

    14/213

    14HPN Fundamentals

    Element of a wireless network (3)

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Source: Jim Kurose, Keith Ross: Computer Networking: A TopDown Approach - 5th edition, Addison-Wesley, April 2009.

    network

    infrastructure

    wireless link

    r typically used to connectmobile(s) to base station

    r also used as backbone

    linkr multiple access protocol

    coordinates link access

    r various data rates,transmission distance

  • 8/3/2019 B Fundamentals

    15/213

    15HPN Fundamentals

    Characteristics of selected wireless link standards

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Source: Jim Kurose, Keith Ross: Computer Networking: A TopDown Approach - 5th edition, Addison-Wesley, April 2009.

    Indoor10-30m Outdoor50-200m Mid-rangeoutdoor200m 4 Km

    Long-rangeoutdoor5Km 20 Km

    .056

    .384

    1

    4

    5-11

    54

    IS-95, CDMA, GSM 2G

    UMTS/WCDMA, CDMA2000 3G

    802.15

    802.11b

    802.11a,g

    UMTS/WCDMA-HSPDA, CDMA2000-1xEVDO 3G cellular

    enhanced

    802.16 (WiMAX)

    802.11a,g point-to-point

    200 802.11n

    Datarate(Mbps)

    data

  • 8/3/2019 B Fundamentals

    16/213

    16HPN Fundamentals

    Other Wireless Links Spectrum Map US

    Copyright 2011/2012 Computer Science 4, University of Bonn

    www.fas.org/spp/military/program/sigint/allochrt.pdf

  • 8/3/2019 B Fundamentals

    17/213

    17HPN Fundamentals

    Alternative Ad-hoc mode / Mesh networks

    Copyright 2011/2012 Computer Science 4, University of Bonn

    ad hoc mode

    r no base stationsr nodes can only

    transmit to other nodeswithin link coverage

    r nodes organizethemselves into anetwork: route amongthemselves

  • 8/3/2019 B Fundamentals

    18/213

    18HPN Fundamentals

    Wireless network taxonomy

    Copyright 2011/2012 Computer Science 4, University of Bonn

    single hop multiple hops

    infrastructure(e.g., APs)

    no

    infrastructure

    host connects to

    base station (WiFi,WiMAX, cellular)

    which connects to

    larger Internet

    no base station, no

    connection to larger

    Internet (Bluetooth,

    ad hoc nets)

    host may have to

    relay through severalwireless nodes to

    connect to larger

    Internet: mesh net

    no base station, noconnection to larger

    Internet. May have to

    relay to reach other

    a given wireless node

    MANET, VANET

  • 8/3/2019 B Fundamentals

    19/213

    19HPN Fundamentals

    letter mail

    network

    abstract network cloud

    1.2 How does the Internet work?

    Analogy: letter mail

    Originator:

    - name

    - street + number

    - ZIP code + city

    (several components)

    Destination address:

    - name

    - street + number

    - ZIP code + city

    (several components)

    Max MustermannRmerstr. 164

    D-53117 Bonn

    Copyright 2011/2012 Computer Science 4, University of Bonn

  • 8/3/2019 B Fundamentals

    20/213

    20HPN Fundamentals

    Internet

    Internet cloud

    How does the Internet work?

    Originator:

    - IP address

    - Protocol ID

    - Port Number(several components)

    Destination:

    - IP address

    - Protocol ID- Port Number(several components)

    Data

    Protocol Control

    Information

    IP Datagram (IP = Internet Protocol)

    Router

    Copyright 2011/2012 Computer Science 4, University of Bonn

  • 8/3/2019 B Fundamentals

    21/213

    21HPN Fundamentals

    Packet Switching

    In the Internet, the information units (packets, datagrams) travel across a

    store-and-forward network of redundant connections:

    Packets are stored until they have been forwarded to the next-hop station.

    Copyright 2011/2012 Computer Science 4, University of Bonn

  • 8/3/2019 B Fundamentals

    22/213

    22HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    1.3 Layers

    different layer models are used for the specification of communicationprotocols.

    layered reference model for discussion

    modularization eases maintenance, updating of system change of implementation of layers service transparent to rest of

    system

    Why layering?

  • 8/3/2019 B Fundamentals

    23/213

    23HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    layer n layer n

    The Hierarchy Principle

    According to the hierarchy principle

    each layersolves specific problems. ( protocol of this layer) layer ndirectly communicates with layer n + 1 (offers service to layern + 1) layer ndirectly communicates with layer n - 1 (uses service provided by layern - 1)

    A layer n indirectly communicates with the layer nof the peer instance exchanges data units with a well-defined format with the peer

    (Protocol Data Units PDUs).

    protocol

    services provided by lower layers

    station A station B

    service access point(SAP)

    (layer n)

    service access point(SAP)

    PDUs

  • 8/3/2019 B Fundamentals

    24/213

    24HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Important Properties of the Hierarchy Principle

    Layer nonly knows

    the service access point (SAP) of layer n - 1 the basic characteristics of the service provided by layer n - 1

    Layer n is not aware of the internal structure of layer n 1 (at least should not be aware).

    Advantage of the hierarchy principle:

    Clear structure Flexibility resulting from modularity

    Thus: Internal change of layer n - 1 has no impact on layern(in general),

    layers may be divided into sublayers,

    layers may be omitted.

    Disadvantage of the hierarchy principle:

    a lot of overhead (each layer adds control information)

  • 8/3/2019 B Fundamentals

    25/213

    25HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    The ISO Reference Model for Open Systems Interconnection

    The International Standards Organization (ISO)

    has standardized the ISO reference model for open systems as a firm basis for the

    standardization of protocols:

    Goals of the OSI model:

    standardized nomenclature,

    structuring,

    framework for standards (of protocols).

    Remarks:

    The OSI model does not standardize protocols. Instead, it is a framework for thestandardization of protocols.

    The OSI - model does not specific any implementation.

    Both, the OSI structure and the protocols specified within this structure are independent fromany specific implementation.

    Reference Model for Open Systems Interconnection (OSI)

  • 8/3/2019 B Fundamentals

    26/213

    26HPN Fundamentals

    The Seven Layers of the ISO/OSI Reference Model

    1 Physical Layer

    2 Data Link Layer

    3 Network Layer

    4 Transport Layer

    Session Layer5

    Presentation Layer6

    Application Layer7

    application oriented: layers 5 to 7

    transport oriented: layers 3 and 4

    technology oriented: layers 1 and 2

    physical representation of 0 and 1(in addition: synchronization)

    error protection, flow control(ensures secure transmission)

    addressing, routing(How to find the destination host?)

    reliable end-to-end connection(error recognition and correction)

    structuring of information exchange(e.g. reset to well defined state after error)

    adaptation of the information presentation(interpreter, consistent language inside the network)

    functionality for special applications(e.g. file access)

    Copyright 2011/2012 Computer Science 4, University of Bonn

  • 8/3/2019 B Fundamentals

    27/213

    27HPN Fundamentals

    1 Physical Layer

    2 Data Link Layer(Leitungs- und Sicherungsebene)

    The Layer Model of the IEEE LMSC (IEEE 802)

    2 Data Link Layer

    3 Network Layer

    4 Transport Layer

    Session Layer5

    Presentation Layer6

    Application Layer7

    OSI-Modell:

    Upper Layers

    LAN/MAN Standards Committee der IEEE

    (IEEE 802)

    MAC

    (Media Access Control)

    LLC

    (Logical Link Control)

    How to control the access to the media?

    Copyright 2011/2012 Computer Science 4, University of Bonn

  • 8/3/2019 B Fundamentals

    28/213

    28HPN Fundamentals

    The Layer Model of the IEEE LMSC (IEEE 802) (2)

    1 Physical Layer

    2 Data Link Layer(Leitungs- und Sicherungsebene)

    3

    4

    5

    6

    7

    Upper Layers

    MAC

    (Media Access Control)

    LLC

    (Logical Link Control)

    2a

    2b

    3

    4

    5

    6

    7

    Upper Layers

    The LAN/MAN Standards Committee of the

    IEEE (better known as IEEE 802)

    standardizes protocols for

    layer 1,

    layer 2a and

    layer 2b

    of the OSI model.

    Well known protocols are

    Ethernet (IEEE 802.3),

    Token Ring (IEEE 802.5)

    Wireless LAN (IEEE 802.11) Wireless PAN, Bluetooth (IEEE 802.15)

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Th L M d l f h IETF

  • 8/3/2019 B Fundamentals

    29/213

    29HPN Fundamentals

    1

    2

    1

    2

    Physical Layer

    Data Link Layer

    3 Network Layer

    OSI model:Internet Engineering Task Force

    Network

    Technology

    3 Internetwork

    4 Transport Layer4 Transport

    5

    6

    7

    Session Layer

    Presentation Layer

    Application Layer

    Application

    The IETF standardizes protocols for

    layer 3 and

    layer 4

    of the OSI model.

    Well known protocols are

    Internet Protocol (IP), Transmission Control Protocol (TCP) and

    User Data Protocol (UDP)

    In addition, the IETF works on applications

    like e-mail, file transfer and remote login.

    5

    6

    7

    router

    router

    The Layer Model of the IETF

    Copyright 2011/2012 Computer Science 4, University of Bonn

    T

  • 8/3/2019 B Fundamentals

    30/213

    30HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Terms

    (N)-layer

    (N)-servicespecifies the service provided by the (N)-layer to higher layers

    (N)-service providerabstract machine offering the (N)-service

    (N)-service usera (N+1)-protocol entity, communicating with one or more (N+1) peer entity/entities using the

    (N)-service (N)-service access point (SAP)

    exchange point where (N)-service primitives are used

    (N)-service primitive (N)-SPimplementation independent representation of an interaction between (N)-service

    provider and (N)-service user

    (N)-service data unit (SDU)(N)-SDUs are parameters of (N)-SPs, they carry information

    The OSI model played a tremendous role in the specification of wording.

    Important terms include:

    T (2)

  • 8/3/2019 B Fundamentals

    31/213

    31HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Terms (2)

    (N)-protocolcontrols the (indirect) communication of the (N)-peer entity

    (N)-protocol entityindependent entity of the (N)-layer, is able to communicate with (N)-peer entities

    (N)-peer entityentity of layer (N)

    (N)-protocol data unit (PDU)consists of (N)-SDU and (N)-PCI, is sent from (N)-entity to (N)-peer entity

    (N)-protocol control information (N)-PCIcontrol information (e.g. for error recognition and -correction), added by an (N)-entity to

    an (N)-SDU.

    (N 1) Service and (N 1) Protocol

  • 8/3/2019 B Fundamentals

    32/213

    32HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    (N+1)-Service and (N+1)-Protocol

    (N)-service

    (N)-SAP

    (N)-SPs;

    where required

    with (N)-SDUs

    (N+1)-protocol

    exchange of (N+1)-PDUs (virtual)

    (N+1)-service user

    (N+1)-

    Protokoll-

    -anz

    (N)-SAP

    (N)-SPs;

    where required

    with (N)-SDUs

    (N+1)-

    layer

    (N+1)-SPs

    (N+1)-service user

    (N+1)-SPs

    (N+1)-service

    (N+1)-

    protocol-

    entity

    (N+1)-

    protocol-

    entity

    Simplified Model of a Communication System

  • 8/3/2019 B Fundamentals

    33/213

    33HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    layer (N)

    layer (N-1)

    layer (N+1)

    Simplified Model of a Communication System

    (N+1)-PDU

    (N)-SDU(N)-PCI

    (N)-PDU

    (N+1)-PDU

    (N)-SDU(N)-PCI

    (N)-PDU

    Important note:

    An implementation with queues between the layers is neither mandatory nor desirable.

    The OSI model does not specify this kind of implementation detail.

    Sending a (N+1) PDU to layer (N)

  • 8/3/2019 B Fundamentals

    34/213

    34HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    layer (N)

    layer (N-1)

    layer (N+1)

    Sending a (N+1)-PDU to layer (N)

    (N+1)-PDU

    Wait for

    processing!

    A PDU becomes a SDU

  • 8/3/2019 B Fundamentals

    35/213

    35HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    A PDU becomes a SDU

    (N+1)-PDU

    Enter now!The (N+1)-PDU

    becomes a

    (N)-SDU

    (N)-SDU

    layer (N)

    layer (N-1)

    layer (N+1)

    (N+1)-PDU

    Layer (N) forms a (N)-PDU from a (N)-SDU

  • 8/3/2019 B Fundamentals

    36/213

    36HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Layer (N) forms a (N)-PDU from a (N)-SDU

    (N)-PCI

    (N)-PDU

    Adding the

    (N)-PCI

    results in the

    (N)-PDU.(N)-SDU

    layer (N)

    layer (N-1)

    layer (N+1)

    Transfer to Layer (N-1) and Transmission

  • 8/3/2019 B Fundamentals

    37/213

    37HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Transfer to Layer (N 1) and Transmission

    (N)-PDU

    (N)-PDU

    (N)-PDU

    layer (N)

    layer (N-1)

    layer (N+1)

    The PDU

    is forwarded

    to

    layer N-1

    Forward to Layer (N) and Process

  • 8/3/2019 B Fundamentals

    38/213

    38HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Forward to Layer (N) and Process

    (N)-PDU

    (N)-PDU

    (N)-PCI (N)-SDU

    layer (N)

    layer (N-1)

    layer (N+1)

    layer N

    receives

    the message.

    Processing by Layer (N)

  • 8/3/2019 B Fundamentals

    39/213

    39HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    layer (N+1)

    Processing by Layer (N)

    (N)-PCI (N)-SDU

    Lets see whatis written here...

    layer (N)

    layer (N-1)

    Forward to Layer (N+1)

  • 8/3/2019 B Fundamentals

    40/213

    40HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    layer (N+1)

    Forward to Layer (N+1)

    (N)-SDU

    layer (N)

    layer (N-1)

    (N+1)-PDU

    Wrapping of Data

  • 8/3/2019 B Fundamentals

    41/213

    41HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    pp g

    audio

    compact

    disc

    jewel box

    storage casedisplay

    packageshipping box

    Each layer wraps data with an additional envelope (header and/or trailer), before

    transferring the data to the lower layer:

    For the protocol of layer (N) only (N)-PCI is relevant.

    The protocol just works on the wrapping.

    But: The size of a (N+1)-PDU has to obey certain rules.

    (The postal service does not accept packets of 30 tons)

    The transfer of the PDU has to be done in a proper manner.

    Basic Principle Encapsulation

  • 8/3/2019 B Fundamentals

    42/213

    42HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    p psource

    applicationtransportnetwork

    link

    physical

    HtHn M

    segment Htdatagram

    destination

    applicationtransportnetwork

    linkphysical

    HtHnHl M

    HtHn M

    Ht MM

    network

    linkphysical

    linkphysical

    Ht

    Hn

    Hl

    M

    HtHn M

    HtHn M

    HtHnHl M

    router

    switch

    message MHt M

    Hn

    frame

    Source: Jim Kurose, Keith Ross: Computer Networking: A TopDown Approach - 5th edition, Addison-Wesley, April 2009.

    From Ethernet to HTML

  • 8/3/2019 B Fundamentals

    43/213

    43HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    DA SA Type Data ChecksumPreamble SF

    Ethernet Frame

    Data

    IP Datagram

    Data

    TCP Segment

    Data

    HTTP Slice

    HTTP/1.0 200 OK\r\nServer: PAWS ElB-1.42\r\nContent-Type: text/html\r\nDate: Tue, 3

    Network

    Technology

    Internetwork

    Transport

    Application

    The TCP/IP-Internet

  • 8/3/2019 B Fundamentals

    44/213

    44HPN Fundamentals

    TCP/IP allows stations to communicate across totally different networks !

    Copyright 2011/2012 Computer Science 4, University of Bonn

    The Transmission Control Protocol (TCP)

  • 8/3/2019 B Fundamentals

    45/213

    45HPN Fundamentals

    Networks are unreliable.

    End systems take care of error detection / correction.

    The Internet Philosophy

    The Transmission Control Protocol (TCP)

    makes sure that all damaged and lost packets are retransmitted and thatduplicates are removed,

    re-orders the messages at the receiver(ordering preservation), splits large information units into flows of small, numbered packets,

    decides how fast packets are sent to the network, subject to capabilities ofthe sender, the receiver and the network in-between.

    Copyright 2011/2012 Computer Science 4, University of Bonn

    The Internet Protocol (IP)

  • 8/3/2019 B Fundamentals

    46/213

    46HPN Fundamentals

    The Internet Protocol

    defines ................................

    tries ..................

    does not guarantee anything.

    un-ambiguous, standardized, network-independent addresses,

    to take the messages to the receiversomehow,

    Net 1

    IP

    TCP

    Application

    Login,

    File Transfer,

    e-mail, ...

    Net 1 Net 2

    IP

    TCP

    Application

    Net 1 Router

    Net 2

    IP

    Identicalfor all

    applications

    Net 2

    The Internet Protocol (IP)

    specifies what all packets must look like to allow for routing(based on hierarchic addresses: network-ID, subnetwork-ID, ..., host-ID).

    Copyright 2011/2012 Computer Science 4, University of Bonn

    The Slim Waist

  • 8/3/2019 B Fundamentals

    47/213

    47HPN Fundamentals

    FTP mail remote login WWW access...

    TCP UDP TP4...

    IP

    Ethernet Token Ring ISDN DSL Satellite

    banking

    Wireless LAN ...

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Summary: Names, T-, N- and MAC-Addresses

  • 8/3/2019 B Fundamentals

    48/213

    48HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    (in case of networks within the Internet)

    Transport Protocol: TCP, UDP

    (Layer 4)

    Network Protocol: IP(Layer 3)

    Medium Access, Network Technology(Layers 2 and 1)

    Applications

    File Transfer (ftp) WWW browser (http)

    Names

    Port Number

    IP Addresses

    MAC Addresses

    Statically assigned

    to applications

    + dynamically

    assigned by the OS

    DNS

    ARP/

    RARP

    1.4 Delays, Losses, etc.

  • 8/3/2019 B Fundamentals

    49/213

    49HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    www.n24.dephotothek.net

    Analogy: Road Traffic

    Delay Loss

    www.colber-forster.de www.bmvbs.de

    How do loss and delay occur?

  • 8/3/2019 B Fundamentals

    50/213

    50HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    A

    B

    packet being transmitted (delay)

    packets queueing (delay)

    free (available) buffers: arriving packetsdropped (loss) if no free buffers

    packets queue in router buffers packet arrival rate to link exceeds output link capacity

    packets queue, wait for turn

    Source: Jim Kurose, Keith Ross: Computer Networking: A TopDown Approach - 5th edition, Addison-Wesley, April 2009.

    Four sources of packet delay

  • 8/3/2019 B Fundamentals

    51/213

    51HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    1. nodal processing

    check bit errors

    determine output link

    2. queueing

    time waiting at output link for transmission

    depends on congestion level of router

    3. transmission delay R=link datarate (bps), L=packet length (bits)

    time to send bits into link = L/R

    4. propagation delay

    d = length of physical link, s = propagation speed in medium propagation delay = d/s

    A

    B

    propagation

    transmission

    nodal

    processing queueing

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

    Nodal delay

  • 8/3/2019 B Fundamentals

    52/213

    52HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    dproc = processing delay

    typically a few microsecs or less

    dqueue = queuing delay

    depends on congestion

    dtrans = transmission delay

    = L/R, significant for low-speed links

    dprop = propagation delay

    a few microsecs to hundreds of msecs

    A

    B

    propagation

    transmission

    nodal

    processing queueing

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

    proptransqueueprocnodalddddd

    Queueing delay (revisited)

  • 8/3/2019 B Fundamentals

    53/213

    53HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    R=link datarate (bps)

    L=packet length (bits)

    a=average packet arrival rate

    traffic intensity = La/R

    La/R ~ 0: average queueing delay small

    La/R 1: delays become large

    La/R > 1: more work arriving than can be serviced, average delay infinite!

    Packet Loss

  • 8/3/2019 B Fundamentals

    54/213

    54HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    queue (aka buffer) preceding link in buffer has finite capacity packet arriving to full queue dropped (aka lost) lost packet may be retransmitted by previous node, by source

    end system, or not at all

    A

    B

    packet being transmitted

    packet arriving tofull buffer is lost

    buffer

    (waiting area)

    Source: Jim Kurose, Keith Ross: Computer Networking: A TopDown Approach - 5th edition, Addison-Wesley, April 2009.

    1.5. Protocol Architecture in Real Life: Introducing WireShark

  • 8/3/2019 B Fundamentals

    55/213

    55HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    WireShark is not the only open source tool available for protocol analysis:

    tcpdump / windump (command line tool with textual output),

    ngrep (filters and displays network connections),

    netstat (command line tool to view open connections),

    ettercap

    A nice starting point for more tools is http://www.insecure.org/tools.html

    WireShark is an open source (GNU GPL) tool for

    software and protocol development,

    troubleshooting,

    analysis,

    education,

    (from http://www.wireshark.org/, accessed October 2007)

    WireShark basically is of a successor of Ethereal!

    Getting Connected WireShark Perspective

  • 8/3/2019 B Fundamentals

    56/213

    56HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    ARP

    TCP/HTTP

    DNS

    Packet List

    Packet Details

    Data on the wire

    Traffic in a wireless campus network

  • 8/3/2019 B Fundamentals

    57/213

    57HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    T.Henderson,D.Kotz,I.Ab

    yzovThechangingusageofamature

    cam

    pus-widewirelessnetwork-ProceedingsMobiCom2004

    Measurements in WiFi-network of Dartmouth Campus Hanover, USA (121 Access Points measured).

    Inbound: Traffic sent by the AP to the card. Outbound: Traffic sent by the card to the AP.

    Ports & TCP-Header information were analyzed

    2. Application Layer in a Nutshell

  • 8/3/2019 B Fundamentals

    58/213

    58HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    2.1 Conventional data communication

    2.2 Multimedia communication

    2.4. Skype

    2.3 What is SIP?

    2.1. Conventional data communication

    "Cl i l" d t i ti lt i b t t ffi

  • 8/3/2019 B Fundamentals

    59/213

    59HPN Fundamentals

    "Classical" data communication results in bursty traffic.

    In general, we find the following requirements:

    Error free transmission (or error detection and correction),

    As much bandwidth (throughput) as possible,

    Delays as small as possible,

    (maybe) support ofBroadcasting (One-to-all),

    (maybe) support ofMulticasting (One-to-many),

    (maybe) characteristics similar to LANs, e.g. connectionless communication(many applications were originally developed for LANs).

    Copyright 2011/2012 Computer Science 4, University of Bonn

    The Domain Name System (DNS)Instead of using numerical addresses in "Dotted Decimal Notation" a human user would

  • 8/3/2019 B Fundamentals

    60/213

    60HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    prefer to have alphanumerical Internet names, e.g. "www.uni-bonn.de".

    Therefore, we need a "DNS server" implemented as a distributed database which isable to map Internet names to Internet addresses.

    DNS uses a hierarchical structure of names. This allows for a decentralized assignment of

    names within the specific "Domain".

    ( nameless root)

    jpus de

    uni-bonn rwth-aachen dtag

    informatik

    va

    reston

    National

    mil edu govcom org

    sun

    eng

    yale

    cs eng

    IEEEACM

    Generic

    net int

    The complete name of the domain results from the path up towards the root of the name tree.

    Names can be mapped to IP addresses by asking the DNS server of the domain responsible.

    Caching of name/address mappings increases the efficiency considerably.

    Top-Level-Domains

    But how long should those name/address mappings reside within the cache?

    Example: Using Names when Surfing the Internet

  • 8/3/2019 B Fundamentals

    61/213

    61HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Name Server

  • 8/3/2019 B Fundamentals

    62/213

    62HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Name Space

    The whole DNS name space is subdivided into so-called "zones". Each zone has one or

    several name servers.

    mil edu govcom org jpus de

    uni-bonn rwth-aachen dtagva

    reston

    sun

    eng

    yale

    cs eng

    IEEEACM

    net int

    ai linda

    robot

    cnri

    pharmazieinformatik

    1 42 3 5 6

    The decision whether (and how) to structure zones into sub zones is responsibility of the

    "owner" of a specific zone.

    This allows for high flexibility in the naming hierarchy.

    Implementation of Name Resolution iterative

  • 8/3/2019 B Fundamentals

    63/213

    63HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    A client's name resolvercontacts a name server.

    This name serverpasses back a reference to the next responsible name server. The resolver contacts this server, ...

    Source:A.S.Tanenbau

    m,M.vanSteen:

    DistributedSystems-PrinciplesandParadigms.

    2ndEd.,Prentice-Hall,

    2006

    Implementation of Name Resolution recursive

  • 8/3/2019 B Fundamentals

    64/213

    64HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    A client's name resolveronly contacts the next name server. Finding the responsible name server and thus the address now

    is made by the involved name servers.

    Recursive compared to iterative name resolution:Con: higher performance demands for name serverPro: caching is easier

    may reduce communication costs at edge

    Source:A.S.Tanenbau

    m,M.vanSteen:

    DistributedSystems-PrinciplesandParadigms.

    2ndEd.,Prentice-Hall,2006

    DNS Query

  • 8/3/2019 B Fundamentals

    65/213

    65HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Source:

    BeckyGranger:Slides-DNSSECforthe.eduDomain,2010

    IllustrationofNiranjanKunwar/Nirlog.com

    2.2. Multimedia communication

  • 8/3/2019 B Fundamentals

    66/213

    66HPN Fundamentals

    In case of multimedia communication we often find

    predictable load profiles,

    elastic applications (e.g. coding subject to the current condition inside the network),

    minimum throughput,

    maximum delay,

    maximum jitter ("Schwankungen der Verzgerung"),

    maximum message loss rate(In case of appropriate coding a certain loss rate is acceptable).

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Specification of requirementsThe application can specify the acceptable delay in different ways. In general, the

    specification refers to

  • 8/3/2019 B Fundamentals

    67/213

    67HPN Fundamentals

    specification refers to

    information units at application layer (pictures, samples, ...),

    the local clock.

    i,DD maxi

    minmaxi ZDDProb

    i,JD-D=J maxii

    minmaxi UJJProb

    Deterministic delay limits:

    Di the delay of message number i,Dmax the upper limit selected by the application

    Statistical delay limit:

    Di, Dmax as above. Zmin is the lower probability bound

    for successful and in-time reception of message number i.

    Deterministic jitter limit:

    Di as above. D is the "perfect" delay.

    Ji is the jitter of message number i,

    Jmax

    the upper jitter limit selected by the application.

    Statistical jitter limit:

    Ji, Jmax as above. Umin is the lower probability bound

    for successful reception within the specified

    jitter limits.

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Total delay in case of "multimedia"

  • 8/3/2019 B Fundamentals

    68/213

    68HPN Fundamentals

    Digitization

    Pixels

    Coding

    Macro blocks

    Packetization

    Transmission buffer

    Network access

    Network

    receive packet, de-packetize

    check delay

    buffer or drop

    Playback bufferDe-coding

    Pixels

    Macro blocks

    Packets

    Sender

    Receive

    r

    Ddig

    Dencode

    Dpack

    Dnetwork

    Dplayback

    Ddecode

    Ddisplay

    Receive buffer Packets

    Copyright 2011/2012 Computer Science 4, University of Bonn

    VoIP QoS

    7

    ITU G.114

    Utility

    Packet loss (%) VoIP Issues Solutions

  • 8/3/2019 B Fundamentals

    69/213

    69HPN Fundamentals

    1 2 3 4 5 6 1 3 5 4 6

    Packet Loss

    Inversion

    Jitter

    IPNe

    twork

    Network Delay

    SenderNetwork

    Receiver

    Sender Delay:

    Coding delay

    Packeting delay

    Transmission delay

    Receiver Delay:

    Decoding delay

    DePacketing delay

    Receiver delay

    100 200 300 400 500

    0

    4

    3

    5

    2

    1

    7

    6

    OperationalTarget for

    Voice

    Possibly

    Tolerable forVoice

    Unacceptable for

    Voice or Fax

    yRecommendation

    Delay (ms)

    Packetizing delay Small packets for VoIP

    Serial delay Priorities and jitter buffers

    High bit-rate video Video compression

    Constant-bit-rate voiceSilence suppression and comfort

    noise

    Resend due to errors Real-time Transport Protocol

    Copyright 2011/2012 Computer Science 4, University of Bonn

    2.3. What is SIP?

    SIP* is an application layer control (signaling) protocol for creating

  • 8/3/2019 B Fundamentals

    70/213

    70HPN Fundamentals

    SIP is an application layer control (signaling) protocol for creating,

    modifying and terminating multimedia sessions with one or moreparticipants.

    * SIP is the Session Initiation Protocol, specified in RFC 3261

    What Can You Do With SIP?

    SIP is a peer-to-peer protocol where end-devices initiate sessions

    SIP sessions include Internet Multimedia conferences, Internet telephone calls, and multimediadistribution

    SIP is suitable for applications having a notion of session, e.g. network games, video conferences

    SIP is designed for scalability, simplicity, mobility, and service creation

    SIP is text-based for easyimplementation and debugging

    SIP is a simple, extensible protocol

    SIP is text-based for easyimplementation and debugging

    SIP is a simple, extensible protocol

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Setting up a call to a known IP address

    Ali SIP i itAliceBob

  • 8/3/2019 B Fundamentals

    71/213

    71HPN Fundamentals

    Alices SIP invite message

    indicates her port number, IPaddress, encoding she prefers to

    receive (PCM ulaw)

    Bobs 200 OK message indicates

    his port number, IP address,preferred encoding (GSM)

    SIP messages can be sent over

    TCP or UDP; here sent over

    RTP/UDP.

    default SIP port number is 5060.

    time time

    Bob's

    terminal rings

    Alice

    167.180.112.24 193.64.210.89

    port5060

    port 38060

    Law audio

    GSMport 48753

    [email protected]=INIP4167.180.112.24m=audio38060RTP/AVP0 port5060

    200OK

    c=INIP4193.64.210.89

    m=audio48753RTP/AVP

    3

    ACKport5060

    Source: Jim Kurose, Keith Ross: Computer Networking: A Top

    Down Approach - 5th edition, Addison-Wesley, April 2009.

    Copyright 2011/2012 Computer Science 4, University of Bonn

    2.4. Skype

  • 8/3/2019 B Fundamentals

    72/213

    72HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Skype Details ?Research?

  • 8/3/2019 B Fundamentals

    73/213

    73HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Skype Details

    uses a proprietary solution (no SIP, H323, )

    difficult to reverse engineer due to extensive use of both cryptography and

  • 8/3/2019 B Fundamentals

    74/213

    74HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Source:TrackingdownSkypetraffic

    byDarioBonfiglio,MarcoMellia,

    MichelaMeo,NicoloRitaccaand

    DarioRossi[INF

    OCOM'08]

    difficult to reverse engineer due to extensive use of both cryptography and

    obfuscation techniques

    may rely on eitherTCP or UDP at the transport layer

    both signaling and communication data are preferentially carried over UDP

    a single random port is selected during application installation

    never changed (unless forced by the user)

    when a UDP communication is impossible, Skype falls back to TCP

    listening to the same random port whenever possible, or using port 80 and 443

    can select between different Codecs according to an unknown algorithm

    Skype Adaptive Voice Coding

    Mellia,

  • 8/3/2019 B Fundamentals

    75/213

    75HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Source:TrackingdownSkypetrafficb

    yDarioBonfiglio,MarcoM

    MichelaMeo,N

    icoloRitaccaandDario

    Rossi[INFOCOM'08]

    Average Bitrate (B): the average amount of bits generated at application layer in atime interval of 1 second.

    Inter-Packet-Gap (IPG): the time elapsed between two consecutive packetsbelonging to the same flow.

    Payload length (L): the number of bytes carried by TCP or UDP.

    Skype Features

    http://www.blackhat.com/presentations/bh-europe-06/bh-eu-06-biondi/bh-eu-06-biondi-up.pdf

  • 8/3/2019 B Fundamentals

    76/213

    76HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    3. Transport Layer in a Nutshell

  • 8/3/2019 B Fundamentals

    77/213

    77HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    3.1 Transport services and protocols

    3.2 TCP - Error Control

    3.3 TCP - Connection Management

    3.4 TCP - Retransmission Timer

    3.5 TCP - Flow Control and Congestion Control

    3.1 Transport services and protocols

    g:ATop

    009.

  • 8/3/2019 B Fundamentals

    78/213

    78HPN Fundamentals

    provide logical communicationbetween app processes running

    on different hosts

    transport protocols run in end

    systems sender side: breaks app

    messages into segments,passes to network layer

    receiver side: reassemblessegments 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

    logicalend-endtransport

    Source:JimKurose,Keith

    Ross:ComputerNetworking

    DownApproach-5thedition,Addison-Wesley,April

    20

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Internet transport-layer protocols

    reliable in-order delivery

    Top

    .

  • 8/3/2019 B Fundamentals

    79/213

    79HPN Fundamentals

    reliable, in order delivery

    (TCP)

    congestion control

    flow control

    connection setup unreliable, unordered delivery:

    UDP

    no-frills extension of best-

    effort IP services not available:

    delay guarantees

    bandwidth guarantees

    application

    transport

    network

    data link

    physicalnetwork

    data link

    physical

    network

    data link

    physical

    network

    data link

    physical

    network

    data link

    physical

    network

    data link

    physical

    networkdata link

    physical

    application

    transport

    network

    data link

    physical

    logicalend-endtrans

    port Sou

    rce:JimKurose,KeithRoss:ComputerNetworking:

    A

    Dow

    nApproach-5thedition,Addison-Wesley,April200

    9.

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Internet transport protocols services

    TCP service:

    connection-oriented:setup required between

    UDP service:

    unreliabledata transfer between

  • 8/3/2019 B Fundamentals

    80/213

    80HPN Fundamentals

    co ect o o e ted p q

    client and server processes

    reliable transportbetween sending andreceiving process

    flow control:sender wont overwhelm receiver

    congestion control:throttle sender whennetwork overloaded

    does not provide:timing, minimumthroughput guarantees, security

    u e ab e

    sending and receiving process

    does not provide: connection

    setup, reliability, flow control,

    congestion control, timing,

    throughput guarantee, or security

    Application Application layerprotocol Underlying transport protocol

    e-mail SMTP [RFC 2821] TCP

    remote terminal access Telnet [RFC 854] TCP

    Web HTTP [RFC 2616] TCP

    file transfer FTP [RFC 959] TCP

    streaming multimediaHTTP (eg Youtube),

    RTP [RFC 1889]TCP or UDP

    Internet telephonySIP, RTP,

    proprietary (e.g., Skype)typically UDP

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Transport service requirements of common apps

    Data loss

    some apps (e.g., audio) can tolerate some loss

  • 8/3/2019 B Fundamentals

    81/213

    81HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Application Data loss Throughput Time Sensitive

    file transfer no loss elastic no

    e-mail no loss elastic no

    Web documents no loss elastic no

    real-time audio/video loss-tolerant audio: 5kbps-1Mbps;video:10kbps-5Mbps

    yes, 100s msec

    stored audio/video loss-tolerant same as above yes, few secs

    interactive games loss-tolerant few kbps up yes, 100s msec

    instant messaging no loss elastic yes and no

    other apps (e.g., file transfer, telnet) require 100% reliable data transfer

    Throughput

    some apps (e.g., multimedia) require minimum amount of throughput to be effective

    other apps (elastic apps) make use of whatever throughput they get

    Timing some apps (e.g., Internet telephony, interactive games) require low delay to be effective

    Security

    Encryption, data integrity,

    UDP

    Why is there a UDP?UDP: User Datagram Protocol [RFC 768]

    0 8 16 24 31

  • 8/3/2019 B Fundamentals

    82/213

    82HPN Fundamentals

    no frills, bare bones Internet

    transport protocol

    best effort service, UDP segmentsmay be:

    lost

    delivered out of order to app

    connectionless:

    no handshaking between UDPsender, receiver

    each UDP segment handled

    independently of others

    no connection establishment(which can add delay)

    simple: no connection state at

    sender, receiver

    small segment header

    no congestion control: UDP canblast away as fast as desired

    ChecksumDatagram Length

    Data

    ....

    Source Port Destination Port

    often used for streaming multimedia

    apps

    loss tolerant rate sensitive

    other UDP uses

    DNS

    SNMP

    reliable transfer over UDP: add

    reliability at application layer

    application-specific error

    recovery!

    Copyright 2010/2011 Computer Science 4, University of Bonn

    UDP PDUs

    The service provided by the User Data Protocol (UDP) is a best effort service. UDP is used forconnectionless data transmission. The PDUs have the following structure:

  • 8/3/2019 B Fundamentals

    83/213

    83HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    ChecksumDatagram Length

    Data....

    Source Port Destination Port

    0 8 16 24 31

    Source Port (16 bit)(Optional) Identification of sender process for mapping of replies.

    Destination Port (16 bit)Identification of destination process.

    Datagram Length (16 bit)Total TPDU length (in byte) incl. UDP overhead.

    Checksum (16 bit)(Optional) Error detection; mandatory for UDP with IPv6.

    Note:Without UDP checksum, there is no error detection for the data field: IPv4 error control

    is limited to the IP header.

    TCP PDUs

    Source Port Destination Port

    0 8 16 24 31

  • 8/3/2019 B Fundamentals

    84/213

    84HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Sequence Number

    Acknowledgement Number

    HLEN Reserved Code bits Window

    Urgent PointerChecksum

    Options (if any) Padding

    Data

    ....

    Source Port, Destination Port (16 bit each)Addresses of specific processes; also used for connection identification.

    Sequence Number (32 bit)Position of a data segment within the byte stream (for window mechanism).

    Acknowledgement Number (32 bit)Number of the next expected byte in the opposite direction.Cumulative acknowledgement; for this reason: robust against loss of ACKs.

    HLEN (4 bit)Header length (in multiples of 32 bit); also: Offset for the data field in the TPDU.

    The Transmission Control Protocol(TCP) makes communication reliable.

    TCP adds to the IP address a

    16 bit TSAP address.With TCP, a TSAP is called Port.

    TCP PDUs (2)

    Reserved (6 bit)Reserved for future use.

  • 8/3/2019 B Fundamentals

    85/213

    85HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Code Bits (6 bit)Purpose and contents of the TPDU. From left to right:

    URG Urgent pointer field is valid

    ACK Acknowledgement field is valid; flag reset in the connection setup packet

    PSH This segment requests a push (Immediate delivery to the receiver)

    RST Reset the connection

    SYN Synchronize sequence numbers (Used during connection establishment)

    FIN End of data stream

    Window (16 bit)

    The receiver controls the transmission window size, cf. chapter on flow control.

    Checksum (16 bit)Checksum for the whole TPDU and a pseudo header which includes the IPaddresses of sender and receiver.

    Urgent Pointer (16 bit)Marks the end of urgent data included in the data stream.

    OptionsTCP specifies additional options, e.g. window scaling (multiply the window value by 2n; n

    between 0 and 14).

    TCP Message Format

    TCP provides a connection-oriented, reliable, byte-stream service

  • 8/3/2019 B Fundamentals

    86/213

    86HPN Fundamentals

    TCP Packet

    which cares for network resources

    Sequence Number

    Acknowledgement Number

    HLEN Reserved Code bits Window

    Urgent PointerChecksum

    Options (if any) Padding

    Data

    ....

    Source Port Destination Port

    0 8 16 24 31

    Copyright 2011/2012 Computer Science 4, University of Bonn

    TCP Connections

    TCP provides a connection-oriented, reliable, byte-stream service

    hi h f k

  • 8/3/2019 B Fundamentals

    87/213

    87HPN Fundamentals

    which cares for network resources

    TCP connects applications across networks

    Multiple applications on the same host are distinguished by theirports Unlike UDP, a TCP port is not simply a queue!

    TCP connections are full-duplex

    TCP uses the connection, not the protocol port, as its fundamental abstraction.Connections are identified by a pair of endpoint identifiers.

    Copyright 2011/2012 Computer Science 4, University of Bonn

    TCP Connections (2)

  • 8/3/2019 B Fundamentals

    88/213

    88HPN Fundamentals

    TCP Packet

    0 8 16 24 31

    A TCP endpoint is a pair of

    integers

    (host id, port number)

    Source Port Destination Port

    10.1.5.3 10.5.2.3

    A given TCP port number can be shared by multiple connections.

    Copyright 2011/2012 Computer Science 4, University of Bonn

    TCP Byte Stream

    TCP provides a connection-oriented, reliable, byte-stream service

    hich cares for net ork reso rces

  • 8/3/2019 B Fundamentals

    89/213

    89HPN Fundamentals

    which cares for network resources

    TCP is byte-oriented, not packet oriented

    TCP streams are unstructured The application has (nearly) no means to control the TCP flow

    TCP transmits data in units called segments

    a segment may be as small as 1 byte!

    typical segment size is 1024 (plus header overhead)

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Reliable Stream Transport Service

    TCP provides a connection-oriented, reliable, byte-stream service

    which cares for network resources

  • 8/3/2019 B Fundamentals

    90/213

    90HPN Fundamentals

    which cares for network resources

    TCP is reliable:

    TCP delivers data correctly or not at all

    TCP delivers data completely

    TCP eliminates duplicates

    TCP delivers data in the correct order

    Copyright 2011/2012 Computer Science 4, University of Bonn

    3.2. TCP Error Control

    Potential errors:

    Corruption of bits

    Potential errors:

    Corruption of bits

    Detection:

    Checksum

    Detection:

    Checksum

  • 8/3/2019 B Fundamentals

    91/213

    91HPN Fundamentals

    TCP Packet

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Corruption of bits

    Loss of entire messages

    Duplicates

    Packet misordering

    Huge delays

    Corruption of bits

    Loss of entire messages

    Duplicates

    Packet misordering

    Huge delays

    Checksum

    missing acknowledgement

    sequence number

    sequence number

    congestion control

    Checksum

    missing acknowledgement

    sequence number

    sequence number

    congestion control

    Sequence Number

    Acknowledgement Number

    Checksum

    Source Port Destination Port

    0 8 16 24 31

    A

    Automatic Repeat Request

  • 8/3/2019 B Fundamentals

    92/213

    92HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Idea: After sending a message, the sender waits for a positive acknowledgement.

    If the acknowledgement does not arrive before a timer expires,

    the message is repeated and

    the senderwaits for a positive acknowledgement again.

    This strategy is called stop-and-wait.

    The most important strategy for the detection (and correction) of the loss of entire

    messages is called ARQ (Automatic Repeat reQuest).

    A new message is only transmitted after the acknowledgement for the previous

    message has been received by the sender.

    The Alternating Bit Protocol

    Sender Receiver Sender Receiver

    The alternating bit protocol is a straightforward way of realizing stop-and-wait:

  • 8/3/2019 B Fundamentals

    93/213

    93HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    DT.1

    ACK.1 successfultransmission

    successfultransmission

    data lost

    DT.0

    ACK.0

    DT.1

    DT.1ACK.1

    DT.0

    retransmissionafter timeout; correctacknowledgement

    Business as

    usual

    Sender Receiver

    DT.0

    ACK.0acknowledgementlost

    retransmissionafter timeout; receiverignores duplicate butsends ACK

    DT.0

    ACK.0

    DT.1

    ACK.1

    Sender Receiver

    successfultransmission

    Obviously, message numbering is based on 1 bit only.

    In real life, this approach is used in short-range networks such as Bluetooth.

    When sending data in both directions, the acknowledgement may be carriedtogether with the data in the opposite direction (piggybacking).

    Sliding Windows

    Stop-and-Wait is inefficient with short messages and/or large signal

    propagation delay:

    S d R i

  • 8/3/2019 B Fundamentals

    94/213

    94HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    DT.1

    ACK.1Receive + check message 1,send ACK

    DT.0

    ACK.0

    Sender Receiver

    Receive + check message 2,send ACK

    Send message 1

    Send message 2

    DT.1

    ACK.1

    Receive + check message 3,

    send ACK

    Send message 3

    Wait

    Wait

    Wait

    Efficiency may be improved by allowing the sender to transmit several PDUs

    before stopping and waiting for ACKs.The mechanism used in this case is called

    Sliding Window Protocol

    Sender Window and Receiver Window

    Sender and receiver negotiate a window size W before starting transmission:

    1

  • 8/3/2019 B Fundamentals

    95/213

    95HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    1 W m, with m 2 modulus

    The sender window:

    tells which PDUs may currently be sent,

    changes (slides upwards) when receiving correct ACKs.

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

    161 2 3 4 5 6 7 8 9 101112131415Overall number of the message:

    Sequence number of the PDU: 0 1 2

    191718

    The receiver window:

    tells which PDUs are currently accepted at the destination,

    changes (slides upwards) when receiving correct (new) PDUs

    The PDUs are numbered modulo m (using a n-bit field).

    Example:

    Example: sender window size = 3; receiver window size = 1

    Start:

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Sequence no of PDU: 0 1 2

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Sender window: 0 1 2

  • 8/3/2019 B Fundamentals

    96/213

    96HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Sender window: 0 1 2

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Receiver window: 0 1 2

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Sequence no of PDU: 0 1 2

    Sender window :

    Receiver window :

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Sequence no of PDU: 0 1 2

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Sender window : 0 1 2

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Receiver window : 0 1 21

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Sequence no of PDU: 0 1 2

    0 2 3 4 5 6 7 0 1 2 3 4 5 6 7Sender window : 0 1 2

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7Receiver window : 0 1 21

    1

    Transmission of PDUs 0, 1 and 2: Both windows remain unchanged

    PDU 0 received: Change at receiver window

    ACK for PDU 0 received: Change at sender window

    2 31

    0 0 30 0

    Strategies at the Receiver

    With sliding window protocols, the receiver has several options of how to react to PDU

    loss:

    Ask for a retransmission of those PDUs which were lost (specific selection)

  • 8/3/2019 B Fundamentals

    97/213

    97HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    et a s ss o Us c e e ost ( p )

    Ask forretransmission ofall PDUs beginning with the first one which was lost

    Hybrid solutions of both options

    For the retransmission of specific PDUs, negative acknowledgements (NACK) may

    be used: These carry the sequence number(s) of PDUs to be retransmitted.

    Go back n

    All PDUs beginning with the first one lost are retransmitted.(Receiver window with size 1)

    Pro: - Simple implementation of the protocol

    Con: - Channel capacity is wasted by retransmitting PDUs correctly deliveredto the destination.

    Remark: The receiver only accepts PDUs in the correct order.

    Selective Repeat and Selective Reject

    Selective Repeat

    The receiver

    Selective Reject

    Retransmit lost PDUs only

  • 8/3/2019 B Fundamentals

    98/213

    98HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    The receiver

    buffers all PDUs received correctly

    acknowledges the sequence ofpackets received without a gap

    Pro: - Improved efficiency

    Con: - More complex implementation

    (out-of-order packets bufferedat destination)

    Retransmit lost PDUs only(requested by NACKs).

    The retransmission is initiated by some

    kind of NACK.

    Pro: - Excellent efficiency

    Con: - No gain when loosing sequence

    of PDUs (several or even manyPDUs have to be retransmitted anyway)

    Question: What is the impact of the receiver strategy on the size of the sender buffer?

    Comparison of Receiver Strategies

    1

    32

    1

    23al

    1

    23al

    D t

    Sender Receiver Sender Receiver Sender Receiver

  • 8/3/2019 B Fundamentals

    99/213

    99HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    34567

    89

    101123

    456789

    10

    1

    --

    ------

    -23456

    78910

    34567

    892

    101112

    131415161718

    19

    1

    34

    567892

    101112131415

    161718

    19

    Tim

    eoutInterva 3

    4567

    89

    101123

    45678

    12

    13

    1

    34

    5678910

    112----

    --1213

    Tim

    eoutInterva

    TimeoutInterval

    Data:

    ACK:

    NACK:ACK

    1

    ACK

    2

    ACK

    3 ACK

    11

    ACK

    1

    ACK

    1

    NACK2

    ACK

    9

    Go back n Selective Repeat Selective Reject

    Sliding Window with TCP

    The sliding window scheme of TCP works byte by byte.Therefore, 3 pointers are in use:

    Left border of the sending window

  • 8/3/2019 B Fundamentals

    100/213

    100HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Left border of the sending window(border between ACKnowledged and not yet ACKnowledged data)

    Right border of the sending window(all bytes up to this border may be sent without waiting for any ACKs)

    Marker of current sending position(border between data already sent and data waiting to be sent)

    1 2 3 4 5 6 7 8 9 10 11 12 13 ...

    current sender window

    All bytes waiting to be sent are being sent as soon as possible. Therefore, the

    marker of the sending position usually moves pretty fast towards the right border.

    TCP ACKs indicate which byte is expected next by the receiver:All bytes up to the one given in the ACK are acknowledged.

    3.3. TCP Connection Management

    For connection establishment, TCP uses the concept of a Three Way Handshake.The following bit flags of the TCP header are important:

    SYN bit (synchronize sequence numbers):

  • 8/3/2019 B Fundamentals

    101/213

    101HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    SYN bit (synchronize sequence numbers):Is set to 1, if the sequence number of the TCP PDU carries its initial value. The SYNPDU is the very first PDU of a TCP connection.

    ACK bit (acknowledgement):Is set to 1, if the PDU carries a valid acknowledgement number.

    A sends SYN seq=xB receives SYN

    B sends SYN seq=y, ACK x+1

    Host A Host B

    A receives SYN+ACK

    A sends ACK y+1B receives ACK

    (Application needs transport connection)

    Server allocates resourcesfor connection management.

    SYN-Flooding - an Denial-of-Service-Attack

    Client Server

  • 8/3/2019 B Fundamentals

    102/213

    102HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    send SYNServer receives SYN

    Server sends SYN+ACK

    send SYN Server receives SYNServer sends SYN+ACK

    send SYNServer receives SYN

    Server sends SYN+ACKsend SYN

    Server receives SYN

    Server sends SYN+ACKsend SYN

    Server receives SYN

    Server sends SYN+ACKsend SYN

    Server receives SYN

    Server sends SYN+ACK

    Connection Release with TCP

    TCP establishes full duplex connections. Therefore, both end points have to agree

    on the release.

    Connection release is based on a modified Three Way Handshake.

  • 8/3/2019 B Fundamentals

    103/213

    103HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Anotherbit flag of the TCP header is used for connection release:

    FIN bit:

    Is set to 1, if the sender has no more data to transmit.

    The first FIN-PDU will be issued when the senderhas send all of its data andadditionally has received all outstanding ACKnowledgements.

    A sends FIN seq=xB receives FIN

    B sends ACK x+1

    Host A Host B

    A receives ACK

    A sends ACK y+1B receives ACK

    (Application wants to close the connection)

    (B informs its application)

    (Application closes connection)B sends FIN seq = y; ACK x+1A receives FIN+ACK

    Simplified State Diagram of TCP Connection Management

    closed

    begin

    anything / reset

    Terminology:

    Input/ Output

  • 8/3/2019 B Fundamentals

    104/213

    104HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    SYN

    sent

    estab-lished close

    wait

    last

    ACK

    FIN

    wait-1closing

    FIN

    wait-2

    timed

    wait

    passive open /close

    active open /SYN

    close / timeout /reset

    send /SYN

    SYN / SYN+ACK

    reset

    SYN / SYN+ACK

    close/FIN

    ACK /

    close/ FINFIN / ACK

    SYN+ACK /ACK

    close/ FIN

    ACK

    /ACK/

    FIN /ACK

    ACK/

    FIN /ACK

    FIN+ACK/ACK Timeout after 2 lifetimes of a segment

    SYN

    receivd

    listen

    3.4. TCP Retransmission TimerIn the Internet, we observe

    heavy variations of theRound Trip Time

    (= time from sending a PDU toreceiving the corresponding

    190

    200

    210

    220

    s]

  • 8/3/2019 B Fundamentals

    105/213

    105HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn 17.10.2011

    receiving the corresponding

    ACK).

    The figure shows an example.

    In 1988, Van Jacobson proposed an RTT estimation algorithm for TCP which uses anaging function:

    1. For each PDU, determine the point in time of sending the PDU

    2. For each PDU determine the point in time of receiving the corresponding ACK

    3. Calculate the difference of both

    4. Update a weighted average value

    The choice of (0<

  • 8/3/2019 B Fundamentals

    106/213

    106HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    ACK for original PDU or

    ACK for retransmission/duplicate ?

    4567

    8910112

    1

    --

    ------

    -2

    Tim

    eoutInterv

    ACK

    1

    ACK

    2

    Go back n

    ACK2

    ? RTT ?

    RTT ?

    Karns Algorithm and Timer Backoff

    ti tti t

    a) Ignore RTT measurements in case of timeout and PDU retransmission.

    b) Instead, use a timer backoff strategy:

  • 8/3/2019 B Fundamentals

    107/213

    107HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    timeouttimeoutnew

    A typical value is= 2.

    This algorithm originally proposed by Phil Karn (included in almost all implementations ofTCP)

    eliminates the ambiguity of ACKs, enlarges the timeout interval in case of high network load,

    in critical situations decouples the calculation of timeout intervals fromRTT measurements.

    The timeout interval grows until a successful transmission (without retransmissions)happens again.

    After successful transmission, the timeout interval estimation is based on RTT

    measurements as discussed before.

    Timer Control according to Van Jacobson

    The Timer control algorithm originally proposed by Van Jacobson is presented by

    William Stallings** as follows:

    aging functionSRTT(k+1) = (1-g) x SRTT (k) + g x RTT (k+1)

  • 8/3/2019 B Fundamentals

    108/213

    108HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    SERR (k+1) = RTT(k+1) SRTT(k)

    SDEV (k+1) = (1-h) x SDEV (k) + h x SERR (k+1)

    RTO (k+1) = SRTT (k+1) + f x SDEV (k+1)

    *Van Jacobson, Michael J. Karels, Congestion Avoidance and Control, Proceedings of SIGCOM

    Almost identically available at ftp.ee.lbl.gov/papers/congavoid.ps.Z

    **W. Stallings, Data & Computer Communications, 6th Ed., Prentice Hall, 2000

    aging function

    RTT round trip time SRTT smoothed round trip time

    SERR smoothed error SDEV smoothed mean deviation

    RTO retransmission timeout

    Van Jacobson proposed for the constants: g = 1/8; h =1/4; f = 2

    Later (1990) he changed his recommendation to: g = 1/8; h =1/4; f = 4

    3.5. TCP Flow Control and Congestion Control

    (end-to-end) Flow control

    protects the receiver from being overloaded by the sender.

    Obviously the receiver cannot be overloaded in case of stop and wait: A new

  • 8/3/2019 B Fundamentals

    109/213

    109HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Congestion control(Internet flow control)

    protects the network(s) from being congested.

    The senders reduce their load in critical situations.

    Obviously, the receiver cannot be overloaded in case of stop-and-wait: A newmessage may only be transmitted after receiving the (positive) ACK.

    ACK based window mechanisms provide flow control in a similar way: The

    transmission window may only be moved after receiving ACKs.This effect is not sufficient because ofbuffer overflow and retransmissionmechanisms.

    Flow control by acknowledgements

    Wi h i i k l d

    Acknowledgement based error detection and correction with appropriately

    chosen window sizes results in flow control.

  • 8/3/2019 B Fundamentals

    110/213

    110HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    With increasing network load,

    data arrive later at the receiver.

    With increasing receiver load,

    data received wait longer for processing (by the receiver).

    In both cases,

    acknowledgements are sent later,

    acknowledgements arrive later at the sender,

    finally, the sender must wait for acknowledgements before resuming

    transmission, [ there is a risk of timeouts and (unnecessary) duplicate transmissions ].

    A situation where the sender is completely controlled by the incoming ACK stream

    is called ACK Clocking.

    TCP Window Advertisement

    The TCP header includes a window field (Window Advertisement) telling thebuffer space available at the sender of this packet.

  • 8/3/2019 B Fundamentals

    111/213

    111HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    TCP Packet

    Source Port Destination Port

    0 8 16 24 31

    SA F

    Sequence Number

    Acknowledgement Number

    Checksum

    Window

    TCP Window Advertisement

    Sender Receiver1000

    The TCP header includes a window field (Window Advertisement) telling thebuffer space available at the sender of this packet.

    Note:

    The receiver must

  • 8/3/2019 B Fundamentals

    112/213

    112HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Ack1001,Window200

    Send

    Receive

    Send

    Wait

    Wait

    ACK and

    new window

    Ack1,Window1000

    Ack1201,Window0

    Receive

    ACK and

    new window

    The receiver must

    not revoketransmission

    permissionsalready granted:

    The window may

    only be reduced

    after receiving

    (new) data.

    Remark:

    The strategy shown here

    may also be used at OSIlayer 2.

    1000bytes

    200bytes

    TCP window control mechanisms (simplified)

    TCP sender windowT itt d

    The following figure illustrates the TCP window control mechanisms.

  • 8/3/2019 B Fundamentals

    113/213

    113HPN Fundamentals

    Data to transmit

    Not yet transmitted.May only be transmitted

    after the window has

    opened again.

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Not yet transmitted,but ready for immediate

    transmission.

    Transmittedbut not yet

    acknowledged.

    Retransmission may be

    necessary.

    TCP sender window

    Minimum of

    sender buffer size and

    receiver capabilities (advertised window)

    Transmittedand

    already

    acknowledged

    Border moves right

    when receiving

    ACKs

    Border moves right

    when transmitting

    data.

    Border moves right

    if and only if the

    receiver tells thesender to do so.

    TCP in case of high load and overload

    In the Internet,

    more than 80 % of the total load is TCP traffic,

    network collapse is avoided by the cooperative behaviour of TCP.

  • 8/3/2019 B Fundamentals

    114/213

    114HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    TCP tries to reach both maximum efficiency and maximum predictability: a trade-off!

    Maximumnetwork utilization

    (max. efficiency)

    Predictablenetwork behaviour

    (in particular

    for real time traffic)

    TCP supports both interactive application and bulk transfer:

    Interactive applications: usually small amount of data

    typical examples: telnet, ssh

    Bulk transfer of data: usually large amount of data

    typical examples: ftp, email, http

    TCP in case of bulk data transfer

    For bulk data transfer, TCP tries to achieve

    maximum throughput with minimum packet loss.

  • 8/3/2019 B Fundamentals

    115/213

    115HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Slow Start

    Fast Retransmit and Fast Recovery

    Congestion Avoidance

    p

    With adaptive load control TCP achieves efficient resource utilization in todays Internet.

    The throughput achievable per data stream usually cannot be predicted.

    Inventions

    by Van Jacobson

    TCP applies mainly three techniques to achieve these goals:

    Slow Start

    The slow start and congestion avoidance algorithms MUST be used by a TCP

    sender to control the amount of outstanding data being injected into the network.

    RFC 2581, TCP Congestion Control, April 1999, p.3

    The slow start and congestion avoidance algorithms MUST be used by a TCPsender to control the amount of outstanding data being injected into the network.

    RFC 2581 TCP Congestion Control April 1999 p 3

  • 8/3/2019 B Fundamentals

    116/213

    116HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    RFC 2581, TCP Congestion Control , April 1999, p.3RFC 2581, TCP Congestion Control , April 1999, p.3

    Slow Start makes TCP discover the load situation on the path from the source

    to the destination when starting data transfer and

    after packet loss with Retransmission Timer Timeout.

    Idea: Limit the transmission window by a Congestion WindowIdea: Limit the transmission window by a Congestion Window

    CONGESTION WINDOW (cwnd):A TCP state variable that limits the amount of data a TCP can send.

    At any given time, a TCP MUST NOT send data with a sequence number higher than

    the sum of the highest acknowledged sequence number and the minimum of cwnd andrwnd*.

    RFC 2581, TCP Congestion Control, April 1999, p.2

    *RECEIVER WINDOW (rwnd): The most recently advertised receiver window.

    TCP window control mechanisms

    TCP sender window

    Minimum of sender buffer size and

    i biliti ( d ti d i d )

    Transmittedand

    already

  • 8/3/2019 B Fundamentals

    117/213

    117HPN Fundamentals

    Data to transmit

    Not yet transmitted.May only be transmitted

    after the window has

    opened again.

    Copyright 2011/2012 Computer Science 4, University of Bonn

    Not yet transmitted,but ready for immediate

    transmission.

    Transmittedbut not yet acknowledged.

    Retransmission may be

    necessary.

    receiver capabilities (advertised window)

    current congestion window

    acknowledged

    Border moves right

    when receiving ACKs

    Border moves

    right when

    transmitting data.

    Border moves right

    if and only if the

    receiver tells the

    sender to do so*.

    *if the congestion window is not exceeded

    Initial cwnd size: maximum message size (new: 2 x max. message size)

    When to increment cwnd: cf. next slide

    How slow is slow start ?

    The congestion window size is influenced by

    the size of transmitted messages and by

    the Round Trip Time:

  • 8/3/2019 B Fundamentals

    118/213

    118HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    Initial cwnd size: max. one segment (max. SMSS); cf. RFC 2001, 1997max. 2 segments (max. 2xSMSS); cf. RFC 2581, 1999

    How to increment cwnd: One segment per correctly received ACK.

    SENDER MAXIMUM SEGMENT SIZE (SMSS):

    The SMSS is the size of the largest segment that the sender can transmit.

    This value can be based on the maximum transmission unit of the network, the path MTU discovery algorithm, Receiver Maximum Segment Size, or other factors.

    The size does not include the TCP/IP headers and options.

    RFC 2581, TCP Congestion Control, April 1999, p.2

    Example: Congestion window size

    The graph shows how the congestion window is incremented for each ACK

    received.

    Finally, the tx_window and the transmission data rate become too large:

  • 8/3/2019 B Fundamentals

    119/213

    119HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    0

    10

    20

    30

    40

    50

    60

    0 10 20 30 40 50 60 70 80 90 100

    Segments transmitted

    Congestion

    wi

    ndows

    ize

    The resulting timeout yields

    packet retransmission (duplicate),

    change to Timer Backoff and

    congestion window reduction to 1 segment.

    Packet loss due to buffer overflow.

    Linear or exponential growth?

    The transmission window only seems to grow slowly.

    The larger the tx_window, the larger the number of ACKs.

  • 8/3/2019 B Fundamentals

    120/213

    120HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    After log2 N Round Trip Times, TCP may already transmit N segments

    RoundTrip

    Time

    With maximum speed into the traffic jam

    Slow Start obviously makes TCP

    very quickly reach the available bandwidth and

    very quickly go beyond this to overload.

    ... upon a timeout cwnd MUST be set to no more than ... 1 full-sized segment

  • 8/3/2019 B Fundamentals

    121/213

    121HPN Fundamentals

    Slow Start

    Copyright 2011/2012 Computer Science 4, University of Bonn

    CongestionAvoidance

    cwnd < ssthresh ?Yes No

    When a TCP sender detects segment loss using the retransmission timer, the value of ssthreshMUST be set to no more than the value ...

    ssthresh = max (FlightSize / 2, 2*SMSS) .. [ssthresh = slow start threshold]

    ..., FlightSize is the amount of outstanding data in the network.

    RFC 2581, TCP Congestion Control, April 1999

    After this, the value ssthresh (any value for connection setup) determines the upperlimit for staying with slow start:

    RFC 2581, TCP Congestion Control, April 1999

    Introduction to Time Sequence Plots

    Time Sequence plots are a common means of logging (and observing) TCP behavior.

    Each mark resembles a packet receive or a packet transmission event. The X-axis denotes the time at which an event occurs

    The Y-axis denoted the sequence number of the packet

  • 8/3/2019 B Fundamentals

    122/213

    122HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    0

    5

    10

    15

    20

    25

    30

    35

    0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

    S

    egmentnumber

    Time [s]

    Segment transmittedAck received

    In the following

    a diamond ( ) denotes a data segment transmission event

    a crosshair ( ) denotes an acknowledgement segment reception event

    At second 1.0, the sender

    The following plot derives from the observation of a TCP sender:

    receives an acknowledgement for

    segment 10

    transmits segment 20

    Introduction to Time Sequence Plots (2)

    Time Sequence plots convey more information than that.

    In the following we assume that the sender is saturated (i.e. the senders application hasalways sufficient data to transmit)

  • 8/3/2019 B Fundamentals

    123/213

    123HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    0

    5

    10

    15

    20

    25

    30

    35

    4 4.5 5 5.5 6

    Segmentnumber

    Time s

    Segment transmittedAck received

    Observable facts from the plot:

    The maximum transmissionwindow size Wis 10 segments. Itcorresponds to the y-offset of the

    dot trails.

    The round trip time is one

    second. It corresponds to the x-offset of the dot trails.

    The transmission rate W/ RTT is10 segments per second. It

    corresponds to the slope of the dottrails.

    W

    RTT

    W / RTT

    TCP Slow Start (Time Sequence Plot)

    The TCP Slow-start algorithm is applied on connection establishment, or

    on reestablishment after a retransmission timeout

    Fundamental question on connection startup:

    Which congestion window size to begin with?

  • 8/3/2019 B Fundamentals

    124/213

    124HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    The slow-start algorithm results in

    exponential growth of the congestionwindow over time.

    Q: How long can this continue?

    g g

    TCP solution: start with minimum congestion window size and increase cwnd by one

    segment for each acknowledgement received.

    Slow-start example:

    0

    10

    20

    30

    40

    50

    60

    70

    0 0.2 0.4 0.6 0.8 1 1.2

    Sequencenumber

    Time [s]

    Segment transmittedAck received

    TCP Slow Start (2)

    Q: How long can slow-starts exponential growth continue?

    A: Until packet loss is detected, or the congestion window grows too large.

    TCP maintains a state variable, the slow-start threshold (ssthresh) that determineswhether the TCP sender is in slow-start or congestion avoidance.

  • 8/3/2019 B Fundamentals

    125/213

    125HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    For

    congestion window size < ssthresh: TCP is in slow-start

    congestion window size >= ssthresh: TCP is in congestion avoidance

    The task ofslow-start is to quickly ramp up thecongestion window to ssthresh. The ssthresh is

    regarded as an estimate for the proper magnitude ofthe congestion window.

    The task ofcongestion avoidance is tocontinuously probe if the network can handle a

    higher congestion window.

    RTT

    cwnd

    ssthresh

    Congestion

    avoidance

    Slow-start

    Congestion Avoidance

    Idea:

    The congestion only grows linearly over time (instead of exponentially)

    Current versions of TCP carefully discover the bottleneck capacity.

  • 8/3/2019 B Fundamentals

    126/213

    126HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    The congestion only grows linearly over time (instead of exponentially).

    One formula commonly used to update cwnd during congestion avoidance is ...:

    cwnd += SMSS*SMSS/cwnd (2)

    This adjustment is executed on every incoming non-duplicate ACK.

    Equation (2) provides an acceptable approximation to the underlying principle of increasing

    cwnd by 1 full-sized segment per RTT.

    During congestion avoidance, cwnd is incremented by 1 full-sized segment perround-trip time (RTT). Congestion avoidance continues until congestion is detected.

    RFC 2581, TCP Congestion Control, April 1999, p. 4

    Congestion window during Congestion Avoidance

    100

    Over time, the congestion window size

    initially grows exponentially (Slow Start)

    then grows close to linearly (Congestion Avoidance)

  • 8/3/2019 B Fundamentals

    127/213

    127HPN FundamentalsCopyright 2011/2012 Computer Science 4, University of Bonn

    0

    10

    20

    30

    40

    50

    60

    70

    80

    90

    0 10 20 30 40 50 60 70 80 90 100

    Time [Round Trip Times]

    cwdsize

    Note:

    TCP believes all kinds ofpacket loss to be due to network congestion.

    Consequently, TCP considerably reduces the load.

    TCPs fundamental assumption is not necessarily true for wireless networks.

    TCP Congestion Avoidance (Time Sequence Plot)

    In congestion avoidance, the congestion window grows, but at a slower rate than in slow

    start.