Sie sind auf Seite 1von 61

Chapter 8

Internet Protocol
(IP)
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

CONTENTS
DATAGRAM
FRAGMENTATION
OPTIONS
CHECKSUM
IPPACKAGE

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-1

McGraw-Hill

PositionofIPinTCP/IPprotocolsuite

The McGraw-Hill Companies, Inc., 2000

8.1
DATAGRAM

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-2

IPdatagram

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-3

ServiceTypeorDifferentiatedServices

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Theprecedencesubfieldis
notusedinversion4.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Thetotallengthfielddefinesthe
totallengthofthe
datagramincludingtheheader.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-4

McGraw-Hill

Encapsulationofasmalldatagram
inanEthernetframe

The McGraw-Hill Companies, Inc., 2000

Figure 8-5

McGraw-Hill

Multiplexing

The McGraw-Hill Companies, Inc., 2000

Example 1

AnIPpackethasarrivedwiththefirst8bits
asshown:
01000010
Thereceiverdiscardsthepacket.Why?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution
There is an error in this packet. The 4 leftmost
bits(0100)showtheversion,whichiscorrect.The
next 4 bits (0010) show the header length, which
means(248),whichiswrong.Theminimum
number of bytes in the header must be 20. The
packethasbeencorruptedintransmission.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 2

InanIPpacket,thevalueofHLENis1000
in binary. How many bytes of options are
beingcarriedbythispacket?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution
The HLEN value is 8, which means the total
numberofbytesintheheaderis84or32bytes.
Thefirst20bytesarethemainheader,thenext12
bytesaretheoptions.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 3

InanIPpacket,thevalueofHLENis516and
the value of the total length field is 002816.
Howmanybytesofdataarebeingcarriedby
thispacket?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution
The HLEN value is 5, which means the total
numberofbytesintheheaderis54or20bytes
(no options). The total length is 40 bytes, which
means the packet is carrying 20 bytes of data
(4020).

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 4

An IP packet has arrived with the first few


hexadecimal digits as shown below:
45000028000100000102...................
Howmanyhopscanthispackettravelbefore
being dropped? The data belong to what
upperlayerprotocol?
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution

To find the timetolive field, we should skip 8


bytes (16 hexadecimal digits). The timetolive
fieldistheninthbyte,whichis01.Thismeansthe
packetcantravelonlyonehop.Theprotocolfield
is the next byte (02), which means that the upper
layerprotocolisIGMP.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

8.2
FRAGMENTATION

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-6

McGraw-Hill

MTU

The McGraw-Hill Companies, Inc., 2000

Figure 8-7

McGraw-Hill

Flagfield

The McGraw-Hill Companies, Inc., 2000

Figure 8-8

McGraw-Hill

Fragmentationexample

The McGraw-Hill Companies, Inc., 2000

Figure 8-9

McGraw-Hill

Detailed
example

The McGraw-Hill Companies, Inc., 2000

Example 5

ApackethasarrivedwithanMbitvalueof
0.Isthisthefirstfragment,thelastfragment,
or a middle fragment? Do we know if the
packetwasfragmented?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution

If the M bit is 0, it means that there are no more


fragments; the fragment is the last one. However,
we cannot say if the original packet was
fragmented or not. A nonfragmented packet is
consideredthelastfragment.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 6

ApackethasarrivedwithanMbitvalueof
1.Isthisthefirstfragment,thelastfragment,
or a middle fragment? Do we know if the
packetwasfragmented?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution

IftheMbitis1,itmeansthatthereisatleastone
morefragment.Thisfragmentcanbethefirstone
or a middle one, but not the last one. We dont
knowifitisthefirstoneoramiddleone;weneed
more information (the value of the fragmentation
offset). However, we can definitely say the
originalpackethasbeenfragmentedbecausetheM
bitvalueis1.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 7

ApackethasarrivedwithanMbitvalueof1
and a fragmentation offset value of zero. Is
thisthefirstfragment,thelastfragment,ora
middlefragment?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution

Because the M bit is 1, it is either the first


