11.07.2015 Views

Network Layer - Network and Systems Lab

Network Layer - Network and Systems Lab

Network Layer - Network and Systems Lab

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2008/12/2Chapter 4<strong>Network</strong> <strong>Layer</strong>A note on the use of these ppt slides:We’re making these slides freely available to all (faculty, students, readers).They’re in PowerPoint form so you can add, modify, <strong>and</strong> delete slides(including this one) <strong>and</strong> slide content to suit your needs. They obviouslyrepresent a lot of 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,that you mention their source (after all, we’d like people to use our book!) If you post any slides in substantially unaltered form on a www site, thatyou note that they are adapted from (or perhaps identical to) our slides, <strong>and</strong>note our copyright of this material.Thanks <strong>and</strong> enjoy! JFK/KWRAll material copyright 1996-2007J.F Kurose <strong>and</strong> K.W. Ross, All Rights ReservedComputer <strong>Network</strong>ing:A Top Down Approach4 th edition.Jim Kurose, Keith RossAddison-Wesley, July2007.<strong>Network</strong> <strong>Layer</strong> 4-1Chapter 4: <strong>Network</strong> <strong>Layer</strong>Chapter goals: underst<strong>and</strong> principles behind network layerservices: network layer service models forwarding versus routing how a router works routing (path selection) dealing with scale advanced topics: IPv6, mobility instantiation, implementation in the Internet<strong>Network</strong> <strong>Layer</strong> 4-2Chapter 4: <strong>Network</strong> <strong>Layer</strong> 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routing<strong>Network</strong> layer transport segment fromsending to receiving host on sending sideencapsulates segmentsinto datagrams on rcving side, deliverssegments to transportlayer network layer protocolsin every host, router router examines headerfields in all IP datagramspassing through itapplicationtransportnetworkdata linkphysicalnetwork networkdata link data linknetworkphysical physicaldata linkphysicalnetwork networkdata link data linkphysical physicalnetworknetworkdata link data linkphysical physicalnetworkdata linkphysicalnetworkdata linknetworknetworkphysicaldata linkdata linkphysicalphysicalapplicationtransportnetworkdata linkphysical<strong>Network</strong> <strong>Layer</strong> 4-3<strong>Network</strong> <strong>Layer</strong> 4-4Two Key <strong>Network</strong>-<strong>Layer</strong> FunctionsInterplay between routing <strong>and</strong> forwarding forwarding: movepackets from router’sinput to appropriaterouter output routing: determineroute taken bypackets from sourceto dest. routing algorithmsanalogy: routing: process ofplanning trip fromsource to dest forwarding: processof getting throughsingle interchangevalue in arrivingpacket’s headerrouting algorithmlocal forwarding tableheader value output link01110100010101111001322113 2<strong>Network</strong> <strong>Layer</strong> 4-5<strong>Network</strong> <strong>Layer</strong> 4-61


2008/12/2Connection setup 3 rd important function in some network architectures: ATM, frame relay, X.25 before datagrams flow, two end hosts <strong>and</strong> interveningrouters establish virtual connection routers get involved network vs transport layer connection service: network: between two hosts (may also involveinervening routers in case of VCs) transport: between two processes<strong>Network</strong> service modelQ: What service model for “channel” transportingdatagrams from sender to receiver?Example services forindividual datagrams: guaranteed delivery guaranteed deliverywith less than 40 msecdelayExample services for aflow of datagrams: in-order datagramdelivery guaranteed minimumb<strong>and</strong>width to flow restrictions onchanges in interpacketspacing<strong>Network</strong> <strong>Layer</strong> 4-7<strong>Network</strong> <strong>Layer</strong> 4-8<strong>Network</strong> layer service models:Chapter 4: <strong>Network</strong> <strong>Layer</strong><strong>Network</strong>ArchitectureInternetATMATMATMATMServiceModelbest effortCBRVBRABRUBRB<strong>and</strong>widthnoneconstant yesrateguaranteed yesrateguaranteed nominimumnone noGuarantees ?Loss Order TimingnonoyesyesyesyesnoyesyesnonoCongestionfeedbackno (inferredvia loss)nocongestionnocongestionyesno 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routing<strong>Network</strong> <strong>Layer</strong> 4-9<strong>Network</strong> <strong>Layer</strong> 4-10<strong>Network</strong> layer connection <strong>and</strong>connection-less service datagram network provides network-layerconnectionless service VC network provides network-layerconnection service analogous to the transport-layer services,but: service: host-to-host no choice: network provides one or the other implementation: in network coreVirtual circuits“source-to-dest path behaves much like telephonecircuit” performance-wise network actions along source-to-dest path call setup, teardown for each call before data can flow each packet carries VC identifier (not destination hostaddress) every router on source-dest path maintains “state” foreach passing connection link, router resources (b<strong>and</strong>width, buffers) may beallocated to VC (dedicated resources = predictable service)<strong>Network</strong> <strong>Layer</strong> 4-11<strong>Network</strong> <strong>Layer</strong> 4-122


