Top Banner
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
28

IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

Sep 28, 2018

Download

Documents

vanminh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

GoalsofToday’sLecture•  ConnecQvity

–  Circuitswitching–  Packetswitching

•  IPservicemodel–  Best‐effortpacketdelivery–  IPastheInternet’s“narrowwaist”– DesignphilosophyofIP

•  IPpacketstructure–  FieldsintheIPheader–  TracerouteusingTTLfield–  Source‐addressspoofing

2

Page 3: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

Review:CircuitSwitching‐MulQplexingaLink

•  Time‐division– EachcircuitallocatedcertainQmeslots

•  Frequency‐division– Eachcircuitallocatedcertainfrequencies

4

time frequency

time

Page 5: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

CircuitSwitching(e.g.,PhoneNetwork)

1.  SourceestablishesconnecQontodesQnaQon– NodealongthepathstoreconnecQoninfo– NodesmayreserveresourcesfortheconnecQon

2.  SourcesendsdataovertheconnecQon– NodesQnaQonaddress,sincenodesknowpath

3.  SourcetearsdownconnecQonwhendone

5

Page 6: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

CircuitSwitchingWithHumanOperator6

Telephone switch

“Operator, please connect me to

555-1212”

Page 7: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

DisadvantagesofCircuitSwitching•  Wastedbandwidth

–  Burstytrafficleadstoidleconnduringsilentperiod

•  BlockedconnecQons–  ConnecQonrefusedwhenresourcesarenotsufficient

•  ConnecQonset‐updelay– Unabletoavoidextralatencyforsmalldatatransfers

•  Networkstate– Networknodesmuststoreper‐connecQoninformaQon

8

Page 9: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

PacketSwitching(e.g.,Internet)1.  Datatrafficdividedintopackets

– Eachpacketcontainsheader(withsrcanddstaddr)2.  Packetstravelseparatelythroughnetwork

– Packetforwardingbasedontheheader– Networknodesmaystorepacketstemporarily– Besteffort:Packetsmaybeloss,corrupted,reordered

3.  DesQnaQonreconstructsthemessage

10

Page 11: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

History:WhyIPPackets?•  IPproposedintheearly1970s

– DefenseAdvancedResearchProjectAgency(DARPA)

•  Goal:connectexisQngnetworks– MulQplexeduQlizaQonofexisQngnetworks–  E.g.,connectpacketradionetworkstotheARPAnet

•  MoQvaQngapplicaQons–  Remotelogintoservermachines–  Inherentlyburstytrafficwithlongsilentperiods

•  PriorARPAnetexperiencewithpacketswitching–  Previouslyshowedstore‐and‐forwardpacketswitching

14

Page 15: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

OtherMainDrivingGoals(InOrder)

•  CommunicaQonshouldconQnuedespitefailures–  Surviveequipmentfailureorphysicala>ack–  TrafficbetweentwohostsconQnueonanotherpath

•  SupportmulQpletypesofcommunicaQonservices– Differingrequirementsforspeed,latency,&reliability

–  BidirecQonalreliabledeliveryvs.messageservice

•  Accommodateavarietyofnetworks–  BothmilitaryandcommercialfaciliQes

– MinimizeassumpQonsabouttheunderlyingnetwork

15

Page 16: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

OtherDrivingGoals,SomewhatMet•  Permitdistributedmanagementofresources

– NodesmanagedbydifferentinsQtuQons– …thoughthisissQllratherchallenging

•  Cost‐effecQveness–  StaQsQcalmulQplexingthroughpacketswitching– …thoughpacketheadersandretransmissionswasteful

•  Easeofa>achingnewhosts–  StandardimplementaQonsofend‐hostprotocols– …thoughsQllneedafairamountofend‐hostsooware

•  Accountabilityforuseofresources– MonitoringfuncQonsinthenodes– …thoughthisissQllfairlylimitedandimmature

16

Page 17: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

IPHeader:MoreonTime‐to‐Live(TTL)

•  PotenQalrobustnessproblem–  Forwardingloopscancausepacketstocycleforever–  Confusingifthepacketarrivesmuchlater

•  Time‐to‐livefieldinpacketheader–  TTLfielddecrementedbyeachrouteronpath–  PacketisdiscardedwhenTTLfieldreaches0…– …and“Qmeexceeded”message(ICMP)senttosource

20

Page 21: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

IPHeader:ToandFromAddresses•  TwoIPaddresses

– SourceanddesQnaQon(32bitseach)

•  DesQnaQonaddress– UniqueidenQfierforreceivinghost– Allowseachnodetomakeforwardingdecisions

•  Sourceaddress– UniqueidenQfierforsendinghost– Enablesrecipienttosendareplybacktosource

26

Page 27: IP Packet Switching - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

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 - Princeton University Computer … · IP Packet Switching Reading ... – E.g., connect packet radio networks to the ARPAnet ... – “tracert cnn.com” or

Summary:PacketSwitchingReview•  Efficient

–  Cansendfromanyinputthatisready

•  General– MulQpletypesofapplicaQons

•  Accommodatesburstytraffic– AddiQonofqueues

•  Storeandforward–  Packetsareselfcontainedunits–  Canusealternatepaths–reordering

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

28