chapter 8 internet protocol (ip)

61
1 Chapter 8 Chapter 8 Internet Protocol Internet Protocol (IP) (IP) Mi-Jung Choi Dept. of Computer Science and Engineering [email protected]

Upload: kenda

Post on 10-Feb-2016

33 views

Category:

Documents


3 download

DESCRIPTION

Chapter 8 Internet Protocol (IP). Mi-Jung Choi Dept. of Computer Science and Engineering [email protected]. Contents . 8.1 DATAGRAM 8.2 FRAGMENTATION 8.3OPTIONS 8.4CHECKSUM 8.5IP PACKAGE 8.6KEY TERMS 8.7 SUMMARY. Objectives. Upon completion you will be able to: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 8  Internet Protocol (IP)

11

Chapter 8Chapter 8 Internet Protocol (IP) Internet Protocol (IP)

Mi-Jung Choi

Dept. of Computer Science and Engineering

[email protected]

Page 2: Chapter 8  Internet Protocol (IP)

22

8.1 DATAGRAM

8.2 FRAGMENTATION

8.3 OPTIONS

8.4 CHECKSUM

8.5 IP PACKAGE

8.6 KEY TERMS

8.7 SUMMARY

Contents

Page 3: Chapter 8  Internet Protocol (IP)

33

Objectives Upon completion you will be able to:

Understand the format and fields of a datagram

Understand the need for fragmentation and the fields involved

Understand the options available in an IP datagram

Be able to perform a checksum calculation

Understand the components and interactions of an IP package

Page 4: Chapter 8  Internet Protocol (IP)

44

Position of IP in TCP/IP protocol suite

Page 5: Chapter 8  Internet Protocol (IP)

55

Internet Protocol (IP)

Packet delivery mechanism in TCP/IP

Unreliable connectionless datagram protocol

Each datagram handled independently

Each datagram can follow a different route to destination.

datagrams sent by same source and destination could arrive out of order

Best effort delivery

No error checking or tracking

Page 6: Chapter 8  Internet Protocol (IP)

66

A packet in the IP layer is called a A packet in the IP layer is called a datagramdatagram, a variable-length packet , a variable-length packet consisting of two parts: header and data. The header is 20 to 60 bytes in consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and deliverylength and contains information essential to routing and delivery

8.1 IP Datagram

Page 7: Chapter 8  Internet Protocol (IP)

77

Version(VER)

4BIT field

Currently, the version is 4

Header Length(HLEN)

4BIT field

The total length of the datagram header in 4byte words

No options : 5(5*4=20), with maximum option size : 15(15*4=60)

8.1 DATAGRAM8.1 DATAGRAM

Page 8: Chapter 8  Internet Protocol (IP)

88

8.1 DATAGRAM8.1 DATAGRAM Differentiated Services (formerly

Service Type): 8bits

1. Service type

The first 3bit : precedence bit

Precedence 1(000) to 7(111) The priority of the datagram

(congestion) Not used in version 4

000 routine001 Priority010 Immediate011 Flash100 Flash override101 Critical110 Internetwork control111 Network control

TOS Bits Description 0000 Normal (default)

0001 Minimize cost 0010 Maximize reliability 0100 Maximize throughput 1000 Minimize delay The precedence subfield was

designed, but never used in version 4.

Page 9: Chapter 8  Internet Protocol (IP)

99

Table 8.2 Default types of serviceTable 8.2 Default types of service

Protocol TOS Bits DescriptionICMP 0000 NormalBOOTP 0000 NormalNNTP 0001 Minimize costIGP 0010 Maximize reliabilitySNMP 0010 Maximize reliabilityTELNET 1000 Minimize delayFTP (data) 0100 Maximize throughputFTP (control) 1000 Minimize delayTFTP 1000 Minimize delaySMTP (command) 1000 Minimize delaySMTP (data) 0100 Maximize throughputDNS (UDP query) 1000 Minimize delayDNS (TCP query) 0000 NormalDNS (zone) 0100 Maximize throughput

Page 10: Chapter 8  Internet Protocol (IP)

1010

8.1 DATAGRAM8.1 DATAGRAM

2. Differentiated ServicesFirst 6bit : code pointLast 2bit : not usedThe codepoint subfield can be used in two different ways

1. When the 3bit right-most bits are 0s, the 3bit left-most bits are interpreted the same as the precedence bits in the Service Type Interpretation

