network layer - courses · • link-layer (layer 2) ... • only one protocol at the network layer....

102
Network Layer Brad Smith Spring 2017 CE 151 - Advanced Networks 1

Upload: nguyentu

Post on 28-May-2018

238 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

NetworkLayer

BradSmith

Spring2017 CE151-AdvancedNetworks 1

Page 2: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

LogisAcs•  SignupforPiazza(piazza.com)

•  Sunday–  Firstlabdue.–  FirstlabsecAonishalfofthelabgrade.–  85pointsforthelab–  85pointsforaMendingfirstlabsecAon–  VMProblems

•  Tuesday–  Linklayerlecture

•  Thursday–  Read“End-to-EndArgument”paper–  IPv4/layerexercise–  IPv4quiz…revieworangeslides

Spring2017 CE151-AdvancedNetworks 2

Page 3: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

netref.soe.ucsc.edu

Spring2017 CE151-AdvancedNetworks 3

Page 4: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

InternetBackground•  TheARPAnetwasthefirstpacket-switchednetwork.•  It’ssuccessledtotheInternet•  TheARPAnetarchitecture

–  Homogeneousswitches•  InterfaceMessageProcessors(IMPs)

–  Heterogeneoushosts–  TheNetworkControlProtocol(NCP)implementedconservaAveerror,flow,

andcongesAoncontrol

•  Newtechnicalchallenges–  MoresophisAcatedeBrror,flow,andcongesAoncontrolacrossanetwork.

•  Link-layer(layer2)networkfromtoday’sperspec>ve.

Spring2017 CE151-AdvancedNetworks 4

Page 5: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

TheARPAnet

Spring2017 CE151-AdvancedNetworks 5

HOST

Host-IMP IMP-IMP

HOST Host-Host (NCP)

IMP

IMP

IMP

IMP

application application

Page 6: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ARPAnetArchitecture•  Host-to-Hostprotocol

–  ImplementedintheNetworkControlProgram(NCP)–  PrimaryfuncAons:connecAonmanagement,processnaming(“sockets”),flow

control(memorymanagement)

•  Host-IMPprotocol–  PrimaryfuncAon:“bidirecAonalcommunicaAonbetweenthehostandIMP”…

basicallythehost’snetworkinterface.

•  IMP-IMPprotocol–  PrimaryfuncAons:(de-)packeAzingdata,flowcontrol(end-pointIMPs),error

detecAon,reliablydelivery(ingresstoegressIMPs),rouAngthroughIMPtopology.

Spring2017 CE151-AdvancedNetworks 6

Page 7: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

GoalsoftheInternet•  New,diversenetworktechnologies

–  LANs(e.gEthernet)–  DARPApacketradionetwork(PRNET)–  DARPAsatellitenetwork(SATNET)

•  Internetgoal–  InterconnecAonofdiversenetworks,whichwecallsubnets

•  Minimal-servicenetworkmodel

•  VintCerfandRobertKahn-“AProtocolforPacketNetworkInterconnecAon”(May,1974)

Spring2017 CE151-AdvancedNetworks 7

Page 8: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Minimal-ServiceNetworkModel•  Newconcepts

–  “Gateway”interconnectsdissimilarnetworks.–  Internet-levelhostaddressing

•  NewfuncAonality–  NCPupgraded

•  End-to-end,slidingwindowerror,flow,andcongesAoncontrol•  CalledTransmissionControlProtocol(TCP)

Spring2017 CE151-AdvancedNetworks 8

Page 9: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

TheInternetArchitecture

Spring2017 CE151-AdvancedNetworks 9

G

G

G G

SUBNET

SUBNET

SUBNET

SUBNET A

B

TCP

TCP

Page 10: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

EvoluAonofTCP/IP•  TCPoriginallymeanttoreplaceNCP

•  Problems–  MonolithicfuncAonality–  Decidedtoseparate“addressinglayer”from“streamlayer”–  Allowforfuturedatagramand/ornon-reliable(e.g.voice)protocols

•  Movefromsmartnetworktosmarthosts…“End-to-endPrinciple”

•  TCPsplitintoTCP/IP–  InternetProtocol(IP)

•  Best-effortrouAng•  Internetleveladdressing

–  TransmissionControlProtocol(TCP)•  New,end-to-enderror,flow,andcongesAoncontrol

•  WhatistheminimalsetoffuncAonalityneededtoconstructaninternet?

Spring2017 CE151-AdvancedNetworks 10

Page 11: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

End-to-EndPrinciple

�If a function can completely and correctly be implemented only with the knowledge and help of the application end-points of a

communication system, then the function should not be implemented in the communication system itself (although

sometimes it may be useful to implement an incomplete version of the function in the communication system as a performance

enhancement).�

“End-to-End Arguments in System Design” by Saltzer, Reed, and Clark (‘84)

Spring2017 CE151-AdvancedNetworks 11

Page 12: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

End-to-EndPrinciple•  AvoidsimpacAngapplicaAonsthatdon’tneedthisfuncAon.

•  Reducescomplexityofthenetwork…–  Dumbnetwork,smartend-points…reverseofthetelephonesystem!

•  Overall,improvesefficiencyandreliabilityofthenetwork.

•  E.g.TransportfuncAons…–  End-pointsmustbeinvolvedtoensuredatamakesittotheprocess

(corrupAonintheend-system)–  ThereforenotransportfuncAonalityinthenetwork.

•  ReasonableinterpretaAon…forfuncAonsrequiringend-pointinvolvement–  ThinktwicebeforeimplemenAnginthenetwork–  JusAfyasaperformanceenhancement–  Don’timposeaburdenonapplicaAonsthatdon’trequireit–  E.g.verylossy(wireless)links–  Doesn’tneedtobeheavy-weight…candependonend-to-endmechanisms

Spring2017 CE151-AdvancedNetworks 12

Page 13: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

EvoluAonofTCP/IP•  TCPoriginallymeanttoreplaceNCP

•  Problems–  MonolithicfuncAonality–  Reliabledeliveryahost-hostissue

•  Movefromsmartnetworktosmarthosts…“End-to-endPrinciple”

•  TCPsplitintoTCP/IP–  InternetProtocol(IP)

•  Best-effortrouAng•  Internetleveladdressing

–  TransmissionControlProtocol(TCP)•  New,end-to-enderror,flow,andcongesAoncontrol

•  WhatistheminimalsetoffuncAonalityneededtoconstructaninternet?

Spring2017 CE151-AdvancedNetworks 13

Page 14: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

InternetArchitectureFollowingposAngfromDaveCrocker(earlyInternetparAcipant)tothe“end2end-interest”mailinglist(4/11/13):