2008/12/2VC implementationForwarding tableVC numbera VC consists of:1. path from source to destination2. VC numbers, one number for each link alongpath3. entries in forwarding tables in routers alongpath packet belonging to VC carries VC number(rather than dest address) VC number can be changed on each link. New VC number comes from forwarding table<strong>Network</strong> <strong>Layer</strong> 4-13Forwarding table innorthwest router:interfacenumber1212 322 32Incoming interface Incoming VC # Outgoing interface Outgoing VC #1 12 3 222 63 1 183 7 2 171 97 3 87… … … …Routers maintain connection state information!<strong>Network</strong> <strong>Layer</strong> 4-14Virtual circuits: signaling protocols used to setup, maintain teardown VC used in ATM, frame-relay, X.25 not used in today’s InternetDatagram networks no call setup at network layer routers: no state about end-to-end connections no network-level concept of “connection” packets forwarded using destination host address packets between same source-dest pair may takedifferent pathsapplicationtransportnetworkdata linkphysical5. Data flow begins 6. Receive data4. Call connected3. Accept call1. Initiate call 2. incoming callapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysical1. Send data 2. Receive dataapplicationtransportnetworkdata linkphysical<strong>Network</strong> <strong>Layer</strong> 4-15<strong>Network</strong> <strong>Layer</strong> 4-16Forwarding table4 billionpossible entriesLongest prefix matchingDestination Address Range11001000 00010111 00010000 00000000through 011001000 00010111 00010111 11111111Link InterfacePrefix MatchLink Interface11001000 00010111 00010 011001000 00010111 00011000 111001000 00010111 00011 2otherwise 311001000 00010111 00011000 00000000through 111001000 00010111 00011000 1111111111001000 00010111 00011001 00000000through 211001000 00010111 00011111 11111111otherwise 3<strong>Network</strong> <strong>Layer</strong> 4-17ExamplesDA: 11001000 00010111 00010110 10100001DA: 11001000 00010111 00011000 10101010Which interface?Which interface?<strong>Network</strong> <strong>Layer</strong> 4-183


2008/12/2Datagram or VC network: why?Chapter 4: <strong>Network</strong> <strong>Layer</strong>Internet (datagram) data exchange amongcomputers “elastic” service, no stricttiming req. “smart” end systems(computers) can adapt, performcontrol, error recovery simple inside network,complexity at “edge” many link types different characteristics uniform service difficultATM (VC) evolved from telephony human conversation: strict timing, reliabilityrequirements need for guaranteedservice “dumb” end systems telephones complexity insidenetwork<strong>Network</strong> <strong>Layer</strong> 4-19 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routing<strong>Network</strong> <strong>Layer</strong> 4-20Router Architecture OverviewTwo key router functions: run routing algorithms/protocol (RIP, OSPF, BGP) forwarding datagrams from incoming to outgoing linkInput Port FunctionsPhysical layer:bit-level receptionData link layer:e.g., Ethernetsee chapter 5Decentralized switching: given datagram dest., lookup output portusing forwarding table in input portmemory goal: complete input port processing at‘line speed’ queuing: if datagrams arrive faster thanforwarding rate into switch fabric<strong>Network</strong> <strong>Layer</strong> 4-21<strong>Network</strong> <strong>Layer</strong> 4-22Three types of switching fabricsSwitching Via MemoryFirst generation routers: traditional computers with switching under directcontrol of CPUpacket copied to system’s memory speed limited by memory b<strong>and</strong>width (2 buscrossings per datagram)InputPortMemoryOutputPortSystem Bus<strong>Network</strong> <strong>Layer</strong> 4-23<strong>Network</strong> <strong>Layer</strong> 4-244