2. When the 3bit right-most bits are not all 0s, the 6bits define 64 services based on the priority assignment

Temporary or experimentalXXXX013

LocalXXXX112

InternetXXXXX01

Assignment AuthorityCodepointCategory

Page 11: Chapter 8  Internet Protocol (IP)

1111

8.1 DATAGRAM (cont.)8.1 DATAGRAM (cont.) Total length

The total length field defines the total length of the datagram including the

header.

Total length of the IP datagram in byte(header + data)

Length of data = total length – HLEN

Maximum size : 65535 bytes (216 – 1)

Encapsulation is needed to transfer datagram in some case

(some padding added)

Page 12: Chapter 8  Internet Protocol (IP)

1212

8.1 DATAGRAM (cont.)8.1 DATAGRAM (cont.)

Identification

Used in fragmentation

Flags.

Used in fragmentation

Fragmentation offset

Used in fragmentation

fragmentation

Page 13: Chapter 8  Internet Protocol (IP)

1313

8.1 DATAGRAM (cont.)8.1 DATAGRAM (cont.) Time to live

Datagram should have a limited lifetime Decremented by each visited router Discarded when zero All the machine must have synchronized clocks and how long it takes for a

datagram to go from one machine to anotherCases

Corrupted router Intentionally limit the journey of the packet

25

25 24

24

232322

Page 14: Chapter 8  Internet Protocol (IP)

1414

8.1 DATAGRAM(cont.)8.1 DATAGRAM(cont.) Protocol

Define the higher level protocol that uses the services of the IP layer. Encapsulate data from several higher level protocol(TCP,UDP,ICMP,IGMP) Specify the final destination protocol to which datagram should be delivered

Value Protocol 1 ICMP 2 IGMP 6 TCP 8 EGP 17 UDP 41 IPv6 89 OSPF

Page 15: Chapter 8  Internet Protocol (IP)

1515

8.1 DATAGRAM (cont.)8.1 DATAGRAM (cont.) Checksum

Later present

Source IP address

Define the IP address of the source

Destination IP address

Define the IP address of the destination

Page 16: Chapter 8  Internet Protocol (IP)

1616

Example 1Example 1 : : An IP packet has arrived with the first 8 bits as shown: 01000010

The receiver discards the packet. Why?

There is an error in this packet. The 4 left-most bits (0100) show the version, which is correct. The next 4 bits (0010) show the header length, which means (2 4 8), which is wrong. The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission.

Example 2Example 2 : : In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet?

The HLEN value is 8, which means the total number of bytes in the header is 8 4 or 32 bytes. The first 20 bytes are the main header, the next 12 bytes are the options.

8.1 DATAGRAM (cont.)8.1 DATAGRAM (cont.)

Page 17: Chapter 8  Internet Protocol (IP)

1717

Example 3Example 3 : : In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816. How many bytes of data are being carried by this packet?

The HLEN value is 5, which means the total number of bytes in the header is 5 4 or 20 bytes (no options). The total length is 40 bytes, which means the packet is carrying 20 bytes of data (4020).

Example 4Example 4 : : An IP packet has arrived with the first few hexadecimal digits as shown below: 45000028000100000102...................

How many hops can this packet travel before being dropped? The data belong to what upper layer protocol?

To find the time-to-live field, we should skip 8 bytes (16 hexadecimal digits). The time-to-live field is the ninth byte, which is 01. This means the packet can travel only one hop. The protocol field is the next byte (02), which means that the upper layer protocol is IGMP.

8.1 DATAGRAM (cont.)8.1 DATAGRAM (cont.)

Page 18: Chapter 8  Internet Protocol (IP)

1818

8.2 FRAGMENTATION8.2 FRAGMENTATION The format and size of a frame depend on the protocol used by the physical The format and size of a frame depend on the protocol used by the physical

network. A datagram may have to be fragmented to fit the protocol regulations.network. A datagram may have to be fragmented to fit the protocol regulations.

The topics discussed in this section include:The topics discussed in this section include:

Maximum Transfer Unit (MTU)Maximum Transfer Unit (MTU)

Fields Related to FragmentationFields Related to Fragmentation

router

Ethernet formatted frame

Token ring formatted frame

Ethernet network

Token ring network

Page 19: Chapter 8  Internet Protocol (IP)

1919

8.2 FRAGMENTATION8.2 FRAGMENTATION Maximum Transfer Unit (MTU)

Maximum size of the data field