Here'sacommentthatIsentearliertoday,toanon-technicalpersonwhoisawareoftheoverallInternetAmeline,butIbelievedoesnotunderstandwhatisdisAncAveaboutInternet'architecture'.I'mcuriousaboutreacAonsonthislist,andanypossibleimprovements--includingcompletereplacement--butmoreimportantlyI'minterestedinfillinginthedetails:

TheoriginaluseofthetermInternetwastodescribeadis;nc;vetechnicaldesignforadistributed,scalabledataexchangefabric.Itsdesigncharacteris;csdifferdrama;callyfromthoseofitspredecessor,theArpanet,andfromotherrelatedefforts.

That'swhatIsent.Toprimethepumpforthedetail:

Bysaying'fabric'Imeanttodis;nguishthemechanismformovingrawdatafromtheapplica;onsthatusedit.WhatI'dclassasdis;nc;vewere•  theTCP/IPsepara>on,•  theremarkablymodestfunc>onalityofIP,eventothepointofmovingit'scontrolplanetothe

nextlevelupwithICMP,and•  con>nuingwithmodestexpecta>onsthelayerbelow(whichmadeitpossibletooperateover

anymediumincludingbirds.)Thisisusuallycharacterizedasmovingrobustnesstotheedges.

Spring2017 CE151-AdvancedNetworks 14

Page 15: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  IPgoals

–  interconnectdiversenetworktechnologies,makingminimalassumpAonsoftheunderlyingnetworks

–  implementtheminimalsetoffuncAonalityneededtoconstructaninternet…inthissenseIPisthewaistofthenetworkprotocolstackhourglass

•  IPimplementsadatagram,packet-switchedmodelofcommunicaAons.

•  Packet-switchcommunicaAoninvolvestransmissionofdigitaldata–  inpackets–  noresourcereservaAon...usestaAsAcalmulAplexingtoshareachannel

Spring2017 CE151-AdvancedNetworks 15

Page 16: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  End-to-EndPrinciple

–  IfafuncAonrequiresend-pointinvolvementtoimplementthefuncAoncompletelyandcorrectly,thenonlyimplementintheend-points!

•  AvoidsimpacAngnetworkapplicaAonsthatdon’tneedthisfuncAon•  Reducescomplexityofthenetwork...dumbnetwork,smartend-points.Reverseof

thetelephonesystem!•  Overall,improvesefficiencyandreliabilityofthenetwork.

–  ReasonableinterpretaAon...ifafuncAonrequiresinvolvementofend-points...•  ThinktwicebeforeimplemenAngitinthenetwork•  OnlyjusAficaAonisasaperformanceenhancement•  DonotimposeaburdenonapplicaAonsthatdon’trequireit•  E.g.verylossy(wireless)links

Spring2017 CE151-AdvancedNetworks 16

Page 17: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReadingReview

•  “End-to-EndArgumentsinSystemDesign”–Salzer,Reed,Clark–  HowdoesthereliablefiletransferproblemmoAvatetheend-to-end

principle?

–  WhatistheprimaryreasonforexcepAonstotheend-to-endprinciple?

–  WhatisacommonproblemwithimplemenAngaperformance-enhancementinthecommunicaAonchannel?

–  Whyisitopenacceptabletoimplementaweakversionofend-to-endservicesasanexcepAontotheend-to-endprinciple(i.e.outsidetheend-nodes)?

Spring2017 CE151-AdvancedNetworks 17

Page 18: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

EvoluAonofTCP/IP•  TCPoriginallymeanttoreplaceNCP

•  Problems–  MonolithicfuncAonality–  Reliabledeliveryahost-hostissue

•  Movefromsmartnetworktosmarthosts…“End-to-endPrinciple”

•  TCPsplitintoTCP/IP–  InternetProtocol(IP)

•  Best-effortrouAng•  Internetleveladdressing

–  TransmissionControlProtocol(TCP)•  New,end-to-enderror,flow,andcongesAoncontrol

•  WhatistheminimalsetoffuncAonalityneededtoconstructaninternet?

Spring2017 CE151-AdvancedNetworks 18

Page 19: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

AMAZING!!!!

Spring2017 CE151-AdvancedNetworks 19

Page 20: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

IPheaderprocessing

Spring2017 CE151-AdvancedNetworks 20

Page 21: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

IPheaderprocessing

RouAng

Spring2017 CE151-AdvancedNetworks 21

Page 22: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

IPheaderprocessing

RouAng

AddressResoluAonProtocol

Spring2017 CE151-AdvancedNetworks 22

Page 23: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

IPheaderprocessing

AddressResoluAonProtocol

RouAng

InternetControlMessageProtocol

Spring2017 CE151-AdvancedNetworks 23

Page 24: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IP-OrientaAon•  IP(InternetProtocol)isaNetworkLayerProtocol.•  IP’scurrentversionisVersion4(IPv4).•  ItisspecifiedinRFC791.•  IPv6isbeingdeployednow…

NetworkLayer

Link Layer

IP

ARP NetworkAccess

Media

ICMP IGMP

TransportLayer

TCP UDP

Spring2017 CE151-AdvancedNetworks 24

Page 25: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IP:Thewaistofthehourglass•  IPisthewaistofthehourglassofthe

Internetprotocolarchitecture

•  MulAplehigher-layerprotocols•  MulAplelower-layerprotocols

•  Onlyoneprotocolatthenetworklayer.

•  MinimumfuncAonalitytoconstructaninternet

Spring2017 CE151-AdvancedNetworks 25

Applications

HTTP FTP SMTP

TCP UDP

IP

Data link layer protocols

Physical layer protocols

Page 26: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

HighestLayerHop-by-HopProtocol•  IPisthehighestlayerprotocolwhichisimplementedatbothroutersand

hosts(hop-by-hop)

Spring2017 CE151-AdvancedNetworks 26

Application

TCP

IP

Data Link

Application

TCP

IP

NetworkAccess

Application protocol

TCP protocol

IP protocol IP protocol

DataLink

DataLink

IP

DataLink

DataLink

IP

DataLink

DataLink

DataLink

IP protocol

RouterRouter HostHost

Page 27: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPService•  DeliveryserviceofIPisminimal…packet-switchedcommunicaAonmodel

–  Datasentinpackets–  Sta>s>calmul>plexing(best-effort…packetscanbedroppedordeliveredout

oforder)

•  IPimplementsdatagramflavorofpacket-switching

•  DisAnguishingcharacterisAcofdatagramisitisconnecAonless–  Routescomputedonanevent-drivenbasis(topologychanges)–  Forwardingdecisionsdoneperpacket–  Differentpacketsinthesameflowmayfollowdifferentpaths–  Noper-flowstateisrequired–  Thinktelegram

•  Whatistheotherformofpacket-switching?

Spring2017 CE151-AdvancedNetworks 27

Page 28: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPService•  Virtual-circuit

•  Howisvirtual-circuitdifferentfromdatagram?

