chapter5(link) ece358slides

Upload: hoon-cho

Post on 05-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Chapter5(Link) ECE358Slides

    1/182

    Data Link Layer 5-1

    Chapter 5

    Link Layer and LANs

    A note on the use of these ppt slides:Were making these slides freely available to all (faculty, students, readers).

    Theyre in PowerPoint form so you can add, modify, and delete slides

    (including this one) and slide content to suit your needs. They obviously

    represent a lotof work on our part. In return for use, we only ask thefollowing:

    If you use these slides (e.g., in a class) in substantially unaltered form, thatyou mention their source (after all, wed like people to use our book!)

    If you post any slides in substantially unaltered form on a www site, that

    you note that they are adapted from (or perhaps identical to) our slides, and

    note our copyright of this material.

    Thanks and enjoy! JFK/KWR

    All material copyright 1996-2010

    J.F Kurose and K.W. Ross, All Rights Reserved

    Computer Networking:A Top Down Approach5th edition.Jim Kurose, Keith RossAddison-Wesley, April2009.

  • 7/31/2019 Chapter5(Link) ECE358Slides

    2/182

    Data Link Layer 5-2

    Chapter 5: The Data Link Layer

    Our goals: understand principles behind data link layerservices:

    errordetection and correction ( by the receiver)

    link access by sharing a broadcast channel: multiple access Instruct the hardware (PHY layer) whento transmit ( MAC protocols)

    link layer addressing

    reliable data transfer, flow control

    implementation of various link layer technologies

  • 7/31/2019 Chapter5(Link) ECE358Slides

    3/182

    Data Link Layer 5-3

    Link Layer

    5.1 Introduction andservices

    5.2 Error detection andcorrection

    5.3Multiple access protocols

    New: WiFi

    5.4 Link-layer Addressing

    5.5 Ethernet

    5.6 Link-layer switches

    5.7 PPP (Point-to-Point Protocol)

    5.8 Link virtualization: MPLS(Multi-protocol Label Switching)

    5.9 A day in the life of a webrequest (dropped: NOTmeaningful in bottom/upapproach to understandingnetworking)

    3.4 New: Reliable datatransfer + flow control

  • 7/31/2019 Chapter5(Link) ECE358Slides

    4/182

    Data Link Layer 5-4

    Link Layer: Introduction

    Terminology: hosts and routers are nodes communication channels that

    connect adjacent nodes are links wired links

    wireless links LANs

    layer-2 packet is a frame,encapsulates datagram (from netlayer)

    data-link layer has responsibility oftransferring datagram from one node

    tophysically adjacentnode over a link

  • 7/31/2019 Chapter5(Link) ECE358Slides

    5/182

    Data Link Layer 5-5

    Link layer: context

    datagram transferred bydifferent link protocolsover different links: e.g., Ethernet on first link,

    frame relay on intermediate

    links, 802.11 on last link each link protocol provides

    different services e.g., may or may not provide

    reliable data transfer overlink

    transportation analogy trip from Princeton to

    Lausanne

    limo: Princeton to JFK

    plane: JFK to Geneva

    train: Geneva to Lausanne tourist = datagram

    transport segment =communication link

    transportation mode =link layer protocol

    travel agent = routingalgorithm

  • 7/31/2019 Chapter5(Link) ECE358Slides

    6/182

    Data Link Layer 5-6

    Link Layer Services

    framing, link access: encapsulate datagram into frame, adding header, trailer

    channel access if shared medium (a.k.a. broadcast medium)

    MAC addresses used in frame headers to identify source,

    dest different from IP address!

    reliable delivery between adjacent nodes we learned how to do this already (ch. 3)! (Will do it in this ch.)

    seldom used on low bit-error link (fiber, some twisted pair) wireless links: high error rates

    Q.: Why both link-level and end-to-end reliability?

  • 7/31/2019 Chapter5(Link) ECE358Slides

    7/182Data Link Layer 5-7

    Link Layer Services (more)

    flow control: pacing between (adjacent) sending and receiving nodes

    error detection: errors caused by signal attenuation and noise

    receiver detects presence of errors error correction:

    receiver identifies and correctsbit error(s) withoutresorting to retransmission

    receiver signals sender for retransmission

    half-duplex and full-duplex with half duplex, nodes at both ends of link can transmit,

    but not at the same time

  • 7/31/2019 Chapter5(Link) ECE358Slides

    8/182Data Link Layer 5-8

    Where is the link layer implemented?

    in each and every host link layer implemented in

    adaptor (aka networkinterface cardNIC) Ethernet card, PCMCI

    card, 802.11 card implements link, physical

    layer

    attaches into hosts

    system buses combination of

    hardware, software,firmware

    controller

    physical

    transmission

    cpu memory

    hostbus(e.g., PCI)

    network adaptercard

    host schematic

    application

    transport

    networklink

    link

    physical

  • 7/31/2019 Chapter5(Link) ECE358Slides

    9/182Data Link Layer 5-9

    Adaptors Communicating

    sending side: encapsulates datagram in

    frame

    adds error checking bits,rdt, flow control, etc.

    receiving side looks for errors, rdt, flow

    control, etc

    extracts datagram, passesto upper layer at receivingside

    controller controller

    sending host receiving host

    datagram datagram

    datagram

    frame

  • 7/31/2019 Chapter5(Link) ECE358Slides

    10/182Data Link Layer 5-10

    Link Layer

    5.1 Introduction andservices

    5.2 Error detection andcorrection

    5.3Multiple accessprotocols

    5.4 Link-layerAddressing

    5.5 Ethernet

    5.6 Link-layer switches

    5.7 PPP

    5.8 Link virtualization:

    MPLS5.9 A day in the life of aweb request

    3.4 Reliable data transfer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    11/182

  • 7/31/2019 Chapter5(Link) ECE358Slides

    12/182

    Data Link Layer 5-12

    Parity Checking

    Single Bit Parity:Detect single bit errors

    Two Dimensional Bit Parity:Detect and correctsingle bit errors

    0 0

  • 7/31/2019 Chapter5(Link) ECE358Slides

    13/182

    Data Link Layer 5-13

    Internet checksum (review; detailsin Transport Layer . Just wait.)

    Sender: treat segment contents

    as sequence of 16-bitintegers

    checksum: addition (1scomplement sum) of

    segment contents sender puts checksum

    value into UDP checksumfield

    Receiver:

    compute checksum ofreceived segment

    check if computed checksumequals checksum field value:

    NO - error detected

    YES - no error detected.But maybe errorsnonetheless?

    Goal:detect errors (e.g., flipped bits) in transmittedpacket (note: used at transport layer only)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    14/182

  • 7/31/2019 Chapter5(Link) ECE358Slides

    15/182

    Data Link Layer 5-15

    CRC Example: D = 101110, r = 3, G = 1001

    Want:D.2rXOR R = nG

    equivalently:

    D.2r = nG XOR R

    equivalently:if we divide D.2r by G,we get remainder R

    R = remainder[ ]D.2r

    G

  • 7/31/2019 Chapter5(Link) ECE358Slides

    16/182

    Data Link Layer 5-16

    1 0 1 1 1 0 0 0 01 0 0 1------------------0 0 1 0 10 0 0 0

    1 00 1------------------0 0 1 0 10 0 0 0

    1 0 01------------------0 0 0 0 11 0 0 0

    1 00 1------------------0 0 0 0 11 0 0 0

    10 0 1------------------0 0 0 0 01 0 1 0

    1 0 0 1------------------0 0 0 0 000 1 1

    Process: Calculation of CRCIf the input bit above the leftmost divisor bit is 1,

    the divisor is XORed into the input.Else (the input bit above the leftmost divisor bit is 0) do nothing.

    The divisor is then shiftedone bit to the right (

    )The process is repeated untilthe divisor reaches the right-hand end of the input row.

    Input: D.2r

    Divisor: G

    Align input and divisor on MSB

    R

  • 7/31/2019 Chapter5(Link) ECE358Slides

    17/182

    Data Link Layer 5-17

    Link Layer

    5.1 Introduction andservices

    5.2 Error detection andcorrection

    5.3Multiple accessprotocols

    5.4 Link-layerAddressing

    5.5 Ethernet

    5.6 Link-layer switches

    5.7 PPP

    5.8 Link virtualization:

    MPLS5.9 A day in the life of aweb request

  • 7/31/2019 Chapter5(Link) ECE358Slides

    18/182

    Data Link Layer 5-18

    Multiple Access Links and Protocols

    Two types of links: point-to-point

    PPP for dial-up access

    point-to-point link between Ethernet switch and host

    broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC

    802.11 wireless LAN

    shared wire (e.g.,cabled Ethernet)

    shared RF(e.g., 802.11 WiFi)

    shared RF(satellite)

    humans at acocktail party

    (shared air, acoustical)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    19/182

    Data Link Layer 5-19

    Multiple Access protocols

    single shared broadcast channel

    two or more simultaneous transmissions by nodes:interference collision if node receives two or more signals at the same time

    multiple access protocol

    distributed algorithm that determines how nodesshare channel, i.e., determine when a node can transmit

    communication about channel sharing must use channelitself! no separate control channel for coordination

  • 7/31/2019 Chapter5(Link) ECE358Slides

    20/182

    20

    PacketCollision

    PHY

    Link/MACdata

    PHY

    Link/MACdata

    PHY

    Link/MAC

    +

    Rx

    Tx

    Tx

  • 7/31/2019 Chapter5(Link) ECE358Slides

    21/182

    Data Link Layer 5-21

    Ideal Multiple Access Protocol

    Broadcast channel of rate R bps

    1. when one node wants to transmit, it can send at rate R.

    2. when M nodes want to transmit, each can send ataverage rate R/M

    3. fully decentralized:

    no special node to coordinate transmissions no synchronization of clocks, slots

    4. simple

  • 7/31/2019 Chapter5(Link) ECE358Slides

    22/182

    Data Link Layer 5-22

    MAC Protocols: a taxonomy

    Three broad classes: Channel Partitioning (Commonly done in cellular networks)

    divide channel into smaller pieces (time slots, frequency, code)

    allocate piece to node for exclusive use

    Random Access channel not divided, allow collisions

    recover from collisions

    Taking turns

    nodes take turns

  • 7/31/2019 Chapter5(Link) ECE358Slides

    23/182

    Data Link Layer 5-23

    Channel Partitioning MAC protocols: TDMA

    TDMA: time division multiple access access to channel in "rounds"

    each station gets fixed length slot (length = pkttrans time) in each round

    unused slots go idle example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6

    idle

    1 3 4 1 3 4

    6-slotframe

  • 7/31/2019 Chapter5(Link) ECE358Slides

    24/182

    Data Link Layer 5-24

    Channel Partitioning MAC protocols: FDMA

    FDMA: frequency division multiple access channel spectrum divided into frequency bands

    each station assigned fixed frequency band

    unused transmission time in frequency bands go idle

    example: 6-station LAN, 1,3,4 have pkt, frequencybands 2,5,6 idle

    frequencyb

    ands

    FDM cable

  • 7/31/2019 Chapter5(Link) ECE358Slides

    25/182

    Data Link Layer 5-25

    Random Access Protocols

    When node has packet to send transmit at full channel data rate R.

    no a prioricoordination among nodes (partial exception in WiFi)

    two or more transmitting nodes collision,

    random access MAC protocol specifies: how to detect collisions

    how to recover from collisions (e.g., via delayed retransmissions)

    Examples of random access MAC protocols: ALOHA and slotted ALOHA

    CSMA/CD, CSMA/CA CSMA: Carrier Sense Multiple Access CD: Collision Detection

    CA: Collision Avoidance

  • 7/31/2019 Chapter5(Link) ECE358Slides

    26/182

    26

    Aloha Protocol

    Developed in the 1970s at U of Hawaii

    To interconnect terminals with mainframes

    LAN/ WLAN: Possible, but not used

    GSM: Cell phones use this protocol to request achannel from the base stations

    Two types Pure Aloha (Continuous time)

    Slotted Aloha

  • 7/31/2019 Chapter5(Link) ECE358Slides

    27/182

    27

    Pure AlohaStart:i = 0

    Start atimerT = 2*Tp +

    ACKreceivedCancel timer

    Success

    Timeouti++

    TransmitFrame

    i > Kmax

    R =Random(0,2i-1)

    WaitTB= R*Tp

    Error

    Yes

    No

    Exponential backoff

  • 7/31/2019 Chapter5(Link) ECE358Slides

    28/182

    Data Link Layer 5-28

    Pure (unslotted) ALOHA

    unslotted Aloha: simpler, no synchronization when frame first arrives

    transmit immediately

    collision probability increases:

    frame sent at t0 collides with other frames sent in [t0-1,t0+1]

  • 7/31/2019 Chapter5(Link) ECE358Slides

    29/182

    Data Link Layer 5-29

    Pure Aloha efficiency

    P(success by given node) = P(node transmits) .P(no other node transmits in [t0-1,t0] .P(no other node transmits in [t0, t0+1]

    = p . (1-p)N-1 . (1-p)N-1

    = p . (1-p)2(N-1)

    choosing optimum p and then letting n -> infty ...

    = 1/(2e) = .18

    even worsethan slotted Aloha!

  • 7/31/2019 Chapter5(Link) ECE358Slides

    30/182

    Data Link Layer 5-30

    Slotted ALOHA

    Assumptions: all frames same size time divided into equal

    size slots (time to

    transmit 1 frame) nodes start to transmit

    only at slot beginning nodes are synchronized

    if 2 or more nodestransmit in a slot, allnodes detect collision

    Operation: when node obtains fresh

    frame, transmits in nextslot

    if no collision:node cansend new frame in nextslot

    if collision:noderetransmits frame ineach subsequent slotwith prob. p untilsuccess

  • 7/31/2019 Chapter5(Link) ECE358Slides

    31/182

    Data Link Layer 5-31

    Slotted ALOHA

    Pros

    single active node cancontinuously transmitat full rate of channel

    highly decentralized:only slots in nodesneed to be in sync

    simple

    Cons collisions, wasting slots idle slots nodes may be able to

    detect collision in lessthan time to transmitpacket

    clock synchronization

  • 7/31/2019 Chapter5(Link) ECE358Slides

    32/182

    Data Link Layer 5-32

    Slotted Aloha efficiency

    suppose:N nodes with manyframes to send, eachtransmits in slot withprobabilityp

    prob that given node has

    success in a slot = p(1-p)N-1

    prob that anynode has asuccess = Np(1-p)N-1

    max efficiency: find p* thatmaximizesNp(1-p)N-1

    for many nodes, take limit ofNp*(1-p*)N-1 as N goes to

    infinity, gives:Max efficiency = 1/e = .37

    Efficiency : long-run

    fraction of successful slots(many nodes, all with manyframes to send)

    At best:channelused for usefultransmissions 37% of time! !

  • 7/31/2019 Chapter5(Link) ECE358Slides

    33/182

    Data Link Layer 5-33

    CSMA (Carrier Sense Multiple Access)

    CSMA: listen before you transmit:

    If channel sensed idle: transmit entire frame

    If channel sensed busy, defer transmission

    human analogy: dont interrupt others!

  • 7/31/2019 Chapter5(Link) ECE358Slides

    34/182

    34

    CSMA/CDConcepts of Carrier Sense and Collision Detection

    Tx Rx

    Data

    Collision?Carrier?

    Medium

    MAC/PHY

    Sense voltage (V) on medium:V > Vth1carrier is presentV > Vth2 collision

    Time

    Vth2

    Vth1

    V

  • 7/31/2019 Chapter5(Link) ECE358Slides

    35/182

    Data Link Layer 5-35

    CSMA collisions

    collisions canstill occur:propagation delay meanstwo nodes may not heareach others transmission

    collision:entire packet transmissiontime wasted

    note:role of distance & propagationdelay in determining collisionprobability

  • 7/31/2019 Chapter5(Link) ECE358Slides

    36/182

    Data Link Layer 5-36

    CSMA/CD (Collision Detection)

    CSMA/CD: carrier sensing, deferral as in CSMA collisions detectedwithin short time

    colliding transmissions aborted, reducing channelwastage

    collision detection: easy in wired LANs: measure signal strengths

    difficult in wireless LANs

  • 7/31/2019 Chapter5(Link) ECE358Slides

    37/182

    37

    CSMA/CD Start:i = 0

    Success

    Sendjamming signal+Abort

    i++

    Sensemedium

    i > Kmax

    R = Random(0,2i-1)

    WaitTB= R*Tp

    Error

    Yes

    No

    Busy WaitY

    N

    No collisionCollision

    TransmitframeWHILEdetectingcollision

    Exponential backoff

  • 7/31/2019 Chapter5(Link) ECE358Slides

    38/182

    38

    CSMA/CD

    Medium sensing is done for 96 bit-times.

    Jamming signal length is 48 bits. Jamming signal createsenough energy on the medium for collision detection.

    Tp is equated with 512 bit-times.

    i saturates at 10.

  • 7/31/2019 Chapter5(Link) ECE358Slides

    39/182

    Data Link Layer 5-39

    CSMA/CD collision detection

  • 7/31/2019 Chapter5(Link) ECE358Slides

    40/182

    Data Link Layer 5-40

    Taking Turns MAC protocols

    channel partitioning MAC protocols:

    share channel efficientlyand fairlyat high load

    inefficient at low load: delay in channel access,1/N bandwidth allocated even if only 1 activenode!

    random access MAC protocols

    efficient at low load: single node can fullyutilize channel

    high load: collision overhead

    taking turns protocols

    look for best of both worlds!

  • 7/31/2019 Chapter5(Link) ECE358Slides

    41/182

    Data Link Layer 5-41

    Taking Turns MAC protocols

    Polling: master node

    invites slave nodesto transmit in turn

    typically used withdumb slave devices

    concerns: polling overhead

    latency single point of

    failure (master)

    master

    slaves

    poll

    data

    data

  • 7/31/2019 Chapter5(Link) ECE358Slides

    42/182

    Data Link Layer 5-42

    Taking Turns MAC protocols

    Token passing: control token passed

    from one node to nextsequentially.

    token message concerns:

    token overhead

    latency

    single point of failure(token)

    T

    data

    (nothingto send)

    T

  • 7/31/2019 Chapter5(Link) ECE358Slides

    43/182

    43

    Wireless LAN

    IEEE 802.11/a/b/g

  • 7/31/2019 Chapter5(Link) ECE358Slides

    44/182

    44

    WLAN View

    Access

    Point

    C

    C

    C: Computer, AP: Access Point

    Radio range of the AP

    IEEE 802.11 protocol

    Basic Service Set (BSS): BSSID = MAC address of APIndependent BSS (IBSS)= BSS - APExtended Service Set (ESS): A collection of BSS

    connected by a Distribution System

  • 7/31/2019 Chapter5(Link) ECE358Slides

    45/182

    45

    IEEE 802.11/a/b/g/n Family

    IEEE Technique Frequency

    Band

    Rate

    (Mbps)

    802.11 DSSS

    FHSS

    2.4 GHz

    2.4 GHz

    1 and 2

    1 and 2

    802.11a OFDM 5 GHz 6--54802.11b DSSS 2.4 GHz 5.5 and 11

    802.11g

    802.11n

    802.11ac

    (Draft/Nov. 2011)

    OFDM

    OFDM

    OFDM

    2.4 GHz

    2.4/5 GHz

    5 GHz

    22 and 54

    72 and 150

    6.9 Gbps

  • 7/31/2019 Chapter5(Link) ECE358Slides

    46/182

    46

    Different Modes of Operation of MAC in IEEE802.11

    Modes of IEEE802.11 MAC

    Point Coordination

    Function(PCF)modeDistributed Coordination

    Function(DCF)mode

    With Hand-shake Without Hand-shake

  • 7/31/2019 Chapter5(Link) ECE358Slides

    47/182

    47

    PCF Mode: Optional

    The AP Operates as the central controller for all nodes within its range. Decideswho transmits and when.

    Can follow a round-robin policy to allocate slots.

    Note:There is no contention for medium access.

    This mode Can support real-time traffic due to periodic scheduling.

    Leads to waste of bandwidth if a scheduled node has no traffic.

    Is optional

  • 7/31/2019 Chapter5(Link) ECE358Slides

    48/182

    48

    DCF Mode: Mandatory

    An AP Need not be used.

    Computers can directly communicate among themselves

  • 7/31/2019 Chapter5(Link) ECE358Slides

    49/182

    49

    Alternating use of PCF and DCF

    The WLAN operates In the PCF mode for T1 seconds

    Bandwidth guarantee for some nodes

    In the DCF mode for T2 seconds Nodes with additional traffic can contend for a share of the bandwidth

    PCF DCF PCF DCF PCF DCF

    TimeT1 T2 T3 T4

  • 7/31/2019 Chapter5(Link) ECE358Slides

    50/182

    50

    DCF with hand-shake A sender obtains permission from the receiver

    before transmitting a data frame. called hand-shake

    Hand-shake mechanism Sender transmits a Request To Send (RTS) frame

    Receiver gives permission by sending back a Clear To Send (CTS)frame

    Used to increase the probability of successful Tx when

    Packet length is long. ( dotRTSThreshold holds the value.)

    Incurs additional cost

    loss of some bandwidth due to hand-shake

  • 7/31/2019 Chapter5(Link) ECE358Slides

    51/182

    51

    DCF with and without hand-shake

    The two modes are not mutually exclusive. A node decides what mode to use on a frame/frame basis. The MAC management database contains a variable

    dotRTSThreshold: integer in bytes

    Length of a data frame >= dotRTSThreshold

    Use hand-shake

    Length of a data frame < dotRTSThreshold

    Do not use hand-shake

    PCF PCF

    DCF

    Hand-shake

    No hand-shake

    PCF

    DCF

    Mode of operation of the same node}

  • 7/31/2019 Chapter5(Link) ECE358Slides

    52/182

    52

    DCF withouthand-shake A sender does not obtain permission from the

    receiver before transmitting a data frame.

    RTS/CTS mechanism is NOTused. There is no prior coordination between sender and receiver

    A sender transmits a frame when some medium sensing conditions are satisfied.

    To follow

    When data frames are short Use this to save bandwidth

  • 7/31/2019 Chapter5(Link) ECE358Slides

    53/182

    53

    Problems in WLAN

    Hidden Terminal Problem Exposed Terminal Problem

    Inability to detect collision (at the receiver)

    Assumption All nodes have identical radio ranges

    how far away their signals can be received

    Note The assumption is not the cause of the problems.

    Without this assumption, the problems become worse.

  • 7/31/2019 Chapter5(Link) ECE358Slides

    54/182

    Exp sed Terminal Pr blem

  • 7/31/2019 Chapter5(Link) ECE358Slides

    55/182

    55

    Exposed Terminal Problem

    A B C

    Tx

    Problem- A istransmittinga frame to D.- B knowsthat someone is transmitting.

    - If B transmits a frame to C, no problem. However, Bdoes not transmitbecause it is unaware of Ds location.

    The above problem is due to B beingexposedto As Tx.

    D

  • 7/31/2019 Chapter5(Link) ECE358Slides

    56/182

    56

    No collision detection

    Fact:Collision at receiver is more serious than

    collision at transmitter. In a wired LAN Collision is indirectlydetected after some delay by

    the sender. In a WLAN, collision detection by sender is not

    possible. That is why we have the hidden terminal problem.

    Collision is avoided (CA), rather than detected

    WLAN MAC: CSMA/CA

  • 7/31/2019 Chapter5(Link) ECE358Slides

    57/182

    57

    WLAN MAC: CSMA/CA (RTS: Request to Send; CTS: Clear to Send)

    In CSMA/CA, collision is avoided using PHY-level carrier sensing: Done in receiver hardware Virtual carrier sensing: Done by examining frame header

    Frame headers of RTS, CTS, DATA A durationfield in frame headers indicates

    for how long the sender of the frame may use the medium.

    A Network Allocation Vector is managed using durationfields Each node has its own NAV (essentially an integer)

    NAV > 0: A node had announced its intention to use the medium now.

    NAV = 0:Nobody had wanted to use the medium now.

    Transmit condition: When medium is idle(Carrier is absent)AND(NAV = 0)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    58/182

    58

    NAV Update Mechanism

    Each node has its own NAV. NAV is the length of time for which the medium is likely

    to remain busy.

    Procedure to update NAV Initially: NAV = 0. With each passing s (micro second)

    NAV = NAV 1 Stop decrementing ifNAV = 0.

    NAV is updated using the durationfield in a received

    frame NAV = Max(NAV, duration)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    59/182

    59

    RTS and CTS Frames

    Frame format

    FrameControl

    Duration RA TA FCSRTS

    FrameControl

    Duration RA FCSCTS/ACK

    2 2 6 6 4 bytes

    2 2 6 4 bytes

    FCS: Frame Check Sequence CRCRA: Receiver AddressTA: Transmitter Address

  • 7/31/2019 Chapter5(Link) ECE358Slides

    60/182

    60

    DATA Frame

    Frame format

    FrameControl

    Duration/ID

    A1 A2 A3 A4Seq.

    ControlFCSFrame Body

    RA TA

    TA:Physically transmitting the frame.

    TA RA

    Ti i I l

  • 7/31/2019 Chapter5(Link) ECE358Slides

    61/182

    61

    Timing Intervals The IEEE 802.11 MAC defines 4 timing intervals 2 at the PHY level

    SIFS: Short Inter-Frame Space (10 micro-sec)

    aSlot (20 micro-sec)

    2 at the MAC level PIFS: Priority (in PCF) IFS (SIFS + aSlot)

    DIFS: Distributed IFS (PIFS + aSlot)

    Note:aSlot is chosen s.t. a station is capable of determining if another

    station initiated a Tx at the beginning of the previous slot.

    H d h k i RTS/CTS

  • 7/31/2019 Chapter5(Link) ECE358Slides

    62/182

    62

    Hand-shake using RTS/CTS

    RTS

    CTSSIFS

    SIFSDATA

    SIFS ACK

    Value of duration in RTS

    Value of duration in CTS

    A

    B

    C(neighbor of A)

    D

    (neighbor of B)

    Value of NAV of C

    Value of NAV of D

    Time

    DIFS

    data

    DCF with Hand-shake: Tx

  • 7/31/2019 Chapter5(Link) ECE358Slides

    63/182

    63

    DCF with Hand shake: TxF: a new data frame to be transmittedi = 0, CW = CWmin

    NAV =0?

    Send RTSStart a timer

    Cancel timer

    Send DATA (F)Start a timer

    i = i+1

    CW = CWmin*2i

    (At some point, CW saturates at CWmax.)

    Timeout

    Timeout

    RandomBackoff

    No

    Yes

    CTS is received

    ACK is received

    End ofbackoff

    Yes

    No

    Medium idlefor DIFS?

    B k ff M h i

  • 7/31/2019 Chapter5(Link) ECE358Slides

    64/182

    64

    Backoff Mechanism

    Initialize a counter: Backoff Time Counter (BTC)

    BTC = Random(0,CW-1) The time unit of BTC is aSlotTime

    aSlotTime: propagation + transceiver switching time

    As time passes, BTC is decremented as follows BTC = BTC -1 if medium is idle for aSlotTime

    Pause decrementing BTCif medium is busy

    Resume decrementingBTCif medium is idle for DIFS.

    Subsequent decrementing is done for every aSlotTime ofidleness of the medium.

    B k ff M h i

  • 7/31/2019 Chapter5(Link) ECE358Slides

    65/182

    65

    Backoff Mechanism

    Ch. busy dueto node A

    Ch. Busy due tonode C

    DIFS DIFSX X X X

    BTC = 5

    5 4 3 3 2

    3

    X = aSlotTime

    B 1 0

    Time

    Bis executingbackoff

  • 7/31/2019 Chapter5(Link) ECE358Slides

    66/182

    66

    DCF with Hand-shake: Rx

    Receive RTS

    NAV = 0?

    Send CTS

    No

    Yes

    No

    Yes

    Receive DATA frame

    Send data to upperlayer

    Send ACK

    Note:The above two fragments of flow-charts can

    be easily merged.

    No

    Yes

    Medium idle forSIFS?

    Medium idle forSIFS?

    DCF Mode without Hand shake

  • 7/31/2019 Chapter5(Link) ECE358Slides

    67/182

    67

    DCF Mode without Hand-shake

    A special case of DCF with hand-shake

    RTS/CTS frames are not exchanged. The idea of NAV is still used in this mode All nodes process the received RTS/CTS of others

    NOTE: A node may broadcast a DATA frame to all Done in DCF without hand-shake

    Receivers do not send back an ACK.

    Withouthandshake

    RTS/CTS This must processreceived RTS/CTS

    PCF Mode: AP becomes the controller

  • 7/31/2019 Chapter5(Link) ECE358Slides

    68/182

    68

    AP alternates between PCF and DCF modes

    AP operates as the controller as follows AP senses the medium at the start of a CF (Contention-

    Free) period for a PIFS (Priority IFS) interval. SIFS < PIFS < DIFS

    You know that

    PIFS = SIFS + aSlotTime

    DIFS = SIFS + 2*aSlotTime

    If the medium is idle for PIFS, transmit a beacon frame Beacon contains a CFPMaxDuration field

    Nodes receiving a beacon update their NAV to CFPMaxDuration

    These nodes perceive the medium to be busy for CFPMaxDuration

    PCF Mode of Operation (Contd )

  • 7/31/2019 Chapter5(Link) ECE358Slides

    69/182

    69

    PCF Mode of Operation (Contd.)

    After transmitting a beacon, AP waits for SIFS beforetransmitting one of the following

    DATA frame

    CF Poll frame

    DATA+CF Poll frame ACK frame

    CF End frame

  • 7/31/2019 Chapter5(Link) ECE358Slides

    70/182

    70

    PCF Mode of Operation (Contd.)

    CF Poll frame

    AP APUser 1 User 2 User 1

    CF Poll CF Poll

    DATA DATA

    ACK ACK

    The polled usersends data toanother user.

    The polled user sendsdata to the AP.

    SIFS

    SIFS

    SIFS

    SIFS

    Time

  • 7/31/2019 Chapter5(Link) ECE358Slides

    71/182

    71

    PCF Mode of Operation (Contd.)

    DATA + CF Poll frame

    AP User 1 User 2DATA+CFPoll

    DATA

    ACK

    The polled user receives data from the AP andsends data to another user.

    SIFS

    SIFS

    ACK

    Note 1:If AP doesnotreceive an ACK, itretransmits data after PIFS.

    Note 2:If User 1 does not receive ACK, it doesnot retransmitdata.

    PCF Mode of Operation (Contd )

  • 7/31/2019 Chapter5(Link) ECE358Slides

    72/182

    72

    PCF Mode of Operation (Contd.)

    DATA frame

    Contains user data from AP to a specific station. The receiver sends back an ACK after SIFS interval.

    AP does not receive an ACK Retransmit the DATA after a PIFS interval

    AP can broadcast a DATA frame These are not ACKed.

    PCF Mode of Operation (Contd )

  • 7/31/2019 Chapter5(Link) ECE358Slides

    73/182

    73

    PCF Mode of Operation (Contd.)

    CF Poll frame

    AP grants permission to another node to transmit DATAto the AP or to a third node.

    Receiver of DATA frame sends an ACK to the sender.

    If the polled node has no data to send, it sends a null

    DATA frame. If the polled station does not receive an ACK, it can not

    retransmit its data frame until it is polled again.

  • 7/31/2019 Chapter5(Link) ECE358Slides

    74/182

    A d j i i WLAN ith AP

  • 7/31/2019 Chapter5(Link) ECE358Slides

    75/182

    75

    A node joining a WLAN with an AP

    (No need for such a procedure in a wired LAN) Two ways for a node to join a WLAN Passive scanning

    Scan a channel for a Beacon frame

    If a Beacon frame is received NegotiateAuthentication andAssociation processes

    Active Scanning Transmit a Probe frame

    If a Probe Response is received Negotiate Authentication and Authorization processes

    Summary of MAC protocols

  • 7/31/2019 Chapter5(Link) ECE358Slides

    76/182

    Data Link Layer 5-76

    Summary of MAC protocols

    channel partitioningby time, frequency or code Time Division, Frequency Division, Code Division

    random access(dynamic), ALOHA, S-ALOHA, CSMA/CD

    carrier sensing: easy in some technologies (wire), hard in wireless

    CSMA/CD used in Ethernet

    CSMA/CA used in 802.11

    taking turns polling from central site, token passing

    Bluetooth, FDDI (Fibre Dist. Data Interface), IBM Token Ring

    Bluetoothpiconet

    master

    Up to 7 slaves

    Li k L

  • 7/31/2019 Chapter5(Link) ECE358Slides

    77/182

    Data Link Layer 5-77

    Link Layer

    5.1 Introduction andservices

    5.2 Error detection andcorrection

    5.3Multiple accessprotocols

    5.4 Link-LayerAddressing

    5.5 Ethernet

    5.6 Link-layer switches5.7 PPP

    5.8 Link virtualization:MPLS

    5.9 A day in the life of aweb request

    3.4 Reliable data transfer

    MAC Add d ARP

  • 7/31/2019 Chapter5(Link) ECE358Slides

    78/182

    Data Link Layer 5-78

    MAC Addresses and ARP (Address Resolution Protocol)

    32-bit IP address: (for comparison only .) network-layeraddress

    used to get datagram to destination IP subnet

    MAC (or LAN or physical or Ethernet) address: function:get frame from one interface to another

    physically-connected interface(same network)

    48 bit MAC address (for most LANs) burned in NIC ROM, also sometimes software settable

  • 7/31/2019 Chapter5(Link) ECE358Slides

    79/182

    LAN Add d ARP

  • 7/31/2019 Chapter5(Link) ECE358Slides

    80/182

    Data Link Layer 5-80

    LAN Addresses and ARP

    Each adapter on LAN has unique LAN address

    Broadcast address =FF-FF-FF-FF-FF-FF

    = adapter

    1A-2F-BB-76-09-AD

    58-23-D7-FA-20-B0

    0C-C4-11-6F-E3-98

    71-65-F7-2B-08-53

    LAN(wired orwireless)

    LAN Address (more)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    81/182

    Data Link Layer 5-81

    LAN Address (more)

    MAC address allocationadministered by IEEE

    manufacturer buys portion of MAC address space(to assure uniqueness)

    MAC flat address portability can move LAN card from one LAN to another

    (IP hierarchical address NOT portable) address depends on IP subnet to which node is attached

    ARP: Address Resolution Protocol

  • 7/31/2019 Chapter5(Link) ECE358Slides

    82/182

    Data Link Layer 5-82

    ARP: Address Resolution Protocol

    Each IP node (host, router)

    on LAN has ARP table

    ARP table: IP/MAC addr.mappings for some LAN

    nodes< IP address; MAC address; TTL>

    TTL (Time To Live): timeafter which address mappingwill be forgotten (typically 20min)

    Question:

    how to determine Bs MAC addressknowing Bs IP address?

    1A-2F-BB-76-09-AD

    58-23-D7-FA-20-B0

    0C-C4-11-6F-E3-98

    71-65-F7-2B-08-53

    LAN

    137.196.7.23

    137.196.7.78

    137.196.7.14

    137.196.7.88

    ARP protocol: Same LAN (network)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    83/182

    Data Link Layer 5-83

    ARP protocol Same LAN (network)

    A wants to send datagram

    to B, and Bs MAC addressnotin As ARP table.

    A broadcastsARP querypacket, containing B's IPaddress

    dest MAC address =FF-FF-FF-FF-FF-FF

    all machines on LANreceive ARP query

    B receives ARP query,replies to A with its (B's)MAC address frame sent to As MAC

    address (unicast)

    A caches (saves) IP-to-MACaddress pair in its ARP tableuntil information becomes old(times out)

    soft state: information

    that times out (goes away)unless refreshed

    ARP is plug-and-play: nodes create their ARP

    tables without interventionfrom net administrator

    Addressing: routing to another LAN

  • 7/31/2019 Chapter5(Link) ECE358Slides

    84/182

    Data Link Layer 5-84

    walkthrough: send datagram from A to B via R.

    focus on addressing - at both IP (datagram) and MAC layer (frame) assume A knows Bs IP address

    assume A knows Bs MAC address (how?)

    assume A knows IP address of first hop router, R (how?)

    assume A knows MAC address of first hop router interface (how?)

    Addressing routing to another LAN

    R

    1A-23-F9-CD-06-9B222.222.222.220

    111.111.111.110E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

    111.111.111.112

    111.111.111.111

    74-29-9C-E8-FF-55

    A

    222.222.222.22249-BD-D2-C7-56-2A

    222.222.222.22188-B2-2F-54-1A-0F

    B

    Addressing: routing to another LAN

  • 7/31/2019 Chapter5(Link) ECE358Slides

    85/182

    Data Link Layer 5-85

    Addressing routing to another LAN

    R

    1A-23-F9-CD-06-9B222.222.222.220

    111.111.111.110E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

    111.111.111.112

    111.111.111.111

    74-29-9C-E8-FF-55

    A

    IPEth

    Phy

    IP src: 111.111.111.111

    IP dest: 222.222.222.222

    A creates IP datagram with IP source A, destination B

    A creates link-layer frame with R's MAC address as dest,frame contains A-to-B IP datagram

    MAC src: 74-29-9C-E8-FF-55

    MAC dest: E6-E9-00-17-BB-4B

    222.222.222.22249-BD-D2-C7-56-2A

    222.222.222.22188-B2-2F-54-1A-0F

    B

    Addressing: routing to another LAN

  • 7/31/2019 Chapter5(Link) ECE358Slides

    86/182

    Data Link Layer 5-86

    Addressing routing to another LAN

    R

    1A-23-F9-CD-06-9B222.222.222.220

    111.111.111.110E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

    111.111.111.112

    111.111.111.111

    74-29-9C-E8-FF-55

    A

    IPEth

    Phy

    frame sent from A to R

    IP src: 111.111.111.111

    IP dest: 222.222.222.222

    MAC src: 74-29-9C-E8-FF-55

    MAC dest: E6-E9-00-17-BB-4B

    IPEth

    Phy

    frame received at R, datagram removed, passed up to IP

    222.222.222.22249-BD-D2-C7-56-2A

    222.222.222.22188-B2-2F-54-1A-0F

    B

    Addressing: routing to another LAN

  • 7/31/2019 Chapter5(Link) ECE358Slides

    87/182

    Data Link Layer 5-87

    Addressing routing to another LAN

    R

    1A-23-F9-CD-06-9B222.222.222.220

    111.111.111.110E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

    111.111.111.112

    111.111.111.111

    74-29-9C-E8-FF-55 222.222.222.22249-BD-D2-C7-56-2A

    222.222.222.22188-B2-2F-54-1A-0F

    BA

    IP src: 111.111.111.111

    IP dest: 222.222.222.222

    R forwards datagram with IP source A, destination B

    R creates link-layer frame with B's MAC address as dest,frame contains A-to-B IP datagram

    MAC src: 1A-23-F9-CD-06-9B

    MAC dest: 49-BD-D2-C7-56-2A

    IPEth

    Phy

    IP

    EthPhy

    Addressing: routing to another LAN

  • 7/31/2019 Chapter5(Link) ECE358Slides

    88/182

    Data Link Layer 5-88

    Address ng rout ng to another LAN

    R

    1A-23-F9-CD-06-9B222.222.222.220

    111.111.111.110E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

    111.111.111.112

    111.111.111.111

    74-29-9C-E8-FF-55 222.222.222.22249-BD-D2-C7-56-2A

    222.222.222.22188-B2-2F-54-1A-0F

    BA

    R forwards datagram with IP source A, destination B

    R creates link-layer frame with B's MAC address as dest,frame contains A-to-B IP datagram

    IP src: 111.111.111.111

    IP dest: 222.222.222.222

    MAC src: 1A-23-F9-CD-06-9B

    MAC dest: 49-BD-D2-C7-56-2A

    IPEth

    Phy

    IP

    EthPhy

    Addressing: routing to another LAN

  • 7/31/2019 Chapter5(Link) ECE358Slides

    89/182

    Data Link Layer 5-89

    ng u ng n L N

    R

    1A-23-F9-CD-06-9B222.222.222.220

    111.111.111.110E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

    111.111.111.112

    111.111.111.111

    74-29-9C-E8-FF-55 222.222.222.22249-BD-D2-C7-56-2A

    222.222.222.22188-B2-2F-54-1A-0F

    BA

    R forwards datagram with IP source A, destination B

    R creates link-layer frame with B's MAC address as dest,frame contains A-to-B IP datagram

    IP src: 111.111.111.111

    IP dest: 222.222.222.222

    MAC src: 1A-23-F9-CD-06-9B

    MAC dest: 49-BD-D2-C7-56-2A

    IP

    EthPhy

    Link Layer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    90/182

    Data Link Layer 5-90

    Link Layer

    5.1 Introduction andservices

    5.2 Error detection andcorrection

    5.3Multiple accessprotocols

    5.4 Link-LayerAddressing

    5.5 Ethernet

    5.6 Link-layer switches5.7 PPP

    5.8 Link virtualization:MPLS

    5.9 A day in the life of aweb request

    Ethernet

  • 7/31/2019 Chapter5(Link) ECE358Slides

    91/182

    Data Link Layer 5-91

    Ethernet

    dominant wired LAN technology:

    cheap $20 for NIC

    first widely used LAN technology

    simpler, cheaper than token LANs and ATM

    kept up with speed race: 10 Mbps 10 Gbps

    Metcalfes Ethernet

    sketch

    Star topology

  • 7/31/2019 Chapter5(Link) ECE358Slides

    92/182

    Data Link Layer 5-92

    p gy

    bus topology popular through mid 90s

    all nodes in same collision domain (can collide with eachother)

    today:star topology prevails active switchin center each spoke runs a (separate) Ethernet protocol (nodes

    do not collide with each other)

    switch

    bus: coaxial cable star

    Ethernet Frame Structure

  • 7/31/2019 Chapter5(Link) ECE358Slides

    93/182

    Data Link Layer 5-93

    Ethernet Frame Structure

    Sending adapter encapsulates IP datagram (or othernetwork layer protocol packet) in Ethernet frame

    Preamble:

    7 bytes with pattern 10101010 followed by one bytewith pattern 10101011

    used to synchronize receiver, sender clock rates

    Ethernet Frame Structure (more)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    94/182

    Data Link Layer 5-94

    Ethernet Frame Structure (more)

    Addresses: 6 bytes if adapter receives frame with matching destination

    address, or with broadcast address (e.g. ARP packet), itpasses data in frame to network layer protocol

    otherwise, adapter discards frame

    Type: indicates higher layer protocol (mostly IPbut others possible, e.g., Novell IPX, AppleTalk)

    CRC: checked at receiver, if error is detected,frame is dropped

    Ethernet: Unreliable connectionless

  • 7/31/2019 Chapter5(Link) ECE358Slides

    95/182

    Data Link Layer 5-95

    Ethernet: Unreliable, connectionless

    connectionless: No handshaking between sending andreceiving NICs

    unreliable:receiving NIC doesnt send acks or nacksto sending NIC

    stream of datagrams passed to network layer can have gaps(missing datagrams)

    gaps will be filled if app is using TCP

    otherwise, app will see gaps

    Ethernets MAC protocol: unslotted CSMA/CD

    Ethernet CSMA/CD algorithm

  • 7/31/2019 Chapter5(Link) ECE358Slides

    96/182

    Data Link Layer 5-96

    g

    1. NIC receives datagramfrom network layer,creates frame

    2. If NIC senses channel idle,starts frame transmission.

    If NIC senses channelbusy, waits until channelidle, then transmits

    3. If NIC transmits entire

    frame without detectinganother transmission, NICis done with frame !

    4. If NIC detects anothertransmission whiletransmitting, aborts andsendsjam signal

    5. After aborting, NIC

    enters exponentialbackoff: after mthcollision, NIC chooses Katrandom from

    {0,1,2,,2m

    -1}. NIC waitsK512 bit times, returns toStep 2

    Ethernets CSMA/CD (more)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    97/182

    Data Link Layer 5-97

    Ethernet s CSMA/CD (more)

    Jam Signal: make sure allother transmitters areaware of collision; 48 bits

    Bit time: .1 microsec for 10Mbps Ethernet ;for K=1023, wait time is

    about 50 msec

    Exponential Backoff:

    Goal: adapt retransmissionattempts to estimatedcurrent load

    heavy load: random waitwill be longer

    first collision: choose K from{0,1}; delay is K 512 bittransmission times

    after second collision: choose

    K from {0,1,2,3} after ten collisions, choose K

    from {0,1,2,3,4,,1023}

    See/interact with Java

    applet on AWL Web site:highly recommended !

    CSMA/CD efficiency

  • 7/31/2019 Chapter5(Link) ECE358Slides

    98/182

    Data Link Layer 5-98

    CSMA/CD efficiency

    Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

    efficiency goes to 1 as tprop goes to 0

    as ttrans goes to infinity better performance than ALOHA: and simple,

    cheap, decentralized!

    transprop/ttefficiency 51

    1

    802.3 Ethernet Standards: Link & Physical Layers

  • 7/31/2019 Chapter5(Link) ECE358Slides

    99/182

    Data Link Layer 5-99

    y y

    manydifferent Ethernet standards common MAC protocol and frame format different speeds: 2 Mbps, 10 Mbps, 100 Mbps,

    1Gbps, 10G bps different physical layer media: fiber, cable

    application

    transport

    networklink

    physical

    MAC protocol

    and frame format

    100BASE-TX

    100BASE-T4

    100BASE-FX100BASE-T2

    100BASE-SX 100BASE-BX

    fiber physical layercopper (twisterpair) physical layer

    Manchester encoding

  • 7/31/2019 Chapter5(Link) ECE358Slides

    100/182

    Data Link Layer5-100

    Manchester encoding

    used in 10BaseT

    each bit has a transition

    allows clocks in sending and receiving nodes tosynchronize to each other no need for a centralized, global clock among nodes!

    Hey, this is physical-layer stuff!

    Link Layer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    101/182

    Data Link Layer5-101

    Link Layer

    5.1 Introduction andservices

    5.2 Error detection andcorrection

    5.3 Multiple accessprotocols

    5.4 Link-layerAddressing

    5.5 Ethernet

    5.6 Link-layer switches,LANs, VLANs

    5.7 PPP

    5.8 Link virtualization:

    MPLS5.9 A day in the life of a

    web request

    Hubs

  • 7/31/2019 Chapter5(Link) ECE358Slides

    102/182

    Data Link Layer5-102

    physical-layer (dumb) repeaters:

    bits coming in on one link go out allother links at samerate

    all nodes connected to hub can collide with one another

    no frame buffering

    no CSMA/CD at hub: host NICs detect collisions

    twisted pair

    hub

    Switch

  • 7/31/2019 Chapter5(Link) ECE358Slides

    103/182

    Data Link Layer5-103

    link-layer device: smarter than hubs, take

    activerole store, forward Ethernet frames

    examine incoming frames MAC address,selectively forward frame to one-or-more

    outgoing links when frame is to be forwarded onsegment, uses CSMA/CD to access segment

    transparent hosts are unaware of presence of switches

    plug-and-play, self-learning switches do not need to be configured

    Switch: allows multiplesimultaneous

  • 7/31/2019 Chapter5(Link) ECE358Slides

    104/182

    Data Link Layer5-104

    ptransmissions

    hosts have dedicated,direct connection to switch

    switches buffer packets Ethernet protocol used on

    eachincoming link, but nocollisions; full duplex each link is its own collision

    domain

    switching:A-to-A and B-to-B simultaneously,without collisions not possible with dumb hub

    A

    A

    B

    B

    C

    C

    switch with six interfaces(1,2,3,4,5,6)

    1 23

    45

    6

    Switch Table

  • 7/31/2019 Chapter5(Link) ECE358Slides

    105/182

    Data Link Layer5-105

    Switch Table

    Q:how does switch know thatA reachable via interface 4,B reachable via interface 5?

    A: each switch has a switch

    table, each entry: (MAC address of host, interface

    to reach host, time stamp)

    looks like a routing table!

    Q:how are entries created,maintained in switch table? something like a routing

    protocol?

    A

    A

    B

    B

    C

    C

    switch with six interfaces(1,2,3,4,5,6)

    1 23

    45

    6

    Switch: self-learning

    Source: AD t A

  • 7/31/2019 Chapter5(Link) ECE358Slides

    106/182

    Data Link Layer5-106

    Switch: self learning

    switchlearnswhich hostscan be reached throughwhich interfaces when frame received,

    switch learns location ofsender: incoming LANsegment

    records sender/locationpair in switch table

    A

    A

    B

    B

    C

    C

    1 23

    45

    6

    A A

    Dest: A

    MAC addr interface TTL

    Switch table(initially empty)

    A 1 60

    Switch: frame filtering/forwarding

  • 7/31/2019 Chapter5(Link) ECE358Slides

    107/182

    Data Link Layer5-107

    When frame received:

    1. record link associated with sending host

    2. index switch table using MAC dest address

    3. ifentry found for destination

    then {ifdest on segment from which frame arrived

    then drop the frame

    else forward the frame on interface indicated

    }elseflood forward on all but the interface

    on which the frame arrived

    Self-learning,

    Source: AD st: A

  • 7/31/2019 Chapter5(Link) ECE358Slides

    108/182

    Data Link Layer5-108

    f g,forwarding:

    example

    A

    A

    B

    B

    C

    C

    1 23

    45

    6

    A A

    Dest: A

    MAC addr interface TTL

    Switch table(initially empty)

    A 1 60

    A AA AA AA AA A

    frame destinationunknown:flood

    A A

    destination Alocation known:

    A 4 60

    selective send

    Interconnecting switches

  • 7/31/2019 Chapter5(Link) ECE358Slides

    109/182

    Data Link Layer5-109

    switches can be connected together

    A

    B

    Q:sending from A to G - how does S1 know toforward frame destined to F via S4 and S3?

    A:self learning! (works exactly the same as insingle-switch case!)

    S1

    C DE

    FS2

    S4

    S3

    HI

    G

    Self-learning multi-switch example

  • 7/31/2019 Chapter5(Link) ECE358Slides

    110/182

    Data Link Layer 5-110

    Suppose C sends frame to I, I responds to C

    Q:show switch tables and packet forwarding in S1,S2, S3, S4

    A

    B

    S1

    C DE

    FS2

    S4

    S3

    HI

    G

    1

    2

    Institutional network

  • 7/31/2019 Chapter5(Link) ECE358Slides

    111/182

    Data Link Layer 5-111

    Institutional network

    to externalnetwork

    router

    IP subnet

    mail server

    web server

    Switches vs. Routers

  • 7/31/2019 Chapter5(Link) ECE358Slides

    112/182

    Data Link Layer 5-112

    both store-and-

    forward devices routers: network-layer

    devices (examinenetwork-layer headers)

    switches are link-layerdevices (examine link-

    layer headers) routers maintain

    routing tables,implement routingalgorithms

    switches maintainswitch tables,implement filtering,learning algorithms

    applicationtransport

    networklinkphysical

    networklink

    physical

    linkphysical

    switch

    datagram

    application

    transportnetwork

    linkphysical

    frame

    frame

    frame

    datagram

    VLANs: motivation

  • 7/31/2019 Chapter5(Link) ECE358Slides

    113/182

    Data Link Layer 5-113

    VLANs motivation

    What happens if: CS user moves office to EE,

    but wants connect to CSswitch?

    single broadcast domain: all layer-2 broadcast

    traffic (ARP, DHCP)crosses entire LAN(security/privacy,efficiency issues)

    each lowest level switch hasonly few ports in use

    ComputerScience Electrical

    Engineering

    ComputerEngineering

    Whats wrong with this picture?

    VLANs Port-based VLAN: switch ports grouped(by switch management software) so

  • 7/31/2019 Chapter5(Link) ECE358Slides

    114/182

    Data Link Layer 5-114

    VLANs (by switch management software) sothat singlephysical switch

    Switch(es) supportingVLAN capabilities canbe configured todefine multiple virtualLANS over singlephysical LANinfrastructure.

    Virtual LocalArea Network

    1

    8

    9

    16102

    7

    Electrical Engineering

    (VLAN ports 1-8)

    Computer Science

    (VLAN ports 9-15)

    15

    Electrical Engineering

    (VLAN ports 1-8)

    1

    82

    7 9

    1610

    15

    Computer Science

    (VLAN ports 9-16)

    operates as multiplevirtual switches

    Port-based VLAN

  • 7/31/2019 Chapter5(Link) ECE358Slides

    115/182

    Data Link Layer 5-115

    Port based VLAN

    1

    8

    9

    16102

    7

    Electrical Engineering

    (VLAN ports 1-8)

    Computer Science

    (VLAN ports 9-15)

    15

    traffic isolation:frames

    to/from ports 1-8 canonlyreach ports 1-8 can also define VLAN based on

    MAC addresses of endpoints,rather than switch port

    dynamic membership:ports can be dynamicallyassigned among VLANs

    router

    forwarding between VLANS:

    done via routing (just as withseparate switches) in practice vendors sell combined

    switches plus routers

    VLANS spanning multiple switches

  • 7/31/2019 Chapter5(Link) ECE358Slides

    116/182

    Data Link Layer 5-116

    L p g m p

    trunk port:carries frames between VLANS definedover multiple physical switches

    frames forwarded within VLAN between switches cant bevanilla 802.1 frames (must carry VLAN ID info)

    802.1q protocol adds/removed additional header fields forframes forwarded between trunk ports

    1

    8

    9

    102

    7

    Electrical Engineering

    (VLAN ports 1-8)

    Computer Science

    (VLAN ports 9-15)

    15

    2

    73

    Ports 2,3,5 belong to EE VLAN

    Ports 4,6,7,8 belong to CS VLAN

    5

    4 6 816

    1

    802.1Q VLAN frame format

  • 7/31/2019 Chapter5(Link) ECE358Slides

    117/182

    Data Link Layer 5-117

    Type

    2-byte Tag Protocol Identifier

    (value: 81-00)

    Tag Control Information (12 bit VLAN ID field,

    3 bit priority field like IP TOS)

    RecomputedCRC

    Q f f

    802.1 frame

    802.1Q frame

    Link Layer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    118/182

    Data Link Layer 5-118

    L L y

    5.1 Introduction andservices

    5.2 Error detection andcorrection

    5.3Multiple accessprotocols

    5.4 Link-LayerAddressing

    5.5 Ethernet

    5.6 Link-layer switches5.7 PPP

    5.8 Link virtualization:MPLS

    5.9 A day in the life of aweb request

    Point to Point Data Link Control

  • 7/31/2019 Chapter5(Link) ECE358Slides

    119/182

    Data Link Layer 5-119

    one sender, one receiver, one link: easier thanbroadcast link:

    no Media Access Control

    no need for explicit MAC addressing

    e.g., dialup link, ISDN line popular point-to-point DLC protocols:

    PPP (point-to-point protocol)

    HDLC: High level data link control (Data link

    used to be considered high layer in protocolstack!

    PPP Design Requirements [RFC 1557]

  • 7/31/2019 Chapter5(Link) ECE358Slides

    120/182

    Data Link Layer5-120

    packet framing: encapsulation of network-layerdatagram in data link frame carry network layer data of any network layer

    protocol (not just IP) at same time

    ability to demultiplex upwards

    bit transparency: must carry any bit pattern in thedata field

    error detection (no correction)

    connection liveness: detect, signal link failure tonetwork layer

    network layer address negotiation: endpoint canlearn/configure each others network address

    PPP non-requirements

  • 7/31/2019 Chapter5(Link) ECE358Slides

    121/182

    Data Link Layer5-121

    q

    no error correction/recovery no flow control

    out of order delivery OK

    no need to support multipoint links (e.g., polling)

    Error recovery, flow control, data re-orderingall relegated to higher layers!

    PPP Data Frame

  • 7/31/2019 Chapter5(Link) ECE358Slides

    122/182

    Data Link Layer5-122

    Flag: delimiter (framing) Address: does nothing (only one option)

    Control: does nothing; in the future possiblemultiple control fields

    Protocol: upper layer protocol to which framedelivered (e.g., PPP-LCP, IP, IPCP, etc)

    PPP Data Frame

  • 7/31/2019 Chapter5(Link) ECE358Slides

    123/182

    Data Link Layer5-123

    info: upper layer data being carried check: cyclic redundancy check for error

    detection

    Byte Stuffing

  • 7/31/2019 Chapter5(Link) ECE358Slides

    124/182

    Data Link Layer5-124

    y g data transparency requirement: data field must

    be allowed to include flag pattern Q: is received data or flag?

    Sender:adds (stuffs) extra < 01111110> byteafter each < 01111110> data byte

    Receiver:

    two 01111110 bytes in a row: discard first byte,continue data reception

    single 01111110: flag byte

    Byte Stuffing

  • 7/31/2019 Chapter5(Link) ECE358Slides

    125/182

    Data Link Layer5-125

    y g

    flag bytepatternin datato send

    flag byte pattern plusstuffed byte intransmitted data

    PPP Data Control Protocol

  • 7/31/2019 Chapter5(Link) ECE358Slides

    126/182

    Data Link Layer5-126

    Before exchanging network-layer

    data, data link peers must configure PPP link (max. frame

    length, authentication)

    learn/configure networklayer information

    for IP: carry IP ControlProtocol (IPCP) msgs(protocol field: 8021) toconfigure/learn IP address

    Link Layer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    127/182

    Data Link Layer5-127

    y

    5.1 Introduction andservices

    5.2 Error detectionand correction

    5.3Multiple accessprotocols

    5.4 Link-LayerAddressing

    5.5 Ethernet

    5.6 Link-layer switches 5.7 PPP

    Skip 5.8 and 5.9

    5.8 Link virtualization: MPLS 5.9 A day in the life of a

    web request

    3.4 Reliable data transfer

    Virtualization of networks

  • 7/31/2019 Chapter5(Link) ECE358Slides

    128/182

    Data Link Layer5-128

    Virtualization of resources: a powerful abstraction in

    systems engineering: computing examples: virtual memory, virtual devices

    Virtual machines: e.g., java

    IBM VM OS from 1960s/70s

    layering of abstractions: dont sweat the details ofthe lower layer, only deal with lower layers abstractly

    The Internet: virtualizing networks

  • 7/31/2019 Chapter5(Link) ECE358Slides

    129/182

    Data Link Layer5-129

    1974: multiple unconnectednets ARPAnet

    data-over-cable networks

    packet satellite network (Aloha)

    packet radio network

    differing in: addressing conventions packet formats

    error recovery

    routing

    ARPAnet satellite net"A Protocol for Packet Network Intercommunication",

    V. Cerf, R. Kahn, IEEE Transactions on Communications,

    May, 1974, pp. 637-648.

    The Internet: virtualizing networks

  • 7/31/2019 Chapter5(Link) ECE358Slides

    130/182

    Data Link Layer5-130

    ARPAnet satellite net

    gateway

    Internetwork layer (IP): addressing: internetwork

    appears as single, uniformentity, despite underlying localnetwork heterogeneity

    network of networks

    Gateway: embed internetwork packets in

    local packet format or extractthem route (at internetwork level) to

    next gateway

    Cerf & Kahns Internetwork Architecture

  • 7/31/2019 Chapter5(Link) ECE358Slides

    131/182

    Data Link Layer5-131

    What is virtualized? two layers of addressing: internetwork and local

    network

    new layer (IP) makes everything homogeneous atinternetwork layer

    underlying local network technology cable

    satellite

    56K telephone modem today: ATM, MPLS

    invisible at internetwork layer. Looks like a linklayer technology to IP!

    ATM and MPLS

  • 7/31/2019 Chapter5(Link) ECE358Slides

    132/182

    Data Link Layer5-132

    ATM, MPLS separate networks in their ownright different service models, addressing, routing

    from Internet

    viewed by Internet as logical link connectingIP routers just like dialup link is really part of separate

    network (telephone network)

    ATM, MPLS: of technical interest in theirown right

    Asynchronous Transfer Mode: ATM

  • 7/31/2019 Chapter5(Link) ECE358Slides

    133/182

    Data Link Layer5-133

    1990s/00 standard for high-speed (155Mbps to

    622 Mbps and higher) Broadband IntegratedService Digital Networkarchitecture

    Goal:integrated, end-end transport of carry voice,video, data

    meeting timing/QoS requirements of voice, video(versus Internet best-effort model)

    next generation telephony: technical roots intelephone world

    packet-switching (fixed length packets, calledcells) using virtual circuits

    Multiprotocol label switching (MPLS)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    134/182

    Data Link Layer5-134

    initial goal: speed up IP forwarding by using fixedlength label (instead of IP address) to doforwarding borrowing ideas from Virtual Circuit (VC) approach

    but IP datagram still keeps IP address!

    PPP or Ethernet

    headerIP header remainder of link-layer frameMPLS header

    label Exp S TTL

    20 3 1 5

    MPLS capable routers

  • 7/31/2019 Chapter5(Link) ECE358Slides

    135/182

    Data Link Layer5-135

    a.k.a. label-switched router forwards packets to outgoing interface based

    only on label value (dont inspect IP address) MPLS forwarding table distinct from IP forwarding

    tables signaling protocol needed to set up forwarding RSVP-TE forwarding possible along paths that IP alone would

    not allow (e.g., source-specific routing) !! use MPLS for traffic engineering

    must co-exist with IP-only routers

    MPLS forwarding tables

  • 7/31/2019 Chapter5(Link) ECE358Slides

    136/182

    Data Link Layer5-136

    R1R2

    D

    R3R4R5

    0

    1

    00

    A

    R6

    in out out

    label label dest interface

    6 - A 0

    in out out

    label label dest interface

    10 6 A 1

    12 9 D 0

    in out out

    label label dest interface

    10 A 0

    12 D 0

    1

    in out out

    label label dest interface

    8 6 A 0

    0

    8 A 1

    Link Layer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    137/182

    Data Link Layer5-137

    5.1 Introduction andservices

    5.2 Error detection andcorrection

    5.3Multiple accessprotocols

    5.4 Link-LayerAddressing

    5.5 Ethernet

    5.6 Link-layer switches5.7 PPP

    5.8 Link virtualization:MPLS

    5.9 A day in the life of aweb request

    Synthesis: a day in the life of a web request

  • 7/31/2019 Chapter5(Link) ECE358Slides

    138/182

    Data Link Layer5-138

    journey down protocol stack complete! application, transport, network, link

    putting-it-all-together: synthesis! goal:identify, review, understand protocols (at

    all layers) involved in seemingly simple scenario:requesting www page

    scenario:student attaches laptop to campusnetwork, requests/receives www.google.com

    A day in the life: scenario

  • 7/31/2019 Chapter5(Link) ECE358Slides

    139/182

    Data Link Layer5-139

    Comcast network68.80.0.0/13

    Googles network

    64.233.160.0/1964.233.169.105

    web server

    DNS server

    school network

    68.80.2.0/24

    browser

    web page

    A day in the life connecting to the Internet

    DHCP

  • 7/31/2019 Chapter5(Link) ECE358Slides

    140/182

    Data Link Layer5-140

    connecting laptop needs toget its own IP address,

    addr of first-hop router,addr of DNS server: useDHCP

    router(runs DHCP)

    DHCP

    UDP

    IP

    Eth

    Phy

    DHCP

    DHCP

    DHCP

    DHCP

    DHCP

    DHCP

    UDPIP

    Eth

    Phy

    DHCP

    DHCP

    DHCP

    DHCPDHCP

    DHCP request encapsulatedin UDP, encapsulated in IP,

    encapsulated in 802.1Ethernet

    Ethernet frame broadcast(dest: FFFFFFFFFFFF) on LAN,received at router running

    DHCPserver Ethernet demuxedto IP

    demuxed, UDP demuxed toDHCP

    A day in the life connecting to the Internet

    DHCP f lDHCP

  • 7/31/2019 Chapter5(Link) ECE358Slides

    141/182

    Data Link Layer5-141

    DHCP server formulatesDHCP ACKcontainingclients IP address, IPaddress of first-hoprouter for client, name &IP address of DNS server

    router(runs DHCP)

    DHCP

    UDP

    IP

    Eth

    Phy

    DHCP

    DHCP

    DHCP

    DHCP

    DHCP

    UDPIP

    Eth

    Phy

    DHCP

    DHCP

    DHCP

    DHCP

    DHCP

    encapsulation at DHCPserver, frame forwarded(switch learning) throughLAN, demultiplexing atclient

    Client now has IP address, knows name & addr of DNSserver, IP address of its first-hop router

    DHCP client receives DHCPACK reply

    A day in the life ARP (before DNS, before HTTP)

    before sending HTTP requestDNS

  • 7/31/2019 Chapter5(Link) ECE358Slides

    142/182

    Data Link Layer5-142

    before sending HTTPrequest,need IP address of www.google.com:

    DNS

    DNS

    UDP

    IP

    Eth

    Phy

    DNS

    DNS

    DNS

    DNS query created, encapsulatedin UDP, encapsulated in IP,encapsulated in Eth. In order tosend frame to router, need MACaddress of router interface: ARP

    ARP querybroadcast, receivedby router, which replies withARP replygiving MAC addressof router interface

    client now knows MAC addressof first hop router, so can nowsend frame containing DNSquery

    ARP query

    Eth

    Phy

    ARP

    ARP

    ARP reply

    A day in the life using DNS

    DNS

    DNS server

    DNS

    UDP

    IPDNS

    DNS

  • 7/31/2019 Chapter5(Link) ECE358Slides

    143/182

    Data Link Layer5-143

    DNS

    UDP

    IP

    Eth

    Phy

    DNS

    DNS

    DNS

    DNS

    DNS

    IP datagram containing DNSquery forwarded via LAN

    switch from client to 1st hoprouter

    IP datagram forwarded fromcampus network into comcastnetwork, routed (tables createdby RIP, OSPF, IS-ISand/orBGProuting protocols) to DNSserver

    demuxed to DNS server DNS server replies to

    client with IP address ofwww.google.com

    Comcast network

    68.80.0.0/13

    Eth

    Phy

    DNS

    DNS

    A day in the life TCP connection carrying HTTP

    HTTPHTTP

  • 7/31/2019 Chapter5(Link) ECE358Slides

    144/182

    Data Link Layer5-144

    HTTP

    TCP

    IP

    Eth

    Phy

    HTTP

    to send HTTP request,

    client first opens TCPsocketto web server TCP SYN segment(step 1

    in 3-way handshake) inter-domain routedto webserver

    TCP connection established!64.233.169.105web server

    SYN

    SYN

    SYN

    SYN

    TCP

    IP

    Eth

    Phy

    SYN

    SYN

    SYN

    SYNACK

    SYNACK

    SYNACK

    SYNACK

    SYNACK

    SYNACK

    SYNACK

    web server responds withTCP SYNACK(step 2 in 3-way handshake)

    A day in the life HTTP request/reply

    HTTPHTTP

    HTTP

    web page finally (!!!)di l d

  • 7/31/2019 Chapter5(Link) ECE358Slides

    145/182

    Data Link Layer5-145

    HTTP

    TCP

    IP

    Eth

    Phy

    HTTP

    HTTP requestsent intoTCP socket

    IP datagram containingHTTP request routed towww.google.com

    IP datagram containingHTTP reply routed back toclient

    64.233.169.105

    web server

    HTTP

    TCP

    IP

    Eth

    Phy

    web server responds withHTTP reply(containingweb page)

    HTTP

    HTTP

    HTTPHTTP

    HTTP

    HTTP

    HTTP

    HTTP

    HTTP

    HTTP

    HTTP

    HTTP

    HTTP

    displayed

    Chapter 5: Summary

  • 7/31/2019 Chapter5(Link) ECE358Slides

    146/182

    Data Link Layer5-146

    principles behind data link layer services: error detection, correction sharing a broadcast channel: multiple access

    link layer addressing

    instantiation and implementation of various link

    layer technologies Ethernet

    switched LANS, VLANs

    PPP

    virtualized networks as a link layer: MPLS

    synthesis: a day in the life of a web request

    Chapter 5: lets take a breath

  • 7/31/2019 Chapter5(Link) ECE358Slides

    147/182

    Data Link Layer5-147

    journey down protocol stack complete(except PHY)

    solid understanding of networking principles,practice

    .. could stop here . but lotsof interestingtopics! wireless

    multimedia

    security

    network management

    3.4 Principles of Reliable data transfer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    148/182

    TransportLayer3-148

    important in app., transport, link layers top-10 list of important networking topics!

    characteristics of unreliable channel will determinecomplexity of reliable data transfer protocol (rdt)

    Network

    Linklayer

    Linklayer

    Principles of Reliable data transfer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    149/182

    TransportLayer3-149

    important in app., transport, link layers

    top-10 list of important networking topics!

    characteristics of unreliable channel will determinecomplexity of reliable data transfer protocol (rdt)

    Network

    Linklayer

    Principles of Reliable data transfer

  • 7/31/2019 Chapter5(Link) ECE358Slides

    150/182

    TransportLayer3-150

    important in app., transport, link layers

    top-10 list of important networking topics!

    characteristics of unreliable channel will determinecomplexity of reliable data transfer protocol (rdt)

    Network

    Linklayer

    Reliable data transfer: getting started

  • 7/31/2019 Chapter5(Link) ECE358Slides

    151/182

    Transport Layer3-151

    sendside receiveside

    rdt_send():called from above,

    (e.g., by app.). Passed data todeliver to receiver upper layer

    udt_send():called by rdt,to transfer packet over

    unreliable channel to receiver

    rdt_rcv():called when packet

    arrives on rcv-side of channel

    deliver_data():called by

    rdt to deliver data to upper

    Reliable data transfer: getting started

  • 7/31/2019 Chapter5(Link) ECE358Slides

    152/182

    Transport Layer3-152

    Well:

    incrementally develop sender, receiver sides ofreliable data transfer protocol (rdt)

    consider only unidirectional data transfer but control info will flow on both directions!

    use finite state machines (FSM) to specifysender, receiver

    state1 state2

    event causing state transitionactions taken on state transition

    state:when in this

    state next stateuniquely determined

    by next event

    eventactions

    Rdt1.0: reliable transfer over a reliable channel

  • 7/31/2019 Chapter5(Link) ECE358Slides

    153/182

    Transport Layer3-153

    underlying channel perfectly reliable no bit errors no loss of packets

    separate FSMs for sender, receiver: sender sends data into underlying channel

    receiver read data from underlying channel

    Wait forcall from

    abovepacket = make_pkt(data)udt_send(packet)

    rdt_send(data)

    extract (packet,data)

    deliver_data(data)

    Wait forcall from

    below

    rdt_rcv(packet)

    sender receiver

    Rdt2.0: channel with bit errors

  • 7/31/2019 Chapter5(Link) ECE358Slides

    154/182

    Transport Layer3-154

    underlying channel may flip bits in packet checksum to detect bit errors

    thequestion: how to recover from errors: acknowledgements (ACKs):receiver explicitly tells sender

    that pkt received OK

    negative acknowledgements (NAKs):receiver explicitlytells sender that pkt had errors

    sender retransmits pkt on receipt of NAK

    new mechanisms in rdt2.0 (beyond rdt1.0): error detection

    receiver feedback: control msgs (ACK,NAK) rcvr->sender

    How do humans recover from errorsduring conversation?

    Rdt2.0: channel with bit errors

  • 7/31/2019 Chapter5(Link) ECE358Slides

    155/182

    Transport Layer3-155

    underlying channel may flip bits in packet checksum to detect bit errors

    thequestion: how to recover from errors: acknowledgements (ACKs):receiver explicitly tells sender

    that pkt received OK

    negative acknowledgements (NAKs):receiver explicitlytells sender that pkt had errors

    sender retransmits pkt on receipt of NAK

    new mechanisms in rdt2.0 (beyond rdt1.0): error detection

    receiver feedback: control msgs (ACK,NAK) rcvr->sender

    rdt2.0: FSM specification

    receiverrdt_send(data)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    156/182

    Transport Layer3-156

    Wait for

    call fromabove

    sndpkt = make_pkt(data, checksum)

    udt_send(sndpkt)

    extract(rcvpkt,data) ,deliver_data(data)udt_send(ACK)

    rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

    rdt_rcv(rcvpkt) && isACK(rcvpkt)

    udt_send(sndpkt)

    rdt_rcv(rcvpkt) &&isNAK(rcvpkt)

    udt_send(NAK)

    rdt_rcv(rcvpkt) && corrupt(rcvpkt)

    Wait for

    ACK orNAK

    Wait for call

    from below

    sender

    receiver

    L

    rdt2.0: operation with no errors

    rdt_send(data)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    157/182

    Transport Layer3-157

    Wait for

    call fromabove

    snkpkt = make_pkt(data, checksum)

    udt_send(sndpkt)

    extract(rcvpkt,data),deliver_data(data)udt_send(ACK)

    rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

    rdt_rcv(rcvpkt) && isACK(rcvpkt)

    udt_send(sndpkt)

    rdt_rcv(rcvpkt) &&isNAK(rcvpkt)

    udt_send(NAK)

    rdt_rcv(rcvpkt) && corrupt(rcvpkt)Wait forACK or

    NAK

    Wait forcall frombelow

    L

    rdt2.0: error scenariordt_send(data)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    158/182

    Transport Layer3-158

    Wait for

    call fromabove

    snkpkt = make_pkt(data, checksum)udt_send(sndpkt)

    extract(rcvpkt,data),deliver_data(data)udt_send(ACK)

    rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

    rdt_rcv(rcvpkt) && isACK(rcvpkt)

    udt_send(sndpkt)

    rdt_rcv(rcvpkt) && isNAK(rcvpkt)

    udt_send(NAK)

    rdt_rcv(rcvpkt) && corrupt(rcvpkt)Wait for

    ACK orNAK

    Wait for

    call frombelow

    L

    rdt2.0 has a fatal flaw!

  • 7/31/2019 Chapter5(Link) ECE358Slides

    159/182

    Transport Layer3-159

    What happens ifACK/NAK corrupted? sender doesnt know what

    happened at receiver!

    cant just retransmit:

    possible duplicate

    Handling duplicates: sender retransmits current

    pkt if ACK/NAK garbled

    sender adds sequencenumberto each pkt

    receiver discards (doesntdeliver up) duplicate pkt

    Sender sends one packet,then waits for receiverresponse

    stop and wait

    rdt2.1: sender, handles garbled ACK/NAKs

    rdt_send(data)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    160/182

    Transport Layer3-160

    Wait forcall0fromabove

    sndpkt = make_pkt(0, data, checksum)

    udt_send(sndpkt)

    Wait forACK orNAK 0

    udt_send(sndpkt)

    rdt_rcv(rcvpkt) &&( corrupt(rcvpkt) ||isNAK(rcvpkt) )

    sndpkt = make_pkt(1, data, checksum)udt_send(sndpkt)

    rdt_send(data)

    rdt_rcv(rcvpkt)&& notcorrupt(rcvpkt)&& isACK(rcvpkt)

    udt_send(sndpkt)

    rdt_rcv(rcvpkt) &&

    ( corrupt(rcvpkt) ||isNAK(rcvpkt) )

    rdt_rcv(rcvpkt)&& notcorrupt(rcvpkt)

    && isACK(rcvpkt)

    Wait forcall1 fromabove

    Wait for ACKor NAK 1

    L

    L

    rdt2.1: receiver, handles garbled ACK/NAKs

    d ( k ) ( k )

  • 7/31/2019 Chapter5(Link) ECE358Slides

    161/182

    Transport Layer3-161

    Wait for0 frombelow

    sndpkt = make_pkt(NAK, chksum)udt_send(sndpkt)

    rdt_rcv(rcvpkt) &&not corrupt(rcvpkt) &&has_seq0(rcvpkt)

    rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

    && has_seq1(rcvpkt)extract(rcvpkt,data)deliver_data(data)sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

    Wait for1 frombelow

    rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)&& has_seq0(rcvpkt)

    extract(rcvpkt,data)deliver_data(data)sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

    rdt_rcv(rcvpkt) && (corrupt(rcvpkt)

    sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

    rdt_rcv(rcvpkt) &&not corrupt(rcvpkt) &&has_seq1(rcvpkt)

    rdt_rcv(rcvpkt) && (corrupt(rcvpkt)

    sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

    sndpkt = make_pkt(NAK, chksum)udt_send(sndpkt)

    rdt2.1: discussion

  • 7/31/2019 Chapter5(Link) ECE358Slides

    162/182

    Transport Layer3-162

    Sender: seq # added to pkt

    two seq. #s (0,1) willsuffice. Why?

    must check if receivedACK/NAK corrupted

    twice as many states state must remember

    whether current pkthas 0 or 1 seq. #

    Receiver: must check if received

    packet is duplicate state indicates whether

    0 or 1 is expected pktseq #

    note: receiver can notknow if its lastACK/NAK received OK

    at sender

    rdt2.2: a NAK-free protocol

  • 7/31/2019 Chapter5(Link) ECE358Slides

    163/182

    Transport Layer3-163

    same functionality as rdt2.1, using ACKs only instead of NAK, receiver sends ACK for last pkt

    received OK receiver must explicitlyinclude seq # of pkt being ACKed

    duplicate ACK at sender results in same action asNAK: retransmit current pkt

    rdt2.2: sender, receiver fragments

    rdt send(data)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    164/182

    Transport Layer3-164

    Wait for call0 fromabove

    sndpkt = make_pkt(0, data, checksum)

    udt_send(sndpkt)

    rdt_send(data)

    udt_send(sndpkt)

    rdt_rcv(rcvpkt) &&

    (corrupt(rcvpkt) ||isACK(rcvpkt,1))

    rdt_rcv(rcvpkt)

    && notcorrupt(rcvpkt)&& isACK(rcvpkt,0)

    Wait forACK0

    sender FSMfragment

    rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt)

    extract(rcvpkt,data)deliver_data(data)sndpkt = make_pkt(ACK1, chksum)udt_send(sndpkt)

    Wait for0 frombelow

    rdt_rcv(rcvpkt) &&(corrupt(rcvpkt) ||

    has_seq1(rcvpkt))

    udt_send(sndpkt)

    receiver FSMfragment

    L

    rdt3.0: channels with errors andloss

  • 7/31/2019 Chapter5(Link) ECE358Slides

    165/182

    Transport Layer3-165

    New assumption:underlying channel canalso lose packets (dataor ACKs) checksum, seq. #, ACKs,

    retransmissions will beof help, but not enough

    Approach: sender waitsreasonable amount oftime for ACK

    retransmits if no ACKreceived in this time

    if pkt (or ACK) just delayed(not lost):

    retransmission will beduplicate, but use of seq.#s already handles this

    receiver must specify seq# of pkt being ACKed

    requires countdown timer

    rdt3.0 senderrdt_send(data)

    rdt rcv(rcvpkt) &&

  • 7/31/2019 Chapter5(Link) ECE358Slides

    166/182

    Transport Layer3-166

    sndpkt = make_pkt(0, data, checksum)udt_send(sndpkt)

    start_timer

    WaitforACK0

    dt_ c ( c p t) &&( corrupt(rcvpkt) ||isACK(rcvpkt,1) )

    Wait forcall 1 fromabove

    sndpkt = make_pkt(1, data, checksum)udt_send(sndpkt)start_timer

    rdt_send(data)

    rdt_rcv(rcvpkt)

    && notcorrupt(rcvpkt)&& isACK(rcvpkt,0)

    rdt_rcv(rcvpkt) &&( corrupt(rcvpkt) ||isACK(rcvpkt,0) )

    rdt_rcv(rcvpkt)&& notcorrupt(rcvpkt)

    && isACK(rcvpkt,1)

    stop_timer

    stop_timer

    udt_send(sndpkt)start_timer

    timeout

    udt_send(sndpkt)start_timer

    timeout

    rdt_rcv(rcvpkt)

    Wait forcall 0fromabove

    WaitforACK1

    L

    rdt_rcv(rcvpkt)

    L

    L

    L

    rdt3.0 in action

  • 7/31/2019 Chapter5(Link) ECE358Slides

    167/182

    TransportLayer3-167

    rdt3.0 in action

  • 7/31/2019 Chapter5(Link) ECE358Slides

    168/182

    TransportLayer3-168

    Performance of rdt3.0

  • 7/31/2019 Chapter5(Link) ECE358Slides

    169/182

    TransportLayer3-169

    rdt3.0 works, but performance stinks ex: 1 Gbps link, 15 ms prop. delay, 8000 bit packet:

    Usender:utilizationfraction of time sender busy sending

    Usender

    =.008

    30.008= 0.00027

    L / R

    RTT + L / R=

    if RTT=30 msec, 1KB pkt every 30 msec -> 33kB/sec thruputover 1 Gbps link

    network protocol limits use of physical resources!

    dsmicrosecon8bps10

    bits80009

    R

    Ldtrans

    rdt3.0: stop-and-wait operation

  • 7/31/2019 Chapter5(Link) ECE358Slides

    170/182

    TransportLayer3-170

    first packet bit transmitted, t =0

    sender receive

    r

    RTT

    last packet bit transmitted, t = L/ R

    first packet bit arriveslast packet bit arrives, send

    ACK

    ACK arrives, send nextpacket, t = RTT + L / R

    Usender

    =.008

    30.008= 0.00027

    L / R

    RTT + L / R=

    Pipelined protocols

    i li i d ll lti l i fli ht t t

  • 7/31/2019 Chapter5(Link) ECE358Slides

    171/182

    TransportLayer3-171

    pipelining:sender allows multiple, in-flight, yet-to-

    be-acknowledged pkts range of sequence numbers must be increased

    buffering at sender and/or receiver

    two generic forms of pipelined protocols:go-Back-N,selective repeat

    Pipelining: increased utilization

    sender receiver

  • 7/31/2019 Chapter5(Link) ECE358Slides

    172/182

    TransportLayer3-172

    first packet bit transmitted, t

    = 0

    sender

    RTT

    last bit transmitted, t = L /R

    first packet bit arriveslast packet bit arrives, send ACK

    ACK arrives, send nextpacket, t = RTT + L / R

    last bit of 2ndpkt arrives, send ACK

    last bit of 3rdpkt arrives, send ACK

    Usender

    =.024

    30.008= 0.0008

    3 * L / R

    RTT + L / R=

    Increase utilizationby a factor of 3!

    Pipelined Protocols

  • 7/31/2019 Chapter5(Link) ECE358Slides

    173/182

    TransportLayer3-173

    Go-back-N: big picture: sender can have up to N

    unacked packets inpipeline

    rcvr only sends

    cumulative acks doesnt ack packet if

    theres a gap

    sender has timer foroldest unacked packet if timer expires,

    retransmit allunackedpackets

    Selective Repeat: big pic sender can have up to N

    unacked packets inpipeline

    rcvr sends individual ack

    for each packet

    sender maintains timerfor each unacked packet

    when a timer expires,retransmit onlyunackedpacket

    Go-Back-NS d :

  • 7/31/2019 Chapter5(Link) ECE358Slides

    174/182

    TransportLayer3-174

    Sender:

    k-bit seq # in pkt header window of up to N, consecutive unacked pkts allowed

    ACK(n): ACKs all pkts up to, including seq # n -cumulative ACK

    may receive duplicate ACKs (see receiver) timer for each in-flight pkt

    timeout(n): retransmit pkt n and all higher seq # pkts in window

    GBN: sender extended FSMrdt_send(data)

  • 7/31/2019 Chapter5(Link) ECE358Slides

    175/182

    TransportLayer3-175

    Waitstart_timerudt_send(sndpkt[base])udt_send(sndpkt[base+1])udt_send(sndpkt[nextseqnum-1])

    timeout

    if (nextseqnum < base+N) {sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum)

    udt_send(sndpkt[nextseqnum])if (base == nextseqnum) start_timernextseqnum++

    }elserefuse_data(data)

    base = getacknum(rcvpkt)+1If (base == nextseqnum) stop_timerelse start_timer

    rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

    base=1

    nextseqnum=1

    rdt_rcv(rcvpkt)&& corrupt(rcvpkt)

    L

    GBN: receiver extended FSMdefault

  • 7/31/2019 Chapter5(Link) ECE358Slides

    176/182

    TransportLayer3-176

    ACK-only: always send ACK for correctly-received pktwith highest in-orderseq # may generate duplicate ACKs need only remember expectedseqnum

    out-of-order pkt: discard (dont buffer) -> no receiver buffering!

    Re-ACK pkt with highest in-order seq #

    Wait

    udt_send(sndpkt)rdt_rcv(rcvpkt)

    && notcurrupt(rcvpkt)&& hasseqnum(rcvpkt,expectedseqnum)

    extract(rcvpkt,data)deliver_data(data)sndpkt = make_pkt(expectedseqnum,ACK,chksum)udt_send(sndpkt)expectedseqnum++

    expectedseqnum=1sndpkt =make_pkt(expectedseqnum,ACK,chksum)

    L

    GBN inaction

  • 7/31/2019 Chapter5(Link) ECE358Slides

    177/182

    TransportLayer3-177

    Selective Repeat

  • 7/31/2019 Chapter5(Link) ECE358Slides

    178/182

    TransportLayer3-178

    receiver individuallyacknowledges all correctlyreceived pkts buffers pkts, as needed, for eventual in-order delivery

    to upper layer

    sender only resends pkts for which ACK not

    received sender timer for each unACKed pkt

    sender window N consecutive seq #s

    again limits seq #s of sent, unACKed pkts

    Selective repeat: sender, receiver windows

  • 7/31/2019 Chapter5(Link) ECE358Slides

    179/182

    TransportLayer3-179

    Selective repeat

    sender receiver

  • 7/31/2019 Chapter5(Link) ECE358Slides

    180/182

    TransportLayer3-180

    data from above : if next available seq # in

    window, send pkt

    timeout(n): resend pkt n, restart timer

    ACK(n) in [sendbase,sendbase+N]: mark pkt n as received

    if n smallest unACKed pkt,advance window base to

    next unACKed seq #

    sender

    pkt n in[rcvbase, rcvbase+N-1] send ACK(n)

    out-of-order: buffer

    in-order: deliver (alsodeliver buffered, in-order

    pkts), advance window tonext not-yet-received pkt

    pkt n in[rcvbase-N,rcvbase-1] ACK(n)

    otherwise: ignore

    Selective repeat in action

  • 7/31/2019 Chapter5(Link) ECE358Slides

    181/182

    TransportLayer3-181

    Selective repeat:dilemma

  • 7/31/2019 Chapter5(Link) ECE358Slides

    182/182

    Example: seq #s: 0, 1, 2, 3

    window size=3

    receiver sees no

    difference in twoscenarios!

    incorrectly passesduplicate data as newin (a)