The total size of encapsulated datagram in a frame must be less than maximum size

Differ from one physical network protocol to another

IP datagram

Page 20: Chapter 8  Internet Protocol (IP)

2020

8.2 FRAGMENTATION8.2 FRAGMENTATION

- MTUs for different network -

Table 8.5 MTUs for some networksTable 8.5 MTUs for some networks

Page 21: Chapter 8  Internet Protocol (IP)

2121

8.2 FRAGMENTATION8.2 FRAGMENTATION Fragmentation

Divide the datagram to make it possible to pass some networks

Each fragment has its own header

– With most of the fields repeated, but some changed

A datagram can be fragmented several times

Only final destination can reassembly of the datagram

Required parts of the header must be copied by all fragments

Three fields(flags, fragmentation offsets, total length) changed

Page 22: Chapter 8  Internet Protocol (IP)

2222

8.2 FRAGMENTATION8.2 FRAGMENTATION

Fields related to fragmentation

Identification(16bits)

Identify a datagram originating from the source host

Combination of the identification and source IP address must be unique

IP protocol uses positive number counter(guarantee uniqueness)

– Kept in the Main Memory

All fragment of a datagram have the same identification number

Page 23: Chapter 8  Internet Protocol (IP)

2323

8.2 FRAGMENTATION8.2 FRAGMENTATIONFlags (3bits)

First bit : reserved Second bit : do not fragment

– 1 : must not fragment the datagram– If cannot pass the datagram through any physical network,

discards the datagram and return ICMP error message to source host

– 0 : the datagram can be fragmented if necessary Third bit : more fragment

– 1 : more fragments after this one– 0 : last or only fragment

Page 24: Chapter 8  Internet Protocol (IP)

2424

8.2 FRAGMENTATION8.2 FRAGMENTATION Fragmentation offset (13bits)

Relative position of fragment with respect to the whole datagram

Offset of the data in the original datagram measured in units of eight bytes (The size of first fragment is divisible by eight)

Reassemble step in final destination host:

First fragment offset value is 0. Divide the length of 1st fragment by 8. This value is the offset value of

2nd fragment. Divide the length of 2st fragment by 8. This value is the offset value of

3rd fragment. Continue the process. The last fragment has more bit value of 0.

Page 25: Chapter 8  Internet Protocol (IP)

2525

8.2 FRAGMENTATION (cont.)8.2 FRAGMENTATION (cont.)

Fragmentation example

Page 26: Chapter 8  Internet Protocol (IP)

2626

8.2 FRAGMENTATION (cont.)8.2 FRAGMENTATION (cont.)

Page 27: Chapter 8  Internet Protocol (IP)

2727

Example 5 : Example 5 : A packet has arrived with an M bit value of 0. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented?

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 considered the last fragment.

Example 6 : Example 6 : A packet has arrived with an M bit value of 1. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented?

If the M bit is 1, it means that there is at least one more fragment. This fragment can be the first one or a middle one, but not the last one. We don’t know if it is the first one or a middle one; we need more information (the value of the fragmentation offset). However, we can definitely say the original packet has been fragmented because the M bit value is 1.

8.2 FRAGMENTATION (cont.)8.2 FRAGMENTATION (cont.)

Page 28: Chapter 8  Internet Protocol (IP)

2828

Example 7 :Example 7 :A packet has arrived with an M bit value of 1 and a fragmentation offset value of zero. Is this the first fragment, the last fragment, or a middle fragment?

Because the M bit is 1, it is either the first fragment or a middle one. Because the offset value is 0, it is the first fragment.

Example 8 : Example 8 : A packet has arrived in which the offset value is 100. What is the number of the first byte? Do we know the number of the last byte?

To find the number of the first byte, we multiply the offset value by 8. This means that the first byte number is 800. We cannot determine the number of the last byte unless we know the length of the data.

Example 9 : Example 9 : A packet has arrived in which the offset value is 100, the value of HLEN is 5 and the value of the total length field is 100. What is the number of the first byte and the last byte?

The first byte number is 100 8 800. The total length is 100 bytes and the header length is 20 bytes (5 4), which means that there are 80 bytes in this datagram. If the first byte number is 800, the last byte number must 879.

8.2 FRAGMENTATION (cont.)8.2 FRAGMENTATION (cont.)

Page 29: Chapter 8  Internet Protocol (IP)

2929

8.3 Options8.3 Options The header of the IP datagram is made of two parts: a The header of the IP datagram is made of two parts: a fixedfixed part and a part and a