•  DisAnguishingcharacterisAcofvirtual-circuitisitisconnecAon-oriented–  RoutecomputaAonandforwardingdecisionsdoneonce/flow–  Requiresper-flowstate–  Thinktelephone-callwithoutbandwidthreservaAons

•  Consequencesofdatagrammodel–  Higherlayerprotocolshavetodealwithlossesorwithduplicatepackets

•  Hmmm…moreaccurately,Iwouldsaythisisaconsequenceofpacket-switching

–  Packetsmaybedeliveredout-of-sequence

Spring2017 CE151-AdvancedNetworks 28

Page 29: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPService•  IPsupportsthefollowingservices:

–  one-to-one (unicast)–  one-to-all (broadcast)–  one-to-group (mulAcast)

•  IPmulAcastalsosupportsamany-to-manyservice.•  IPmulAcastrequiressupportofotherprotocols(IGMP,mulAcastrouAng)•  Anycast?

Spring2017 CE151-AdvancedNetworks 29

unicast broadcast multicast

Page 30: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  DisAnguishingcharacterisAcsofpacket-switchedcommunicaAon

–  DatatransmiMedinpackets–  StaAsAcalmulAplexing(best-effort-packetscanbedroppedordeliveredoutoforder)

•  Packet-switchingcomesintwoflavors–  virtual-circuit-connecAonoriented

•  routeonce/flow•  per-flowforwardingstate

–  datagram–connecAonless•  routescomputedoneventdriven-basis•  per-desAnaAonforwardingstate

•  Consequencesofpacket-switching–  higherlayerprotocolshavetodealwithlossesorwithduplicatepackets–  withdatagrammodel,packetsmaybedeliveredoutofsequence

Spring2017 CE151-AdvancedNetworks 30

Page 31: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  4classesofservices

–  Unicast–  Broadcast–  MulAcast–  Anycast

Spring2017 CE151-AdvancedNetworks 31

Page 32: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  IPgoals

–  interconnectdiversenetworktechnologies,makingminimalassumpAonsoftheunderlyingnetworks

–  implementtheminimalsetoffuncAonalityneededtoconstructaninternet…inthissenseIPisthewaistofthenetworkprotocolstackhourglass

•  IPimplementsadatagram,packet-switchedmodelofcommunicaAons.

•  Packet-switchcommunicaAoninvolvestransmissionofdigitaldata–  inpackets–  noresourcereservaAon...usestaAsAcalmulAplexingtoshareachannel

•  best-effort-packetscanbedroppedordeliveredoutoforder

Spring2017 CE151-AdvancedNetworks 32

Page 33: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  Consequencesofpacket-switching

–  higherlayerprotocolshavetodealwithlossesorwithduplicatepackets–  withdatagrammodel,packetsmaybedeliveredoutofsequence

•  End-to-endPrincipal

•  Packet-switchingcomesintwoflavors–  virtual-circuit-connecAonoriented

•  routeonce/flow•  per-flowforwardingstate

–  datagram–connecAonless•  routescomputedoneventdriven-basis•  per-desAnaAonforwardingstate

•  4classesofservices:Unicast,Broadcast,MulAcast,Anycast

Spring2017 CE151-AdvancedNetworks 33

Page 34: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

AMAZING!!!!

Spring2017 CE151-AdvancedNetworks 34

Page 35: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

IPheaderprocessing

AddressResoluAonProtocol

RouAng

InternetControlMessageProtocol

Spring2017 CE151-AdvancedNetworks 35

Page 36: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPDatagramFormat

Spring2017 CE151-AdvancedNetworks 36

ECNversion headerlength DS total length (in bytes)

Identification Fragment offset

source IP address

destination IP address

options (0 to 40 bytes)

payload

4 bytes

time-to-live (TTL) protocol header checksum

bit # 0 15 23 248 317 16

0 MF

DF

Page 37: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPHeaderFields•  Version(4bits):currentversionis4.•  Headerlength(4bits):

–  LengthofIPheader,inmulAplesof4bytes–  20bytes≤HeaderLength≤(24-1)*4=60bytes

•  Servicefield(1byte)–  Iffirstthreebitsare0,interpretedasoriginalType-of-Service(TOS).–  Otherwise

•  6bits:DifferenAatedService(DS)(RFC2474):•  2bits:ExplicitCongesAonNoAficaAon(ECN)(RFC3168):

Spring2017 CE151-AdvancedNetworks 37

Page 38: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPHeaderFields•  Totallength(16bits):

–  TotallengthofIPv4datagram,inbytes.–  20bytes≤TotalLength≤216-1=65535bytes–  Lengthofdata=totallength-headerlength

•  IdenAficaAon(16bits):UniqueidenAficaAonofadatagramfromahost.IncrementedwheneveradatagramistransmiMed

•  Flags(3bits):–  Firstbitalwayssetto0–  DFbit(Donotfragment)–  MFbit(Morefragments)

ForFragmentaAon…willbeexplainedlater

Spring2017 CE151-AdvancedNetworks 38

Page 39: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPHeaderFields•  TimeToLive(TTL)(1byte):

–  Specifieslongestpathsbeforedatagramisdropped–  RoleofTTLfield:EnsurethatpacketiseventuallydroppedwhenarouAng

loopoccurs

Usedasfollows:–  Sendersetsthevalue(e.g.,64)–  Eachrouterdecrementsthevalueby1–  Whenthevaluereaches0,thedatagramisdropped

•  NoTTLinEthernet…whydoyouthinktheydidn’tincludeone?

Spring2017 CE151-AdvancedNetworks 39

Page 40: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPHeaderFields•  Protocol(1byte):

–  Specifiesthehigher-layerprotocol.–  UsedfordemulAplexingtohigherlayers.

Spring2017 CE151-AdvancedNetworks 40

IP

1 = ICMP 2 = IGMP

6 = TCP 17 = UDP

4 = IP-in-IPencapsulation

Page 41: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPHeaderFields•  Headerchecksum(2bytes):Simple16-

bitlongchecksumcoversonlyheader.•  Upperlayerprotocolscoverdata•  IPishighesthop-by-hopprotocol;need

tominimizeprocessing

Spring2017 CE151-AdvancedNetworks 41

Page 42: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

IPHeaderFields•  OpAonType

–  Copyflag:IndicatesifopAontobecopiedtofragments.–  OpAonclass:0=Control,2=Debug/Measurement,rest“Reserved”.–  OpAonnumber:idenAfiesopAon

•  OpAonlength:notpresentforNoopandEndofOpAons•  OpAondata:notpresentforNOPandEndofOpAons

Spring2017 CE151-AdvancedNetworks 42

Page 43: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

FragmentaAon•  MaximumsizeofIPdatagramis65535…

