chapter 4 network layerqianzh/comp562-2009/notes/chapter4_2009.pdf · chapter 4: network layer 4. 1...

85
Chapter 4 Network Layer Computer Networking: A Top Down Approach 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007. A note on the use of these ppt slides: The notes used in this course are substantially based on powerpoint slides developed and copyrighted by J.F. Kurose and K.W. Ross, 1996- 2007 Network Layer 4-1

Upload: lekhanh

Post on 26-Jul-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • Chapter 4Network Layer

    Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith RossAddison-Wesley, July 2007.

    A note on the use of these ppt slides:The notes used in this course are substantially based on powerpoint slides developed and copyrighted by J.F. Kurose and K.W. Ross, 1996-2007

    Network Layer 4-1

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-2

  • Two Key Network-Layer Functions

    Forwarding:movepacketsfromroutersinputtoappropriaterouteroutput

    Routing: determineroutetakenbypacketsfromsourcetodestRoutingalgorithms

    Analogy:

    Routing: processofplanningtripfromsourcetodest

    Forwarding: processofgettingthroughsingleinterchange

    Network Layer 4-3

  • Interplay between Routing and Forwarding

    1

    23

    0111

    value in arrivingpackets header

    routing algorithm

    local forwarding tableheader value output link

    0100010101111001

    3221

    4-4Network Layer

  • Connection Setup

    The3rd importantfunctioninsome networkarchitectures:

    ATM,framerelay,X.25

    Beforedatagramsflow,twoendhostsandinterveningroutersestablishvirtualconnection

    RoutersgetinvolvedNetworkvs.transportlayerconnectionservice:

    Network: betweentwohosts(mayalsoinvolveinterveningroutersincaseofVCs)Transport: betweentwoprocesses

    Network Layer 4-5

  • Network Service Model

    Q: Whatservicemodel forchannel transportingpacketsfromsendertoreceiver?Guaranteedbandwidth?Preservationofinterpackettiming(nojitter)?Lossfreedelivery?Inorderdelivery?Congestionfeedbacktosender?

    service abstraction? ??virtual circuit

    or datagram?

    Themostimportantabstractionprovidedbynetworklayer:

    Network Layer 4-6

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-7

  • Virtual Circuits

    Callsetup,teardownforeachcallbefore datacanflowEachpacketcarriesVCidentifier(notdestinationhostaddress)Every routeronsourcedestpathmaintainsstate foreachpassingconnectionLink,routerresources(bandwidth,buffers)maybeallocatedto

    sourcetodestpathbehavesmuchliketelephonecircuitPerformancewiseNetworkactionsalongsourcetodestpath

    VC(dedicatedresources=predictableservice)

    Network Layer 4-8

  • Virtual Circuits: Signaling Protocols

    Usedtosetup,maintainteardownVCUsedinATM,framerelay,X.25NotusedintodaysInternet

    applicationtransportnetworkdata linkphysical

    applicationtransportnetworkdata linkphysical

    1. Initiate call 2. incoming call3. Accept call4. Call connected

    5. Data flow begins 6. Receive data

    Network Layer 4-9

  • Datagram NetworksNocallsetupatnetworklayerRouters:nostateaboutendtoendconnections

    NonetworklevelconceptofconnectionPacketsforwardedusingdestinationhostaddress

    Packetsbetweensamesourcedestpairmaytakedifferentpaths

    4-10

    applicationtransportnetworkdata linkphysical

    applicationtransportnetworkdata linkphysical

    1. Send data 2. Receive data

    Network Layer

  • Datagram or VC Network: Why?

    Internet(datagram)Dataexchangeamongcomputers

    Elastic service,nostricttimingreq.

    Smart endsystems(computers)

    Canadapt,performcontrol,errorrecoverySimpleinsidenetwork,complexityatedge

    ManylinktypesDifferentcharacteristicsUniformservicedifficult

    ATM(VC)EvolvedfromtelephonyHumanconversation:

    Stricttiming,reliabilityrequirementsNeedforguaranteedservice

    Dumb endsystemsTelephonesComplexityinsidenetwork

    Network Layer 4-11

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-12

  • Router Architecture Overview

    Twokeyrouterfunctions:Runroutingalgorithms/protocol(RIP,OSPF,BGP)Forwardingdatagramsfromincomingtooutgoinglink

    Network Layer 4-13

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-14

  • The Internet Network LayerHost,routernetworklayerfunctions:

    forwardingtable

    Routing protocolsPath selectionRIP, OSPF, BGP

    IP protocolAddressing conventionsDatagram formatPacket handling conventions

    ICMP protocolError reportingRouter signaling

    Transport layer: TCP, UDP

    Link layer

    physical layer

    Networklayer

    Network Layer 4-15

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-16

  • IP Datagram Format

    Network Layer 4-17

    ver length

    32 bits

    data (variable length,typically a TCP

    or UDP segment)

    16-bit identifierheader

    checksumtime to

    live

    32 bit source IP address

    head.len

    type ofservice

    flgs fragmentoffsetupperlayer

    32 bit destination IP address

    Options (if any)

    IP protocol versionnumber

    header length(bytes)

    max numberremaining hops

    (decremented at each router)

    forfragmentation/reassembly

    total datagramlength (bytes)

    upper layer protocolto deliver payload to

    type of data (QoS)

    E.g. timestamp,record routetaken, specifylist of routers to visit.

    How much overhead with TCP?20 bytes of TCP20 bytes of IP= 40 bytes + app layer overhead

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-18

  • IP Addressing: IntroductionIPaddress: 32bitidentifierforhost,routerinterface

    Interface: connectionbetweenhost/routerandphysicallink

    RouterstypicallyhavemultipleinterfacesHosttypicallyhasoneinterface(mayhavemultipletoday)IPaddressesassociatedwitheachinterface,not

    223.1.1.1

    223.1.1.2

    223.1.1.3

    223.1.1.4 223.1.2.9

    223.1.2.2

    223.1.2.1

    223.1.3.2223.1.3.1

    223.1.3.27

    withhostorrouter223.1.1.1 = 11011111 00000001 00000001 00000001

    223 1 11

    Network Layer 4-19

  • SubnetsIPaddress:

    Subnetpart(highorderbits)Hostpart(loworderbits)

    Whatsasubnet?DeviceinterfaceswithsamesubnetpartofIPaddressCanphysicallyreacheachotherwithoutinterveningrouter

    network consisting of 3 subnets

    223.1.1.1

    223.1.1.2

    223.1.1.3

    223.1.1.4 223.1.2.9

    223.1.2.2

    223.1.2.1

    223.1.3.2223.1.3.1

    223.1.3.27

    subnet

    (for IP addresses starting with 223, first 24 bits are network address)

    Network Layer 4-20

  • IP AddressesGivennotionofnetwork,letsreexamineIPaddresses:

    class-full addressing:

    class1.0.0.0 to127.255.255.255A 0network host

    128.0.0.0 to191.255.255.255

    B 10 network host

    192.0.0.0 to223.255.255.255C 110 network host

    224.0.0.0 to239.255.255.255D 1110 multicast address

    32 bits

    Network Layer 4-21

  • IP Addressing: CIDRClassfuladdressing:

    Inefficientuseofaddressspace,addressspaceexhaustionE.g.,classBnetallocatedenoughaddressesfor65Khosts,even ifonly2Khostsinthatnetwork

    CIDR: ClasslessInterDomainRoutingSubnetportionofaddressofarbitrarylengthAddressformat:a.b.c.d/x,wherexis#bitsinsubnetportionofaddress

    11001000 00010111 00010000 00000000

    subnetpart

    hostpart

    200.23.16.0/23Network Layer 4-22

  • NAT: Network Address Translation

    10.0.0.1

    10.0.0.2

    10.0.0.3

    10.0.0.4

    138.76.29.7

    local network(e.g., home network)

    10.0.0/24

    rest ofInternet

    Datagrams with source or destination in this networkhave 10.0.0/24 address for source, destination (as usual)

    All datagrams leaving localnetwork have same single source

    NAT IP address: 138.76.29.7,different source port numbers

    Network Layer 4-23

  • NAT: Network Address Translation

    Implementation: NATroutermust:

    Outgoingdatagrams: replace (sourceIPaddress,port#)ofeveryoutgoingdatagramto(NATIPaddress,newport#)...remoteclients/serverswillrespondusing(NATIPaddress,newport#)asdestinationaddr.

    Remember(inNATtranslationtable)every(sourceIPaddress,port#)to(NATIPaddress,newport#)translationpair

    Incomingdatagrams: replace (NATIPaddress,newport#)indestfieldsofeveryincomingdatagramwithcorresponding(sourceIPaddress,port#)storedinNATtable

    Network Layer 4-24

  • NAT: Network Address Translation

    10.0.0.1

    10.0.0.2

    10.0.0.3

    S: 10.0.0.1, 3345D: 128.119.40.186, 80

    110.0.0.4

    138.76.29.7

    1: host 10.0.0.1 sends datagram to 128.119.40.186, 80

    NAT translation tableWAN side addr LAN side addr138.76.29.7, 5001 10.0.0.1, 3345

    S: 128.119.40.186, 80 D: 10.0.0.1, 3345 4

    S: 138.76.29.7, 5001D: 128.119.40.186, 802

    2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table

    S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3

    3: Reply arrivesdest. address:138.76.29.7, 5001

    4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345

    Network Layer 4-25

  • NAT: Network Address Translation

    Outsidenodecannotinitiatethecommunication

    Reservedaddresses:10.0.0.0 10.255.255.255/8172.16.0.0 172.31.255.255/12192.168.0.0 192.168.255.255/16

    Network Layer 4-26

  • NAT: Network Address Translation

    16bitportnumberfield:60,000simultaneousconnectionswithasingleLANsideaddress!

    NATiscontroversial:Routersshouldonlyprocessuptolayer3Violatesendtoendargument

    NATpossibilitymustbetakenintoaccountbyappdesigners,eg,P2Papplications

    AddressshortageshouldinsteadbesolvedbyIPv6

    Network Layer 4-27

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-28

  • ICMP: Internet Control Message Protocol

    Usedbyhosts&routerstocommunicatenetworklevelinformation

    Errorreporting:unreachablehost,network,port,protocolEchorequest/reply(usedbyping)

    Networklayerabove IP:ICMPmsgscarriedinIPdatagrams

    ICMPmessage: type,codeplusfirst8bytesofIPdatagram

    Type Code Description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion

    control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header

    causingerror

    Network Layer 4-29

  • ICMP: Brief Summary

    ICMPisthecontrolsiblingofIPICMPisusedbyIPandusesIPasnetworklayerprotocolICMPisusedforping,traceroute,andpathMTUdiscovery

    Ping:UsesICMPEchorequest/replymessagesPathMTUDiscovery

    SendalargeIPdatagramwithNofragment bitsetReducesizeuntilsuccess(NoICMPmessagereceived)

    Network Layer 4-30

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-31

  • IPv6Initialmotivation: 32bitaddressspacesoontobecompletelyallocatedAdditionalmotivation:Headerformathelpsspeedprocessing/forwardingHeaderchangestofacilitateQoS

    IPv6datagramformat:Fixedlength40byteheaderNofragmentationallowed

    Network Layer 4-32

  • Transition From IPv4 To IPv6

    NotallrouterscanbeupgradedsimultaneousnoflagdaysHowwillthenetworkoperatewithmixedIPv4andIPv6routers?

    Tunneling: IPv6carriedaspayloadinIPv4datagramamongIPv4routers

    Network Layer 4-33

  • TunnelingA B E F

    IPv6 IPv6 IPv6 IPv6

    tunnelLogical view:

    Physical view:A B E F

    IPv6 IPv6 IPv6 IPv6IPv4 IPv4

    Network Layer 4-34

  • TunnelingA B E F

    IPv6 IPv6 IPv6 IPv6

    tunnelLogical view:

    Network Layer

    A B E F

    IPv6 IPv6 IPv6 IPv6

    C D

    IPv4 IPv4

    Flow: XSrc: ADest: F

    data

    Flow: XSrc: ADest: F

    data

    Flow: XSrc: ADest: F

    data

    Src:BDest: E

    Flow: XSrc: ADest: F

    data

    Src:BDest: E

    A-to-B:IPv6

    E-to-F:IPv6B-to-C:IPv6 inside

    IPv4

    B-to-C:IPv6 inside

    IPv4

    Physical view:

    4-35

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-36

  • Graph Abstraction

    u

    yx

    wv

    z2

    21

    3

    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), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }

    Remark: Graph abstraction is useful in other network contexts

    Example: P2P, where N is set of peers and E is set of TCP connections

    Network Layer 4-37

  • Graph Abstraction: Costs

    u

    yx

    wv

    z2

    21

    3

    1

    1

    2

    53

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

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

    Cost could always be 1, or inversely related to bandwidth,or inversely related to congestion

    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

    Network Layer 4-38

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-39

  • A Link-State Routing Algorithm

    DijkstrasalgorithmNettopology,linkcostsknowntoallnodes

    AccomplishedvialinkstatebroadcastAllnodeshavesameinfo

    Computesleastcostpathsfromonenode(source)toallothernodes

    Givesforwardingtable forthatnode

    Iterative:afterkiterations,knowleastcostpathtokdest.s

    Notation:c(x,y): linkcostfromnodextoy;= ifnotdirectneighborsD(v): currentvalueofcostofpathfromsourcetodest.vp(v): predecessornodealongpathfromsourcetovN': setofnodeswhoseleastcostpathdefinitivelyknown

    Network Layer 4-40

  • Dijkstras Algorithm

    1 Initialization:2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = 7 8 Loop9 find w not in N' such that D(w) is a minimum 10 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 known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N'

    Network Layer 4-41

  • Dijkstras Algorithm: Example

    Step012345

    start NA

    D(B),p(B)2,A

    D(C),p(C)5,A

    D(D),p(D)1,A

    D(E),p(E)

    D(F),p(F)

    2,A2,A 4,D

    3,E3,E

    2,D 4,E4,E4,E

    ADEBCFADEBC

    ADEBADE

    AD

    A

    ED

    CB

    F2

    21

    3

    1

    1

    2

    53

    5

    Network Layer 4-42

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-43

  • Distance Vector Algorithm

    BellmanFordEquation(dynamicprogramming)Definedx(y):=costofleastcostpathfromxtoy

    Then

    dx(y)=min{c(x,v)+dv(y)}

    whereministakenoverallneighborsvofx

    v

    Network Layer 4-44

  • Bellman-Ford Example

    u

    yx

    wv

    z2

    21

    3

    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) + dx(z),c(u,w) + dw(z) }

    = min {2 + 5,1 + 3,5 + 3} = 4

    B-F equation says:

    Node that achieves minimum is nexthop in shortest path forwarding table

    Network Layer 4-45

  • Distance Vector Algorithm

    Dx(y) =estimateofleastcostfromxtoyNodexknowscosttoeachneighborv:c(x,v)NodexmaintainsdistancevectorDx =[Dx(y):y N]Nodexalsomaintainsitsneighbors distancevectorsForeachneighborv,xmaintainsDv =[Dv(y):y N]

    Network Layer 4-46

  • Distance Vector Algorithm (4)

    Basicidea:EachnodeperiodicallysendsitsowndistancevectorestimatetoneighborsWhenanodexreceivesnewDVestimatefromneighbor,itupdatesitsownDVusingBFequation:

    Dx(y) minv{c(x,v) + Dv(y)} for each node y N

    Underminor,naturalconditions,theestimateDx(y)convergetotheactualleastcostdx(y)

    Network Layer 4-47

  • Distance Vector Algorithm (5)

    Iterative,asynchronous:eachlocaliterationcausedby:LocallinkcostchangeDVupdatemessagefromneighbor

    Distributed:EachnodenotifiesneighborsonlywhenitsDVchanges

    Neighborsthennotifytheir

    wait for (change in local link cost or msg from neighbor)

    recompute estimates

    if DV to any dest has changed, notify neighbors

    Each node:

    neighborsifnecessary

    Network Layer 4-48

  • x y zxyz

    0 2 7

    from

    cost to

    from

    x y zxyz

    cost to

    x y z

    7 1 0

    cost to

    2 0 1

    Network Layer 4-49

    from

    xyz

    node x table

    node y table

    node z table

    x z12

    7

    y

    time

  • x y zxyz

    0 2 7

    from

    cost to

    from

    x y z0

    from

    cost to

    xyz

    x y zxyz

    cost to

    x y z

    7 1 0

    cost to

    2 0 1

    2 0 17 1 0

    x

    from yz

    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

    32

    Network Layer 4-50

  • x y zxyz

    0 2 7

    from

    cost to

    from

    x y z0 2 3

    from

    cost to

    xyz

    x y zxyz

    cost tox y zcost to

    0 2 7x

    from y

    Network Layer 4-51

    from

    z

    x y zxyzf

    rom 0 2 7

    cost tox y z

    7 1 0

    cost to

    2 0 1

    2 0 17 1 0

    2 0 13 1 0

    2 0 17 1 0

    xyz

    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

  • x y zxyz

    0 2 7

    from

    cost to

    from

    x y zxyz

    0 2 3

    from

    cost tox y z0 2 3

    from

    cost to

    xyz

    x y zxyz

    cost tox y z0 2 7

    from

    cost to

    Network Layer 4-52

    from

    xyz

    x y zcost to

    0 2 3xyzf

    rom

    x y zxyz

    0 2 3

    from

    cost tox y z

    z

    0 2 7

    from

    cost to

    xy

    x y z

    7 1 0

    cost to

    2 0 1

    2 0 17 1 0

    2 0 17 1 0

    2 0 13 1 0

    2 0 13 1 0

    2 0 1

    3 1 02 0 1

    3 1 0

    xyz

    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

  • Distance Vector: Link Cost Changes

    Link cost changes:Node detects local link cost change Updates routing info, recalculates distance vectorIf DV changes, notify neighbors

    goodnews travelsfast

    x z14

    50

    y1

    At time t0, y detects the link-cost change, updates its DV, and informs its neighbors.

    At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV.

    At time t2, y receives zs update and updates its distance table. ys least costs do not change and hence y does not send any message to z.

    Network Layer 4-53

  • badnews travelsslow

    Network Layer

    xyz

    cost tox y z0 4 5

    from 4 0 1

    5 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 4 5

    from 4 0 1

    5 1 0

    xyz

    cost tox y z0 4 5

    from 4 0 1

    5 1 0

    Initial routing table

    count to infinityproblem

    x z14

    50

    y

    4-54

  • x z14

    50

    y60

    xyz

    cost tox y z0 51 50

    from 4 0 1

    5 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 4 5

    from 6 0 1

    5 1 0

    xyz

    cost tox y z0 4 5

    from 4 0 1

    5 1 0

    xyz

    cost tox y z0 51 50

    from 6 0 1

    5 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 51 50

    from 6 0 1

    5 1 0

    xyz

    cost tox y z0 51 50

    from 6 0 1

    7 1 0Cost of link xy changes to 60

    badnews travelsslow

    xyz

    cost tox y z0 51 50

    from 6 0 1

    7 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 51 50

    from 8 0 1

    7 1 0

    xyz

    cost tox y z0 51 50

    from 6 0 1

    7 1 0

    Algorithm converges in 44 steps.

    xyz

    cost tox y z0 51 50

    from 8 0 1

    7 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 51 50

    from 8 0 1

    7 1 0

    xyz

    cost tox y z0 51 50

    from 8 0 1

    9 1 0

    Network Layer 4-55

  • badnews travelsslow

    xyz

    cost tox y z0 51 50

    from 48 0 1

    49 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 51 50

    from 50 0 1

    49 1 0

    xyz

    cost tox y z0 51 50

    from 48 0 1

    49 1 0

    xyz

    cost tox y z0 51 50

    from 50 0 1

    49 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 51 50

    from 50 0 1

    49 1 0

    xyz

    cost tox y z0 51 50

    from 50 0 1

    50 1 0

    xyz

    cost tox y z0 51 50

    from 50 0 1

    50 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 51 50

    from 51 0 1

    50 1 0

    xyz

    cost tox y z0 51 50

    from 50 0 1

    50 1 0

    xyz

    cost tox y z0 51 50

    from 51 0 1

    50 1 0

    node x table

    node y table

    node z table

    xyz

    cost tox y z0 51 50

    from 51 0 1

    50 1 0

    xyz

    cost tox y z0 51 50

    from 51 0 1

    50 1 0

    Algorithm converges in 44 steps.

    x z14

    50

    y60

    Cost of link xy changes to 60 Network Layer 4-56

  • Distance Vector: Link Cost Changes

    Network Layer 4-57

    Linkcostchanges:GoodnewstravelsfastBadnewstravelsslowcounttoinfinity problem!44iterationsbeforealgorithmstabilizes:seetext

    Poisonedreverse:IfZroutesthroughYtogettoX:

    ZtellsYits(Zs)distancetoXisinfinite(soYwontroutetoXviaZ)

    Willthiscompletelysolvecounttoinfinityproblem?

    x z14

    50

    y60

    Realproblemisthatythinksitsshortestpathtoxisthroughz,whilezthinksitsshortestpathtoxisthroughy.Theypingpongbackandforthwiththisinformation.

  • Comparison of LS and DV algorithms

    MessagecomplexityLS:

    Robustness: whathappensifroutermalfunctions?

    LS:Nodecanadvertiseincorrectlink costEachnodecomputesonlyitsown table

    DV:DVnodecanadvertiseincorrectpath costEachnodestableusedbyothers

    Errorpropagatethrunetwork

    withnnodes,Elinks,O(nE)msgssentDV:exchangebetweenneighborsonly

    Convergencetimevaries

    SpeedofConvergenceLS: O(n2)algorithmrequiresO(nE)msgs

    MayhaveoscillationsDV:convergencetimevaries

    MayberoutingloopsCounttoinfinityproblem

    Network Layer 4-58

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-59

  • Hierarchical Routing

    Aggregateroutersintoregions, autonomoussystems (AS)

    RoutersinsameASrunsameroutingprotocol

    IntraAS routing protocolRoutersindifferentAScanrundifferentintraASroutingprotocol

    Network Layer 4-60

    SpecialroutersinASRunintraASroutingprotocolwithallotherroutersinASAlso responsibleforroutingtodestinationsoutsideAS

    RuninterASroutingprotocolwithothergatewayrouters

    gateway routers

  • Interconnected ASes

    ForwardingtableisconfiguredbybothintraandinterASroutingalgorithm

    IntraASsetsentriesforinternaldestsInterAS&IntraAssetsentriesforexternaldests

    Network Layer 4-61

    3b

    1d

    3a

    1c2aAS3

    AS1AS2

    1a

    2c2b

    1b

    3c

    Intra-ASRouting algorithm

    Inter-ASRouting algorithm

    Forwardingtable

  • Inter-AS TasksSupposerouterinAS1receivesdatagramforwhichdestisoutsideofAS1

    Routershouldforwardpackettowardsoneofthegatewayrouters,butwhichone?

    AS1needs:1. Tolearnwhichdests

    arereachablethroughAS2andwhichthroughAS3

    2. TopropagatethisreachabilityinfotoallroutersinAS1

    JobofinterASrouting!

    Network Layer 4-62

    3b

    1d

    3a

    1c2aAS3

    AS1AS2

    1a

    2c2b

    1b

    3c

  • Example: Choosing Among Multiple ASes

    NowsupposeAS1learnsfromtheinterASprotocolthatsubnetx isreachablefromAS3and fromAS2Toconfigureforwardingtable,router1dmustdeterminetowardswhichgatewayitshouldforwardpacketsfordestxThisisalsothejoboninterASroutingprotocol!Hotpotatorouting: sendpackettowardsclosestoftworouters

    Learn from inter-AS protocol that subnet x is reachable via multiple gateways

    Use routing infofrom intra-AS

    protocol to determinecosts of least-cost

    paths to eachof the gateways

    Hot potato routing:Choose the gateway

    that has the smallest least cost

    Determine fromforwarding table the interface I that leads

    to least-cost gateway. Enter (x,I) in

    forwarding table

    Network Layer 4-63

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-64

  • Routing in the InternetTheGlobalInternetconsistsofAutonomousSystems(AS)interconnectedwitheachother:

    StubAS:smallcorporation:oneconnectiontootherASsMultihomedAS:largecorporation(notransit):multipleconnectionstootherASsTransitAS:provider,hookingmanyASstogether

    Twolevelrouting:IntraAS: (withinAS)administratorresponsibleforchoiceofroutingalgorithmwithinnetworkInterAS: (betweenASes)uniquestandardforinterASrouting:BGP

    Network Layer 4-65

  • Intra-AS Routing

    AlsoknownasInteriorGatewayProtocols(IGP)

    MostcommonIntraASroutingprotocols:

    RIP:RoutingInformationProtocol

    OSPF:OpenShortestPathFirst

    IGRP:InteriorGatewayRoutingProtocol(Ciscoproprietary)

    Network Layer 4-66

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-67

  • RIP (Routing Information Protocol)

    Distancevector algorithmIncludedinBSDUNIXDistributionin1982Distancemetric:#ofhops(max=15hops)

    DC

    BA

    u vw

    x

    yz

    destination hopsu 1v 2w 2x 3y 3z 2

    From router A to subsets:

    Network Layer 4-68

  • RIP Advertisements

    Distancevectors:exchangedamongneighborsevery30secviaResponseMessage(alsocalledadvertisement)Eachadvertisement:listofupto25destinationnetswithinAS

    Network Layer 4-69

  • RIP: Link Failure and RecoveryIfnoadvertisementheardafter180sec>neighbor/linkdeclareddeadRoutesvianeighborinvalidatedNewadvertisementssenttoneighborsNeighborsinturnsendoutnewadvertisements(iftableschanged)LinkfailureinfoquicklypropagatestoentirenetPoisonreverse usedtopreventpingpongloops(infinitedistance=16hops)

    Network Layer 4-70

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-71

  • OSPF (Open Shortest Path First)

    Open:publiclyavailableUsesLinkStatealgorithm

    LSpacketdisseminationTopologymapateachnodeRoutecomputationusingDijkstrasalgorithm

    OSPFadvertisementcarriesoneentryperneighborrouterAdvertisementsdisseminatedtoentire AS(viaflooding)

    CarriedinOSPFmessagesdirectlyoverIP(ratherthanTCPorUDP

    Network Layer 4-72

  • OSPF Advanced Features (not in RIP)

    Security: allOSPFmessagesauthenticated(topreventmaliciousintrusion)Multiplesamecostpathsallowed(onlyonepathinRIP)Foreachlink,multiplecostmetricsfordifferentTOS(e.g.,satellitelinkcostsetlow forbesteffort;highforrealtime)Integrateduni andmulticast support:

    MulticastOSPF(MOSPF)usessametopologydatabaseasOSPF

    Hierarchical OSPFinlargedomains

    Network Layer 4-73

  • Hierarchical OSPF

    Network Layer 4-74

  • Chapter 4: Network Layer

    4.1Introduction4.2Virtualcircuitanddatagramnetworks4.3Whatsinsidearouter4.4IP:InternetProtocol

    DatagramformatIPv4addressingICMPIPv6

    4.5RoutingalgorithmsLinkstateDistanceVectorHierarchicalrouting

    4.6RoutingintheInternetRIPOSPFBGP

    Network Layer 4-75

  • Inter-AS Routing in the Internet: BGP

    Figure 4.5.2-new2: BGP use for inter-domain routing

    AS2 (OSPF

    intra-AS routing)

    AS1 (RIP intra-AS

    routing) BGP

    AS3 (OSPF intra-AS

    routing)

    BGP

    R1 R2

    R3

    R4 R5

    Network Layer 4-76

  • Internet Inter-AS Routing: BGP

    BGP(BorderGatewayProtocol): the defactostandardBGPprovideseachASameansto:1. ObtainsubnetreachabilityinformationfromneighboringASs.

    2. PropagatereachabilityinformationtoallASinternalrouters.

    3. Determinegood routestosubnetsbasedonreachabilityinformationandpolicy.

    AllowssubnettoadvertiseitsexistencetorestofInternet:Iamhere

    Network Layer 4-77

  • BGP BasicsPairsofrouters(BGPpeers)exchangeroutinginfooversemipermanentTCPconnections:BGPsessions

    BGPsessionsneednotcorrespondtophysicallinks

    WhenAS2advertisesaprefixtoAS1,AS2ispromising itwillforwardanydatagramsdestinedtothatprefixtowardstheprefix

    AS2canaggregateprefixesinitsadvertisement

    3b

    1d

    3a

    1c2aAS3

    AS1

    AS21a

    2c

    2b

    1b

    3c

    eBGP session

    iBGP sessionNetwork Layer 4-78

  • Distributing Reachability InfoWitheBGPsessionbetween3aand1c,AS3sendsprefixreachabilityinfotoAS11ccanthenuseiBGPdodistributethisnewprefixreachinfoto allroutersinAS11bcanthenreadvertisenewreachabilityinfotoAS2over1bto2aeBGPsessionWhenrouterlearnsofnewprefix,createsentryforprefixinitsforwardingtable

    3b

    1d

    3a

    1c2aAS3

    AS1

    AS21a

    2c

    2b

    1b

    3c

    eBGP session

    iBGP sessionNetwork Layer 4-79

  • Path Attributes & BGP Routes

    Whenadvertisingaprefix,advertincludesBGPattributes.prefix+attributes=route

    Twoimportantattributes:ASPATH: containsASsthroughwhichprefixadvertisementhaspassed:AS67AS17NEXTHOP: IndicatesspecificinternalASroutertonexthopAS.(TheremaybemultiplelinksfromcurrentAStonexthopAS.)

    Whengatewayrouterreceivesrouteadvertisement,usesimportpolicy toaccept/decline

    Network Layer 4-80

  • BGP Route Selection

    Routermaylearnaboutmorethan1routetosomeprefix.Routermustselectroute

    Eliminationrules:1. Localpreferencevalueattribute:policydecision2. ShortestASPATH3. ClosestNEXTHOProuter:hotpotatorouting4. Additionalcriteria

    Network Layer 4-81

  • BGP Routing Policy

    Network Layer 4-82

    A,B,CareprovidernetworksX,W,Yarecustomer(ofprovidernetworks)Xisdualhomed: attachedtotwonetworks

    XdoesnotwanttoroutefromBviaXtoC..soXwillnotadvertisetoBaroutetoC

  • BGP Routing Policy (2)

    Network Layer 4-83

    AadvertisestoBthepathAWBadvertisestoXthepathBAWShouldBadvertisetoCthepathBAW?

    Noway!Bgetsnorevenue forroutingCBAWsinceneitherWnorCareBscustomersBwantstoforceCtoroutetowviaABwantstorouteonlyto/fromitscustomers!

  • Why different Intra- and Inter-AS routing ?

    Policy:InterAS:adminwantscontroloverhowitstrafficrouted,whoroutesthroughitsnet.IntraAS:singleadmin,sonopolicydecisionsneeded

    Scale:Hierarchicalroutingsavestablesize,reducedupdatetraffic

    Performance:IntraAS:canfocusonperformanceInterAS:policymaydominateoverperformance

    Network Layer 4-84

  • Network Layer: SummaryWhatwevecovered:NetworklayerservicesRoutingprinciples:linkstateanddistancevectorHierarchicalroutingIPInternetroutingprotocolsRIP,OSPF,BGPWhatsinsidearouter?IPv6

    Network Layer 4-85