IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as...
Transcript of IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as...
![Page 1: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/1.jpg)
COS461:ComputerNetworksSpring2011
MikeFreedman
h>p://www.cs.princeton.edu/courses/archive/spring11/cos461/
IPPacketSwitchingReading:Sect4.1.1–4.1.4,4.3.5
![Page 2: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/2.jpg)
GoalsofToday’sLecture• ConnecQvity
– Circuitswitching– Packetswitching
• IPservicemodel– Best‐effortpacketdelivery– IPastheInternet’s“narrowwaist”– DesignphilosophyofIP
• IPpacketstructure– FieldsintheIPheader– TracerouteusingTTLfield– Source‐addressspoofing
2
![Page 3: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/3.jpg)
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
![Page 4: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/4.jpg)
Review:CircuitSwitching‐MulQplexingaLink
• Time‐division– EachcircuitallocatedcertainQmeslots
• Frequency‐division– Eachcircuitallocatedcertainfrequencies
4
time frequency
time
![Page 5: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/5.jpg)
CircuitSwitching(e.g.,PhoneNetwork)
1. SourceestablishesconnecQontodesQnaQon– NodealongthepathstoreconnecQoninfo– NodesmayreserveresourcesfortheconnecQon
2. SourcesendsdataovertheconnecQon– NodesQnaQonaddress,sincenodesknowpath
3. SourcetearsdownconnecQonwhendone
5
![Page 6: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/6.jpg)
CircuitSwitchingWithHumanOperator6
Telephone switch
“Operator, please connect me to
555-1212”
![Page 7: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/7.jpg)
AdvantagesofCircuitSwitching• Guaranteedbandwidth
– Predictableperformance:not“besteffort”
• SimpleabstracQon– ReliablecommunicaQonchannelbetweenhosts– Noworriesaboutlostorout‐of‐orderpackets
• Simpleforwarding– ForwardingbasedonQmeslotorfrequency– Noneedtoinspectapacketheader
• Lowper‐packetoverhead– ForwardingbasedonQmeslotorfrequency– NoIP(andTCP/UDP)headeroneachpacket
7
![Page 8: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/8.jpg)
DisadvantagesofCircuitSwitching• Wastedbandwidth
– Burstytrafficleadstoidleconnduringsilentperiod
• BlockedconnecQons– ConnecQonrefusedwhenresourcesarenotsufficient
• ConnecQonset‐updelay– Unabletoavoidextralatencyforsmalldatatransfers
• Networkstate– Networknodesmuststoreper‐connecQoninformaQon
8
![Page 9: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/9.jpg)
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
![Page 10: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/10.jpg)
PacketSwitching(e.g.,Internet)1. Datatrafficdividedintopackets
– Eachpacketcontainsheader(withsrcanddstaddr)2. Packetstravelseparatelythroughnetwork
– Packetforwardingbasedontheheader– Networknodesmaystorepacketstemporarily– Besteffort:Packetsmaybeloss,corrupted,reordered
3. DesQnaQonreconstructsthemessage
10
![Page 11: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/11.jpg)
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
![Page 12: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/12.jpg)
IPService:Best‐EffortisEnough• NoerrordetecQonorcorrecQon
– Higher‐levelprotocolcanprovideerrorchecking• Successivepacketsmaynotfollowthesamepath
– NotaproblemaslongaspacketsreachthedesQnaQon
• Packetscanbedeliveredout‐of‐order– Receivercanputpacketsbackinorder(ifnecessary)
• Packetsmaybelostorarbitrarilydelayed– Sendercansendthepacketsagain(ifdesired)
• NonetworkcongesQoncontrol(beyond“drop”)– Sendercanslowdowninresponsetolossordelay
12
![Page 13: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/13.jpg)
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
![Page 14: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/14.jpg)
History:WhyIPPackets?• IPproposedintheearly1970s
– DefenseAdvancedResearchProjectAgency(DARPA)
• Goal:connectexisQngnetworks– MulQplexeduQlizaQonofexisQngnetworks– E.g.,connectpacketradionetworkstotheARPAnet
• MoQvaQngapplicaQons– Remotelogintoservermachines– Inherentlyburstytrafficwithlongsilentperiods
• PriorARPAnetexperiencewithpacketswitching– Previouslyshowedstore‐and‐forwardpacketswitching
14
![Page 15: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/15.jpg)
OtherMainDrivingGoals(InOrder)
• CommunicaQonshouldconQnuedespitefailures– Surviveequipmentfailureorphysicala>ack– TrafficbetweentwohostsconQnueonanotherpath
• SupportmulQpletypesofcommunicaQonservices– Differingrequirementsforspeed,latency,&reliability
– BidirecQonalreliabledeliveryvs.messageservice
• Accommodateavarietyofnetworks– BothmilitaryandcommercialfaciliQes
– MinimizeassumpQonsabouttheunderlyingnetwork
15
![Page 16: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/16.jpg)
OtherDrivingGoals,SomewhatMet• Permitdistributedmanagementofresources
– NodesmanagedbydifferentinsQtuQons– …thoughthisissQllratherchallenging
• Cost‐effecQveness– StaQsQcalmulQplexingthroughpacketswitching– …thoughpacketheadersandretransmissionswasteful
• Easeofa>achingnewhosts– StandardimplementaQonsofend‐hostprotocols– …thoughsQllneedafairamountofend‐hostsooware
• Accountabilityforuseofresources– MonitoringfuncQonsinthenodes– …thoughthisissQllfairlylimitedandimmature
16
![Page 17: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/17.jpg)
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
![Page 18: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/18.jpg)
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
![Page 19: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/19.jpg)
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
![Page 20: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/20.jpg)
IPHeader:MoreonTime‐to‐Live(TTL)
• PotenQalrobustnessproblem– Forwardingloopscancausepacketstocycleforever– Confusingifthepacketarrivesmuchlater
• Time‐to‐livefieldinpacketheader– TTLfielddecrementedbyeachrouteronpath– PacketisdiscardedwhenTTLfieldreaches0…– …and“Qmeexceeded”message(ICMP)senttosource
20
![Page 21: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/21.jpg)
Aside:Tracerouteasnetworktool
• Commonusesoftraceroute– DiscoverthetopologyoftheInternet– Debugperformanceandreachabilityproblems
• OnUNIXmachine– “traceroutecnn.com”or“traceroute12.1.1.1”
• OnWindowsmachine– “tracertcnn.com”or“tracert12.1.1.1”
21
![Page 22: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/22.jpg)
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
![Page 23: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/23.jpg)
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
![Page 24: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/24.jpg)
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
![Page 25: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/25.jpg)
IPHeader:ChecksumonHeader
• Checksum(16bits)– Sumofall16‐bitwordsinIPheader– Ifanybitsofheaderarecorruptedintransit,checksumwon’tmatchatreceivinghost
– Receivinghostdiscardscorruptedpackets• Sendinghostwillretransmitthepacket,ifneeded
25
134 + 212
= 346
134 + 216
= 350 Mismatch!
![Page 26: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/26.jpg)
IPHeader:ToandFromAddresses• TwoIPaddresses
– SourceanddesQnaQon(32bitseach)
• DesQnaQonaddress– UniqueidenQfierforreceivinghost– Allowseachnodetomakeforwardingdecisions
• Sourceaddress– UniqueidenQfierforsendinghost– Enablesrecipienttosendareplybacktosource
26
![Page 27: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/27.jpg)
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
![Page 28: IP Packet Switching• Successive packets may not follow the same path – Not a problem as long as packets reach the desnaon • Packets can be delivered out‐of‐order – Receiver](https://reader034.fdocuments.us/reader034/viewer/2022042023/5e7b48ab446e861190591dbe/html5/thumbnails/28.jpg)
Summary:PacketSwitchingReview• Efficient
– Cansendfromanyinputthatisready
• General– MulQpletypesofapplicaQons
• Accommodatesburstytraffic– AddiQonofqueues
• Storeandforward– Packetsareselfcontainedunits– Canusealternatepaths–reordering
• ContenQon(i.e.,noisolaQon)– CongesQon– Delay
28