–  …butlink-layerpayloadlimitstypicallymuchsmaller•  CalledtheMaximumTransmissionUnit(MTU).•  ExampleMTUs:

•  FragmentIPdatagramslargerthanMTUofalink.•  Issues

–  HowcommunicatefragmentaAonamonghopsinapath?–  HowhandlepathscontainingnetworkswithdifferentMTUs?–  WhereisfragmentaAondone?

Spring2017 CE151-AdvancedNetworks 43

Page 44: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

FragmentaAon-How?•  Involvesfollowingfields(pluschecksum)

•  IdenAficaAon:IDandsourceIPaddressuniquelyidenAfydatagram.•  Flags

–  DF:“Don’tfragment.”Discardandsenderror.–  MF:“Morefragments.”Morefragmentsfollow.

•  FragmentOffset:Offsetofcurrentpayloadinoriginaldatagram.–  Only13bitfield-givesoffsetinunitsof8bytes–  NumberoffirstbyteinpayloadisFO*8.–  Sizeofallfragments,butlast,mustbemulApleof8.

Spring2017 CE151-AdvancedNetworks 44

ECNversion headerlength DS total length (in bytes)

Identification Fragment offset

time-to-live (TTL) protocol header checksum

0 MF

DF

Page 45: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

FragmentaAon-How?

•  Totallength:Totallengthofthecurrentfragment.•  ConstraintsoffragmentaAon

–  FragmentaAoncanbedoneatthesenderoratintermediaterouters–  ThesamedatagramcanbefragmentedseveralAmes.–  ReassemblyoforiginaldatagramisonlydoneatdesAnaAonhosts!!

•  Why?

•  Howdetermineifadatagramisafragment?–  FO≠0or…–  MFflagisset

Spring2017 CE151-AdvancedNetworks 45

ECNversion headerlength DS total length (in bytes)

Identification Fragment offset

time-to-live (TTL) protocol header checksum

0 MF

DF

•  ExplanaAon•  WhatdoesFO=0mean?Thisisthefirstfragment.•  WhatdoesMF=0mean?Thisisthelastfragment.•  Whatdoes((FO=0)and(MF=0))mean?Thisisboththefirstandlastfragment->

thisistheonlyfragment->thisistheoriginalpacket(i.e.notafragment).NOTE:thisistheonlywaytonotbeafragment.

•  Soapacketisafragmentif!((FO=0)and(MF=0))<->((FO≠0)or(MF≠0))

Page 46: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

FragmentaAonExample

Spring2017 CE151-AdvancedNetworks 46

Page 47: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

FragmentaAonExample•  ExamplewherelastfragmentisnotmulApleof8.

Spring2017 CE151-AdvancedNetworks 47

IP datagram

Router

Fragment 2Fragment 3

MTU: 1000MTU: 4000

Fragment 1

Header length: 20Total length: 2400

Identification: 0xa428DF flag: 0MF flag: 0

Fragment offset: 0

Header length: 20Total length: 996

Identification: 0xa428DF flag: 0MF flag: 1

fragment offset: 0

Header length: 20Total length: 996

Identification: 0xa428DF flag: 0MF flag: 1

Fragment offset: 122

Header length: 20Total length: 448

Identification: 0xa428DF flag: 0MF flag: 0

Fragment offset: 244

Page 48: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Whycalculatechecksum@eachhop?

•  Fieldswillchange…–  TTL–  FragmentaAoninformaAon–  Headerlength–  Others..?

Spring2017 CE151-AdvancedNetworks 48

Page 49: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  IPheaders…

–  Checksumonlycoversheadertominimizehop-by-hopprocessing•  Assumesupperlayerprotocolscoverdata

–  Checksummustberecalculatedateachhop•  IPheaderfieldschange…TTL,FragmentaAoninformaAon,Headerlength

–  FragmentaAonandreassembly•  UsedtomatchpacketstolinkMTUs•  FragmentaAoncanbedoneatanyhoponthepath•  ReassemblycanonlybedoneatthedesAnaAon

Spring2017 CE151-AdvancedNetworks 49

Page 50: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

IPheaderprocessing

AddressResoluAonProtocol

RouAng

InternetControlMessageProtocol

Spring2017 CE151-AdvancedNetworks 50

Page 51: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Forwardingvs.RouAng•  TherearetwodisAnctprocessestodeliveringIPdatagrams:

–  Forwarding:deliverapacketonehopclosertodesAnaAon.–  RouAng:computeforwardingstate.

•  Forwarding,beingindataplane,mustbedoneasfastaspossible:–  Onrouters,isopendonewithsupportofhardware–  OnPCs,isdoneinkerneloftheoperaAngsystem

•  RouAng,beingoutsidedataplane,islessAme-criAcal–  OnaPC,rouAngisdoneasabackgroundprocess

Spring2017 CE151-AdvancedNetworks 51

Page 52: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Forwarding•  AninternetisacollecAonofsubnets•  IPimplementshop-by-hopdeliveryofpacketsbetweenhostsinan

internet•  Routers

–  Interconnectsubnets(broadcastdomains)–  Forwardpacketsacrossaninternet

Spring2017 CE151-AdvancedNetworks 52

H1

R1 R2

R3 R4

H210.2.1.0/24

20.1.0.0/1610.1.2.0/24

10.1.0.0/24 10.3.0.0/16

20.2.1.0/28

Page 53: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Routers•  Routersimplement

–  Forwardingprocess–  RouAngprocess

•  RoutersconnectmulAplesubnets–  HaveaninterfaceonmulAplesubnets–  Forwardpacketsbetweensubnets

•  Receiveononeinterface•  ProcessIPheader•  Determinenexthop•  Sendoutnexthopinterface

Spring2017 CE151-AdvancedNetworks 53

H1

R1 R2

R3 R4

H210.2.1.0/24

20.1.0.0/1610.1.2.0/24

10.1.0.0/24 10.3.0.0/16

20.2.1.0/28

Page 54: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

RouAngandForwardingRouAngfuncAonsinclude:

–  routecalculaAon–  maintenanceoftherouAngtable–  execuAonofrouAngprotocols

•  Oncommercialroutershandledbyasinglegeneralpurposeprocessor,calledrouteprocessor

IPforwardingisper-packetprocessing•  Onhigh-endcommercialrouters,IPforwardingisdistributed•  Mostworkisdoneontheinterfacecards

Spring2017 CE151-AdvancedNetworks 54

Page 55: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ForwardingTable•  ForwardingtableistheinterfacebetweentherouAngandforwarding

processes–  Simplemechanism–  Implements(potenAally)complexpolicies

•  MapsdesAnaAonaddresstonexthoptowardsdesAnaAon

Spring2017 CE151-AdvancedNetworks 55

Control

Datapath: per-packet processing

routingtable

Routingfunctions

IPForwarding

