udlap computer networks spring 2015 pages 191-271

Upload: ponski

Post on 21-Feb-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    1/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    1

    23

    0111

    value in arrivingpackets header

    routing algorithm

    local forwarding table

    header value output link

    0100010101111001

    3221

    4.8 Routing algorithms

    Interplay between

    routing and forwarding

    191

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    u

    yx

    wv

    z2

    2

    13

    1

    1

    2

    53

    5

    Graph: G = (N,E)

    N = set of routers = { u, v, w, x, y, z }

    E = set of links ={ (u,v), (u,x), (u,w), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }

    Graph abstraction

    192

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    2/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Graph abstraction: costs

    u

    yx

    wv

    z2 21

    3

    1

    1

    2

    5

    3

    5 c(x,x) = cost of link (x,x)

    - e.g., c(w,z) = 5

    cost could always be 1, orinversely related to bandwidth,or inversely related tocongestion

    Cost of path (x1, x2, x3,, xp) = c(x1,x2) + c(x2,x3) + + c(xp-1,xp)

    Question: Whats the least-cost path between u and z ?

    Routing algorithm: algorithm that finds least-cost path

    193

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Routing Algorithm classification

    Global or decentralizedinformation?

    Global: all routers have complete

    topology, link cost info

    link state algorithms

    Decentralized: router knows physically-

    connected neighbors, linkcosts to neighbors

    iterative process ofcomputation, exchange ofinfo with neighbors

    distance vector algorithms

    Static or dynamic?

    Static:

    routes change slowlyover time

    Dynamic:

    routes change more

    quickly periodic update in response to link cost

    changes

    194

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    3/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    A Link-State Routing Algorithm

    Dijkstras algorithm

    net topology, link costsknown to all nodes

    accomplished via link

    state broadcast all nodes have same info computes least cost paths

    from one node (source)to all other nodes

    gives forwarding table forthat node

    iterative: after k iterations,

    know least cost path to kdest.s

    Notation: c(x,y): link cost from node x

    to y; = if not direct

    neighbors D(v): current value of cost of

    path from source to dest. v

    p(v): predecessor nodealong path from source to v

    N': set of nodes whose leastcost path definitively known

    195

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Dijsktras Algorithm

    1 Initialization:2 N' = {u}3 for all nodes v4 if v adjacent to u5 then D(v) = c(u,v)6 else D(v) = 78 Loop

    9 find w not in N' such that D(w) is a minimum10 add w to N'11 update D(v) for all v adjacent to w and not in N' :12 D(v) = min( D(v), D(w) + c(w,v) )13 /* new cost to v is either old cost to v or known14 shortest path cost to w plus cost from w to v */15 unti l all nodes in N'

    u

    yx

    wv

    z2

    2

    13

    1

    1

    2

    53

    5

    196

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    4/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Dijkstras algorithm: example

    Step01

    2345

    N'u

    ux

    uxyuxyv

    uxyvwuxyvwz

    D(v),p(v)2,u2,u

    2,u

    D(w),p(w)5,u4,x

    3,y3,y

    D(x),p(x)1,u

    D(y),p(y)

    2,x

    D(z),p(z)

    4,y4,y4,y

    u

    yx

    wv

    z2

    2

    1 3

    1

    1

    2

    53

    5

    197

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Dijkstras Algorithm Example

    The first 5 steps used in computing the shortest path from A toD. The arrows indicate the working node.

    198

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    5/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Distance Vector Algorithm

    Bellman-Ford Equation (dynamic programming)

    Define dx(y) := cost of least-cost path from x to y

    dx(y) = min {c(x,v) + dv(y) } for each node yN

    where min is taken over all neighbors of x

    Basic idea:

    Each node periodically sends its own distance vectorestimate to neighbors

    When node a node x receives new DV estimate from

    neighbor, it updates its own DV using B-F equation:

    199

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Bellman-Ford example

    u

    yx

    wv

    z2

    2

    13

    1

    1

    2

    53

    5Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3

    du(z) = min { c(u,v) + dv(z),c(u,x) + d

    x(z),

    c(u,w) + dw(z) }= min {2 + 5,

    1 + 3,5 + 3} = 4

    Node that achieves minimum is nexthop in shortest path forwarding table

    B-F equation says:

    200

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    6/41

    x y z

    xy

    z

    0 2 7

    from

    cost to

    from

    from

    x y z

    xy

    z

    0 2 3

    from

    cost tox y z

    xy

    z

    0 2 3

    from

    cost to

    x y z

    xyz

    cost tox y z

    xyz

    0 2 7

    from

    cost to

    x y z

    xyz

    0 2 3

    from

    cost to

    x y z

    xyz

    0 2 3

    from

    cost tox y z

    xyz

    0 2 7

    from

    cost to

    x y z

    xyz

    7 1 0

    cost to

    2 0 1

    2 0 1

    7 1 0

    2 0 17 1 0

    2 0 13 1 0

    2 0 1

    3 1 0

    2 0 1

    3 1 0

    2 0 1

    3 1 0

    time

    x z12

    7

    y

    node x table

    node y table

    node z table

    Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}

    = min{2+0 , 7+1} = 2

    Dx(z)= min{c(x,y) + Dy(z), c(x,z) + Dz(z)}

    = min{2+1 , 7+0} = 3

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    201

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Comparison

    Distance vector algorithm

    Very simple to implement May have convergence problems Used in RIP and EIGRP

    Link-state algorithm

    Much more complex Switches perform independent computations Used in OSPF (Open Shortest Path First Protocol)

    202

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    7/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    4.9 Hierarchical Routing

    scale: with 200 milliondestinations:

    cant store all dests inrouting tables!

    routing table exchangewould swamp links!

    administrative autonomy

    Internet = network ofnetworks

    each network admin maywant to control routing in itsown network

    Our routing study thus far - idealization

    all routers identical

    network flat

    not true in practice

    aggregate routers into regions,autonomous systems (AS)

    routers in same AS run samerouting protocol

    intra-AS routing protocol

    routers in different AS canrun different intra-ASrouting protocol

    Gateway router: Direct link torouter in another AS

    203

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Classification Of Internet Routing Protocols

    Two broad classes Interior Gateway Protocols (IGPs): aka Intra-AS routing protocols.

    Used among routers within autonomous system Destinations lie within IGP RIP: Routing Information Protocol. RIPng for IPv6 OSPF: Open Shortest Path First. OSPFv3 for IPv6 IGRP/EIGRP: Interior Gateway Routing Protocol (Cisco proprietary)

    Exterior Gateway Protocols (EGPs) Used among autonomous systems (BGP) Destinations lie throughout Internet

    204

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    8/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    3b

    1d

    3a

    1c

    2a

    AS3

    AS1

    AS21a

    2c

    2b1b

    Intra-ASRoutingalgorithm

    Inter-ASRoutingalgorithm

    Forwardingtable

    3c

    Interconnected ASes

    Forwarding table isconfigured by both intra-and inter-AS routingalgorithm

    Intra-AS sets entries forinternal dests

    Inter-AS & Intra-As setsentries for external dests

    205

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    RIP ( Routing Information Protocol)

    Distance vector algorithm

    Distance metric: # of hops (max = 15 hops)

    DC

    BA

    u v

    w

    x

    yz

    destination hopsu 1v 2

    w 2x 3y 3z 2

    Distance vectors:exchanged amongneighbors every 30 secvia Response Message(also calledadvertisement)

    Each advertisement: listof up to 25 destinationnets within AS

    206

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    9/41

    Destination Network Next Router Num. of hops to dest.

    w A 2y B 2

    z B A 7 5x -- 1. . ....

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    RIP: Example

    w x y

    z

    A

    C

    D B

    Routing table in D207

    Dest Next hopsw - -x - -z C 4. ...

    Advertisementfrom A to D

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    An OSPF AS Consists of Multiple Areas Linked by

    Routers

    (a) an interconnect of routers andnetworks, and

    (b) an equivalent OSPF graph Router corresponds to a node in the

    graph

    Illustration Of OSPF Graph

    Carried in OSPF messages directly over IP(rather than TCP or UDP): protocol number89 for the IP Protocol field

    208

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    10/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    BGP basics

    Pairs of routers (BGP peers) exchange routing info oversemi-permanent TCP conctns: BGP sessions on port 179.

    Note that BGP sessions do not correspond to physicallinks.

    When AS2 advertises a prefix to AS1, AS2 is promising it

    will forward any datagrams destined to that prefix towardsthe prefix. AS2 can aggregate prefixes in its advertisement

    3b

    1d

    3a

    1c2aAS3

    AS1

    AS21a

    2c

    2b

    1b

    3c

    eBGP session

    iBGP session

    209

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    5. Link Layer and LANs

    Some terminology: hosts and routers are nodes

    communication channels thatconnect adjacent nodes alongcommunication path are links

    wired links wireless links

    LANs layer-2 packet is a frame,

    encapsulates datagram

    link

    data-link layer has responsibility oftransferring datagram from one nodeto adjacent node over a link

    210

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    11/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Two types of networks at the data link layer

    Broadcast Networks: All stations share a singlecommunication channel

    Point-to-Point Networks: Pairs of hosts (or routers) aredirectly connected

    Typically, local area networks (LANs) are broadcast andwide area networks (WANs) are point-to-point

    Broadcast Network Point-to-Point Network

    211

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Local Area Networks

    Local area networks (LANs) connect computers within a building or a enterprisenetwork

    Almost all LANs are broadcast networks

    Typical topologies of LANs are bus or star orring. There are also mesh, hybrid,hierarchical star, star-wireless.

    We will work with Ethernet LANs. Ethernet has a bus or star topology.

    212

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    12/41

    IEEE 802 Standards

    Number Description

    802.1 Internetworking

    802.2 Logical Link Control

    802.3 Ethernet (CSMA/CD)

    802.3u Fast Ethernet

    802.3z Gigabit Ethernet

    802.3ae 10 Gigabit Ethernet

    802.4 Token Bus

    802.5 Token Ring

    802.6 Distributed Queue Dual Bus (MAN)

    802.7 Broadband Technology

    802.8 Fiber Optic Technology

    802.10 LAN Security

    802.11a/b/g/n Wireless LAN

    802.15 Wireless Personal Area Network (WPAN)

    802.15.3a UWB (Ultra-WideBand)

    802.16 Wireless MAN WiMAX802.20 Wireless WAN (Mobile Broadband Wireless Access MBWA).

    802.22 Wireless RAN (Regional Area Network)

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    213

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    5.1 Link layer: context and services

    Datagram transferred by different link protocolsover different links:

    e.g., Ethernet on first link, frame relay onintermediate links, 802.11 on last link

    Framing, link access:

    encapsulate datagram into frame, adding header, trailer

    channel access if shared medium MAC addresses used in frame headers to identify source,

    dest

    different from IP address! Reliable delivery between adjacent nodes

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

    214

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    13/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Link Layer Services (more)

    Flow Control: pacing between adjacent sending and receiving nodes

    Error Detection: errors caused by signal attenuation, noise. receiver detects presence of errors:

    signals sender for retransmission or drops frame

    Error Correction: receiver identifies and corrects bit error(s) without

    resorting to retransmission

    Half-duplex and full-duplex

    with half duplex, nodes at both ends of link cantransmit, but not at same time

    215

    Adaptors Communicating

    link layer implemented inadaptor (aka NIC)

    Ethernet card, 802.11 card sending side:

    encapsulates datagram in aframe

    adds error checking bits, rdt(reliable data transfer), flowcontrol, etc.

    receiving side

    looks for errors, rdt, flowcontrol, etc

    extracts datagram, passes torcving node

    adapter is semi-autonomous

    link & physical layers

    sendingnode

    frame

    rcvingnode

    datagram

    frame

    adapter adapter

    link layer protocol

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    216

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    14/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    5.2 Error Detection

    EDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking, may include header fields

    Error detection not 100% reliable! protocol may miss some errors, but rarely

    larger EDC field yields better detection and correction

    217

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Parity Checking

    Single Bit Parity:Detect single bit errors

    Two Dimensional Bit Parity:Detect and correct single bit errors

    0 0

    218

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    15/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Checksumming: Cyclic Redundancy Check

    view data bits, D, as a binary number

    choose r+1 bit pattern (generator), G

    goal: choose r CRC bits, R, such that

    exactly divisible by G (modulo 2) receiver knows G, divides by G. If non-zero

    remainder: error detected!

    can detect all burst errors less than r+1 bits widely used in practice

    219

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    CRC Example

    [D.2rXOR R]/G = Q

    [D.2r]/G = Q XOR R/G

    if we divide D.2rbyG, want remainder R

    R = remainder[ ]D.2r

    G

    220

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    16/41

    Polynomials

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    221

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    5.3 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)

    traditional Ethernet

    upstream HFC 802.11 wireless LAN

    222

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    17/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    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 nodes sharechannel, i.e., determine when node can transmit

    communication about channel sharing must usechannel itself!

    223

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Ideal Multiple Access Protocol

    Broadcast channel of rate R bps

    1. When one node wants to transmit, it can sendat rate R.

    2. When M nodes want to transmit, each cansend at average rate R/M

    3. Fully decentralized: no special node to coordinate transmissions no synchronization of clocks, slots

    4. Simple

    224

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    18/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    MAC Protocols: a taxonomy

    Three broad classes:

    Channel Partitioning 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, but nodes with more to send cantake longer turns

    225

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Channel Partitioning MAC protocols: TDMA

    TDMA: time division multiple access

    access to channel in "rounds"

    each station gets fixed length slot (length = pkt transtime) in each round

    unused slots go idle

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

    TDM (Time Division Multiplexing): channel divided into N time slots, oneper user; inefficient with low duty cycle users and at light load.FDM (Frequency Division Multiplexing): frequency subdivided.

    226

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    19/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    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, frequency bands2,5,6 idle

    frequencybands

    227

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Channel Partitioning MAC protocols: CDMA

    Code Division Multiple Access (CDMA)

    used in several wireless broadcast channels (cellular, satellite, etc)standards

    unique code assigned to each user; i.e., code set partitioning

    all users share same frequency, but each user has own chippingsequence (i.e., code) to encode data

    encoded signal = (original data) X (chipping sequence)

    decoding: inner-product of encoded signal and chipping sequence

    allows multiple users to coexist and transmit simultaneously with

    minimal interference (if codes are orthogonal)

    228

    Hadamard Matrix (Walsh Codes)

    A Hadamard matrix of ordern is a matrix with elements 1 or1 such that

    .

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    20/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    CDMA Encode/Decode Example

    slot 1 slot 0

    d1 = -1

    1 1 1 11- 1- 1- 1-

    Zi,m= di.cm

    d0 = 1

    1 1 1 1

    1- 1- 1- 1-

    1 1 1 1

    1- 1- 1- 1-

    1 1 11

    1-1- 1- 1-

    slot 0channeloutput

    slot 1channeloutput

    channel output Zi,m

    sender

    code

    databits

    slot 1 slot 0

    d1 = -1

    d0 = 1

    1 1 1 1

    1- 1- 1- 1-

    1 1 1 1

    1- 1- 1- 1-

    1 1 1 1

    1- 1- 1- 1-

    1 1 11

    1-1- 1- 1-

    slot 0

    channeloutput

    slot 1

    channeloutputreceiver

    code

    receivedinput

    Di = Zi,m.cm

    m=1

    M

    M

    229

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    CDMA: two-sender interference

    230

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    21/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Random Access Protocols

    When node has packet to send

    transmit at full channel data rate R. no a priori coordination among nodes

    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: slotted ALOHA ALOHA

    CSMA, CSMA/CD (IEEE 802.3), CSMA/CA (IEEE 802.11)

    231

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    The ALOHA Protocol: Pure (unslotted) ALOHA

    Multiple users share a single broadcast channel Users do not test the channel before they transmit. They

    transmit fixed-size frames at arbitrary times

    If a collision occurs (i.e., by overlapping transmissions), thecolliding frames get garbed and thus discarded Retransmission by upper-layer protocols

    Maximum throughput is ~18.4%

    232

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    22/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Slotted ALOHA

    Pure Aloha performance can be substantially improved if werequire frame transmissions to occur on time slot boundaries

    Time slots are the same as the frame size Assume that all stations are globally synchronized The frame will be scheduled for transmission at the start of the

    next time slot User sends the frame without testing the state of the channel If a collision occurs, the colliding frames discarded

    Retransmission by upper-layer protocols Maximum throughput is ~37%

    233

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    CSMA (Carrier Sense Multiple Access)

    CSMA: listen before transmit:If channel sensed idle: transmit entire frame If channel sensed busy, defer transmission

    Multiple Access (MA) Multiple computers attach to shared media Each uses same access algorithm

    Carrier Sense (CS) Wait until medium idle Begin to transmit frame

    Simultaneous transmission possible

    234

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    23/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    CSMA collisions

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

    collision:entire packet transmissiontime wasted

    spatial layout of nodes

    note:role of distance & propagationdelay in determining collision

    probability

    235

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    CSMA/CD (Collision Detection)

    CSMA/CD: carrier sensing,deferral as in CSMA collisions detected within short

    time

    colliding transmissionsaborted, reducing channelwastage

    collision detection: easy in wired LANs: measuresignal strengths, comparetransmitted, received signals

    difficult in wireless LANs:receiver shut off whiletransmitting

    236

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    24/41

    The CSMA Protocols 1-persistent CSMA:

    listens to the channel prior to its transmission. If it is idle then it sends its frame. If a collision occurs the station waits for a random time and tries again. If it is busy it waits for the ongoing transmission to finish.

    Non-persistent CSMA Waits for a random period before it sends the frame if the channel is in use

    P - Persistent:

    1. If medium idle, transmit with probability p, and delay one time unit with probability (1 p) Time unit typically maximum propagation delay2. If medium busy, listen until idle and repeat step 13. If transmission is delayed one time unit, repeat step

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    237

    Taking Turns MAC protocolsPolling: master node invites slave

    nodes to transmit in turn

    concerns:

    polling overhead latency single point of failure

    (master)

    Token passing: control token passed from one

    node to next sequentially; tokenmessage; concerns (token overhead,latency, single point of failure (token)).

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    master

    slaves

    poll

    data

    data

    T

    data

    (nothingto send)

    T

    238

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    25/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    5.4 MAC Addresses and ARP

    32-bit IP address: network-layeraddress used to get datagram to destination IP subnet

    MAC (or LAN or physical or Ethernet) address:

    used to get datagram from one interface to another physically-connected interface (same network) 48 bit MAC address (for most LANs)

    burned in the adapter ROM

    RARP

    Ethernet MAC

    address

    (48 bit)

    ARPIP address(32 bit)

    IGMP Internet Group Management ProtocolICMP Internet Control Message ProtocolNDP Neighbor Discovery Protocol for IPv6 and ICMPv6

    239

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    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)

    240

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    26/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    ARP: Address Resolution Protocol

    Each IP node (Host,Router) on LAN hasARP table

    ARP Table: IP/MACaddress mappings forsome LAN nodes< IP address; MAC address; TTL>

    TTL (Time To Live): timeafter which addressmapping will be forgotten(typically 10 min)

    Question: how to determineMAC address of Bknowing 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

    237.196.7.23

    237.196.7.78

    237.196.7.14

    237.196.7.88

    241

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Address Translation with ARP

    ARP Request:Argon broadcasts an ARP request to all stations on thenetwork: What is the hardware address of Router137?

    Argon128.143.137.144

    00:a0:24:71:e4:44

    Router137128.143.137.1

    00:e0:f9:23:a8:20

    ARP Request:

    What is the MAC address

    of 128.143.137.1?

    ARP Request from Argon:

    Source hardware address: 00:a0:24:71:e4:44Source protocol address: 128.143.137.144Target hardware address: FF:FF:FF:FF:FF:FFTarget protocol address: 128.143.137.1

    242

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    27/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Address Translation with ARP

    ARP Reply:Router 137 responds with an ARP Reply which containsthe hardware address

    Argon128.143.137.144

    00:a0:24:71:e4:44

    Router137128.143.137.1

    00:e0:f9:23:a8:20

    ARP Reply:

    The MAC address of 128.143.137.1

    is 00:e0:f9:23:a8:20

    ARP Reply from Router137:

    Source hardware address: 00:e0:f9:23:a8:20Source protocol address: 128.143.137.1

    Target hardware address: 00:a0:24:71:e4:44Target protocol address: 128.143.137.144

    243

    Internet Architecture & Internet Application

    Example

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    244

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    28/41

    5.5 High-Speed LANs: Ethernet, Token Ring

    dominant wired LAN technology:

    cheap $20 for 100Mbs!

    first widely used LAN technology

    Simpler, cheaper than token LANs and ATM Kept up with speed race: 10 Mbps 10 Gbps

    Robert Metcalfes (1946)(MIT, 1973) EthernetSketch.

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    245

    Ethernet Frame Structure

    Sending adapter encapsulates IP datagram (or other network layerprotocol packet) in Ethernet frame

    Preamble: 7 bytes with pattern 10101010 followed by one byte withpattern 10101011. Used to synchronize receiver, sender clock rates

    Addresses: 6 bytes

    if adapter receives frame with matching destination address, or withbroadcast address (e.g., ARP packet), it passes data in frame to net-layer protocol; otherwise, adapter discards frame

    Type: indicates the higher layer protocol (mostly IP)

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

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    246

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    29/41

    Ethernet CSMA/CD algorithm

    1. Adaptor receives datagramfrom net layer & createsframe

    2. If adapter senses channelidle, it starts to transmitframe. If it senses channelbusy, waits until channel idleand then transmits

    3. If adapter transmits entireframe without detectinganother transmission, theadapter is done with frame !

    4. If adapter detects anothertransmission whiletransmitting, aborts andsends jam signal

    5. After aborting, adapterenters exponentialbackoff: after the mthcollision, adapter choosesa K at random from{0,1,2,,2m-1}. Adapterwaits K512 bit times andreturns to Step 2

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    247

    Ethernets CSMA/CD (more)

    Jam Signal: make sure all othertransmitters are aware ofcollision; 48 bits or 32bits.

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

    about 50 msec

    Exponential Backoff: Goal: adapt retransmission

    attempts to estimated currentload

    heavy load: random wait willbe longer

    first collision: choose K from

    {0,1}; delay is K

    512 bittransmission times

    after second collision: choose Kfrom {0,1,2,3}

    after ten collisions, choose Kfrom {0,1,2,3,4,,1023}

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    248

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    30/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Ethernet Technologies: LAN Wiring

    Ethernet Technologies Three schemes correspond to three generations

    (a) 10Base5, (b) 10Base2, (c) 10Base-T

    All run same link speed of 10Mbps

    All use same frame format

    249

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Ethernet Wiring In An Office

    10Base5

    10Base2

    10BaseT

    250

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    31/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    10BaseT and 100BaseT

    10/100 Mbps rate; latter called fast ethernet

    T stands for Twisted Pair

    Nodes connect to a hub: star topology; 100m

    max distance between nodes and hub

    twisted pair

    hub

    251

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Repeater

    Hardware device

    Connects two LAN segments

    One repeater can effectively double the length of an LANsegment

    Copies signal from one segment to the other

    Connection can be extended with Fiber Optic Intra-Repeater Link

    252

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    32/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Limits On Repeaters

    Can't extend Ethernet with repeaters indefinitely CSMA/CD requires low delay; if medium is too long, CSMA/CD

    won't work Ethernet standard includes limit of 4 repeaters between any two

    Ethernet stations Very easy to use - just plug in

    Repeaters simply re-transmit analog signals Collisions affect entire network Transient problems - noise propagates throughout network

    253

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Fast (802.3u) and Gbit Ethernet (802.3z)

    uses standard Ethernet frame format allows for point-to-point links and shared broadcast channels

    in shared mode, CSMA/CD is used; short distances between nodesrequired for efficiency

    uses hubs, called here Buffered Distributors or Full Duplex Repeater orBuffered Repeater

    Full-Duplex at 1 Gbps for point-to-point links

    10 Gbps now !

    T4: 1 pair is used to receive while3 pairs are used to transmit.

    FX, TX: it uses 1 pair to receiveand 1 pair to transmit

    In 1000Base-T, each of four wirepairs transmits 250 Mbps inboth directions.

    254

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    33/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    CSMA/CD efficiency

    Tprop = max prop between 2 nodes in LAN

    ttrans = time to transmit max-size frame

    N

    Efficiency goes to 1 as tprop goes to 0

    Goes to 1 as ttrans goes to infinity

    Much better than ALOHA, but still decentralized, simple, andcheap

    transprop tt /3.441

    1efficiency

    255

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    IEEE 802.5 Token Ring

    Second most popular LAN topology

    Bits flow in single direction

    Several technologies exist

    Used with ring topology

    Guarantees fair access: IEEE 802.5 standards

    Token

    Special (reserved) message

    Small (a few bits) Frame formats:

    token:SD AC FC

    packet: SD AC FC dest addr src addr data checksum ED FS

    8 8 8 48 48 variable 32 8 8 bits

    SD, ED: mark start, end of frame

    FC: Frame Control: used for monitoringand maintenance, distinguish controlframes and information frames.

    256

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    34/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Frame Formats

    AC: Access Control Byte:

    T - token bit: value 1 means token can be seized, value 0 means data

    packet to follow access control byte.

    PPP - priority bits: priority level of this packet.

    RRR - reservation bits : station can write these bits to prevent stations withlower priority packet from seizing the token next time it becomes free.

    M - is the monitor bit which is set by the Active Monitor (AM) station whenit sees this frame.

    Example: Priority-Based Ring

    257

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Frame Formats (contd)

    Source and destination address: as in Ethernetdata: packet from network layer

    checksum: error detection

    FS: Frame Status: set by destination, read by receiver

    set to indicate that destination is up, packet copied OK from ring

    Destination station nonexistent or not active (A=0, C=0)Destination station exists but frame not copied (A=1, C=0)Frame received (A=1, C=1)

    A C 0 0 A C 0 0

    1 bit 1 bit 1 bit 1 bit 1 bit 1 bit 1 bit 1 bit

    Example:At a propagation speed of 200m/s, what is the effective length Ladded to a ring by a bit delay at each repeater? Now suppose a token holdingtime of 10ms, what is the frame length for each case?.a) At 5Mbpsb) At 40Mbpsc) At 1Mbps

    258

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    35/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    5.6 Interconnecting with hubs and switches

    Backbone hub interconnectsLAN segments

    Extends max distance betweennodes

    But individual segment collisiondomains become one largecollision domain

    Cant interconnect 10BaseT &100BaseT

    hub hub hub

    hub

    Data link layer technologies (switched networks): Switched Ethernet ATM (Asynchronous Transfer Mode) Frame Relay Multi-Protocol Label Switching (MPLS)

    Some switched networks are intended for enterprise networks (SwitchedEthernet), wide area networks (MPLS, Frame Relay), or both (ATM)

    259

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Hubs

    Hubs are essentially physical-layer repeaters:

    bits coming from one link go out all other links at the same rate no frame buffering no CSMA/CD at hub: adapters detect collisions

    twisted pair

    hub

    260

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    36/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Bridge

    Hardware device

    Connects two LAN segments

    handles complete frames Uses NIC like any other station Performs some processing on frame

    Does not forward noise or collisions

    Learns addresses and filters

    Allows independent transmission

    261

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Filtering Example

    262

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    37/41

    Break Cycles--Spanning Tree Algorithm

    Bridges must cooperate to broadcast frames exactly onceon each segment

    Used by all bridges to

    Discover one another

    Break cycle(s)

    Known as Distributed Spanning Tree (DST)-- resulting in aunique path from each source to each destination

    As each bridge joins the network, it communicates withother bridges on special hardware (typically multicast)

    address

    Learns network topology Performs spanning tree computation Determines if bridge will form a cycle

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    263

    Spanning Tree Algorithm

    Step-1: Take the least weighing edge of the graph

    and add it to the minimum Spanning Tree.

    Step-2: Find the adjacent edges for the vertices in the

    spanning tree.

    Step-3: Find the least among all those edges.

    Step-4: Add that edge to the spanning tree if its notforming a loop in the tree and that its not already

    there in the tree.

    Step-5: Stop if all vertices in the Graph have been

    covered by the Tree else go to step-2.

    Dr. Vicente Alarcn Aquino

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    264

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    38/41

    Spanning Tree Example

    AB - 2 Least weighing

    AD - 1 Already in t he tree

    DB - 2

    Least weighing

    DE - 3

    > value

    DA - 1

    Already in t he tree

    BA - 2 Alr eady i n the tree

    BD - 2 > value

    BC - 1

    Least weighing

    BE - 3 > value

    DB - 2 > value

    DE - 3 > value

    CB - 1 Alr eady in the tr ee

    CE - 4 > value

    CF - 2 Least weighing

    BD - 2 Forming a loop

    BE - 3 > value

    DB - 2 Forming a loop

    DE - 3 > value

    FC - 2

    Alr eady in the t ree

    FE - 3 least weighing

    CE - 4

    > value

    BE - 3

    least weighing

    DE - 3

    least weighing

    EB - 3 Alr eady i n the tree

    EC - 4 Forming a loop

    ED - 3

    Forming a loop

    EF - 3 Forming a loop

    FE - 3

    Forming a loop

    CE - 4

    Forming a loop

    DE - 3 Forming a loop

    The resultant Spanning Tree with no loops giving you the shortest distancebetween any two vertices.

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    265

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Switch

    Link layer device

    stores and forwards Ethernet frames examines frame header and selectively

    forwards frame based on MAC dest address

    when frame is to be forwarded on segment,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

    266

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    39/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Forwarding

    How do determine onto which LAN segment to

    forward frame? Looks like a routing problem...

    hub hubhub

    switch1

    2 3

    267

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Switch example

    Suppose C sends frame to D

    Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table, switch forwards frame into

    interfaces 2 and 3

    frame received by D

    hub hub hub

    switch

    A

    B CD

    EF

    G H

    I

    address interface

    ABEG

    1123

    12 3

    268

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    40/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Switch example

    Suppose D replies back with frame to C.

    Switch receives frame from from D notes in bridge table that D is on interface 2

    because C is in table, switch forwards frame only to interface 1 frame received by C

    hub hub hub

    switch

    A

    B CD

    EF

    G H

    I

    address interface

    ABEGC

    11231

    269

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kuroseand K.W. Ross

    Switches vs. Routers

    both store-and-forward devices

    routers: network layer devices (examine network layerheaders)

    switches are link layer devices routers maintain routing tables, implement routing

    algorithms

    switches maintain switch tables, implement filtering,learning algorithms

    270

  • 7/24/2019 UDLAP Computer Networks Spring 2015 pages 191-271

    41/41

    Dr. Vicente Alarcn Aqui no

    Copyright 1996-2015 J.F Kurose

    and K.W. Ross

    Summary comparison

    hubs routers switches

    traffic

    isolation

    no yes yes

    plug & play yes no yes

    optimal

    routing

    no yes no

    cut

    through

    yes no yes

    271