28
COS 461: Computer Networks Spring 2011 Mike Freedman h>p://www.cs.princeton.edu/courses/archive/spring11/cos461/ IP Packet Switching Reading: Sect 4.1.1 – 4.1.4, 4.3.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

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Summary:PacketSwitchingReview•  Efficient

–  Cansendfromanyinputthatisready

•  General– MulQpletypesofapplicaQons

•  Accommodatesburstytraffic– AddiQonofqueues

•  Storeandforward–  Packetsareselfcontainedunits–  Canusealternatepaths–reordering

•  ContenQon(i.e.,noisolaQon)–  CongesQon– Delay

28