routing tablelookup

routing tableupdates

incoming IPdatagrams

outgoing IPdatagrams

routingprotocol

routingprotocol

Page 56: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ForwardingTables•  Eachrouterandeachhostmaintainsaforwardingtablewhichtellsthe

routerhowtoprocessanoutgoingpacket•  Maincolumns:

–  DesAnaAonaddress:whereistheIPdatagramgoingto?–  Nexthoporinterface:howtoforwardtheIPdatagram?

•  RouAngtablesaresetsothatadatagramgetsclosertotheitsdesAnaAoneveryhop

Spring2017 CE151-AdvancedNetworks 56

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.1.0.0/16 20.2.1.0/28

direct direct R4 direct R4 R4

Routing table of a host or router IP datagrams can be directly delivered (�direct�) or are sent to a router (�R4�)

Page 57: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ForwardingTableLookup•  Whenarouterorhostneedsto

transmitanIPdatagram,itperformsaforwardingtablelookup

•  Forwardingtablelookup:UsetheIPdesAnaAonaddressasakeytosearchtherouAngtable.

•  ResultofthelookupistheIPaddressofanexthoprouter,orthenameofanetworkinterface

Spring2017 CE151-AdvancedNetworks 57

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.1.0.0/16 20.2.1.0/28

direct direct R4 direct R4 R4

Page 58: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ForwardingTableMatch•  Forwardingtableentriescomposedof:<IP Address>”/”<mask length>

–  E.g.128.114.48.128/26

•  Maskdefinesthenetworkpartofanaddress–  LogicallyANDtheaddresswithavalueofmask length ‘1’sfollowedby‘0’s –  128.114.48.128/26 = 10000000 01110010 00110000 10xxxxxx

–  ”x”=don’tcare(hostpartofaddress)

•  Forwardingtablematchoccurswhen…–  BoththerouAngentryandIPaddresseshavethesamenetworkpart…–  …giventheroute’snetworkmask

•  Example:is128.114.48.0/17amatchingroutefor128.114.122.5?–  128.114.48.0/17 =10000000 01110010 0xxxxxxx xxxxxxxx–  128.114.122.5/17 =10000000 01110010 01111010 00000101–  Yes.

Spring2017 CE151-AdvancedNetworks 58

Page 59: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ForwardingTableLookup•  Whatorderusedinconsideringforwardingtableentries?•  OnlymaMerswhenrouAngentriesoverlap

–  Use128.114.0.0/16 or128.114.48.0/17for128.114.128.5?

•  128.114.128.5matches128.114.0.0/16–  128.114.0.0/16 =10000000 01110010 xxxxxxxx xxxxxxxx–  128.114.128.5/16=10000000 01110010 10000000 00000101

•  128.114.128.5alsomatches128.114.0.0/17 –  128.114.128.0/17=10000000 01110010 0xxxxxxx xxxxxxxx–  128.114.128.5/17=10000000 01110010 00000000 00000101

•  Answerislongestprefixmatch–  Docomparisoninorderofincreasingmasklength–  Why?Becauseitisuseful…

•  Alsoshortestprefixmatchdoesn’tmakesense(never“see”longerprefix)

•  Howuse?CC-NIEexample

Spring2017 CE151-AdvancedNetworks 59

Page 60: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

DeliverywithForwardingTables

Spring2017 CE151-AdvancedNetworks 60

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.1.0.0/16 20.2.1.0/28

direct R3 R3 R3 R3 R3

H1

R1 R2

R3 R4

H210.2.1.0/24

20.1.0.0/1610.1.2.0/24

10.1.0.0/24 10.3.0.0/16

20.2.1.0/28

20.2.1.2/28

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.1.0.0/16 20.2.1.0/28

direct direct R4 direct R4 R4

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.1.0.0/16 20.2.1.0/28

R3 R3 R2 direct direct R2

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.2.0.0/16 30.1.1.0/28

R3 direct direct R3 R2 R2

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.1.0.0/16 20.2.1.0/28

R1 R1 direct R4 direct direct

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.1.0.0/16 20.2.1.0/28

R2 R2 R2 R2 R2 direct

to: 20.2.1.2

Page 61: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

RouteAggregaAon •  LongestprefixmatchalgorithmallowsaggregaAonofprefixeswith

idenAcalnexthopaddresstoasingleentry•  Benefits

–  ReducessizeofrouAngtables–  MoreefficientrouAngtablelookups

Spring2017 CE151-AdvancedNetworks 61

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.0.0.0/8

R3 direct direct

R3 R2

Destination Next Hop 10.1.0.0/24 10.1.2.0/24 10.2.1.0/24 10.3.1.0/24 20.2.0.0/16 20.1.1.0/28

R3 direct direct

R3 R2 R2

Page 62: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

TypesofForwardingTableEntries•  Networkroute

–  DesAnaAonaddresswith0<prefixlength<32(e.g.,10.0.2.0/24)–  Mostentriesarenetworkroutes

•  Hostroute–  DesAnaAonaddresswithprefixlength=32(e.g.,10.0.1.2/32)–  Usedtospecifyaseparaterouteforcertainhosts

•  Defaultroute–  DesAnaAonaddresswithprefixlength=0(i.e.0.0.0.0/0)–  MatchesalldesAnaAons–  Commonlyusetoconnectacompany’sedgeroutertotheISPnetwork.

•  Specialcasesoflongestprefixmatch

Spring2017 CE151-AdvancedNetworks 62

Page 63: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ipcalc

•  IMO,subnetsarebestthoughtofasaddressranges•  ipcalccalculatestheserangesforyou…

% ipcalc 128.114.48.0/17 Address: 128.114.48.0 10000000.01110010.0 0110000.00000000

Netmask: 255.255.128.0 = 17 11111111.11111111.1 0000000.00000000 Wildcard: 0.0.127.255 00000000.00000000.0 1111111.11111111 =>

Network: 128.114.0.0/17 10000000.01110010.0 0000000.00000000 HostMin: 128.114.0.1 10000000.01110010.0 0000000.00000001 HostMax: 128.114.127.254 10000000.01110010.0 1111111.11111110 Broadcast: 128.114.127.255 10000000.01110010.0 1111111.11111111

Hosts/Net: 32766 Class B

•  …addressrangeof128.114.0.1–127.254•  hMp://jodies.de/ipcalc(availableascommandlinetool)

Spring2017 CE151-AdvancedNetworks 63

Page 64: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ProcessingofanIPdatagraminIP

Spring2017 CE151-AdvancedNetworks 64

UDP TCP

Inputqueue

Lookup nexthop

RoutingProtocol

Destinationaddress local?

Staticrouting

Yes

Senddatagram

IP forwardingenabled?

No

Discard

Yes No

Demultiplex

routingtable

IP module

Data Link Layer