2008/12/2Switching Via a BusSwitching Via An Interconnection<strong>Network</strong> datagram from input port memoryto output port memory via a sharedbus bus contention: switching speedlimited by bus b<strong>and</strong>width 32 Gbps bus, Cisco 5600: sufficientspeed for access <strong>and</strong> enterpriserouters overcome bus b<strong>and</strong>width limitations Banyan networks, other interconnection netsinitially developed to connect processors inmultiprocessor advanced design: fragmenting datagram into fixedlength cells, switch cells through the fabric. Cisco 12000: switches 60 Gbps through theinterconnection network<strong>Network</strong> <strong>Layer</strong> 4-25<strong>Network</strong> <strong>Layer</strong> 4-26Output PortsOutput port queueing Buffering required when datagrams arrive fromfabric faster than the transmission rate Scheduling discipline chooses among queueddatagrams for transmission<strong>Network</strong> <strong>Layer</strong> 4-27 buffering when arrival rate via switch exceedsoutput line speed queueing (delay) <strong>and</strong> loss due to output portbuffer overflow!<strong>Network</strong> <strong>Layer</strong> 4-28How much buffering? RFC 3439 rule of thumb: average bufferingequal to “typical” RTT (say 250 msec) timeslink capacity C e.g., C = 10 Gps link: 2.5 Gbit buffer Recent recommendation: with N flows,buffering equal to RTT . CNInput Port Queuing Fabric slower than input ports combined -> queueingmay occur at input queues Head-of-the-Line (HOL) blocking: queued datagramat front of queue prevents others in queue frommoving forward queueing delay <strong>and</strong> loss due to input buffer overflow!<strong>Network</strong> <strong>Layer</strong> 4-29<strong>Network</strong> <strong>Layer</strong> 4-305


2008/12/2Chapter 4: <strong>Network</strong> <strong>Layer</strong> 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routingThe Internet <strong>Network</strong> layerHost, router network layer functions:<strong>Network</strong>layerRouting protocols•path selection•RIP RIP, OSPF, BGPTransport layer: TCP, UDPforwardingtableLink layerphysical layerIP protocol•addressing conventions•datagram format•packet h<strong>and</strong>ling conventionsICMP protocol•error reporting•router “signaling”<strong>Network</strong> <strong>Layer</strong> 4-31<strong>Network</strong> <strong>Layer</strong> 4-32Chapter 4: <strong>Network</strong> <strong>Layer</strong> 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routing<strong>Network</strong> <strong>Layer</strong> 4-33IP datagram formatIP protocol versionnumberheader length(bytes)“type” of datamax numberremaining hops(decremented ateach router)upper layer protocolto deliver payload tohow much overheadwith TCP? 20 bytes of TCP 20 bytes of IP = 40 bytes + applayer overheadverhead.lentype ofservice32 bitslengthfragment16-bit identifier flgsoffsettime to upper Internetlive layer checksum32 bit source IP address32 bit destination IP addressOptions (if any)data(variable length,typically a TCPor UDP segment)total datagramlength (bytes)forfragmentation/reassemblyE.g. timestamp,record routetaken, specifylist of routersto visit.<strong>Network</strong> <strong>Layer</strong> 4-34IP Fragmentation & ReassemblyIP Fragmentation <strong>and</strong> Reassemblynetwork links have MTU(max.transfer size) - largestpossible link-level frame. different link types,different MTUslarge IP datagram divided(“fragmented”) within net one datagram becomesseveral datagrams “reassembled” only at finaldestination IP header bits used toidentify, order relatedfragmentsreassemblyfragmentation:in: one large datagramout: 3 smaller datagramsExample 4000 bytedatagram MTU = 1500 byteslength=4000ID=xfragflag=0offset=0One large datagram becomesseveral smaller datagramslengthIDfragflagoffset=1500 =x =1 =0length=1500length=1040ID=xID=xfragflag offset=1 =1480fragflag offset=0 =2960<strong>Network</strong> <strong>Layer</strong> 4-35<strong>Network</strong> <strong>Layer</strong> 4-366


