ip packet switching - princeton university
TRANSCRIPT
COS461:ComputerNetworksSpring2011
MikeFreedman
h>p://www.cs.princeton.edu/courses/archive/spring11/cos461/
IPPacketSwitchingReading:Sect4.1.1–4.1.4,4.3.5
GoalsofToday’sLecture• ConnecQvity
– Circuitswitching– Packetswitching
• IPservicemodel– Best‐effortpacketdelivery– IPastheInternet’s“narrowwaist”– DesignphilosophyofIP
• IPpacketstructure– FieldsintheIPheader– TracerouteusingTTLfield– Source‐addressspoofing
2
RecalltheInternetlayeringmodel3
HTTP
TCP
IP
Ethernet interface
HTTP
TCP
IP
Ethernet interface
IP IP
Ethernet interface
Ethernet interface
SONET interface
SONET interface
host host
router router
HTTP message
TCP segment
IP packet IP packet IP packet
Review:CircuitSwitching‐MulQplexingaLink
• Time‐division– EachcircuitallocatedcertainQmeslots
• Frequency‐division– Eachcircuitallocatedcertainfrequencies
4
time frequency
time
CircuitSwitching(e.g.,PhoneNetwork)
1. SourceestablishesconnecQontodesQnaQon– NodealongthepathstoreconnecQoninfo– NodesmayreserveresourcesfortheconnecQon
2. SourcesendsdataovertheconnecQon– NodesQnaQonaddress,sincenodesknowpath
3. SourcetearsdownconnecQonwhendone
5
CircuitSwitchingWithHumanOperator6
Telephone switch
“Operator, please connect me to
555-1212”
AdvantagesofCircuitSwitching• Guaranteedbandwidth
– Predictableperformance:not“besteffort”
• SimpleabstracQon– ReliablecommunicaQonchannelbetweenhosts– Noworriesaboutlostorout‐of‐orderpackets
• Simpleforwarding– ForwardingbasedonQmeslotorfrequency– Noneedtoinspectapacketheader
• Lowper‐packetoverhead– ForwardingbasedonQmeslotorfrequency– NoIP(andTCP/UDP)headeroneachpacket
7
DisadvantagesofCircuitSwitching• Wastedbandwidth
– Burstytrafficleadstoidleconnduringsilentperiod
• BlockedconnecQons– ConnecQonrefusedwhenresourcesarenotsufficient
• ConnecQonset‐updelay– Unabletoavoidextralatencyforsmalldatatransfers
• Networkstate– Networknodesmuststoreper‐connecQoninformaQon
8
PacketSwitching:StaQsQcal(TimeDivision)MulQplexing
9
Packets
• IntuiQon:Trafficbycomputerend‐pointsisbursty!– Versus:Telephonetrafficnotbursty(e.g.,constant56kbps)
• Nodesdifferinnetworkdemand– Peakdatarate(e.g.,Mbps)– Dutycycle(howmuchQmespetnsending/receiving)
• Packetswitching:Packetsqueue,handledinFIFOorder– Eachsendergets#Qmeslots~demand
PacketSwitching(e.g.,Internet)1. Datatrafficdividedintopackets
– Eachpacketcontainsheader(withsrcanddstaddr)2. Packetstravelseparatelythroughnetwork
– Packetforwardingbasedontheheader– Networknodesmaystorepacketstemporarily– Besteffort:Packetsmaybeloss,corrupted,reordered
3. DesQnaQonreconstructsthemessage
10
IPServiceModel:WhyPackets?• Datatrafficisbursty
– Websurfing,email,etc.
• Don’twanttowastebandwidth– Notrafficexchangedduringidleperiods
• Be>ertoallowmulQplexing– Differenttransfersshareaccesstosamelinks
• Don’twantcomplex,statefulrouters– Don’tneedtoreservebandwidth/memory,– Don’tneedtorememberfromonepkttonext
• Packetscanbedeliveredbymostanything– RFC1149:IPDatagramsoverAvianCarriers
• SQll,canbeinefficient:headerbitsineverypackets
11
IPService:Best‐EffortisEnough• NoerrordetecQonorcorrecQon
– Higher‐levelprotocolcanprovideerrorchecking• Successivepacketsmaynotfollowthesamepath
– NotaproblemaslongaspacketsreachthedesQnaQon
• Packetscanbedeliveredout‐of‐order– Receivercanputpacketsbackinorder(ifnecessary)
• Packetsmaybelostorarbitrarilydelayed– Sendercansendthepacketsagain(ifdesired)
• NonetworkcongesQoncontrol(beyond“drop”)– Sendercanslowdowninresponsetolossordelay
12
TheInternetProtocolSuite13
UDP TCP
Data Link
Physical
Applications
The Hourglass Model
Waist
The waist facilitates interoperability
FTP HTTP TFTP DNS
TCP UDP
IP
Ethernet SONET 802.11
History:WhyIPPackets?• IPproposedintheearly1970s
– DefenseAdvancedResearchProjectAgency(DARPA)
• Goal:connectexisQngnetworks– MulQplexeduQlizaQonofexisQngnetworks– E.g.,connectpacketradionetworkstotheARPAnet
• MoQvaQngapplicaQons– Remotelogintoservermachines– Inherentlyburstytrafficwithlongsilentperiods
• PriorARPAnetexperiencewithpacketswitching– Previouslyshowedstore‐and‐forwardpacketswitching
14
OtherMainDrivingGoals(InOrder)
• CommunicaQonshouldconQnuedespitefailures– Surviveequipmentfailureorphysicala>ack– TrafficbetweentwohostsconQnueonanotherpath
• SupportmulQpletypesofcommunicaQonservices– Differingrequirementsforspeed,latency,&reliability
– BidirecQonalreliabledeliveryvs.messageservice
• Accommodateavarietyofnetworks– BothmilitaryandcommercialfaciliQes
– MinimizeassumpQonsabouttheunderlyingnetwork
15
OtherDrivingGoals,SomewhatMet• Permitdistributedmanagementofresources
– NodesmanagedbydifferentinsQtuQons– …thoughthisissQllratherchallenging
• Cost‐effecQveness– StaQsQcalmulQplexingthroughpacketswitching– …thoughpacketheadersandretransmissionswasteful
• Easeofa>achingnewhosts– StandardimplementaQonsofend‐hostprotocols– …thoughsQllneedafairamountofend‐hostsooware
• Accountabilityforuseofresources– MonitoringfuncQonsinthenodes– …thoughthisissQllfairlylimitedandimmature
16
IPPacketStructure4-bit
Version 4-bit
Header Length
8-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
IPHeader:Version,Length,ToS• IPVersionnumber(4bits)
– Necessarytoknowwhatotherfieldstoexpect:howtoparse?
– “4”(forIPv4),“6”(forIPv6)
• Headerlength(4bits)– #of32‐bitwordsinheader– Typically“5”for20‐byteIPv4header,moreif“IPopQons”
• Type‐of‐Service(8bits)– Allowpacketstobetreateddifferentlybasedonneeds– E.g.,lowdelayforaudio,highb/wforbulktransfer– (We’lldiscussmoreduring“QualityofService”lecture)
18
4-bit Version
4-bit Header Length
8-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
IPHeader:Length,Fragments,TTL• Totallength(16bits)
– #ofbytesinthepacket– Maxsizeis63,535bytes(216‐1)– Linksmayhaveharderlimits:Ethernet“MaxTransmissionUnit”(MTU)commonly1500bytes
• FragmentaQoninformaQon(32bits)– PacketidenQfier,flags,andfragmentoffset– SplitlargeIPpacketintofragmentsiflinkcannothandlesize– …sowhytypicallysendmaxMTUpackets?
• Time‐To‐Live(8bits)– HelpsidenQfypacketsstuckinforwardingloops– …andeventuallydiscardfromnetwork
19
4-bit Version
4-bit Header Length
8-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
IPHeader:MoreonTime‐to‐Live(TTL)
• PotenQalrobustnessproblem– Forwardingloopscancausepacketstocycleforever– Confusingifthepacketarrivesmuchlater
• Time‐to‐livefieldinpacketheader– TTLfielddecrementedbyeachrouteronpath– PacketisdiscardedwhenTTLfieldreaches0…– …and“Qmeexceeded”message(ICMP)senttosource
20
Aside:Tracerouteasnetworktool
• Commonusesoftraceroute– DiscoverthetopologyoftheInternet– Debugperformanceandreachabilityproblems
• OnUNIXmachine– “traceroutecnn.com”or“traceroute12.1.1.1”
• OnWindowsmachine– “tracertcnn.com”or“tracert12.1.1.1”
21
ExampleTraceroute:BerkeleytoCNN22
1 169.229.62.1
2 169.229.59.225
3 128.32.255.169
4 128.32.0.249
5 128.32.0.66
6 209.247.159.109
7 *
8 64.159.1.46
9 209.247.9.170
10 66.185.138.33
11 *
12 66.185.136.17
13 64.236.16.52
Hop number, IP address, DNS name
inr-daedalus-0.CS.Berkeley.EDU
soda-cr-1-1-soda-br-6-2
vlan242.inr-202-doecev.Berkeley.EDU
gigE6-0-0.inr-666-doecev.Berkeley.EDU
qsv-juniper--ucb-gw.calren2.net
POS1-0.hsipaccess1.SanJose1.Level3.net
?
?
pos8-0.hsa2.Atlanta2.Level3.net
pop2-atm-P0-2.atdn.net
?
pop1-atl-P4-0.atdn.net
www4.cnn.com
No response from router
No name resolution
IPHeader:UseofTTLinTraceroute• Time‐To‐LivefieldinIPpacketheader
– SourcesendsapacketwithaTTLofn– EachrouteralongthepathdecrementstheTTL– “TTLexceeded”sentwhenTTLreaches0
• TraceroutetoolexploitsthisTTLbehavior
23
source destination
TTL=1 Time
exceeded
TTL=2
SendpacketswithTTL=1,2,…andrecordsourceof“;meexceeded”message
IPHeaderFields:TransportProtocol• Protocol(8bits)
– IdenQfiesthehigher‐levelprotocol• E.g.,“6”forTCP,“17”forUDP
– ImportantfordemulQplexingatreceivinghost• Indicateswhatkindofheadertoexpectnext
24
protocol=6 protocol=17
IP header
UDP header
Ethernet hdr IP header
TCP header
Ethernet hdr
IPHeader:ChecksumonHeader
• Checksum(16bits)– Sumofall16‐bitwordsinIPheader– Ifanybitsofheaderarecorruptedintransit,checksumwon’tmatchatreceivinghost
– Receivinghostdiscardscorruptedpackets• Sendinghostwillretransmitthepacket,ifneeded
25
134 + 212
= 346
134 + 216
= 350 Mismatch!
IPHeader:ToandFromAddresses• TwoIPaddresses
– SourceanddesQnaQon(32bitseach)
• DesQnaQonaddress– UniqueidenQfierforreceivinghost– Allowseachnodetomakeforwardingdecisions
• Sourceaddress– UniqueidenQfierforsendinghost– Enablesrecipienttosendareplybacktosource
26
SourceAddress:WhatifSourceLies?• Sourceaddressshouldbethesendinghost
– But,who’schecking?Youcan“spoof”anyaddress!
• Whywouldsomeonewanttodothis?– Launchadenial‐of‐servicea>ack
• SendexcessivepacketstodesQnaQon• …tooverloadnode,orlinksleadingtoit
– EvadedetecQonby“spoofing”• But,vicQmcouldidenQfyyoubysourceaddr,solie!
– Also,ana>ackagainstthespoofedhost• Spoofedhostiswronglyblamed• Spoofedhostmayreceivereturntrafficfromreceiver
27
Summary:PacketSwitchingReview• Efficient
– Cansendfromanyinputthatisready
• General– MulQpletypesofapplicaQons
• Accommodatesburstytraffic– AddiQonofqueues
• Storeandforward– Packetsareselfcontainedunits– Canusealternatepaths–reordering
• ContenQon(i.e.,noisolaQon)– CongesQon– Delay
28