IProuter:IPforwardingenabledHost:IPforwardingdisabled

Page 65: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

DesAnaAon-BasedForwarding•  InternetrouAngusesasinglepathperdesAnaAon•  DesAnaAon-basedforwardingisarestrictedversionofsingle-path•  ApaththroughanodetoadesAnaAon…•  …mustbeanextensionofthepathfromthenodetothedes>na>on.•  Thisiscomingbacktohauntus…

Spring2017 CE151-AdvancedNetworks 65

Page 66: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  AninternetisacollecAonofsubnets.•  AsubnetisdefinedbyanIPprefix(usingaddress/masknotaAon)•  IPimplementshop-by-hopdeliveryofpacketsbetweenhostsinan

internet•  Routersconnectsubnetsandforwardpacketsacrossaninternet

–  Forwarding:selecAonofpacket'snexthop,dataplane,fast(inhardware)–  RouAng:compuAngforwardingstate,signalingplane,notasAmecriAcal

•  TheforwardingtableistheinterfacebetweentherouAngandforwardingprocesses–  DesAnaAon–  Nexthop

•  ForwardingtablelookupsaredoneusingLongestPrefixMatch•  TheInternetusesdesAnaAon-basedforwarding,whichisarestricted

versionofsingle-pathforwarding.

Spring2017 CE151-AdvancedNetworks 66

Page 67: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

IPheaderprocessing

AddressResoluAonProtocol

RouAng

InternetControlMessageProtocol

Spring2017 CE151-AdvancedNetworks 67

Page 68: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

AddressResoluAonProtocol(ARP)

Spring2017 CE151-AdvancedNetworks 68

NetworkLayer

Link Layer

IP

ARP NetworkAccess RARP

Media

ICMP IGMP

TransportLayer

TCP UDP

Page 69: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

AddressResoluAonProtocol(ARP)•  TheInternetisbasedonIPaddresses•  Datalinkprotocols(Ethernet,FDDI,ATM)mayhavedifferent(MAC)addresses•  TheARPandRARPprotocolsperformthetransla>onbetweenIPaddressesand

MAClayeraddresses•  WewilldiscussARPforbroadcastLANs,parAcularlyEthernetLANs

Spring2017 CE151-AdvancedNetworks 69

RARP

Ethernet MACaddress(48 bit)

ARPIP address(32 bit)

Page 70: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Driver-levelIPPacketProcessing

Spring2017 CE151-AdvancedNetworks 70

loopbackDriver

IP Input

Put on IPinput queue

ARPdemultiplex

Ethernet Frame

Ethernet

IP destination of packet= local IP address ?

IP destination = multicastor broadcast ?

IP Output

Put on IPinput queue

No: get MACaddress withARP

ARPPacket

IP datagram

No

Yes

YesEthernet

Driver

Page 71: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

AddressTranslaAonwithARPARPRequest:

ArgonbroadcastsanARPrequesttoallstaAonsonthenetwork:“WhatisthehardwareaddressofRouter137?”

Spring2017 CE151-AdvancedNetworks 71

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 addressof 128.143.71.1?

Page 72: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

AddressTranslaAonwithARPARPReply:

Router137unicastsanARPreplytowithitshardwareaddress.

Spring2017 CE151-AdvancedNetworks 72

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.71.1is 00:e0:f9:23:a8:20

Page 73: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ARPPacketFormat

Spring2017 CE151-AdvancedNetworks 73

Destinationaddress

6

ARP Request or ARP Reply

28

Sourceaddress

6 2

CRC

4

Type0x8060 Padding

10

Ethernet II header

Hardware type (2 bytes)

Hardware addresslength (1 byte)

Protocol addresslength (1 byte) Operation code (2 bytes)

Target hardware address*

Protocol type (2 bytes)

Source hardware address*

Source protocol address*

Target protocol address*

* Note: The length of the address fields is determined by the corresponding address length fields

Page 74: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Example•  ARPRequestfromArgon:

Sourcehardwareaddress:00:a0:24:71:e4:44Sourceprotocoladdress: 128.143.137.144Targethardwareaddress: 00:00:00:00:00:00Targetprotocoladdress: 128.143.137.1

•  ARPReplyfromRouter137: Sourcehardwareaddress:00:e0:f9:23:a8:20 Sourceprotocoladdress: 128.143.137.1Targethardwareaddress: 00:a0:24:71:e4:44 Targetprotocoladdress: 128.143.137.144

Spring2017 CE151-AdvancedNetworks 74

Page 75: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ARPCache•  SincesendinganARPrequest/replyforeachIPdatagramis

inefficient,hostsmaintainacache(ARPCache)ofcurrententries.Theentriesexpireaper20minutes.

•  ContentsoftheARPCache(“arp–a”):(128.143.71.37)at00:10:4B:C5:D1:15[ether]oneth0(128.143.71.36)at00:B0:D0:E1:17:D5[ether]oneth0(128.143.71.35)at00:B0:D0:DE:70:E6[ether]oneth0(128.143.136.90)at00:05:3C:06:27:35[ether]oneth1(128.143.71.34)at00:B0:D0:E1:17:DB[ether]oneth0(128.143.71.33)at00:B0:D0:E1:17:DF[ether]oneth0

Spring2017 CE151-AdvancedNetworks 75

Page 76: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

OtherARPUses•  WhathappensifanARPRequestismadeforanon-exisAnghost?

SeveralARPrequestsaremadewithincreasingAmeintervalsbetweenrequests.Eventually,ARPgivesup.

•  WhatifahostsendsanARPRequestforitsownIPaddress?

Theothermachinesrespond(gratuitousARP)asifitwasanormalARPrequest.ThisisusefulfordetecAngifanIPaddresshasalreadybeenassigned.

•  Similarly,whatifahostsendsanARPReplywithitsownMACaddress?

TheothermachinesacceptthenewMACaddressforthehost(alsocalledagratuitousARP).ThisisusefulformovingIPaddressestonewNICs.

Spring2017 CE151-AdvancedNetworks 76

Page 77: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ProxyARP•  ProxyARP:HostorrouterrespondstoARPRequestthatarrivesfromone

ofitsconnectednetworksforahostthatisonanotherofitsconnectednetworks.

Spring2017 CE151-AdvancedNetworks 77

128.143.137.1/1600:e0:f9:23:a8:20 128.143.71.1/24

128.143.0.0/16Subnet

128.143.71.0/24Subnet

Router137

ARP Request:What is the MAC addressof 128.143.71.21?

128.143.137.144/16 128.143.171.21/2400:20:af:03:98:28

Argon Neon

ARP Reply:The MAC address of128.143.71.21 is00:e0:f9:23:a8:20

Page 78: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  TheAddressResoluAonProtocoltranslatesfromIPtoMACaddresses.