2008/12/2Chapter 4: <strong>Network</strong> <strong>Layer</strong>IP Addressing: introduction 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routing IP address: 32-bitidentifier for host,router interface interface: connectionbetween host/router<strong>and</strong> physical link routers typically havemultiple interfaces Hosts typically haveone but may havemultiple interfaces IP addressesassociated with eachinterface223.1.1.1223.1.2.1223.1.1.2223.1.1.4 223.1.2.9223.1.1.3223.1.3.1223.1.3.27223.1.2.2223.1.3.2223.1.1.1 = 11011111 00000001 00000001 00000001223 1 1 1<strong>Network</strong> <strong>Layer</strong> 4-37<strong>Network</strong> <strong>Layer</strong> 4-38SubnetsSubnets223.1.1.0/24223.1.2.0/24 IP address: subnet part (highorder bits) host part (low orderbits) What’s a subnet ? device interfaces withsame subnet part of IPaddress can physically reacheach other withoutintervening router223.1.1.1223.1.2.1223.1.1.2223.1.1.4 223.1.2.9223.1.2.2223.1.1.3 223.1.3.27subnet223.1.3.1223.1.3.2network consisting of 3 subnetsRecipe To determine thesubnets, detach eachinterface from itshost or router,creating isl<strong>and</strong>s ofisolated networks.Each isolated networkis called a subnet.223.1.3.0/24Subnet mask: /24<strong>Network</strong> <strong>Layer</strong> 4-39<strong>Network</strong> <strong>Layer</strong> 4-40SubnetsHow many? 223.1.1.1223.1.1.2223.1.1.4223.1.1.3223.1.9.2 223.1.7.0IP addressing: CIDRCIDR: Classless InterDomain Routing subnet portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits insubnet portion of address223.1.9.1223.1.8.1223.1.8.0223.1.7.1223.1.2.1223.1.2.6223.1.2.2223.1.3.27223.1.3.1223.1.3.2<strong>Network</strong> <strong>Layer</strong> 4-41subnethostpartpart11001000 00010111 00010000 00000000200.23.16.0/23<strong>Network</strong> <strong>Layer</strong> 4-427


2008/12/2IP addresses: how to get one?Q: How does host get IP address? hard-coded by system admin in a file Wintel: control-panel->network->configuration->configuration>tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol:dynamically get address from as server “plug-<strong>and</strong>-play”DHCP: Dynamic Host Configuration ProtocolGoal: allow host to dynamically obtain its IP addressfrom network server when it joins networkCan renew its lease on address in useAllows reuse of addresses (only hold address while connected)Support for mobile users who want to join network (moreshortly)DHCP overview: host broadcasts “DHCP discover” msg DHCP server responds with “DHCP offer” msg host requests IP address: “DHCP request” msg DHCP server sends address: “DHCP ack” msg<strong>Network</strong> <strong>Layer</strong> 4-43<strong>Network</strong> <strong>Layer</strong> 4-44DHCP client-server scenarioAB223.1.1.1DHCPserver223.1.1.2223.1.1.4 223.1.2.9223.1.1.3223.1.3.1223.1.3.27223.1.2.1223.1.2.2E223.1.3.2arriving DHCPclient needsaddress in thisnetwork<strong>Network</strong> <strong>Layer</strong> 4-45DHCP client-server scenarioDHCP server: 223.1.2.5DHCP discoversrc : 0.0.0.0, 68dest.: 255.255.255.255,67yiaddr: 0.0.0.0transaction ID: 654DHCP offersrc: 223.1.2.5, 67dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 654Lifetime: 3600 secsDHCP requestsrc: 0.0.0.0, 68dest:: 255.255.255.255, 67yiaddrr: 223.1.2.4transaction ID: 655time Lifetime: 3600 secsDHCP ACKsrc: 223.1.2.5, 67dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secsarrivingclient<strong>Network</strong> <strong>Layer</strong> 4-46IP addresses: how to get one?Q: How does network get network part of IPaddr?A: gets allocated portion of its provider ISP’saddress spaceISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23... ….. …. ….Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23Hierarchical addressing: route aggregationHierarchical addressing allows efficient advertisement of routinginformation:Organization 0200.23.16.0/23Organization 1200.23.18.0/23Organization 2200.23.20.0/23Organization 7200.23.30.0/23. ... Fly-By-Night-ISPISPs-R-Us“Send me anythingwith addressesbeginning200.23.16.0/20”“Send me anythingwith addressesbeginning199.31.0.0/16”Internet<strong>Network</strong> <strong>Layer</strong> 4-47<strong>Network</strong> <strong>Layer</strong> 4-488