variablevariable part. The variable part comprises the part. The variable part comprises the optionsoptions that can be a that can be a maximum of maximum of 4040 bytes. bytes.

The topics discussed in this section include:The topics discussed in this section include:

FormatFormat

Option TypesOption Types

Page 30: Chapter 8  Internet Protocol (IP)

3030

8.3 OPTIONS8.3 OPTIONS Security, Source routing, Record route, Timestamp

Used for network testing and debugging

Not required for every datagram

TLV (Type, Length, Value) Format

Page 31: Chapter 8  Internet Protocol (IP)

3131

8.3 OPTIONS8.3 OPTIONS Code (8bits) : Type

Copy(1bit) Control the presence of the option in fragmentation

– 0 : only copied to the first fragment– 1 : coped to all fragments

Class(2bits) General purpose of the option

– 00 : datagram control– 10 : debugging and management(01& 11 not defined)

Number(5bits) Type of the option(only six types are in use)

LengthTotal length of the option(including code and length fields)Not present in all of the option types

Data : ValueThe data that specific options requireNot present in all of the option types

Page 32: Chapter 8  Internet Protocol (IP)

3232

8.3 OPTIONS8.3 OPTIONS Option types(6 types)

Two types 1 byte Do not require the length or the the data fields

Four types Multiple bytes Require the length and the data fields

Page 33: Chapter 8  Internet Protocol (IP)

3333

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.)

No Operation (00001)

1 byte option

Used as a filler between options

Page 34: Chapter 8  Internet Protocol (IP)

3434

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.) End of Option (00000)

1 byte optionUsed for padding at the end of the option fieldOnly one end of option can be usedSearch payload(data) after option

Page 35: Chapter 8  Internet Protocol (IP)

3535

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.)

경로 기록 - Record Route(00111)

Used to record the internet routers that handle the datagram

Nine router IP can be contained(4byte×9 = 36 bytes ≤ 40bytes)

Uses a pointer field containing the byte number of the first empty entry Initialized by 4 and increased by 4 until over the length value

Page 36: Chapter 8  Internet Protocol (IP)

3636

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.)

Page 37: Chapter 8  Internet Protocol (IP)

3737

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.) Strict Source Route (01001)

Used by the source to predetermine a rout for the datagramAll of the routers defined in the option must be visited by datagramIf the datagram visits a router that is not on the list, the datagram is discarded and an error message is issuedIf the datagram arrives at the destination and some of the entries were not visited, it is also discarded and an error message issued

Page 38: Chapter 8  Internet Protocol (IP)

3838

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.)

Strict source route concept

Page 39: Chapter 8  Internet Protocol (IP)

3939

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.)

Loose Source Route(00011)

Similar to the strict source route

Each router in the list must be visited, but the datagram can visit other routers

Page 40: Chapter 8  Internet Protocol (IP)

4040

8.3 OPTIONS(cont.)8.3 OPTIONS(cont.) Timestamp(00101)

Used to record the time of datagram processing by a router Milliseconds from midnight, Universal Time

Overflow field Records the number of routers that could not add their timestamp because of

no more fields availableFlags field

Specify the visited router responsibilities

Page 41: Chapter 8  Internet Protocol (IP)

4141

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.)

Use of flag in timestamp

-0 : add only the timestamp in the provided field-1 : add each router’s outgoing IP address and the timestamp-3 : each router must check the given IP address with its own incoming IP address If matched, the router overwrites the IP address with its outgoing IP address and adds the timestamp

Page 42: Chapter 8  Internet Protocol (IP)

4242

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.)

Timestamp concept

Page 43: Chapter 8  Internet Protocol (IP)

4343

Example 10: Which of the six options must be copied to each fragment?

We look at the first (left-most) bit of the code for each option.No operation: Code is 00000001; no copy.End of option: Code is 00000000; no copy.Record route: Code is 00000111; no copy.Strict source route: Code is 10001001; copied.Loose source route: Code is 10000011; copied.Timestamp: Code is 01000100; no copy.

Example 11 : Which of the six options are used for datagram control and which are used for debugging and management?

We look at the second and third (left-most) bits of the code.No operation: Code is 00000001; control.End of option: Code is 00000000; control.Record route: Code is 00000111; control.Strict source route: Code is 10001001; control.Loose source route: Code is 10000011; control.Timestamp: Code is 01000100; debugging