•  ARPworksby–  BroadcasAngARPRequestsforanIPaddress–  UnicasAnganARPReplywiththeMACaddresstotherequestor.–  ARPRequestsarerepeatedunAlaReplyisreceivedorARPAmesout.

•  HostsmaintainanARPcachetolimittheneedforARPqueriesforeverypacketsent

•  GratuitousARPareARPRequest/RepliesthatareissuedforotherthanstandardARPpurposes–  GratuitousARPRequestsdetectifanIPaddressisinuse–  GratuitousARPRepliescanbeusedtomoveanIPaddresstoanewNIC

•  RouterscanbeconfiguredtoissueProxyARPRepliestoARPRequestsononeofitsinterfacesforhostsonanotherinterface

Spring2017 CE151-AdvancedNetworks 78

Page 79: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ReceiveanIPdatagram

IPDatagramProcessing1.  IPheadervalidaAon2.  ProcessopAonsinIPheader3.  ParsingthedesAnaAonIP

address

4.  RouAngtablelookup5.  DecrementTTL6.  PerformfragmentaAon(if

necessary)

7.  Calculatechecksum8.  Transmittonexthop9.  SendICMPpacket(ifnecessary)

IPheaderprocessing

AddressResoluAonProtocol

RouAng

InternetControlMessageProtocol

Spring2017 CE151-AdvancedNetworks 79

Page 80: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Overview•  IPreliesonseveralotherprotocolstoperformnecessarycontroland

rouAngfuncAons:–  ControlfuncAons(ICMP)–  MulAcastsignaling(IGMP)–  Se}nguprouAngtables(RIP,OSPF,BGP,PIM,…)

Spring2017 CE151-AdvancedNetworks 80

Control

Routing

ICMP IGMP

RIP OSPF BGP PIM

Page 81: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Overview•  TheInternetControlMessageProtocol(ICMP)isahelperprotocolthat

supportsIPwithfacilityfor–  Simplequeries–  Errorrepor>ng

•  DefinedinRFC792.•  ConceptuallyICMPisapartofIP…•  …howeverisimplemented“ontop”ofIP•  ICMPmessagesareencapsulatedinIPdatagrams:

Spring2017 CE151-AdvancedNetworks 81

IP header ICMP message

IP payload

Page 82: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ICMPmessageformat4byteheader:•  Type(1byte):typeofICMPmessage•  Code(1byte):subtypeofICMPmessage•  Checksum(2bytes):similartoIPheaderchecksum.Checksumiscalculatedover

enAreICMPmessage•  EachICMPmessagesisatleast8byteslong

–  IfthereisnoaddiAonaldata,thereare4bytessettozero.

Spring2017 CE151-AdvancedNetworks 82

additional informationor

0x00000000

type code checksum

bit # 0 15 23 248 317 16

Page 83: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ICMPQuerymessagesICMPquery:•  Requestsentbyhosttoarouterorhost•  Replysentbacktoqueryinghost

Spring2017 CE151-AdvancedNetworks 83

Host

ICMP Request

Host or router

ICMP Reply

Page 84: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ExampleofaQuery:“ping”•  EachPingistranslatedintoanICMPEchoRequest•  ThePing’edhostrespondswithanICMPEchoReply•  AddiAonalinformaAon:IdenAfier,Sequence#,Data•  SourceanddesAnaAonaddressesswapped,typecodechangedto0,

checksumrecomputed.

Spring2017 CE151-AdvancedNetworks 84

Host or

Router

ICMP ECHO REQUEST Host or

router

ICMP ECHO

REPLY

Page 85: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ICMPRouterSolicitaAon/AdverAsement

•  Aperbootstrapping,ahostbroadcastsanICMProutersolicitaAon.

•  Inresponse,routerssendanICMProuteradverAsementmessage

•  Also,routersperiodicallybroadcastICMProuteradverAsement

ThisissomeAmescalledtheRouterDiscoveryProtocol

Spring2017 CE151-AdvancedNetworks 85

Ethernet

H1

R1 R2

ICMP routeradvertisement

ICMP routeradvertisement

ICMP routeradvertisement

Page 86: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ExampleofICMPQueriesType/Code DescripAon

8/0 EchoRequest0/0 EchoReply

13/0 TimestampRequest14/0 TimestampReply

10/0 RouterSolicitaAon9/0 RouterAdverAsement

Spring2017 CE151-AdvancedNetworks 86

ThepingcommandusesEchoRequest/EchoReply

Page 87: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ICMPErrormessages•  ICMPerrormessagesreporterrorcondiAons•  Typicallysentwhenadatagramisdiscarded•  ErrormessageisopenpassedfromICMPtotheapplicaAonprogram

Spring2017 CE151-AdvancedNetworks 87

Host

IP datagram

Host or router

ICMP ErrorMessage

IP datagramis discarded

Page 88: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ICMPErrormessages•  ICMPerrormessagesincludethecompleteIPheaderandthe

first8bytesofthepayload(typically:UDP,TCP)

Spring2017 CE151-AdvancedNetworks 88

Unused (0x00000000)

IP header ICMP header IP header 8 bytes of payload

ICMP Message

from IP datagram that triggered the error

type code checksum

Page 89: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ManipulateRouAngtablewithICMP

•  WhenarouterdetectsthatanIPdatagramshouldhavegonetoadifferentrouter,therouter(hereR2)–  forwardstheIPdatagramtothecorrectrouter–  sendsanICMPredirectmessagetothehost

•  HostusesICMPmessagetoupdateitsrouAngtable

Spring2017 CE151-AdvancedNetworks 89

Destination Next Hop 10.1.0.0/24 …

R2

Destination Next Hop 10.1.0.0/24 …

R1

Ethernet

H1

R1 R2

(1) IP datagram

R1

(2) IP datagram(3) ICMP redirect

Page 90: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Example:ICMPPortUnreachable•  RFC792:If,inthedesAnaAonhost,theIPmodulecannotdeliverthe

datagrambecausetheindicatedprotocolmoduleorprocessportisnotacAve,thedesAnaAonhostmaysendadesAnaAonunreachablemessagetothesourcehost.

•  Scenario:

Spring2017 CE151-AdvancedNetworks 90

Client

Request a service at a port 80

Server

No process is waiting at port 80

Port

Unreacha

ble

Page 91: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ExampleofanError:traceroute•  SendUDPdatagramtodesAnaAonwithIPTTLof1.•  WaitforICMPTEmessagetogetIPaddressofrouter(source).•  IncreaseTTLandrepeat.•  DesAnaAonidenAfiedbyuseofhighUDPportresulAnginICMPPort

Unreachablemessage.•  AddiAonalinformaAon(forbothmessages):

–  InternetHeader–  64bitsoforiginaldatagram

•  Demo

