1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

36
1 Internet Protocol: Internet Protocol: Connectionless Connectionless Datagram Delivery Datagram Delivery (IPv4) (IPv4) Chapter 6 Chapter 6

Transcript of 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

Page 1: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

11

Internet Protocol:Internet Protocol:Connectionless Datagram Connectionless Datagram

Delivery (IPv4)Delivery (IPv4)

Chapter 6Chapter 6

Page 2: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

22

Have looked at HW & SW that make Have looked at HW & SW that make internet communication possibleinternet communication possible

Now begin looking at IPNow begin looking at IP Internet ProtocolInternet Protocol Provides connectionless deliveryProvides connectionless delivery IP datagrams form basis for all internet IP datagrams form basis for all internet

communicationcommunication

Page 3: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

33

Internet PhilosophyInternet Philosophy

Focus: interface internet provides to Focus: interface internet provides to usersusers Not on the interconnection technologyNot on the interconnection technology

User sees single virtual networkUser sees single virtual network Underlying architecture is hidden and irrelevantUnderlying architecture is hidden and irrelevant

Conceptually, TCP/IP provides three sets Conceptually, TCP/IP provides three sets of services:of services: Application Application

ServicesServices

Reliable Transport ServiceReliable Transport Service

Connectionless Packet Delivery ServiceConnectionless Packet Delivery Service

Page 4: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

44

Protocol SW can be associated with eachProtocol SW can be associated with each Instead, consider them Instead, consider them conceptual internet partsconceptual internet parts Embody philosophical underpinnings of designEmbody philosophical underpinnings of design

Internet SW designed around the conceptual servicesInternet SW designed around the conceptual services

Surprisingly robust and adaptable architectureSurprisingly robust and adaptable architecture

Adv of conceptual separationAdv of conceptual separation Can replace one service without disturbing othersCan replace one service without disturbing others

R&D can proceed concurrently on all threeR&D can proceed concurrently on all three

Page 5: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

55

Connectionless Delivery SystemConnectionless Delivery SystemMost fundamental internet service:Most fundamental internet service: Packet delivery systemPacket delivery system

Technically, the service is:Technically, the service is: UnreliableUnreliable

Packet can be lost, duplicated, delayed, out-of-orderPacket can be lost, duplicated, delayed, out-of-order

No notification of such problemsNo notification of such problems Best-effortBest-effort

Makes earnest attempt to deliverMakes earnest attempt to deliver ConnectionlessConnectionless

Packets treated independentlyPackets treated independently

Page 6: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

66

Purpose of the IPPurpose of the IP

IP: protocol that defines delivery serviceIP: protocol that defines delivery service Specifies basic unit of transferSpecifies basic unit of transfer

Exact format of dataExact format of data Performs the routing functionPerforms the routing function

Chooses the paths for packetsChooses the paths for packets Includes rules for unreliable packet deliveryIncludes rules for unreliable packet delivery

How hosts and routers process packetsHow hosts and routers process packets

How and when error messages are generatedHow and when error messages are generated

When packets can be discardedWhen packets can be discarded

Page 7: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

77

Internet DatagramInternet Datagram

Physical network:Physical network: Unit of transfer is Unit of transfer is frameframe

Contains header and dataContains header and data

InternetInternet Unit of transfer is Internet Unit of transfer is Internet datagramdatagram

IP datagram or datagramIP datagram or datagramContains header and dataContains header and data

Header difference:Header difference: IP addresses versus physical addressesIP addresses versus physical addresses

Page 8: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

88

IP DatagramIP Datagram

Datagram formatDatagram format

Datagram HeaderDatagram Header Datagram Data AreaDatagram Data Area

0 4 8 16 19 24 310 4 8 16 19 24 31

VERSVERS HLENHLEN Service TypeService Type Total LengthTotal Length

IdentificationIdentification FlagsFlags Fragment OffsetFragment Offset

Time to LiveTime to Live ProtocolProtocol Header ChecksumHeader Checksum

Source IP AddressSource IP Address

Destination IP AddressDestination IP Address

IP Options (if any)IP Options (if any) PaddingPadding

DataData

. . .. . .

Page 9: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

99

Service Type field:Service Type field: OriginallyOriginally

Precedence 0-7Precedence 0-7Routers use 6 or 7 (info goes thru during congestion)Routers use 6 or 7 (info goes thru during congestion)

D: low delayD: low delay T: high throughputT: high throughput R: high reliabilityR: high reliability

0 1 2 3 4 5 6 70 1 2 3 4 5 6 7

PRECEDENCEPRECEDENCE DD TT RR UNUSEDUNUSED

Page 10: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1010

LaterLater

Differential Services interpretationDifferential Services interpretation Have 8 ordered classes when of form:Have 8 ordered classes when of form:

xxx000xxx000Just like previous precedenceJust like previous precedence6 or 7 goes to high priority class of service6 or 7 goes to high priority class of service

Codepoint values divided into 3 groups:Codepoint values divided into 3 groups:xxxxx0 : assigned by Standards organizationxxxxx0 : assigned by Standards organizationxxxx11 : local or experimentalxxxx11 : local or experimentalxxxx01 : local or experimental for nowxxxx01 : local or experimental for now

0 1 2 3 4 5 6 70 1 2 3 4 5 6 7

CODEPOINTCODEPOINT UNUSEDUNUSED

Page 11: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1111

Regardless of the interpretation:Regardless of the interpretation: Service type specification is a hint to the Service type specification is a hint to the

routing algorithmrouting algorithm Chose among various paths based on:Chose among various paths based on:

Local policiesLocal policies

Knowledge of technologies available on the pathsKnowledge of technologies available on the paths No guarantee to provide a type of serviceNo guarantee to provide a type of service

Page 12: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1212

Datagram EncapsulationDatagram Encapsulation

How long can a datagram be?How long can a datagram be? Handled by SWHandled by SW (not HW) (not HW) Any length protocol designers wantAny length protocol designers want

IPv4 has 16 bits for total length fieldIPv4 has 16 bits for total length field Limit is 65,535 octetsLimit is 65,535 octets

But, want efficient transportationBut, want efficient transportation Map abstract physical packet to real packetMap abstract physical packet to real packet

Page 13: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1313

Encapsulation:Encapsulation: Idea to carry 1 datagram in 1 network frameIdea to carry 1 datagram in 1 network frame Underlying HW not concerned with datagramUnderlying HW not concerned with datagram One machine to another: datagram is in the One machine to another: datagram is in the

data portion of a framedata portion of a frame

Datagram Datagram HeaderHeader

Datagram Data AreaDatagram Data Area

Frame Frame HeaderHeader

Frame Data AreaFrame Data Area

Page 14: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1414

Ideal: entire IP datagram in one frameIdeal: entire IP datagram in one frame Would need maximum datagram sizeWould need maximum datagram size What would that be?What would that be? Look at network hardware:Look at network hardware:

MTU: maximum transfer unitMTU: maximum transfer unit Ethernet: 1500 octet MTUEthernet: 1500 octet MTU FDDI: 4470 octet MTUFDDI: 4470 octet MTU Some hardware: 128 octets or lessSome hardware: 128 octets or less

Limit to smallest: inefficientLimit to smallest: inefficient If bigger than MTU: need multiple framesIf bigger than MTU: need multiple frames

Page 15: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1515

Design goal: convenience for userDesign goal: convenience for user Not worry about physical network constraintsNot worry about physical network constraints

Solution:Solution: Pick convenient initial datagram sizePick convenient initial datagram size Have way to divide up for small MTUHave way to divide up for small MTU

Pieces of divided datagram: Pieces of divided datagram: fragmentsfragments

Process of dividing: Process of dividing: fragmentationfragmentation

Page 16: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1616

Fragmentation usually occurs along the pathFragmentation usually occurs along the path

Host A Host B

R1 R2 Net 2 MTU=620

Net 2 MTU=620

Net 1 Net 3

MTU=1500 MTU=1500

Page 17: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1717

Fragments sized for one per frameFragments sized for one per frameSize is a multiple of eightSize is a multiple of eight Last piece may be shorter than restLast piece may be shorter than rest

Fragments must be reassembledFragments must be reassembled Datagram must be rebuilt before processingDatagram must be rebuilt before processing

IP does not limit datagrams to small sizeIP does not limit datagrams to small size Source can choose any sizeSource can choose any size Fragmentation and reassembly are automaticFragmentation and reassembly are automatic Routers must accept datagrams up to max size of Routers must accept datagrams up to max size of

MTU’s of attached networksMTU’s of attached networks Routers must handle datagrams up to 576 octetsRouters must handle datagrams up to 576 octets

Each piece formatted like original datagramEach piece formatted like original datagram

Page 18: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1818

Fragment header mostly the same as Fragment header mostly the same as datagram headerdatagram header Bit in the Bit in the FLAGSFLAGS field; Value in field; Value in TOTAL LENGTHTOTAL LENGTH

field; checksumfield; checksum

Datagram Datagram HeaderHeader

DataData11 (600 octets)(600 octets)

DataData22 (600 octets)(600 octets)

DataData33 (200 octets)(200 octets)

Fragment1 Fragment1 HeaderHeader

DataData11 Fragment 1 (offset 0)Fragment 1 (offset 0)

Fragment2 Fragment2 HeaderHeader

DataData22 Fragment 2 (offset 600)Fragment 2 (offset 600)

Fragment3 Fragment3 HeaderHeader

DataData33 Fragment 3 (offset 1200)Fragment 3 (offset 1200)

