lecture16-IP-switching...What do we know so far [1] … • Network performance metrics •...
Transcript of lecture16-IP-switching...What do we know so far [1] … • Network performance metrics •...
ComputerNetworks:
ArchitectureandProtocols
CS4450
Lecture16THEInternetProtocolSwitchArchitecture
RachitAgarwal
Announcements
• PrelimonnextThursday
• Willcovereverythingdiscussedinclassandproblemsets
• ProblemSet3solutionsarereleased
• ProblemSet4isout(solutionswillbereleasedThursday)
• Practiceprelimisreleased(solutionswillbereleasedThursday)
• Wewillreleaseourfirstprojectthisweek(notincludedinprelim)
• Recall:notgraded,butwewillprovideallthehelp
• Youmusthavereceivedanemailformid-semesterfeedbackfortheclass
• Pleaseprovidefrankandconstructivefeedback• Recall:IalreadyknowIamanasshole;iteratingitmightnotbeuseful
• Whatyoulike?Wherecouldweimprove?3
Whatdoweknowsofar[1]…
• Networkperformancemetrics
• Transmissiondelay,propagationdelay,queueingdelay,bandwidth
• Sharingnetworks• Circuitswitching,packetswitching,andassociatedtradeoffs• WhyisInternetpacketswitched?
• Architecturalprinciplesanddesigngoals• Layeringprinciple,End-to-endprinciple,Fatesharingprinciple• ManyimportantdesigngoalsfromDavidClark’spaper
• Andmanyimportantmissinggoals
• Addressing• LinklayerMACnames,andscalabilitychallengesattheInternet
• NetworklayerIPaddresses:threerequirements,aggregation,CIDR
4
Whatdoweknowsofar[2]…• LinkLayer
• SharingaBroadcastmedium,associatedchallenges,CSMA/CD
• Linklayeraddressing:MACnames
• WhyFrames?WhySwitchedEthernet?
• TheSpanningTreeProtocol(STP)
• NetworkLayer
• WhyNetworkLayer?WhynotjustuseSTPacrosstheInternet?
• RoutingTables:Acollectionofspanningtrees,oneperdestination
• GeneratingValidRoutingtables(withinadomain):
• Globalview(Link-StateProtocol),andlimitations
• Localview(Distance-vectorProtocol)
• GeneratingValidRoutingtables(acrossdomains):
• BorderGatewayProtocol,Internetstructure,routingpolicies
5
Nextlecture
• Youmaynotrealizethisbut….
• Wehavelearntalotofmaterial!!!!!
• Nextlectureisveryveryvery….• veryveryveryvery….• important
• Pleaseattend
• IwilldiscusshoweverythingwehavecoveredsofarFITSTOGETHER…• …intoanend-to-enddesign
• Youwillfeelawesome—Ipromise!
6
GoalsforToday’sLecture
• UnderstandIP(theInternetProtocol)
• PacketHeaderasanetwork“interface”
• Understandswitcharchitecture
7
NetworkLayer
• THEfunctionality:deliveringthedata
• THEprotocol:InternetProtocol(IP)
• Achievesitsfunctionality(deliveringthedata),usingthreeideas:
• Addressing(IPaddressing)
• Routing(usingavarietyofprotocols)
• Packetheaderasaninterface(Encapsulatingdataintopackets)
InternetProtocol
• THEfunctionality:deliveringthedata
• THEprotocol:InternetProtocol(IP)
• Unifyingprotocol
WhatisDesigningIP?
• Syntax:formatofpacket
• Nontrivialpart:packet“header”
• Restisopaquepayload(whyopaque?)
• Semantics:meaningofheaderfields
• Requiredprocessing
Opaque PayloadHeader
PacketHeaderasInterface
• Thinkofpacketheaderasinterface
• Onlywayofpassinginformationfrompackettoswitch
• Designinginterfaces:
• Whattaskareyoutryingtoperform?
• Whatinformationdoyouneedtoaccomplishit?
• Headerreflectsinformationneededforbasictasks
WhatTasksDoWeNeedtoDo?
• Readpacketcorrectly
• Getthepackettothedestination
• Getresponsestothepacketbacktosource
• Carrydata
• Tellhostwhattodowiththepacketoncearrived
• Specifyanyspecialnetworkhandlingofthepacket
• Dealwithproblemsthatarisealongthepath
ReadingPacketCorrectly
• Wheredoestheheaderend?
• Wherethethepacketend?
• Whatprotocolareweusing?
• Whyisthissoimportant?
GettingtotheDestination
• Providedestinationaddress
• Shouldthisbelocationoridentifier(name)?
• Andwhat’sthedifference?
• Ifahostmovesshoulditsaddresschange?
• Ifnot,howcanyoubuildscalableInternet?
• Ifso,thenwhatgoodisanaddressforidentification?
GettingResponseBacktoSource
• Sourceaddress
• Necessaryforrouterstorespondtosource
• Whenwouldtheyneedtorespondback?
• Failures!
• Dotheyreallyneedtorespondback?
• Howwouldthesourceknowifthepackethasreachedthe
destination?
CarryData
• Payload!
Questions?
ListofTasks
• Readpacketcorrectly
• Getthepackettothedestination
• Getresponsestothepacketbacktosource
• Carrydata
• Tellhostwhattodowithpacketoncearrived
• Specifyanyspecialnetworkhandlingofthepacket
• Dealwithproblemsthatarisealongthepath
TellingDestinationHowtoProcessPacket
• Indicatewhichprotocolsshouldhandlepacket
• Whatlayersshouldthisprotocolbein?
• Whataresomeoptionsforthistoday?
• Howdoesthesourceknowwhattoenterhere?
SpecialHandling
• Typeofservice,priority,etc.
• Options:discusslater
DealingWithProblems
• Ispacketcaughtinloop?
• TTL
• Headercorrupted:
• DetectwithChecksum
• Whataboutpayloadchecksum?
• Packettoolarge?
• Dealwithfragmentation
• Splitpacketapart
• Keeptrackofhowtoputtogether
AreWeMissingAnything?
• Readpacketcorrectly
• Getthepackettothedestination
• Getresponsestothepacketbacktosource
• Carrydata
• Tellhostwhattodowithpacketoncearrived
• Specifyanyspecialnetworkhandlingofthepacket
• Dealwithproblemsthatarisealongthepath
FromSemanticstoSyntax
• Thepastfewslidesdiscussedtheinformationtheheadermustprovide
• Willnowshowthesyntax(layout)ofIPv4header,anddiscussthe
semanticsinmoredetail
IPPacketStructure
4-bit Version4-bit Header
Length8-bit Type of
Service (TOS)
16-bit Total Length (Bytes)
16-bit Identification 3-bit Flags 13-bit Fragment Offset
8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum
32-bit Source IP Address
32-bit Destination IP Address
Options (if any)
Payload
20BytesofStandardHeader,thenOptions
4-bit Version4-bit Header
Length8-bit Type of
Service (TOS)
16-bit Total Length (Bytes)
16-bit Identification 3-bit Flags 13-bit Fragment Offset
8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum
32-bit Source IP Address
32-bit Destination IP Address
Options (if any)
Payload
NextSetofSlides
• Mappingbetweentasksandheaderfields
• Eachofthesefieldsisdevotedtoatask
• Let’sfindoutwhichonesandwhy…
GoThroughTasksOne-by-One
• Readpacketcorrectly
• Getthepackettothedestination
• Getresponsestothepacketbacktosource
• Carrydata
• Tellhostwhattodowithpacketoncearrived
• Specifyanyspecialnetworkhandlingofthepacket
• Dealwithproblemsthatarisealongthepath
ReadPacketCorrectly
• Versionnumber(4bits)
• IndicatestheversionoftheIPprotocol
• Necessarytoknowwhatotherfieldstoexpect
• Typically“4”(forIPv4),andsometimes“6”(forIPv6)
• Headerlength(4bits)
• Numberof32-bitwordsintheheader
• Typically“5”(fora20-byteIPv4header)
• CanbemorewhenIPoptionsareused
• Totallength(16bits)
• Numberofbytesinthepacket
• Maximumsizeis65,535bytes(2^16-1)
• …thoughunderlyinglinksmayimposesmallerlimits
FieldsforReadingPacketCorrectly
4-bit Version4-bit Header
Length8-bit Type of
Service (TOS)
16-bit Total Length (Bytes)
16-bit Identification 3-bit Flags 13-bit Fragment Offset
8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum
32-bit Source IP Address
32-bit Destination IP Address
Options (if any)
Payload
GettingPackettoDestinationandBack
• TwoIPaddresses
• SourceIPaddress(32bits)
• DestinationIPaddress(32bits)
• DestinationAddress
• Uniquelocatorforthereceivinghost
• Allowseachnodetomakeforwardingdecisions
• SourceAddress
• Uniquelocatorforthesendinghost
• Recipientcandecidewhethertoacceptpacket
• Enablesrecipienttosendareplybacktothesource
FieldsforReadingPacketCorrectly
4-bit Version4-bit Header
Length8-bit Type of
Service (TOS)
16-bit Total Length (Bytes)
16-bit Identification 3-bit Flags 13-bit Fragment Offset
8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum
32-bit Source IP Address
32-bit Destination IP Address
Options (if any)
Payload
Questions?
ListofTasks
• Readpacketcorrectly
• Getthepackettothedestination
• Getresponsestothepacketbacktosource
• Carrydata
• Tellhostwhattodowithpacketoncearrived
• Specifyanyspecialnetworkhandlingofthepacket
• Dealwithproblemsthatarisealongthepath
TellingHostHowtoHandlePacket
• Protocol(8bits)
• Identifiesthehigherlevelprotocol
• Importantfordemultiplexingatreceivinghost
• Mostcommonexamples
• E.g.,“6”fortheTransmissionControlProtocol(TCP)
• E.g.,“17”fortheUserDatagramProtocol
IP HeaderTCP Header
IP HeaderTCP Header
Protocol = 6 Protocol = 17
FieldsforReadingPacketCorrectly
4-bit Version4-bit Header
Length8-bit Type of
Service (TOS)
16-bit Total Length (Bytes)
16-bit Identification 3-bit Flags 13-bit Fragment Offset
8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum
32-bit Source IP Address
32-bit Destination IP Address
Options (if any)
Payload
SpecialHandling
• Type-of-Service(8-bits)
• Allowpacketstobetreateddifferentlybasedonneeds
• E.g.,lowdelayforaudio,highbandwidthforbulktransfer
• Hasbeenredefinedseveraltimes,nogeneraluse
• Options
• Abilitytospecifyotherfunctionality
• Extensibleformat
ExamplesofOptions
• RecordRoute
• StrictSourceRoute
• LooseSourceRoute
• Timestamp
• Traceroute
• RouterAlert
• …
PotentialProblems
• HeaderCorrupted:Checksum
• Loop:TTL
• Packettoolarge:Fragmentation
PreventingLoops
• Forwardingloopscausepacketstocycleforever
• Astheseaccumulate,eventuallyconsumeallcapacity
• Time-to-live(TTL)Field(8-bits)
• Decrementedateachhop,packetdiscardedifreaches0
• …and“timeexceeded”messageissenttothesource
• Using“ICMP”controlmessage;basisfortraceroute
TTLField
4-bit Version4-bit Header
Length8-bit Type of
Service (TOS)
16-bit Total Length (Bytes)
16-bit Identification 3-bit Flags 13-bit Fragment Offset
8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum
32-bit Source IP Address
32-bit Destination IP Address
Options (if any)
Payload
HeaderCorruption
• Checksum(16bits)
• Particularformofchecksumoverpacketheader
• Ifnotcorrect,routerdiscardspackets
• Soitdoesn’tactinbogusinformation
• Checksumrecalculatedateveryrouter
• Why?
• WhyincludeTTL?
• Whyonlyheader?
ChecksumField
4-bit Version4-bit Header
Length8-bit Type of
Service (TOS)
16-bit Total Length (Bytes)
16-bit Identification 3-bit Flags 13-bit Fragment Offset
8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum
32-bit Source IP Address
32-bit Destination IP Address
Options (if any)
Payload
PacketHeaderasaninterface
• Uselesstolearntheheaderformatbyheart
• Ifyourememberthetasksthatneedtobeperformed…
• Understandingwhyheaderformatiswhatitis…
• Ingeneral:ifyouunderstandtheproblem,solutioniseasy
• Astheproblemevolves,youwillknowwheretolookforasolution
• TransitionfromIPv4toIPv6
• Graduallyhappening…
• Ifyouwanttolearnabit,seebackupslides
Switch/RouterArchitecture
IPRoutersandSwitches(usedinterchangeablytoday)
• CorebuildingblockofInternetinfrastructure
• $120B+industry
• Vendors:Cisco,Huawei,Juniper,Alcatel-Lucent(accountfor>90%)
Recap:RoutersForwardPackets
Cornell
Harvard
MIT
Switch#1
Switch#2
Switch#3
RouterDefinitions
Rbits/s
• N=No.Ofexternalrouterports
• R=bandwidth(“linerate”)ofaport
• Routercapacity=NxR
12
3
45
…
N-1
N
AT&T BBN
MIT
Cornell
core
core
edge/border (ISP)
edge/border (enterprise)
home, small business
NetworksandRouters
ExamplesofRouters(core)
• Core:CiscoCRS
• R=10/40/100Gbps
• NR=922Tbps
• Netflix:0.7GB/hr(1.5Mb/s)
• ~600millionconcurrentNetflixusers
• Edge(ISP):CiscoASR• R=1/10/40Gbps• NR=120Gbps
• Edge(enterprise):Cisco3945E• R=10/100/1000Mbps
• NR<10Gbps
1
2
N
1
2
N
Linecards (input)
Interconnect(Switching)
Fabric
Route/Control Processor
Linecards (output)
Processespackets ontheirwayin
Processespackets beforetheyleave
Transferspacketsfrominputto outputports
InputandOutputforthesameportareonone
physicallinecard
What’sInsideaRouter?
1
2
N
1
2
N
Linecards (input)
Interconnect(Switching)
Fabric
Route/Control Processor
Linecards (output)
(1) Implement IGP and BGP protocols;
compute routing tables(2) Push forwarding
tables to the line cards
What’sInsideaRouter?
1
2
N
1
2
N
Linecards (input)
InterconnectFabric
Route/Control Processor
Linecards (output)
Constitutes the data plane
Constitutes the control plane
What’sInsideaRouter?
● Receiveincomingpackets(physicallayerstuff)
● UpdatetheIPheader● TTL,Checksum(maybesomeotherfields)
● LookuptheoutputportforthedestinationIPaddress
● Queuethepacketattheswitchfabric
InputLineCards:Tasks
● 100Bpackets@40Gbps=>packetevery20nanosecs!
● Typicallyimplementedwithspecializedhardware
● ASICs,specialized“networkprocessors”
54
Challenge:Speed!
● Uponreceivingapacket
● InspectthedestinationIPaddressintheheader
● Indexintotherouting/forwardingtable
● Ifnomatch,selectthedefaultroute● Forwardpacketoutappropriateinterface
● Defaultroute● Configuredtocovercaseswherenomatches
● Allowssmalltablesatedge(w/oroutingalgorithms)
● ifitisn’tonmysubnet,sendittomyISP
55
LookinguptheOutputPort
● Recall:Forscalability,addressesareaggregated
● LongestPrefixmatch
● Findtheentrywithmatching“longestprefix”withdestinationaddress
ScalingtheLookup
……
3 1128.16.120.xxx
1
2128.16.120.111
128.82.100.101
2128.82.xxx.xxx
128.82.100.xxx
● Incomingpacketdestination:201.143.7.0
57
Prefix Port
201.143.0.0/22 Port1
201.143.4.0.0/24 Port2
201.143.5.0.0/24 Port3
201.143.6.0/23 Port4
FindingaMatch
58
11001001 10001111 00000111 11010010
FindingaMatch:CoverttoBinary
● Incomingpacketdestination:201.143.7.0
11001001 10001111 000000-- --------
11001001 10001111 00000100 --------
11001001 10001111 00000101 --------
11001001 10001111 0000011- --------
RougngTable201.143.0.0/22
201.143.4.0/24
201.143.5.0/24
201.143.6.0/23
59
11001001 10001111 00000111 11010010
FindingaMatch:CoverttoBinary
● Incomingpacketdestination:201.143.7.0
11001001 10001111 000000-- --------
11001001 10001111 00000100 --------
11001001 10001111 00000101 --------
11001001 10001111 0000011- --------
RougngTable201.143.0.0/22
201.143.4.0/24
201.143.5.0/24
201.143.6.0/23
60
11001001 10001111 00000111 11010010
FindingaMatch:CoverttoBinary
● Incomingpacketdestination:201.143.7.0
11001001 10001111 000000-- --------
11001001 10001111 00000100 --------
11001001 10001111 00000101 --------
11001001 10001111 0000011- --------
RougngTable201.143.0.0/22
201.143.4.0/24
201.143.5.0/24
201.143.6.0/23
61
11001001 10001111 00000111 11010010
LongestPrefixMatch
● Incomingpacketdestination:201.143.7.0
11001001 10001111 000000 - - - - - - - - - -
11001001 10001111 00000100 - - - - - - - -
11001001 10001111 00000101 - - - - - - - -
11001001 10001111 0000011- - - - - - - - -
RougngTable201.143.0.0/22
201.143.4.0/24
201.143.5.0/24
201.143.6.0/23
Checkanaddressagainstalldesgnagonprefixesandselecttheprefixitmatcheswithonthemostbits
● Testingeachentrytofindamatchscalespoorly
● Roughly(numberofentries)×(numberofbits)
● Mustleveragetreestructureofbinarystrings
● Setuptree-likedatastructure
● CalledaTRIE● Wewillbrieflydiscussit;moredetailsintext
● Incaseyouareinterested….
62
FindingtheMatchEfficiently
● Justfocusingonthebitswherealltheactionis….
● 0**➔ Port1
● 100➔ Port2
● 101➔ Port3
● 11*➔ Port4
63
ConsiderFour3-BitPrefixes
64
00*
000 001
0 1 01*
010 011
0 111*
110 111
0 110*
100 101
0 1
0**0 1
1**0 1
***0 1
TreeStructure
65
00*
000 001
0 1 01*
010 011
0 111*
110 111
0 110*
100 101
0 1
0**0 1
1**0 1
***0 1
0** ➔ Port 1 100 ➔ Port 2 101 ➔ Port 3 11* ➔ Port 4
WalkTree:StopatPrefixEntries
66
00*
000 001
0 1 01*
010 011
0 111*
110 111
0 110*
100 101
0 1
0**0 1
1**0 1
***0 1
P1
P2 P3
P4
0** ➔ Port 1 100 ➔ Port 2 101 ➔ Port 3 11* ➔ Port 4
WalkTree:StopatPrefixEntries
walkingtreestakesO(#bits)
LongestPrefixMatchinRealRouters
• Realroutersusefarmoreadvanced/complexsolutions
• Butwhatwediscussedisthestartingpoint
• Withmanyheuristicsandoptimizationsthatleveragereal-worldpatterns
• Somedestinationsmorepopularthanothers
• Someportsleadtomoredestinations
• Typicalfixgranularities
Recap:InputLinecards
• Mainchallengeisprocessingspeed
• Butwhatwediscussedisthestartingpoint
• Tasksinvolved
• Updatepacketheader(easy)
• Longestprefixmatchlookupondestinationsaddress(harder)
• Mostlyimplementedwithspecializedhardware
OutputLinecard
• PacketClassification:mapeachpackettoa“flow”
• Flow(fornow):setofpacketsbetweentwoparticularendpoints
• BufferManagement:decidewhenandwhichpackettodrop
• Scheduler:decidewhenandwhichpackettotransmit
OutputLinecard
• PacketClassification:mapeachpackettoa“flow”
• Flow(fornow):setofpacketsbetweentwoparticularendpoints
• BufferManagement:decidewhenandwhichpackettodrop
• Scheduler:decidewhenandwhichpackettotransmit
• Usedtoimplementvariousformsofpolicy
• Denyalle-mailtrafficfromISPXtoY(accesscontrol)
• RouteIPtelephonytrafficfromXtoYviaPHY_CIRCUIT(policy)
• Ensurethatnomorethan50MbpsareinjectedfromISP-X(QoS)
SimplestFIFORouter
• Noclassification
• Droptailbuffermanagement:whenbufferisfulldropincomingpacket
• FirstInFirstOut(FIFO)Scheduling:schedulepacketsinorderofarrival
PacketClassification
• ClassifyanIPpacketbasedonthenumberoffieldsinthepacketheader
• Source/destinationIPaddress(32bits)• Source/destinationTCPportnumber(16bits)
• TypeofService(TOS)byte(8bits)• TypeofProtocol(8bits)
• Ingeneralfieldsarespecifiedbyrange
• Classificationrequiresamulti-dimensionalrangesearch
Scheduler
• Onequeueperflow
• Schedulerdecidesfromwhichqueuetosendapacket
• Goalsofschedulingalgorithm
• Fast!• Dependsonthepolicybeingimplemented(fairness,priority,etc.)
Example:PriorityScheduler
• Packetsinthehighestpriorityqueuearealwaysservedbeforethepacketsinthelowerpriorityqueues
Example:RoundRobinScheduler
• Packetsareservedfromeachqueueinturn
ConnectingInputtoOutput:SwitchFabric
• PriorityScheduler:packetsareservedfromeachqueueinturn
Today’sSwitchFabrics:MiniNetwork!
What’sHardAbouttheSwitchFabric?
Queueing!
ThirdGenerationRouter:SwitchedInterconnects
ThirdGenerationRouter:SwitchedInterconnects
RealityisMoreComplicated
• Commercialhigh-speedroutersuse
• Combinationofinputandoutputqueueing
• Complexmulti-stage“topologies”
• Distributedmulti-stageschedulers(forscalability)
IPRoutersRecap
• CorebuildingblockofInternetinfrastructure
• ScalableRouting->LongestPrefixMatching
• Needfastimplementationsfor
• Longestprefixmatching
• Switchfabricscheduling
Thisisitfortoday!
IPv6
IPv6
• Motivated(prematurely)byaddressexhaustion
• Addressfourtimesasbig
• SteveDeeringfocusedonsimplifyingIP
• Gotridofallfieldsthatwerenotabsolutelynecessary
• “SpringCleaning”forIP
• Resultisanelegant,ifunambitious,protocol
IPv4andIPv6HeaderComparison
Version IHLType of Service (TOS)
Total Length
Identification Flags Fragment Offset
Time to Live (TTL) Protocol Header Checksum
Source Address
Destination Address
Options
Version Traffic Class Flow Label
Payload Length Next Header Hop Limit
Source Address
Destination Address
Field name kept from IPv4 to IPv6
Fields not kept in IPv6
Name and position changed in IPv6
New field in IPv6
SummaryofChanges
• EliminatedFragmentation
• Eliminatedheaderlength
• EliminatedChecksum
• Newoptionsmechanism(nextheader)
• Expandedaddress
• AddedFlowLabel
IPv4andIPv6HeaderComparison
Version IHLType of Service (TOS)
Total Length
Identification Flags Fragment Offset
Time to Live (TTL) Protocol Header Checksum
Source Address
Destination Address
Options
Version Traffic Class Flow Label
Payload Length Next Header Hop Limit
Source Address
Destination Address
Field name kept from IPv4 to IPv6
Fields not kept in IPv6
Name and position changed in IPv6
New field in IPv6
PhilosophyofChanges
• Don’tdealwithproblems:leavetoends
• Eliminatedfragmentation
• Eliminatedchecksum
• WhyretainTTL?
• Simplifyhandling
• Newoptionsmechanism(usesnextheaderapproach)
• Eliminatedheaderlength
• Whycouldn’tIPv4dothis?
• Providegeneralflowlabelforpacket
• Nottiedtosemantics
• Providesgreatflexibility
Traffic Class
IPv4andIPv6HeaderComparison
IHLType of Service (TOS)
Total Length
Identification Flags Fragment Offset
Time to Live (TTL) Protocol Header Checksum
Source Address
Destination Address
Options
Version Flow Label
Payload Length Next Header Hop Limit
Source Address
Destination Address
To Destination and Back (expanded)
Deal with Problems (greatly reduced)
Read Correctly (reduced)
Special Handling (Similar)
Version