8.3 OPTIONS (cont.)8.3 OPTIONS (cont.)

Page 44: Chapter 8  Internet Protocol (IP)

4444

One of the utilities available in UNIX to check the travelling of the IP packets is ping. In the next chapter, we talk about the ping program in more detail. In this example, we want to show how to use the program to see if a host is available. We ping a server at De Anza College named fhda.edu. The result shows that the IP address of the host is 153.18.8.1.

$ ping fhda.eduPING fhda.edu (153.18.8.1) 56(84) bytes of data.64 bytes from tiptoe.fhda.edu (153.18.8.1): ....

The result shows the IP address of the host and the number of bytes used.

Example 12Example 12

Page 45: Chapter 8  Internet Protocol (IP)

4545

We can also use the ping utility with the -R option to implement the record route option.

$ ping -R fhda.eduPING fhda.edu (153.18.8.1) 56(124) bytes of data.64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=0 ttl=62 time=2.70 msRR: voyager.deanza.fhda.edu (153.18.17.11) Dcore_G0_3-69.fhda.edu (153.18.251.3) Dbackup_V13.fhda.edu (153.18.191.249) tiptoe.fhda.edu (153.18.8.1) Dbackup_V62.fhda.edu (153.18.251.34) Dcore_G0_1-6.fhda.edu (153.18.31.254) voyager.deanza.fhda.edu (153.18.17.11)

The result shows the interfaces and IP addresses.

Example 13Example 13

Page 46: Chapter 8  Internet Protocol (IP)

4646

The traceroute utility can also be used to keep track of the route of a packet.

$ traceroute fhda.edutraceroute to fhda.edu (153.18.8.1), 30 hops max, 38 byte packets 1 Dcore_G0_1-6.fhda.edu (153.18.31.254) 0.972 ms 0.902 ms 0.881 ms 2 Dbackup_V69.fhda.edu (153.18.251.4) 2.113 ms 1.996 ms 2.059 ms 3 tiptoe.fhda.edu (153.18.8.1) 1.791 ms 1.741 ms 1.751 ms

The result shows the three routers visited.

Example 14Example 14

Page 47: Chapter 8  Internet Protocol (IP)

4747

The traceroute program can be used to implement loose source routing. The -g option allows us to define the routers to be visited, from the source to destination. The following shows how we can send a packet to the fhda.edu server with the requirement that the packet visit the router 153.18.251.4.

$ traceroute -g 153.18.251.4 fhda.edu.traceroute to fhda.edu (153.18.8.1), 30 hops max, 46 byte packets 1 Dcore_G0_1-6.fhda.edu (153.18.31.254) 0.976 ms 0.906 ms 0.889 ms 2 Dbackup_V69.fhda.edu (153.18.251.4) 2.168 ms 2.148 ms 2.037 ms

Example 15Example 15

Page 48: Chapter 8  Internet Protocol (IP)

4848

The traceroute program can also be used to implement strict source routing. The -G option forces the packet to visit the routers defined in the command line. The following shows how we can send a packet to the fhda.edu server and force the packet to visit only the router 153.18.251.4, not any other one.

$ traceroute -G 153.18.251.4 fhda.edu.traceroute to fhda.edu (153.18.8.1), 30 hops max, 46 byte packets 1 Dbackup_V69.fhda.edu (153.18.251.4) 2.168 ms 2.148 ms 2.037 ms

Example 16Example 16

Page 49: Chapter 8  Internet Protocol (IP)

4949

8.4 CheckSum8.4 CheckSum The error detection method used by most TCP/IP protocols is called the The error detection method used by most TCP/IP protocols is called the

checksum. The checksum protects against the corruption that may occur checksum. The checksum protects against the corruption that may occur during the transmission of a packet. It is redundant information added to during the transmission of a packet. It is redundant information added to the packet.the packet.

The topics discussed in this section include:The topics discussed in this section include:

Checksum Calculation at the Sender Checksum Calculation at the Sender

Checksum Calculation at the ReceiverChecksum Calculation at the Receiver

Checksum in the IP PacketChecksum in the IP Packet

Page 50: Chapter 8  Internet Protocol (IP)

5050

8.4 CheckSum in IP8.4 CheckSum in IP To create the checksum the sender does the following:To create the checksum the sender does the following:

1.1. The packet is divided into k sections, The packet is divided into k sections, each of n bits. each of n bits.