fragmentoramiddleone.Becausetheoffsetvalue
is0,itisthefirstfragment.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 8

A packet has arrived in which the offset


valueis100.Whatisthenumberofthefirst
byte? Do we know the number of the last
byte?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution

To find the number of the first byte, we multiply


theoffsetvalueby8.Thismeansthatthefirstbyte
number is 800. We cannot determine the number
of the last byte unless we know the length of the
data.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 9

A packet has arrived in which the offset


valueis100,thevalueofHLENis5andthe
valueofthetotallengthfieldis100.Whatis
the number of the first byte and the last
byte?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution

Thefirstbytenumberis100 8800.Thetotal
length is 100 bytes and the header length is 20
bytes(54),whichmeansthatthereare80bytes
in this datagram. If the first byte number is 800,
thelastbytenumbermust879.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

8.3
OPTIONS

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-10

McGraw-Hill

Optionformat

The McGraw-Hill Companies, Inc., 2000

Figure 8-11

McGraw-Hill

Categoriesofoptions

The McGraw-Hill Companies, Inc., 2000

Figure 8-12

McGraw-Hill

Nooperationoption

The McGraw-Hill Companies, Inc., 2000

Figure 8-13

McGraw-Hill

Endofoptionoption

The McGraw-Hill Companies, Inc., 2000

Figure 8-14

McGraw-Hill

Recordrouteoption

The McGraw-Hill Companies, Inc., 2000

Figure 8-15

McGraw-Hill

Recordrouteconcept

The McGraw-Hill Companies, Inc., 2000

Figure 8-16

McGraw-Hill

Strictsourcerouteoption

The McGraw-Hill Companies, Inc., 2000

Figure 8-17

Strictsourcerouteconcept

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-18

Loosesourcerouteoption

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-19

McGraw-Hill

Timestampoption

The McGraw-Hill Companies, Inc., 2000

Figure 8-20

Useofflagintimestamp

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-21

Timestampconcept

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 10

Which of the six options must be copied to


eachfragment?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution
Welookatthefirst(leftmost)bitofthecodefor
eachoption.
Nooperation:Codeis00000001;nocopy.
Endofoption:Codeis00000000;nocopy.
Recordroute:Codeis00000111;nocopy.
Strictsourceroute:Codeis10001001;copied.
Loosesourceroute:Codeis10000011;copied.
Timestamp:Codeis01000100;nocopy.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Example 11

Which of the six options are used for


datagram control and which are used for
debuggingandmanagement?

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Solution
Welookatthesecondandthird(leftmost)bitsof
thecode.
Nooperation:Codeis00000001;control.
Endofoption:Codeis00000000;control.
Recordroute:Codeis00000111;control.
Strictsourceroute:Codeis10001001;control.
Loosesourceroute:Codeis10000011;control.
Timestamp:Codeis01000100;debugging
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

8.4
CHECKSUM

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Tocreatethechecksumthesenderdoes
thefollowing:
1.Thepacketisdividedintoksections,
eachofnbits.
2.Allsectionsareaddedtogetherusing
onescomplementarithmetic.
3.Thefinalresultiscomplemented
tomakethechecksum.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-22

McGraw-Hill

Checksumconcept

The McGraw-Hill Companies, Inc., 2000

Figure 8-23

Checksuminonescomplementarithmetic

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-24

McGraw-Hill

Exampleof
checksum
calculation
inbinary

The McGraw-Hill Companies, Inc., 2000

Figure 8-25

McGraw-Hill

Exampleof
checksum
calculation
in
hexadecimal

The McGraw-Hill Companies, Inc., 2000

CheckAppendixCforadetailed
descriptionofchecksumcalculation
andthehandlingofcarries.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

8.5
IPPACKAGE

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Figure 8-26

McGraw-Hill

IP
components

The McGraw-Hill Companies, Inc., 2000

Figure 8-27

McGraw-Hill

MTUtable

The McGraw-Hill Companies, Inc., 2000

Figure 8-28

McGraw-Hill

Reassemblytable

The McGraw-Hill Companies, Inc., 2000

Das könnte Ihnen auch gefallen