%tcpdump–nvhostcas01.ucsc.eduoricmp%traceroute–ncas01.ucsc.edu

Spring2017 CE151-AdvancedNetworks 91

Page 92: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

FrequentICMPErrormessage

Spring2017 CE151-AdvancedNetworks 92

Type Code Description 3

0–15 Destination

unreachable Notification that an IP datagram could not be forwarded and was dropped. The code field contains an explanation.

5 0–3 Redirect Informs about an alternative route for the datagram and should result in a routing table update. The code field explains the reason for the route change.

11 0, 1 Time exceeded

Sent when the TTL field has reached zero (Code 0) or when there is a timeout for the reassembly of segments (Code 1)

12 0, 1 Parameter problem

Sent when the IP header is invalid (Code 0) or when an IP header option is missing (Code 1)

Page 93: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Somesubtypesofthe“DesAnaAonUnreachable”

Spring2017 CE151-AdvancedNetworks 93

Code Description Reason for Sending 0 Network

Unreachable No routing table entry is available for the destination network.

1 Host Unreachable

Destination host should be directly reachable, but does not respond to ARP Requests.

2 Protocol Unreachable

The protocol in the protocol field of the IP header is not supported at the destination.

3 Port Unreachable

The transport protocol at the destination host cannot pass the datagram to an application.

4 Fragmentation Needed and DF Bit Set

IP datagram must be fragmented, but the DF bit in the IP header is set.

Page 94: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

Review•  ICMPprovidestwobasicservices:

–  Networkqueries–  ErrorreporAng

•  FuncAonofanICMPmessagedeterminedbyTypeandCodefields.•  Fornetworkqueries

–  TypefielddefinesmatchingRequest/Replytypes–  Codefieldis0–  AddiAonalinformaAonfieldusedforparameters

•  ForerrorreporAng–  TypefieldidenAfiesgeneralclassoferrors–  CodefieldidenAfiesspecificerror–  Typicallysentwhenadatagramisdiscarded–  IncludeIPheaderandfirst8bytesofpayload(UDPorTCPdata)

Spring2017 CE151-AdvancedNetworks 94

Page 95: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

DHCP

•  AcronymforrememberingDHCPsequence?– DORK

•  Discover-broadcast•  Offer-unicast•  Request-broadcast•  acK-unicast

Spring2017 CE151-AdvancedNetworks 95

Page 96: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

QuesAons?

Spring2017 CE151-AdvancedNetworks 96

Page 97: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ExtraSlides

Spring2017 CE151-AdvancedNetworks 97

Page 98: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

LongestPrefixMatch•  Givenforwardingtable

•  (1)128.114.48.0/17•  (2)128.114.48.0/20•  (3)128.114.48.0/22•  (4)0/0

•  WhichentryischosenfordesAnaAon:128.114.122.5•  Answer:#1•  ExplanaAon(rememberbitvalues:1286432168421)

–  10000000 01110010 0xxxxxxx xxxxxxxx =128.114.48.0/17(0.0–127.255)–  10000000 01110010 0011xxxx xxxxxxxx =128.114.48.0/20(48.0–63.255)–  10000000 01110010 001100xx xxxxxxxx =128.114.48.0/22(48.0–51.255)–  10000000 01110010 01111010 00000101 =128.114.122.5

Spring2017 CE151-AdvancedNetworks 98

Page 99: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

LongestPrefixMatch•  Givenforwardingtable

•  (1)128.114.48.0/17•  (2)128.114.48.0/20•  (3)128.114.48.0/22•  (4)0/0

•  WhichentryischosenfordesAnaAon:128.114.50.2•  Answer:??•  ExplanaAon(rememberbitvalues:1286432168421)

–  10000000 01110010 0xxxxxxx xxxxxxxx =128.114.48.0/17(0.0–127.255)–  10000000 01110010 0011xxxx xxxxxxxx =128.114.48.0/20(48.0–63.255)–  10000000 01110010 001100xx xxxxxxxx =128.114.48.0/22(48.0–51.255)

Spring2017 CE151-AdvancedNetworks 99

Page 100: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

LongestPrefixMatch•  Givenforwardingtable

•  (1)128.114.48.0/17•  (2)128.114.48.0/20•  (3)128.114.48.0/22•  (4)0/0

•  WhichentryischosenfordesAnaAon:128.114.50.2•  Answer:#3•  ExplanaAon(rememberbitvalues:1286432168421)

–  10000000 01110010 0xxxxxxx xxxxxxxx =128.114.48.0/17(0.0–127.255)–  10000000 01110010 0011xxxx xxxxxxxx =128.114.48.0/20(48.0–63.255)–  10000000 01110010 001100xx xxxxxxxx =128.114.48.0/22(48.0–51.255)–  10000000 01110010 00110010 00000000 =128.114.50.2

Spring2017 CE151-AdvancedNetworks 100

Page 101: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

LongestPrefixMatch•  Givenforwardingtable

•  (1)128.114.48.0/17•  (2)128.114.48.0/20•  (3)128.114.48.0/22•  (4)0/0

•  WhichentryischosenfordesAnaAon:128.114.52.10•  Answer:#2•  ExplanaAon(rememberbitvalues:1286432168421)

–  10000000 01110010 0xxxxxxx xxxxxxxx =128.114.48.0/17(0.0–127.255)–  10000000 01110010 0011xxxx xxxxxxxx =128.114.48.0/20(48.0–63.255)–  10000000 01110010 001100xx xxxxxxxx =128.114.48.0/22(48.0–51.255)–  10000000 01110010 00110100 00001010 =128.114.52.10

•  Giveanexampleofanaddressthatwoulduse(4)…thedefaultroute.

Spring2017 CE151-AdvancedNetworks 101

Page 102: Network Layer - Courses · • Link-layer (layer 2) ... • Only one protocol at the network layer. ... TCP IP Network Access Application protocol

ARPAnetArchitecture•  Host-to-HostprotocolimplementedintheNetworkControlProgram

(NCP)-TheprimaryfuncAonoftheNCPistoestablishconnecAons,breakconnecAons[withameanstoidenAfyprocessesusing“sockets”],andcontroldataflowovertheconnecAons.

•  Host-IMP–“responsibleforbidirecAonalcommunicaAonbetweenthehostandIMP”–thehost’sinterfacetotheARPAnet

•  IMP-IMP–“receivingdatapackets,conducAngrudimentaryerrordetecAon,determiningtheroutefortheforwardingofdatapacketsandtransmi}ngthistothenextIMP.”

•  SrcIMP-DstIMP–flowcontrol(managementofreceivermemory),reliabledelivery,fragmentaAon(intopackets)andreassembly.

•  Internetworking:TechnologicalFoundaAonsandApplicaAonsByChristophMeinel,HaraldSack

Spring2017 CE151-AdvancedNetworks 102