Introduction to Computer Science · 1 Mbps link example: §1 Mb/s link §each user: • 100 kb/s...
Transcript of Introduction to Computer Science · 1 Mbps link example: §1 Mb/s link §each user: • 100 kb/s...
Introduction to Computer ScienceCSCI109
AndrewGoodneyFall2018
China– Tianhe-2
Lecture9:NetworksOctober29th,2018
Schedule
1
Midterm Scores
u 30questions,1pointeachu Maxscore:30
u Minscore:u Mean:
2
Computer Networks
u Computernetworkseverywhere!v HeadedtowardsIoT (*everything*electroniconanetwork)
u Howdidwegethere?
3
1960’s
4
u 1960’sv ”Mainframe”computers=$$MMv UniversitiesandGovernmentfacilitiesinstallatdesignatedplaces
(UIUC,UCSD,etc.)v Allowremoteaccesstoresearchersacrossthecountrytobetterutilizev Mainframes– 100%busy
1960’s Remote Access
u DumbTerminalsandanalogmodems
5
Phone call
1960’s Problems
u Anyissueswiththismodel?v Analogconnectionsslow(300BPS)v Onlysomanyphonelinesv Longdistancecallswereexpensive
6
Digital Circuits
u Midtolate1960’sdigitalcircuitsimprovethingsu Also,computer-to-computercommunication
7
mainframe
(smaller) mainframe
64kbpsdigital circuit
(smaller) mainframe
(smaller) mainframe
Late 1960’s
u Terminalsinoffice->localmainframeu Localmainframe->digitalcircuit->bigmainframe
u Keyobservations:v Multipleusersv Computer-to-computer
8
7
Late 1960’s
u Stillnotideal…u Connectionsare“circuitswitched”(dedicated)betweensourceanddestination
u Whathappenswhennooneisusingthecircuit?
u Reallyonlyonedumb-terminalcanuseconnectionatatimeu Dohumanstimesharewell?
u Digitalcircuitsstillexpensiveu Also,computer-to-computeridentifiedaskeyapplication
9
Design Goals
u Needawayto:v Connectusersatterminalstoremotecomputersv Connectmanyusersatthesametime(fairly)v Allowcomputer-to-computercommunicationsv Maximizetheutilizationofexpensivedigitallinks
10
Solution: the packet
u Whatisapacket?u Chunksofuserdata
u AndVERYIMPORTANTLYu Meta-data(header)aboutwherethepacketisfrom,andwhereitneedstogo
11
How do packets solve the problem?
u Nowwecanbuild“packet-switched”networks
12
64kbpsdigital circuit
= packet switch
Packet Switching
u Whatdowehavenow?u Terminalsconnecttolocalcomputers
u Dataisbrokenupintopacketssenttoswitchu Cangotootherlocalcomputers
u Or,switchcan”forward”packettoremoteswitch
u Remoteswitchsendspackettobig,expensivemainframeu Mainadvantage:linksaresharedamongstallusers,orcomputer-to-computercommunication
u Nothingisdedicatedtooneconnection13
Packet Switching Advantage
u Sharingandutilizationismainadvantageofpacketswitching
14
Nusers
1 Mbps link
example:§ 1Mb/slink§ eachuser:
• 100kb/swhen“active”• active10%oftime
u circuit-switching:v 10users
u packetswitching:v with35users,probability>10
activeatsametimeislessthan.0004
v with50users,P=0.01
A bit more history…
u Howdidwemakethejumptopacketswitching?u Ideacameaboutlate1960’s
u ARPA(AdvancedResearchProjectsAgency)v US-DODwantedpacketswitchedcomputer-to-computernetworksv SeenascrucialtoColdWareffort
u Thisisqueueingtheory,packetswitchingisalotlikelinesatamusementpark/grocerystore
15
Len Kleinrock/UCLA
u LenKleinrock writesPhDthesisonqueuingtheory/packetswitchingv Alltheoretical,didn’texistyet
u ARAPcontactsandsays“Heyyouseemlikejusttherightguy,here’satonofmoney,inventtheARPANet…”
u GetsfacultypositionatUCLA(~1963),embarksonproject
u WithBBN,buildsInterfaceMessageProcessor(IMP)(packetswitch)
u 49yearsago(today!),sendsfirstmessagefromUCLAtoStanford
16
Interface Message Processor
17
Network Terminology
u Everythingonthenetworkiseither:v Host
u sendsorreceivesdatav Packetswitch
u receivespacketsoninterfacesandforwardstootherswitchesorhostsv Communicationlink
u Physicalconnectionbetweentwodevicesthatcarriesdata
u Storeandforwardv Packetswitches“storeandforward”
u Receiveapacketu Storeit(store)u Figureoutwheretosendit(forward)
18
Modern Networks
u Howdowebuildmodernnetworks?u TheInternetisanetworkofnetworks!
u Internetedge:v Accessnetworksconnectshoststothe
networkv Accessnetworksconnecttonetworksin
thecore
u InternetCore:v Networksofnetworks(ISPs)connecting
together19
mobile network
global ISP
regional ISP
home network
institutionalnetwork
More Terminology
u AccessnetworksareLocalAreaNetworks(LANs)v Host(desktops,laptops,servers)v Switchesv Routers
u Routersarespecialpacketswitchesthatbridge(connect)multipleLANs,orfromLANtoWAN
u WAN=WideAreaNetworkv ConnectsfromLANtonetworkcore
20
More Terminology
u NetworkCorev LANsandWANconnectionsfromaccessnetworkstoISPsv AndbetweenISPs
21
How do we build modern networks
u Firstlookataccessnetworksv Howdoweconnecthosts(pc,laptop,server,phones)tothenetwork
22
Ethernet LANs
u In2018(almost?)allLANsarebuiltwithEthernettechnologies
u Homes,businesses,universitycampus
u Builtwithv twistedpair(“Ethernetcable”)v Wifiv Opticalfiberv Powerlines
u Widerangeofspeedsv 10M,100M,1G,10G,40G,100G
23
Home Network
24
to/from headend or central office
Cable, DSL modem, or fiber
router, firewall, NAT
wired Ethernet (100 Mbps or 1G)
wireless access point (100->1000
Mbps)
wirelessdevices
Institutional Network
25
Ethernet switch
institutional mail,web servers
institutional router
institutional link to ISP (Internet)
u typicallyusedincompanies,universities,etcv 10Mbps,100Mbps,1Gbps,10Gbps,40G,100Gtransmissionratesv today,endsystemstypicallyconnectintoEthernetswitch
Wireless Network
u Wirelessaccesstophones,etcu Providedbycellularoperators
u 2G(dead?),3G,4G,now5Gu Speedsvary
v 100’skilobits/s(2G)v 5G300Mbps+
26
to Internet
WAN Links
u Howtoconnectaccessnetworkstothecore?
27
DSL
u DigitalSubscriberLine(DSL)v Usesexistingphonelinesv 10- 100Mbpsv Homesandsmallbusinesses
28
central office
ISP
telephonenetwork
DSLAM
voice, data transmittedat different frequencies over
dedicated line to central office
DSLmodem
splitter
DSL access multiplexer
Cable Modem
29
data, TV transmitted at different frequencies over shared cable
distribution network
cablemodem
splitter
…cable headend
CMTS
ISP
cable modemtermination system
v HFC: hybrid fiber coax§ asymmetric: up to 1Gbps downstream transmission rate, <20 Mbps
upstream transmission ratev network of cable, fiber attaches homes to ISP router
§ homes share access network to cable headend § unlike DSL, which has dedicated access to central office
v Homes and small business
Fiber Optical WAN Links
u Institutionalnetworks,ISPtoISPu Laserlightonopticalfiber
u Speeds100Mto100Gu Somehomes!
v ATTFiber,GoogleHome,otherluckypeople!
30
Physical Links
u Communicationlinkscanbemadeupofdifferentphysicalmedia,withdifferentproperties
31
Twisted Pair
u TwistedPair:twocopperwirestwistedaroundeachotheru Examples:oldphonelines,CAT5(6,7)Ethernetcables
u Bandwidth:100Mto2.5Gperpairu Usuallymultiplepairspercable
32
Coaxial cable
u Coaxialcable:centerconductorsurroundedbyinsulationthentubularshield
u Carriesradiofrequencysignals
u “CableTV”(cablemodem)wiresinyourhouse,DS3othersimilartelcoservices
u 100Mto10Gpercable
33
Fiber Optic Cable
u Extremelythinglasscablescalledstrandsu Laserlightusedtotransmitdatau Cancarrymultiplewavelengthsatonce(i.e.multiple”colors”)
u Essentiallyunlimitedbandwidthperstrandu Typically1Gto100Gperwavelengthu 96wavelengthsperstrandu Shortdistance:Ethernetoncampusu Longdistance,underseau Propagatesat60%speedoflight
34
Wireless
u Alsoknownasradiowavesu Connectsthroughfreespace(nowires)
u Wi-fi,cellular,satellite,specializedmicrowaveservicesu Bandwidthdependsonfrequency,channelwidth,modulation,etc.(kilobitstogigabits)v 900MHz,2.4GHz,5GHz,60GHz
u Propagationaffectedbywalls,buildings,trees,ground,water,othertransmissionsources
u Somefree-spacelaserlinksexist,notverycommon
35
Internet structure
u Keepsaying“networkofnetworks”u Whatdowemean?u BasicgoalofInternet“endtoend”communication
v Anyhostcantalktoanyhost
u EndsystemsconnecttoInternetviaaccessISPs(InternetServiceProviders)v Residential,businessanduniversityISPs
u AccessISPsinturnmustbeinterconnected.v Sothatanytwohostscansendpacketstoeachother
u Resultingnetworkofnetworksisverycomplexv Evolutionwasdrivenbyeconomics andnationalpolicies
u Let’stakeastepwiseapproachtodescribecurrentInternetstructure36
Internet Structureu Toenableend-to-endcommunication,allaccessnets(millions)mustinterconnect… how?
37
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnetaccess
net
accessnet
Internet Structureu Naïvesolution:directconnecteveryISPtogether!
38
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnetaccess
net
accessnet
connecting each access ISP to each other directly doesn’t
scale: O(N2) connections.
Internet Structureu Solution:OneglobalISPconnectsaccessnetshierarchicallyu Notpossible,neverhappened…
39
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnetaccess
net
accessnet
globalISP
Internet Structure
40
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnetaccess
net
accessnet
ISP B
ISP A
ISP C
IXP
IXP
peering link
Internet exchange point
Internet Structure
u RegionalISPsarosetoconnectaccessnets(schools,businesses,homes)totheInternet
u RegionalISPsconnectedtogetheratIXPs(InternetExchangePoints)formutualeconomicbenefit
u Specializedregionalnetworksconnectsomeaccessnetworkstogetherv Educational:LosNettos (socal .edu)v Metroareanetworks:Citycharterednetworkstolowerconnection
costsforbusinesses
41
Network of Networks
42
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnet
accessnetaccess
net
accessnet
ISP B
ISP A
ISP C
IXP
IXP
regional net
Hierarchical View
u atcenter:small#ofwell-connectedlargenetworks
v “tier-1” commercialISPs (e.g.,Level3,Sprint,AT&T,NTT),national&internationalcoverage
v contentprovidernetwork(e.g,Google):privatenetworkthatconnectsitdatacenterstoInternet,oftenbypassingtier-1,regionalISPs 43
accessISP
accessISP
accessISP
accessISP
accessISP
accessISP
accessISP
accessISP
Regional ISP Regional ISP
IXP IXP
Tier 1 ISP Tier 1 ISP Google
IXP
Communicating on the Internet
u Materialsofarishowwebuildpacketswitchednetworksu Fromanotherperspective:howdoesdatagettotheotherside?
44
Protocols
u Allcommunicationonnetworksismoderatedbyoneormoreprotocols
u Humanprotocols:v ”Whattimeisit?”“Excuseme,whereis…”v Introductions,smalltalk,etc.
u NetworkProtocolsv Machinetomachine
u Networkprotocols:definetheformatandorderofmessagessentandreceivedbetweennetworkdevices,andtheactionstobetakenuponmessagetransmissionorreciept
45
Protocols
46
ahumanprotocolandacomputernetworkprotocol:
Hi
Hi
Got thetime?2:00
TCP connectionresponse
<file>time
TCP connectionrequest
Get http://www.awl.com/kurose-ross
Getting Data Across the Internet
u Fromtheprogrammersperspective,thenetworkisablack-box
u AsetofinfrastructurecomponentsthatprovideanAPItogetdatafromapptoserverandback
47
GET http://www.usc.edu/
How to provide that service?
u Togetfromdevicetoserverandbackv Datamustbepacketizedv Traverseaccessnetworkà ISPà ISPà ISPà accessnetworkà
server(andback)v Travelacrossheterogeneousnetworktypes,physicallayers
u Does(should?)theprogrammerworryaboutanyofthis?
u No!Itjustworks.u Whatisthesolution?
u AseriesofAbstractions!
48
Flying Analogy
u Firstananalogy
49
ticket (purchase)
baggage (check)
gates (load)
runway takeoff
airplane routing
ticket (complain)
baggage (claim)
gates (unload)
runway landing
airplane routing
airplane routing
Flying Analogy
u Goal:getfromonecitytotheother
layers: eachlayerimplementsaservicev viaitsowninternal-layeractionsv relyingonservicesprovidedbylayerbelow
50
ticket (purchase)
baggage (check)
gates (load)
runway (takeoff)
airplane routing
departureairport
arrivalairport
intermediate air-trafficcontrol centers
airplane routing airplane routing
ticket (complain)
baggage (claim
gates (unload)
runway (land)
airplane routing
ticket
baggage
gate
takeoff/landing
airplane routing
Why Layers
u Explicitstructureeasessystemdesigninhighlycomplexsystemv Addsstructuretothedesignprocess
u Modularityv Eachlayerprovidesaservicetothelayerabove,essentiallyabstracting
theconnectiondetailsawayv Layerscanbeupdatedandimprovedaslongasservicesoffereddon’t
changev EachlayerABSTRACTStheconnectionbetweendevicesatthatlayer
u Easeforapplicationprogrammersv Minimumamounttolearnv UsetheAPIprovidedbyupperlayers,lettherestsortitout 51
Data flow through layers
52
Pack
et fl
ow
abstract connection
Packet Headers
u Eachlayeraddsaheaderasapacketflowsdownu Headercontainstheinformationnecessaryforthatlayertodoitsjob
u Headerisremovedasdataflowsup
53
Closer look at the layers
54
Typically software layers
Typically hardware layers
TCP/IP
u TCP/IPMostfamousprotocolsuiteu TCP
v Layer4protocolv Guaranteesin-orderdeliveryofpackets
u Eithertheygettotheothersideinorderu Orbothhostsknowapacketwaslost
v Offers”datastream”abstractiontolayersaboveu IP(InternetProtocol)
v Layer3protocolv All“Internet”trafficisIPtrafficv Handlesaddressing(IPaddresses)androutingofpacketsacrossthe
Internetv Noguarantees,packetsroutedbesteffortv Offershost-to-hostpacketservicetolayersabove
55
Network Performance
u PerformanceMetricsforNetworksu Bandwidth- ”howfastismynetwork”
v Howmuchdata(bits)canIgettotheothersidepersecondv Appliestocommunicationlinks,aswellasacrossthenetwork
u Latency– “Howslowismynetwork”v Howlongdoesittakefordatatogetfromonesidetotheotherv Measuredintime:s,ms,us
u Loss– “Howbadismynetwork”v Fractionofpacketsthatgetdropped(don’tmakeittotheotherside)v Needstobe<<1%forgoodnetworkoperation
u Throughput– “Howgoodismynetwork”v Consideringhowbandwidth,latency,losscombinewithaprotocolto
measurehowmuchisactuallydeliveredperunittimev Thisiswhatapplicationssee 56
Original Internet Design Goals
u “theInternet”cameoutof(D)ARPAprojectsinthe1960’s,70’sand80
u Primarydriverwastoenablecomputer-to-computercommunications,evenundernuclearattack
57
Original Internet Design Goals
u Paperfor1988:“TheDesignPhilosophyoftheDARPAInternetProtocols”(DavidClark,1988).
u InPRIORITYorderu 1.Continuedespitelossofnetworkinfrastructure(degrade,butstillfunction
underattack)
u 2.Supportmultipletypesofcommunicationservices(manydifferentapplications)
u 3.Accommodateavarietyofnetworks(e.g.earlynetworkswerenotallEthernet,today’snetworksuseEthernetatlayer2,layer1isverydifferent)
u 4.PermitdistributedmanagementofInternetresources(nooneentityisrequiredfornetworktofunction)
u 5.Costeffective
u 6.Hostattachmentshouldbeeasy(onlylocalchangesrequiredtoaddhost)
u 7.Resourceaccountability(security) 58
What about now?
u ManyofthesegoalsmadetheInternetasweknowitpossible.
u Especiallythemiddle4:u Supportmultipletypesofcommunicationservices(manydifferent
applications)
u Accommodateavarietyofnetworks(e.g.earlynetworkswerenotallEthernet,today’snetworksuseEthernetatlayer2,layer1isverydifferent)
u PermitdistributedmanagementofInternetresources(nooneentityisrequiredfornetworktofunction)
u Costeffective
59
What about now?
u However,somemakethingsinterestingu 4.PermitdistributedmanagementofInternetresources
u Originallyindentedtomakethenetworkresilientinamilitaryscenario
u Now:basicallynooneisinchargev 7.Resourceaccountability
u Ifyoureadthepaper,theybasicallynevergottothisu ThisiswhyInternetsecurityissuchadisaster,itwasn’tdesignedinoriginally
u Networkagentsimplicitlytrusted,thisstillcausesproblems,seere:BGPattacks
60
Back to Internet History
61
Growth of the Internet
62
Switch to TCP/IP (layer 4 protocol)
63
u ARPANet switchestoTCP/IP– stillinuse!
USC/ISIu InformationSciencesInstitute
v PartofUSCunderViterbiv Researchers,gradstudents,undergradsv InbeautifulMDR
u BecameprominentindevelopingearlyInternetprotocolsv IP
u “Theinternetprotocolprovidesfortransmittingblocksofdatacalleddatagramsfromsourcestodestinations,wheresourcesanddestinationsarehostsidentifiedbyfixedlengthaddresses.”
v ICMPv DomainNameSystemv SimpleMailTransportProtocol
u ICANNneeIANAv InternetAssignedNumbersAuthority->ICANNv (USCbasicallyrantheInternet) 64
Takeaways
u Networksallowcomputerstocommunicate(exchangedata)u Dataisbrokenintopackets(smallchunks)andsentoversharedcircuits
(packetswitching)byswitchesandroutersu Internetisanetwork-of-networks– Nooneowner/regulatoru TheInternetprovidesanAPIforaservice(networking)thatletsapp
developerswritesoftware(abstraction)u Servicesareimplementedwithprotocolsthatarestackedinlayers(more
abstraction)u TCP/IPisthecoreprotocolonwhichmostinternetworkingisbasedu SecuritywasnotanimportantdesignfeaturewhentheInternetwasinvented
– we’restillpayingforthisnowu Bandwidth,latency,loss,throughputaretheimportantnetworkperformance
metricsu USC/ISIhasbeeninvolvedininventingthemodernInternetsince(notquite)
thebeginning(e.g DNS,IANA,ICANN)65