Page 19: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

1919

Reassembly of FragmentsReassembly of Fragments

Reassembly after each hop or at end?Reassembly after each hop or at end?

TCP/IP: once fragmented, stays that wayTCP/IP: once fragmented, stays that way Reassemble at ultimate destination (host)Reassemble at ultimate destination (host)

Two disadvantages:Two disadvantages: Inefficient if other networks have higher MTUInefficient if other networks have higher MTU Probability of datagram loss increases with more Probability of datagram loss increases with more

fragmentsfragments

Advantages:Advantages: Fragments can be routed independentlyFragments can be routed independently Intermediate routers do not have to store or Intermediate routers do not have to store or

reassemblereassemble

Page 20: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2020

Fragmentation ControlFragmentation Control

Three datagram header fields control Three datagram header fields control fragmentation and reassembly:fragmentation and reassembly: IdentificationIdentification

Unique integer to ID the datagramUnique integer to ID the datagram Fragment OffsetFragment Offset

Offset in original datagram of data being carriedOffset in original datagram of data being carried FlagsFlags

Use two low-order bits of 3-bit fieldUse two low-order bits of 3-bit field11stst bit: if set, means do not fragment bit: if set, means do not fragmentLow bit: Low bit: more fragmentsmore fragments bit bit

Page 21: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2121

Time to Live (TTL)Time to Live (TTL)

TTL specifies how long, in seconds, datagram TTL specifies how long, in seconds, datagram is allowed to remain in the internet systemis allowed to remain in the internet system Router & hosts that process must decrement TTLRouter & hosts that process must decrement TTL Remove when time expiresRemove when time expires Each router decrements TTL by 1Each router decrements TTL by 1

If long delay, decrement by number seconds thereIf long delay, decrement by number seconds there When TTL = 0, discard and send error messageWhen TTL = 0, discard and send error message

Guarantees datagram not be around foreverGuarantees datagram not be around forever

Mostly, TTL acts as hop limit Mostly, TTL acts as hop limit Rather than estimate of delayRather than estimate of delay

Page 22: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2222

Other Datagram Header FieldsOther Datagram Header FieldsPROTOCOLPROTOCOL Tells which high-level protocol used in creationTells which high-level protocol used in creation Specifies format of data areaSpecifies format of data area

HEADER CHECKSUMHEADER CHECKSUM Ensures integrity of header valuesEnsures integrity of header values Only applies to headerOnly applies to header, not data, not data Adv:Adv:

Header smaller; routers only worry about headersHeader smaller; routers only worry about headersHigher level protocols choose own data checksum Higher level protocols choose own data checksum schemescheme

Disadv:Disadv:Higher level protocols must add their own data Higher level protocols must add their own data checksumchecksum

Page 23: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2323

SOURCE IP ADDRESSSOURCE IP ADDRESS

DESTINATION IP ADDRESSDESTINATION IP ADDRESS Contain 32-bit IP addresses of sender & recipientContain 32-bit IP addresses of sender & recipient Never change when going through routersNever change when going through routers

IP OPTIONSIP OPTIONS Variable lengthVariable length PADDING field depends upon options selectedPADDING field depends upon options selected

Page 24: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2424

Datagram OptionsDatagram Options

IP OPTIONS field not requiredIP OPTIONS field not required Used mostly for network testing and debuggingUsed mostly for network testing and debugging Option processing is integral part of IP protocolOption processing is integral part of IP protocol

Field length varies based on options selectedField length varies based on options selected Options appear contiguously; no separatorsOptions appear contiguously; no separators Each option:Each option:

Consists of single octet option codeConsists of single octet option code

Followed by single octet length & set of data octetsFollowed by single octet length & set of data octets

Page 25: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2525

Option code octet divided into three fieldsOption code octet divided into three fields

COPYCOPY flag controls how routers treat options flag controls how routers treat options during fragmentationduring fragmentation

Set to 1: copy options to all fragmentsSet to 1: copy options to all fragmentsSet to 0: only copy into first fragmentSet to 0: only copy into first fragment

CLASS & NUMBERCLASS & NUMBER fields specify general option fields specify general option class and a specific option in the classclass and a specific option in the class

Class 0: datagram or network controlClass 0: datagram or network controlClass 1: Reserved for future useClass 1: Reserved for future useClass 2: Debugging and measurementClass 2: Debugging and measurementClass 3: Reserved for future useClass 3: Reserved for future use

00 11 22 33 44 55 66 77

CopyCopy Option Option ClassClass Option NumberOption Number

Page 26: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.
Page 27: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2727

Record Route OptionRecord Route Option

Source creates empty list of IP addressesSource creates empty list of IP addresses Each router adds its IP address to the listEach router adds its IP address to the list

Format:Format:0 8 16 24 0 8 16 24 3131

