lecture14-ip-addressing-forwarding - cornell university · 2019-03-07 · announcements • prelim:...
TRANSCRIPT
ComputerNetworks:ArchitectureandProtocols
CS4450
Lecture13Distance-vector,Internet,
Addressing,Path-Vector(BGP)
RachitAgarwal
Announcements
• Prelim:28thMarch,In-class(Confirmed)
• Nobodyshouldbeinconflict
• Duringmyfirstlecture,Ipromisedyou:
• Icareaboutyou(rlearning)!
• Ifyousticktothecontract,I’llbringmyAgameineverylecture!
• Youhavebeengreatsofar!
• Iwillsticktomypromise
• Wearealmosthalf-waythrough
• IfyouthinkIamnotbringingmyA-gameinthecourse
• Iwanttoknowandimprove!!!
• Pleasefilloutthemid-termevaluation(thisweekend)
• Completelyanonymized;onlyformyeyes;max5min2
GoalsforToday’sLecture
• FinishDistance-VectorProtocol
• InternetAddressing
• BeginBorder-GatewayProtocol(BGP)
3
Recapfromlastlecture
• CreateTree,routeontree
• E.g.,Spanningtreeprotocol(switchedEthernet)
• Good:easy,no(persistent)loops,nodeadends
• Not-so-good:unnecessaryprocessing,highlatency,lowbandwidth
• Obtainaglobalview:
• Linkstate
• Good:conceptuallysimple,no(persistent)loops,nodeadends
• Not-so-good:floodingoflinkstatetoeverynode
• Distributedroutecomputation:
• Distance-vectorprotocol
Recap:Threeflavorsofprotocolsforproducingvalidroutingstate
Recap:DistanceVectorProtocol
6
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchXinitializesitsroutingtableto(X,0,-)anddistanceinfinitytoallotherdestinations
• Switchesannouncetheirentiredistancevectors(routingtablew/0nexthops)
• Uponreceivingaroutingtablefromanode(sayX),eachnodedoes:
• ForeachdestinationYintheannouncement(distance(X,Y)=d):
• Ifcurrent_distance_to_Y>d+costoflinktoX:
• updatecurrent_distance_to_Y=d
• updatenext_hop_to_destination=X
• Ifshortestdistancetoanydestinationchanged,sendallneighborsyourdistancevectors
Recap:LetsruntheProtocolagainonthisexample
(withdistancevectors)
2
1
3
2 1
7
Round1
2
1
3
2 1
7
distance next-hop1 0 -2 infinity3 infinity
distance next-hop1 infinity2 0 -3 infinity
distance next-hop1 infinity2 infinity3 0 -
Round2
2
1
3
2 1
7
distance next-hop1 0 -2 2 23 1 3
distance next-hop1 2 12 0 -3 7 3
distance next-hop1 1 12 7 23 0 -
Round3
2
1
3
2 1
7
distance next-hop1 0 -2 2 23 1 3
distance next-hop1 2 12 0 -3 3 1
distance next-hop1 1 12 3 13 0 -
Round4
2
1
3
2 1
7
distance next-hop1 0 -2 2 23 1 3
distance next-hop1 2 12 0 -3 3 1
distance next-hop1 1 12 3 13 0 -
• Algorithm:
• NodesuseBellman-Fordtocomputedistances
• Protocol
• Nodesexchangedistancevectors
• Updatetheirownroutingtables
• Andexchangeagain…
• Details:whentoexchange,whattoexchange,etc….
FromAlgorithmtoProtocol
• Whendoyousendmessages?
• Whenanyofyourdistancesd(u,v)change
• Whataboutwhenc(u,v)changes?
• Periodically,toensureconsistencybetweenneighbors
• Whatinformationdoyousend?
• Couldsendentirevector
• Orjustupdatedentries
• Doyousendeveryonethesameinformation
• Considerthefollowingslides
OtherAspectsofProtocol
OnedetailaboutDistanceVector:
HandlingCount-to-InfinityProblem
Threenodenetwork
2
1
3
2 1
7
distance next-hop1 0 -2 2 23 1 3
distance next-hop1 1 12 3 13 0 -
Threenodenetwork
2
1
3
2 1
7
distance next-hop1 0 -2 infinity3 1 3
distance next-hop1 1 12 3 13 0 -
Round1
2
1
3
2 1
7
distance next-hop1 0 -2 4 33 1 3
distance next-hop1 1 12 3 13 0 -
Round2
2
1
3
2 1
7
distance next-hop1 0 -2 4 33 1 3
distance next-hop1 1 12 5 13 0 -
Round3
2
1
3
2 1
7
distance next-hop1 0 -2 6 33 1 3
distance next-hop1 1 12 5 13 0 -
Round4
2
1
3
2 1
7
distance next-hop1 0 -2 6 33 1 3
distance next-hop1 1 12 7 13 0 -
COUNT-TO-INFINITYproblem!!!!
Count-to-infinityproblem
2
1
3
2 1
7
distance next-hop1 0 -2 6 33 1 3
distance next-hop1 1 12 7 13 0 -
Notjustduetofailures:Canhappenwithchangesincost!
• Donotadvertiseapathbacktothenodethatisthenexthoponthepath
• Called“splithorizon”
• Tellingthemaboutyourentrygoingthroughthem
• Doesn’ttellthemanythingnew
• Perhapsmisleadsthemthatyouhaveanindependentpath
• Anothersolution:ifyouareusinganext-hop’spath,then:
• Tellthemnottouseyourpath(bytellingthemcostofinfinity)
• Called“poisonedreverse”
• MoreinProblemSet3
HowCanYouFixThis?
• Distancevectorprotocolscanconvergeslowly
• Whilethesecornercasesarerare
• Theresultingconvergencedelayscanbesignificant
Convergence
• Link-State:
• Globalflood:eachrouter’slink-state(#ports)
• Senditonceperlinkevent,orperiodically
• DistanceVector:
• Sendlongervector(#dest)justtoneighbors
• Butmightenduptriggeringtheirupdates
• SenditeverytimeDVchanges(whichcanbeoften)
• Tradeoff:
• LS:Senditeverywhereandbedoneinpredictabletime
• DV:Sendlocally,andperhapsiterateuntilconvergence
ComparisonofScalability
EndofDistance-vectorRouting
NowyouknowjustasmuchasmyPhDstudents:-)
InternetAddressing
Addressingsofar
• Eachnodehasa“name”
• Wehavesofarworkedonlywithnames
• Assumedthatforwarding/routingetc.doneonnames
• Today:
• Whydoweneedaddresses?
• Whydoweassignaddressesthewayweassignaddresses?
Threerequirementsforaddressing
• Scalablerouting
• Howmuststatemustbestoredtoforwardpackets?
• Howmuchstateneedstobeupdateduponhostarrival/departure?
• Efficientforwarding
• Howquicklycanonelocateitemsinroutingtable?
• Hostmustbeabletorecognizepacketisforthem
Layer2(linklayer):“Flat”Addressing
• UsesMACaddress
• “Names”,remember?Usedasidentifier
• Uniqueidentifiershardcodedinthehardware
• Nolocationinformation
• Localareanetworksrouteonthese“flat”addresses
• SpanningTreeProtocolrunsonswitchesandhosts
• Eachswitchstoresaseparateroutingentryforeachhost
• End-hostsstorenothing
• Uponreceivingapacket,anend-host:
• Putsdestination’sanditsownMACaddressintheheader
• Forwardsittotheswitchitisconnectedto
• Destinationisabletorecognizethepacketisforthemusingaddress
Howdoesthismeetourrequirements?
• Scalablerouting
• Howmuchstatetoforwardpackets?
• Oneentryperhostperswitch
• Howmuchstateupdatedforeacharrival/departure?
• Oneentryperhostperswitch
• Efficientforwarding
• ExactmatchlookuponMACaddresses(exactmatchiseasy!)
• Hostmustbeabletorecognizethepacketisforthem
• MACaddressdoesthisperfectly
Conclusion:L2addressingdoesnotenablescalablerouting
HowwouldyouscaleL2?
• SupposewewanttodesignamuchlargerL2network
• MustuseMACaddressaspartoftheaddress
• Onlywayhostknowsthatthepacketisforthem
• Buthowwouldyouenablescalablerouting?
• Small#routingentries(lessthanoneentryperhostperswitch)
• Small#updates(lessthanoneupdateperswitchperhostchange)
OnepossibleSolution:TowardsInternet-scaleaddressing
• Assigneachend-hostanaddressesoftheform—Switch:MAC
• SpanningTreeProtocolrunsonlyonswitches
• So,eachswitchhasoneentryperswitch(ratherthanperhost)
• Uponreceivingapacket,anend-host:
• Putsdestination’sanditsownSwitch:MACaddressintheheader
• Forwardsittotheswitchitisconnectedto
• Switchesforwardthepacketusingfirstpartoftheaddress
• Destinationisabletorecognizethepacketisforthemusingsecondpartoftheaddress
Layer3:Hierarchicaladdressing
• RoutingtablescannothaveentryforeachswitchintheInternet
• Useaddressesoftheform—Network:Host
• Routersknowhowtoreachallnetworksintheworld
• Routingalgorithmsonlyannounce“Network”partoftheaddresses
• Routingtablesnowstoreanext-hopforeach“network”
• Forwarding:
• Routersignorehostpartoftheaddress
• Whenthepacketreachestherightnetwork
• PacketforwardedusingHostpartoftheaddress
• UsingLayer2
• ThiswastheoriginalIPaddressingscheme
WhatdoImeanby“network”
• IntheoriginalIPaddressingscheme…
• NetworkmeantanL2network
• Oftenreferredtoasa“subnet”
• Therearetoomanyofthemnowtoscale
Aggregation
• Aggregation:singleforwardingentryusedformanyindividualhosts
• Example:
• InourscalableL2solution:aggregatewasswitch
• InourscalableL3solution:aggregatewasnetwork
• Advantages:
• Fewerentriesandmorestable
• Changeofhostsdonotchangetables
• Don’tneedtokeepstateonindividualhosts
HierarchicalStructure
• TheInternetisan“inter-network”
• Usedtoconnectnetworkstogether,nothosts
• Formsanaturaltwo-wayhierarchy
• WideAreaNetwork(WAN)deliverstotheright“network”
• LocalAreaNetwork(LAN)deliverstotherighthost
HierarchicalAddressing
• Canyouthinkofanexample?
• AddressingintheUSmail
• Country
• City,Zipcode
• Street
• HouseNumber
• Occupant“Name”
???
IPaddresses
• Unique32bitnumbersassociatedwithahost
• Usedotted-quadnotation,e.g.,128.84.139.5
Country City,State Street,Number Occupant
(8bits) (8bits) (8bits) (8bits)
10000000 0-1010100 10001011 00000-101
128 84 139 5
Network Host
OriginalAddressingmechanism
• Firsteightbits:networkaddress(/8)
• Slashnotationindicatesnetworkaddress
• Last24bits:hostaddress
• Assumed256networksweremorethanenough!!!
• Nowwehavemillions!
Supposewewanttoaccommodatemorenetworks
• Wecanallocatemorebitstonetworkaddress
• Problem?
• Fewerbitsforhostnames
• Whatifsomenetworksneedmorehosts?
Today’sAddressing:CIDR
• ClasslessInter-domainRouting
• Idea:Flexibledivisionbetweennetworkandhostaddresses
• Prefixisnetworkaddress
• Suffixishostaddress
• Example:
• 128.84.139.5/23isa23bitprefixwith:
• First23bitsfornetworkaddress
• Next9bitsforhostaddresses:maximum2^9hosts
• Terminology:“Slash23”
ExampleforCIDRAddressing
• 128.84.139.5/23isa23bitprefixwith2^9hostaddresses
10000000 0-1010100 10001011 00000-101
128 84 139 5
Network(23bits) Host(9bits)
Allocatingaddresses
• InternetCorporationforAssignedNamesandNumbers(ICANN)…
• AllocateslargeblocksofaddressestoRegionalInternetRegistries• E.g.,AmericanRegistryforInternetNames(ARIN)…
• ThatallocatesblocksofaddressestoLargeInternetServiceProviders(ISP)
• Thatallocateaddressestoindividualsandsmallerinstitutions
• Fakeexample:
• ICANN->ARIN->AT&T->Cornell->CS->Me
Allocatingaddresses:Fakeexample
• ICANNgivesARINseveral/8s
• ARINgivenAT&Tone/8,128.0/8
• Networkprefix:10000000
• AT&TgivesCornellone/16,128.84/16
• Networkprefix:1000000001010100
• CornellgivesCSone/24,128.84.139/24
• Networkprefix:100000000101010010001011
• CSgivenmeaspecificaddress128.84.139.5
• Networkprefix:10000000010101001000101100000101
Howdoesthismeetourrequirements?
• Tounderstandthis,weneedtounderstandtheroutingontheInternet
• Andtounderstandthat,weneedtounderstandtheInternet
Asetofnetworkelementsconnectedtogether,thatimplementasetofprotocolsforthepurposeofsharingresourcesattheendhosts
Backtothebasics:whatisacomputernetwork?
“InteriorRouters”
“AutonomousSystem(AS)”or“Domain” Regionofanetworkunderasingleadministrativeentity
“BorderRouters”
An“end-to-end”route
Whatdoesacomputernetworklooklike?
“InteriorRouters”
“AutonomousSystem(AS)”or“Domain” Regionofanetworkunderasingleadministrativeentity
“BorderRouters”
An“end-to-end”route
Whatdoesacomputernetworklooklike?
AutonomousSystems(AS)
• AnASisanetworkunderasingleadministrativecontrol
• Currentlyover30,000
• Example:AT&T,FranceTelecom,Cornell,IBM,etc.
• AcollectionofroutersinterconnectingmultipleswitchedEthernets
• AndinterconnectionstoneighboringASes
• Sometimescalled“Domains”
• EachASassignedauniqueidentifier
• 16bitASnumber
AT&T a.0.0.0/8
France Telecom
LBL a.b.0.0/16
Cornella.c.0.0/16
a.c.*.* is this way
a.b.*.* is this way
IPaddressing->ScalableRouting?
AT&T a.0.0.0/8
France Telecom
LBL a.b.0.0/16
Cornella.c.0.0/16
a.*.*.* is this way
foo.com a.d.0.0/16
Canaddnewhosts/networkswithoutupdaqngtherouqngentriesatFranceTelecom
IPaddressing->ScalableRouting?
AT&T a.0.0.0/8
LBL a.b.0.0/16
Cornella.c.0.0/16
ESNet
ESNetmustmaintainrouqngentriesforbotha.*.*.*anda.c.*.*
IPaddressing->ScalableRouting?
AdministrativeStructureShapesInter-domainRouting
● ASeswantfreedomtopickroutesbasedonpolicy● “Mytrafficcan’tbecarriedovermycompetitor’snetwork!”
● “Idon’twanttocarryA’strafficthroughmynetwork!”
● CannotbeexpressedasInternet-wide“leastcost”
● ASeswantautonomy● Wanttochoosetheirowninternalroutingprotocol
● Wanttochoosetheirownpolicy
● ASeswantprivacy● Choiceofnetworktopology,routingpolicies,etc.
ChoiceofRoutingAlgorithm
● LinkState(LS)vs.DistanceVector(DV)
The“BorderGatewayProtocol”(BGP)extendsDistance-Vectorideastoaccomodatepolicy
● LSoffersnoprivacy—broadcastsallnetworkinformation
● LSlimitsautonomy—needagreementonmetric,algorithm
● DVisadecentstartingpoint● Per-destinationupdatesbyintermediatenodesgiveusahook
● But,wasn’tdesignedtoimplementpolicy
● …andisvulnerabletoloopsifshortestpathsnottaken
BusinessRelationshipsShapeTopologyandPolicy
● ThreebasickindsofrelationshipsbetweenASes
● Businessimplications● Customerpaysprovider
● Peersdon’tpayeachother● Exchangeroughlyequaltraffic
● ASAcanbeASB’scustomer
● ASAcanbeASB’sprovider
● ASAcanbeASB’speer
peer peerprovider customerRelationsbetweenASes
•Customerspayprovider•Peersdon’tpayeachother
BusinessImplications
BusinessRelationships
peer peerprovider customerRelationsbetweenASes
•Customerspayprovider•Peersdon’tpayeachother
BusinessImplications
A
B C
D E
E.g.,DandE talkalot
Peeringsaves BandCmoney
WhyPeer?
● ASesprovide“transit”betweentheircustomers● Peersdonotprovidetransitbetweenotherpeers
trafficallowed trafficnotallowed
A B C
D E F
QPr Cu
Peer Peer
RoutingFollowstheMoney
● AnASonlycarriestrafficto/fromitsowncustomersoverapeeringlink
A B C
D E F
QPr Cu
Peer Peer
RoutingFollowstheMoney
Inter-domainRouting:Setup
● DestinationsareIPprefixes(12.0.0.0/8)
● NodesareAutonomousSystems(ASes)● InternalsofeachASarehidden
● Linksrepresentbothphysicallinksandbusinessrelationships
● BGP(BorderGatewayProtocol)istheInterdomainroutingprotocol● ImplementedbyASborderrouters
BGP
EachASselectsthe“best”routeithearsadvertisedfor
aprefix
AnASadvertisesitsbestroutes
tooneormoreIPprefixes
Soundfamiliar?
BGPInspiredbyDistanceVector
● Per-destinationrouteadvertisements
● Noglobalsharingofnetworktopology
● Iterativeanddistributedconvergenceonpaths
● But,fourkeydifferences
BGPvs.DV
● BGPselectsroutebasedonpolicy,notshortestdistance/leastcost
(1)BGPdoesnotpicktheshortestpathroutes!
2 3
1
Node2mayprefer2,3,1over2,1
● Howdoweavoidloops?
BGPvs.DV
● Idea:advertisetheentirepath● Distancevector:senddistancemetricperdest.d
● Pathvector:sendtheentirepathforeachdest.d
(2)Path-vectorRouting
C B A
d
“d: path (B,A)” “d: path (A)”
data traffic data traffic
LoopDetectionwithPath-Vector
● Nodecaneasilydetectaloop● Lookforitsownnodeidentifierinthepath
● Nodecansimplydiscardpathswithloops● e.g.node1seesitselfinthepath3,2,1
3 2 1
“d: path (2,1)” “d: path (1)”
“d: path (3,2,1)”
d
BGPvs.DV
● Idea:advertisetheentirepath● Distancevector:senddistancemetricperdest.d
● Pathvector:sendtheentirepathforeachdest.d
(2)Path-vectorRouting
● Benefits
● Loopavoidanceiseasy
● Flexiblepoliciesbasedonentirepath
BGPvs.DV
● Forpolicyreasons,anASmaychoosenottoadvertisearoutetoadestination
(3)SelectiveRouteAdvertisement
● Asaresult,reachabilityisnotguaranteedevenifthegraphisconnected
AS 2
AS 3AS 1
Example:AS#2doesnotwanttocarrytrafficbetweenAS#1andAS#3
BGPvs.DV
● Forscalability,BGPmayaggregateroutesfordifferentprefixes
(4)BGPmayaggregateroutes
AT&T a.0.0.0/8
LBL a.b.0.0/16
Cornella.c.0.0/16
a.*.*.* is this way
foo.com a.d.0.0/16
BGPOutline
● BGPPolicy● Typicalpoliciesandimplementation
● BGPprotocoldetails
● IssueswithBGP
Policy:
Imposedinhowroutesareselectedandexported
Can reach 128.3/16
blah blah
Route selection
A
P
C
B
Q
Route export
● Selection:Whichpathtouse● Controlswhether/howtrafficleavesthenetwork
● Export:Whichpathtoadvertise● Controlswhether/howtrafficentersthenetwork
TypicalSelectionPolicy
● Indecreasingorderofpriority:1. Makeorsavemoney(sendtocustomer>peer>provider)
2. Maximizeperformance(smallestASpathlength)
3. Minimizeuseofmynetworkbandwidth(“hotpotato”)
4. …
TypicalExportPolicy
Destinationprefixadvertisedby…
Exportrouteto…
CustomerEveryone
(providers,peers,othercustomers)
Peer Customers
Provider Customers
Knownasthe“Gao-Rexford”rulesCapturecommon(butnotrequired!)pracqce