2008/12/2Hierarchical addressing: more specificroutesIP addressing: the last word...ISPs-R-Us has a more specific route to Organization 1Organization 0200.23.16.0/23“Send me anythingwith addressesOrganization 2beginning200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20” manages DNS.. Internet.Organization 7200.23.30.0/23Organization 1200.23.18.0/23ISPs-R-Us“Send me anythingwith addressesbeginning 199.31.0.0/16or 200.23.18.0/23”Q: How does an ISP get block of addresses?A: ICANN: Internet Corporation for AssignedNames <strong>and</strong> Numbers allocates addresses assigns domain names, resolves disputes<strong>Network</strong> <strong>Layer</strong> 4-49<strong>Network</strong> <strong>Layer</strong> 4-50NAT: <strong>Network</strong> Address TranslationNAT: <strong>Network</strong> Address Translationrest ofInternet13876297138.76.29.7All datagrams leaving localnetwork have same single sourceNAT IP address: 138.76.29.7,different source port numbers10.0.0.4local network(e.g., home network)10.0.0/24Datagrams with source ordestination in this networkhave 10.0.0/24 address forsource, destination (as usual)10.0.0.110.0.0.210.0.0.3 Motivation: local network uses just one IP address asfar as outside world is concerned: no need to be allocated range of addresses from ISP:- just one IP address is used for all devices can change addresses of devices in local networkwithout notifying outside world can change ISP without changing addresses ofdevices in local network devices inside local net not explicitly addressable,visible by outside world (a security plus).<strong>Network</strong> <strong>Layer</strong> 4-51<strong>Network</strong> <strong>Layer</strong> 4-52NAT: <strong>Network</strong> Address TranslationImplementation: NAT router must: outgoing datagrams: replace (source IP address, port#) of every outgoing datagram to (NAT IP address,new port #). . . remote clients/servers will respond using (NATIP address, new port #) as destination addr. remember (in NAT translation table) every (sourceIP address, port #) to (NAT IP address, new port #)translation pair incoming datagrams: replace (NAT IP address, newport #) in dest fields of every incoming datagramwith corresponding (source IP address, port #)stored in NAT table<strong>Network</strong> <strong>Layer</strong> 4-53NAT: <strong>Network</strong> Address Translation2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table2NAT translation tableWAN side addr LAN side addr138.76.29.7, 5001 10.0.0.1, 3345…………S: 138.76.29.7, 5001D: 128.119.40.186, 8010.0.0.4S: 10.0.0.1, 3345D: 128.119.40.186, 8011: host 10.0.0.1sends datagram to128.119.40, 8010001 10.0.0.110.0.0.2138.76.29.7 S: 128.119.40.186, 80D: 10.0.0.1, 3345 4S: 128.119.40.186, 80D: 138.76.29.7, 5001 310.0.0.34: NAT router3: Reply arrivesCool, but… do you changes see datagramanydest. address:dest addr from138.76.29.7, 5001138.76.29.7, 5001 to 10.0.0.1, 3345problem with this?<strong>Network</strong> <strong>Layer</strong> 4-549


2008/12/2NAT: <strong>Network</strong> Address Translation 16-bit port-number field: 60,000 simultaneous connections with a singleLAN-side address! NAT is controversial: routers should only process up to layer 3 violates layer transparency argument• NAT possibility must be taken into account by appdesigners, eg, P2P applications address shortage should instead be solved byIPv6<strong>Network</strong> <strong>Layer</strong> 4-55NAT traversal problem client want to connect toserver with address 10.0.0.1 server address 10.0.0.1 localto LAN (client can’t use it asdestination addr) only one externally visibleNATted address: 13876297138.76.29.7 solution 1: staticallyconfigure NAT to forwardincoming connectionrequests at given port toserver e.g., (123.76.29.7, port 2500)always forwarded to 10.0.0.1port 25000Client?138.76.29.7 NATrouter10.0.0.410.0.0.1<strong>Network</strong> <strong>Layer</strong> 4-56NAT traversal problem solution 2: Universal Plug <strong>and</strong>Play (UPnP) Internet GatewayDevice (IGD) Protocol. AllowsNATted host to: learn public IP address(138.76.29.7)7) enumerate existing portmappings add/remove port mappings(with lease times)i.e., automate static NAT portmap configuration138.76.29.7 NATrouterIGD10.0.0.410.0.0.1<strong>Network</strong> <strong>Layer</strong> 4-57NAT traversal problem solution 3: relaying (used in Skype) NATed server establishes connection to relay External client connects to relay relay bridges packets between to connectionsClient2. connection torelay initiatedby client3. relayingestablished1. connection torelay initiatedby NATted host138.76.29.7 NATrouter10.0.0.1<strong>Network</strong> <strong>Layer</strong> 4-58Chapter 4: <strong>Network</strong> <strong>Layer</strong>ICMP: Internet Control Message Protocol 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routingused by hosts & routers tocommunicate network-levelinformation error reporting:unreachable host, network,port, protocol echo request/reply (usedby ping)network-layer “above” IP: ICMP msgs carried in IPdatagramsICMP message: type, code plusfirst 8 bytes of IP datagramcausing errorType 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 (congestioncontrol - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header<strong>Network</strong> <strong>Layer</strong> 4-59<strong>Network</strong> <strong>Layer</strong> 4-6010


2008/12/2Traceroute <strong>and</strong> ICMPChapter 4: <strong>Network</strong> <strong>Layer</strong> Source sends series ofUDP segments to dest First has TTL =1 Second has TTL=2, etc. Unlikely port number When nth datagram arrivesto nth router: Router discards datagram And sends to source anICMP message (type 11,code 0) Message includes name ofrouter& IP address When ICMP messagearrives, source calculatesRTT Traceroute does this 3timesStopping criterion UDP segment eventuallyarrives at destination host Destination returns ICMP“host unreachable” packet(type 3, code 3) When source gets thisICMP, stops. 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routing<strong>Network</strong> <strong>Layer</strong> 4-61<strong>Network</strong> <strong>Layer</strong> 4-62IPv6 Initial motivation: 32-bit address space soonto be completely allocated Additional motivation: header format helps speed processing/forwarding header changes to facilitate t QoS IPv6 datagram format: fixed-length 40 byte header no fragmentation allowedIPv6 Header (Cont)Priority: identify priority among datagrams in flowFlow <strong>Lab</strong>el: identify datagrams in same “flow”(concept of “flow” not well defined)Next header: identify upper layer protocol for data<strong>Network</strong> <strong>Layer</strong> 4-63<strong>Network</strong> <strong>Layer</strong> 4-64Other Changes from IPv4 Checksum: removed entirely to reduceprocessing time at each hop Options: allowed, but outside of header,indicated by “Next Header” field ICMPv6: new version of ICMP additional message types, e.g. “Packet Too Big” multicast group management functionsTransition From IPv4 To IPv6 Not all routers can be upgraded simultaneous no “flag days” How will the network operate with mixed IPv4 <strong>and</strong>IPv6 routers? Tunneling: IPv6 carried as payload in IPv4datagram among IPv4 routers<strong>Network</strong> <strong>Layer</strong> 4-65<strong>Network</strong> <strong>Layer</strong> 4-6611


2008/12/2TunnelingLogical view:A BtunnelE FIPv6 IPv6 IPv6 IPv6TunnelingLogical view:A BtunnelE FIPv6 IPv6 IPv6 IPv6Physical view:A B E FPhysical view:A B C D E FIPv6 IPv6 IPv4 IPv4 IPv6 IPv6IPv6 IPv6 IPv4 IPv4 IPv6 IPv6Flow: XSrc: ADest: FdataSrc:BDest: EFlow: XSrc: ADest: FSrc:BDest: EFlow: XSrc: ADest: FFlow: XSrc: ADest: Fdatadatadata<strong>Network</strong> <strong>Layer</strong> 4-67A-to-B:IPv6B-to-C:IPv6 insideIPv4B-to-C:IPv6 insideIPv4E-to-F:IPv6<strong>Network</strong> <strong>Layer</strong> 4-68Chapter 4: <strong>Network</strong> <strong>Layer</strong>Interplay between routing, forwarding 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routingvalue in arrivingpacket’s headerrouting algorithmlocal forwarding tableheader value output link01110100 30101 20111 21001 113 2<strong>Network</strong> <strong>Layer</strong> 4-69<strong>Network</strong> <strong>Layer</strong> 4-70Getting a datagram from source to dest.IP datagram:misc source destfields felds IP addrIP addrdata datagram remainsunchanged, as it travelssource to destination addr fields of interesthereforwarding table in ADest. Net. next router Nhops223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2A 223111 223.1.1.1B223.1.2.1223.1.1.2223.1.1.4 223.1.2.9223.1.1.3223.1.3.1223.1.3.27223.1.2.2E223.1.3.2Getting a datagram from source to dest.fields 223.1.1.1 223.1.1.3 data forwarding table in AmiscDest. Net. next router Nhops223.1.1 1223.1.2 223.1.1.4 2Starting at A, send IP223.1.3 223.1.1.4 2datagram addressed to B: look up net. address of B inforwarding tableA 223111 223.1.1.1 find B is on same net. as A223.1.1.2223.1.2.1 link layer will send datagram223.1.1.4 223.1.2.9directly to B inside link-layer B223.1.2.2frame223.1.1.3 223.1.3.27 E B <strong>and</strong> A are directlyconnected223.1.3.1223.1.3.2<strong>Network</strong> <strong>Layer</strong> 4-71<strong>Network</strong> <strong>Layer</strong> 4-7212


2008/12/2Getting a datagram from source to dest.fields 223.1.1.1 223.1.2.2 data forwarding table in AmiscDest. Net. next router Nhops223.1.1 1223.1.2 223.1.1.4 2Starting at A, dest. E:223.1.3 223.1.1.4 2 look up network address of Ein forwarding table E on different networkA 223111 223.1.1.1 A, E not directly attached223.1.1.2223.1.2.1 routing table: next hop223.1.1.4 223.1.2.9router to E is 223.1.1.4B link layer sends datagram to 223.1.1.3 223.1.3.27223.1.2.2Erouter 223.1.1.4 inside linklayerframe223.1.3.1223.1.3.2 datagram arrives at 223.1.1.4 continued…..<strong>Network</strong> <strong>Layer</strong> 4-73Getting a datagram from source to dest.forwarding table in routermiscfields 223.1.1.1 223.1.2.2 data Dest. Net router Nhops interface223.1.1 - 1 223.1.1.4Arriving at 223.1.4,223.1.2 - 1 223.1.2.9destined for 223.1.2.2223.1.3 - 1 223.1.3.27 look up network address of Ein router’s forwarding tableA 223111 223.1.1.1 E on same network as router’s223.1.1.2223.1.2.1interface 223.1.2.9223.1.1.4 223.1.2.9 router, E directly attached B223.1.2.2 link layer sends datagram to223.1.1.3 223.1.3.27 E223.1.2.2 inside link-layerframe via interface 223.1.2.9 datagram arrives at223.1.2.2!!! (hooray!)223.1.3.1223.1.3.2<strong>Network</strong> <strong>Layer</strong> 4-74Graph abstractionGraph abstraction: costs5v 3 w25u2 1 z31xy 2Graph: G = (N,E)1N = 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 contextsExample: P2P, where N is set of peers <strong>and</strong> E is set of TCP connections2u15 • c(x,x’) = cost of link (x,x’)v2x3 w5- e.g., c(w,z) = 51 z3• cost could always be 1, or1 2inversely related to b<strong>and</strong>width,yor inversely related tocongestionCost of path (x 1 , x 2 , x 3 ,…, x p ) = c(x 1 ,x 2 ) + c(x 2 ,x 3 ) + … + c(x p-1 ,x p )Question: What’s the least-cost path between u <strong>and</strong> z ?Routing algorithm: algorithm that finds least-cost path<strong>Network</strong> <strong>Layer</strong> 4-75<strong>Network</strong> <strong>Layer</strong> 4-76Take a Simpler Case Ways of going from Bto E? B-C-E B-D-E B-C-B-C-E B-C-B-D-E B-D-B-C-E B-D-B-D-E B-C-B-C-B-C-E B-C-B-C-B-D-E B-C-B-D-B-C-E B-C-B-D-B-D-E …infinitely manyBD2A matter of finding thenumber of combinations!31CE1<strong>Network</strong> <strong>Layer</strong> 4-77Picking One Good Way Cost of the ways goingfrom B to E? B-C-E B-D-E B-C-B-C-E 4 3 6+4 B-C-B-D-E 6+3 B-D-B-C-E 4+4 B-D-B-D-E 4+3 B-C-B-C-B-C-E 6+10 B-C-B-C-B-D-E 6+9 B-C-B-D-B-C-E 3+6 B-C-B-D-B-D-E 3+5 …infinitely many …BD231A matter of finding thebest combination!CE1<strong>Network</strong> <strong>Layer</strong> 4-7813


2008/12/2Routing Algorithm classificationChapter 4: <strong>Network</strong> <strong>Layer</strong>Global or decentralizedinformation?Global: all routers have completetopology, link cost info “link state” algorithmsDecentralized: router knows physicallyconnectedneighbors, linkcosts to neighbors iterative process ofcomputation, exchange ofinfo with neighbors “distance vector” algorithmsStatic or dynamic?Static: routes change slowlyover timeDynamic: routes change morequickly periodic update in response to linkcost changes 4. 1 Introduction 4.2 Virtual circuit <strong>and</strong>datagram networks 4.3 What’s inside arouter 4.4 IP: InternetProtocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in theInternet RIP OSPF BGP 4.7 Broadcast <strong>and</strong>multicast routing<strong>Network</strong> <strong>Layer</strong> 4-79<strong>Network</strong> <strong>Layer</strong> 4-80The Idea of Link State RoutingA Link-State Routing Algorithm Given the topology (graph) Compute the least cost path (the bestcombination) From each possible source To each possible destination OK. We kind of have something aboutcomputing the least cost path But how to get the topology?<strong>Network</strong> <strong>Layer</strong> 4-81Dijkstra’s algorithm net topology, link costsknown to all nodes accomplished via “linkstate broadcast” all nodes have same info computes least cost pathsfrom one node (‘source”) toall other nodes gives forwarding tablefor that node iterative: after kiterations, know least costpath to k dest.’sNotation: c(x,y): link cost from nodex to y; = ∞ if not directneighbors D(v): current value of costof path from source todest. v p(v): predecessor nodealong path from source to v N': set of nodes whoseleast cost path definitivelyknown<strong>Network</strong> <strong>Layer</strong> 4-82Dijsktra’s AlgorithmDijkstra’s algorithm: example1 Initialization:52 Travel from the source uv 3 w3 for all nodes v254 if v adjacent to uu25 then D(v) = c(u,v)1 z36 else D(v) = infinity1x y 2718 Loop9 find another node w adjacent to the traveled nodes to travel10 such that D(w) is a minimum11 for all v adjacent to w <strong>and</strong> not yet traveled12 D(v) = min( D(v), D(w) + c(w,v) ) check if there’s a better D(v)13 /* new cost to v is the better one between the old cost to v14 or the minimum path cost to w plus the w-v link cost */15 until all nodes are traveled<strong>Network</strong> <strong>Layer</strong> 4-83Step01234Travel Setuuxuxyuxyvuxyvw5 uxyvwz2u15v2xD(v),p(v)2,u2,u2,u3w13y1D(w),p(w)5,u4,x3,y3,y5z2D(x),p(x)1,uD(y),p(y)infinity2,xD(z),p(z)infinityinfinity4,y4,y4,yOK the min cost to w is 3But what’s the path from u to w?How do computers figureit out from the table?From w, get the previous node yFrom y, get the previous node xFrom x, get the previous node u<strong>Network</strong> <strong>Layer</strong> 4-8414


2008/12/2Dijkstra’s algorithm: example (2)Dijkstra’s algorithm, discussionResulting shortest-path tree from u:uvxResulting forwarding table in u:wyzAlgorithm complexity: n nodes each iteration: need to check all nodes, w, not traveled n*(n+1)/2 comparisons: O(n 2 ) more efficient implementations possible: O(nlogn)Oscillations possible: e.g., link cost = amount of carried traffic initially, link cost = 0 traffic coming from B, C, D to Adestinationvxywzlink(u,v)(u,x)(u,x)(u,x)(u,x)<strong>Network</strong> <strong>Layer</strong> 4-85A1 1+eD B0 00 C e11einitiallyA2+e 0D B1+e 10 C 0… recomputeroutingA0 2+eD B0 01 C 1+e… recomputeA2+e 0D B1+e 10 C e… recompute<strong>Network</strong> <strong>Layer</strong> 4-86LS Routing Summary net topology, link costs known to all nodesaccomplished via “link state broadcast”all nodes have the entire topology info computes least cost paths from one node(‘source’) to all other nodesgives routing table for that node Do you see any problems?LS broadcast: consumes b<strong>and</strong>widthTopology info: occupies memory space<strong>Network</strong> <strong>Layer</strong> 4-8715

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!