Code (7)Code (7) LengthLength PointerPointer

First IP AddressFirst IP Address

Second IP AddressSecond IP Address

. . .. . .

Page 28: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2828

Original source must allocate enough Original source must allocate enough space for the addressesspace for the addresses

When a machine handles the datagram:When a machine handles the datagram: Compare pointer and length fieldsCompare pointer and length fields

Pointer > length: list full (not add address)Pointer > length: list full (not add address)

Otherwise: put 4-octet IP address at pointer Otherwise: put 4-octet IP address at pointer position and increment pointerposition and increment pointer

Source and destination must agree to useSource and destination must agree to use Source enable optionSource enable option Destination agree to process resulting listDestination agree to process resulting list

Page 29: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

2929

Source Route OptionSource Route Option

Sender can dictate path through the internetSender can dictate path through the internet

Format:Format:

Test throughput over particular networkTest throughput over particular network Average user would not know topologyAverage user would not know topology

0 8 16 24 0 8 16 24 3131

Code (137)Code (137) LengthLength PointerPointer

IP Address of first hopIP Address of first hop

IP Address of second hopIP Address of second hop

. . .. . .

Page 30: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

3030

Strict source routing:Strict source routing: Addresses specify exact pathAddresses specify exact path Path between addresses must be a single Path between addresses must be a single

networknetwork

Loose source routingLoose source routing Datagram must follow sequence of IP addressesDatagram must follow sequence of IP addresses May be multiple hops between addressesMay be multiple hops between addresses

Processing similar to record route optionProcessing similar to record route option When router follows an IP address, it replaces When router follows an IP address, it replaces

the IP address with its own addressthe IP address with its own address

Page 31: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

3131

Timestamp OptionTimestamp Option

Initially empty listInitially empty list

Each router adds:Each router adds: 32-bit IP address32-bit IP address 32-bit integer timestamp32-bit integer timestamp

0 8 16 24 310 8 16 24 31

Code (68)Code (68) LengthLength PointerPointer OflowOflow FlagsFlags

First IP AddressFirst IP Address

First IP TimestampFirst IP Timestamp

. . .. . .

Page 32: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

3232

Oflow (4-bits)Oflow (4-bits) Integer count of routers that could not timestampInteger count of routers that could not timestamp

Flags (4-bits)Flags (4-bits) Controls format of the optionControls format of the option

0: Record timestamp only; omit IP addresses0: Record timestamp only; omit IP addresses

1: Precede each timestamp by an IP address1: Precede each timestamp by an IP address

3: IP addresses are specified by sender; a 3: IP addresses are specified by sender; a router only records a timestamp if the next IP router only records a timestamp if the next IP address in the list matches the router’s IP address in the list matches the router’s IP addressaddress

Page 33: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

3333

Timestamps tell when router handled the datagramTimestamps tell when router handled the datagram Expressed as milliseconds since midnightExpressed as milliseconds since midnight Based on Universal Time (Greenwich Mean Time)Based on Universal Time (Greenwich Mean Time)

All computer clocks not necessarily synchronizedAll computer clocks not necessarily synchronized Local clocks may differLocal clocks may differ Should be treated as estimatesShould be treated as estimates

Why not just use record route option?Why not just use record route option? Eliminates ambiguityEliminates ambiguity Receiver knows exactly which path the datagram Receiver knows exactly which path the datagram

followedfollowed

Page 34: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

3434

Processing Options During Fragmentation Processing Options During Fragmentation

COPY bit in CODE fieldCOPY bit in CODE field Replicates some options in all fragmentsReplicates some options in all fragments Places some in only one fragmentPlaces some in only one fragment Ex: Recording the datagram routeEx: Recording the datagram route

Not all fragments will follow the same routeNot all fragments will follow the same route

Reassembly would produce conflicting listsReassembly would produce conflicting lists

Only put in one fragmentOnly put in one fragment Ex: Source route optionEx: Source route option

Must be replicated for all fragments to follow same Must be replicated for all fragments to follow same routeroute

Page 35: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

3535

SummarySummary

Fundamental TCP/IP service isFundamental TCP/IP service is ConnectionlessConnectionless UnreliableUnreliable Best-effortBest-effort Packet deliveryPacket delivery

IP formally specifies internet packet formatIP formally specifies internet packet format Called datagramCalled datagram

Page 36: 1 Internet Protocol: Connectionless Datagram Delivery (IPv4) Chapter 6.

3636

Like physical frame, datagram has header Like physical frame, datagram has header and dataand data Header contains:Header contains:

Source and destination IP addressesSource and destination IP addresses

Fragmentation controlFragmentation control

PrecedencePrecedence

ChecksumChecksum

Options fieldOptions field Variable in lengthVariable in length Intended to help monitor and control an internetIntended to help monitor and control an internet