2.2. All sections are added together using All sections are added together using one’s complement arithmetic. one’s complement arithmetic.

3.3. The final result is complemented The final result is complemented to make the checksum. to make the checksum.

Checksum in one’s complement arithmetic

Page 51: Chapter 8  Internet Protocol (IP)

5151

Checksum concept

Page 52: Chapter 8  Internet Protocol (IP)

5252

An example of IP header checksum calculation in binary and hexadecimal

Page 53: Chapter 8  Internet Protocol (IP)

5353

Check Appendix C for a detailed description of checksum calculation and

the handling of carries.

Note:Note:

Page 54: Chapter 8  Internet Protocol (IP)

5454

Modulo 2 ArithmeticModulo 2 Arithmetic

1111 11001+1010 11 -------- -------- 0101 11001

11001---------

101011

110011 | 10101 / 11

--------- x11

11 -------- x00 00

----- x01

00 ---- x1

010 2011 3---- --001 1 Mod 2101 5 Binary

Page 55: Chapter 8  Internet Protocol (IP)

5555

8.5 IP PACKAGE8.5 IP PACKAGE

We give an example of a simplified IP software package to show its components We give an example of a simplified IP software package to show its components

and the relationships between the components. This IP package involves eight and the relationships between the components. This IP package involves eight

modules.modules.

The topics discussed in this section include:The topics discussed in this section include: Header-adding module Processing module Routing module Fragmentation module Reassembly module Routing table MTU table Reassembly table

Page 56: Chapter 8  Internet Protocol (IP)

5656

8.5 IP PACKAGE8.5 IP PACKAGE

Page 57: Chapter 8  Internet Protocol (IP)

5757

8.5 IP PACKAGE8.5 IP PACKAGE

Header-adding module

• Receive : data, destination address

1. Encapsulate the data in an IP datagram

2.Calculate the checksum and insert it in the checksum field

3. Send the data to the corresponding input queue

4. Return

Page 58: Chapter 8  Internet Protocol (IP)

5858

8.5 IP PACKAGE8.5 IP PACKAGE

Processing module

1. 1. Remove one datagram from one of the input queues2. 2. If(destination address is 127.X.Y.Z or matches one of the local

addresses)1. 1. Send the datagram to the reassembly module2. 2. Return

3. 3. If(machine is a router)1. 1. Decrement TTL

4. 4. If(TTL less than or equal to zero)1. 1. Discard the datagram2. 2. Send an ICMP error message3. 3. Return

5. 5. Send the datagram to the routing module6. 6. Return

Page 59: Chapter 8  Internet Protocol (IP)

5959

8.5 IP PACKAGE8.5 IP PACKAGEFragmentation module

• Receive : an IP datagram from the routing module1. Extract the size of the datagram2. If(size > MTU of the corresponding network)

1. If(D(do not fragment) bit is set)1. Discard the datagram1. Discard the datagram2. Send an ICMP error message2. Send an ICMP error message3. Return3. Return

2. Else1. Calculate the maximum size1. Calculate the maximum size2. Divide the datagram into fragments2. Divide the datagram into fragments3. Add header to each fragment3. Add header to each fragment4. Add required options to each fragment4. Add required options to each fragment5. Send the datagrams5. Send the datagrams6. Return6. Return

3. Else1. Send the datagram

4. ReturnMTU table

Page 60: Chapter 8  Internet Protocol (IP)

6060

8.5 IP PACKAGE8.5 IP PACKAGE

Reassembly table• Used by the reassembly module• Five field

- State(FREE or IN-USE)- Source IP address(source IP of the datagram)- Datagram ID(uniquely define a datagram)- Time-out(predetermined amount of time, in which all fragments must

arrive)- Fragments(a pointer to a linked list of fragments)

Page 61: Chapter 8  Internet Protocol (IP)

6161

8.5 IP PACKAGE (cont.)8.5 IP PACKAGE (cont.)Reassembly module

Receive : an IP packet from the processing module1. If (offset value is zero and the M bit is 0)

1. Send the datagram to the appropriate queue2. Return

2. Search the reassembly table for the corresponding entry3. If (not found)

1. Create a new entry4. Insert the fragment at the appropriate place in the linked list

1. if (all fragments have arrived)1. Reassemble the fragments2. Deliver the datagram to the corresponding upper layer protocol 3. Return

2. Else1. Check the time-out2. if (time-out expired)

1. Discard all fragment2. Send an ICMP error message

5. Return