+ All Categories
Home > Documents > Chapter 8

Chapter 8

Date post: 04-Jan-2016
Category:
Upload: omar-owen
View: 26 times
Download: 0 times
Share this document with a friend
Description:
Chapter 8. Internet Protocol. 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 - PowerPoint PPT Presentation
65
TCP/IP Protocol Suite 1 Chapter 8 Chapter 8 Upon completion you will be able to: Internet Protocol Internet Protocol 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 Objectives
Transcript
Page 1: Chapter   8

TCP/IP Protocol Suite 1

Chapter 8Chapter 8

Upon completion you will be able to:

Internet ProtocolInternet Protocol

• 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

Objectives

Page 2: Chapter   8

TCP/IP Protocol Suite 2

Position of IP in TCP/IP protocol suite

Page 3: Chapter   8

TCP/IP Protocol Suite 3

•It is the transmission mechanism used by TCP/IP protocols.

•It is an unreliable & connectionless datagram protocol-a best delivery service.

•Best effort means that IP provides no error checking or tracking.

•IP is also a connectionless protocol for a packet switching network that uses the datagram approach.

•This means that each datagram is handled independently & each datagram can follow a different route to the destination.

INTERNET PROTOCOL (IP)

Page 4: Chapter   8

TCP/IP Protocol Suite 4

8.1 DATAGRAM

A packet in the IP layer is called a datagram, a variable-length packet A packet in the IP layer is called a datagram, a variable-length packet consisting of two parts: header and data. consisting of two parts: header and data.

The header is 20 to 60 bytes in length and contains information essential The header is 20 to 60 bytes in length and contains information essential to routing and delivery.to routing and delivery.

Page 5: Chapter   8

TCP/IP Protocol Suite 5

IP datagram

Page 6: Chapter   8

TCP/IP Protocol Suite 6

Service type or differentiated services (DS)

Precedence: (0 to 7 bits). The precedence defines the priority of datagram in issues such as congestion. If a router is congested & needs to discard some datagram, those datagram with lowest precedence are discarded first.The precedence subfield was part of version 4, but never used.

Page 7: Chapter   8

TCP/IP Protocol Suite 7

Types of serviceTypes of service

•4-bit subfield with each bit having special meaning.

•The bit pattern & their interpretation are given below:

Page 8: Chapter   8

TCP/IP Protocol Suite 8

Default types of serviceDefault types of service

Page 9: Chapter   8

TCP/IP Protocol Suite 9

Values for code pointsValues for code points

•The first 6 bits make up codepoints subfield & last 2 bits are not used.•The first category (0, 2, 4, ……..62) is assigned by the Internet authority IETF.•The second category (3, 7, 11, 15, ….63)can be used by local authorities.•The third category (1, 5, 9….61) is temporary & can be used for experimental purposes.

Page 10: Chapter   8

TCP/IP Protocol Suite 10

Total Length=Header + Data

Length of Data=Total Length – Header Length

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

Note:Note:

Page 11: Chapter   8

TCP/IP Protocol Suite 11

Encapsulation of a small datagram in an Ethernet frame

Page 12: Chapter   8

TCP/IP Protocol Suite 12

Figure 8.5 Multiplexing

Page 13: Chapter   8

TCP/IP Protocol Suite 13

ProtocolsProtocols

Page 14: Chapter   8

TCP/IP Protocol Suite 14

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

Example 1

01000010

The receiver discards the packet. Why?

Page 15: Chapter   8

TCP/IP Protocol Suite 15

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

Example 1

01000010

The receiver discards the packet. Why?

SolutionThere 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.

Page 16: Chapter   8

TCP/IP Protocol Suite 16

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

Example 2

Page 17: Chapter   8

TCP/IP Protocol Suite 17

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

Example 2

SolutionThe 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 base header, the next 12 bytes are the options.

Page 18: Chapter   8

TCP/IP Protocol Suite 18

In an IP packet, the value of HLEN is 516

and the value of the total length field is 002816 . Howmany bytes of data are being carried by this packet?

Example 3

Page 19: Chapter   8

TCP/IP Protocol Suite 19

In an IP packet, the value of HLEN is 516

and the value of the total length field is 002816 . Howmany bytes of data are being carried by this packet?

Example 3

SolutionThe 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 (40 − 20).

Page 20: Chapter   8

TCP/IP Protocol Suite 20

8.2 FRAGMENTATION

The format and size of a frame depend on the protocol used by the The format and size of a frame depend on the protocol used by the physical network. physical network. A datagram may have to be fragmented to fit the protocol regulations. 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

Page 21: Chapter   8

TCP/IP Protocol Suite 21

MTU

Each data link layer protocol has its own protocols.

One of the field in the format is maximum size of the data field.

The value of the MTU differs from one physical network protocol to another.

Page 22: Chapter   8

TCP/IP Protocol Suite 22

MTUs for some networksMTUs for some networks

When a datagram is fragmented, each fragment has its own header with most of the field repeated, but some changed.That means, datagram can be fragmented many times before it reaches the final destination.

Page 23: Chapter   8

TCP/IP Protocol Suite 23

FIELDS RELATED TO FRAGMENTATION:

Identification:•This is a 16-bit field identifies a datagram & uniquely defined•IP protocol uses a counter to label the datagram.•When the IP protocol sends a datagram , it copies the current value of the counter to the identification field & increments the counter by one.•All fragments have the same identification number.

Flags:

•This is a 3-bit field.•The first bit is reserved.•If D=1, the machine must not fragment the datagram.•If D=0, the datagram can be fragmented.•If M=1, there are more fragments after this fragments.•If M=0, this is the last or only fragment.

Page 24: Chapter   8

TCP/IP Protocol Suite 24

FIELDS RELATED TO FRAGMENTATION:

Fragmentation Offset:•This is a 13-bit field shows the relative position of this fragment with respect to the whole datagram.•It is the offset of data in the original datagram measured in units of 8 bytes.

Page 25: Chapter   8

TCP/IP Protocol Suite 25

Fragmentation example

The following ex. Shows a datagram with a data size of 4000 bytes in units of 8 bytes.

Page 26: Chapter   8

TCP/IP Protocol Suite 26

Detailed fragmentation example

Page 27: Chapter   8

TCP/IP Protocol Suite 27

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?

Example 5

Page 28: Chapter   8

TCP/IP Protocol Suite 28

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?

Example 5

SolutionIf 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.

Page 29: Chapter   8

TCP/IP Protocol Suite 29

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?

Example 6

Page 30: Chapter   8

TCP/IP Protocol Suite 30

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?

Example 6

SolutionIf 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). See also the next example.

Page 31: Chapter   8

TCP/IP Protocol Suite 31

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?.

Example 7

Page 32: Chapter   8

TCP/IP Protocol Suite 32

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?.

Example 7

SolutionBecause 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.

Page 33: Chapter   8

TCP/IP Protocol Suite 33

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?

Example 8

Page 34: Chapter   8

TCP/IP Protocol Suite 34

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?

Example 8

SolutionTo 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.

Page 35: Chapter   8

TCP/IP Protocol Suite 35

OPTIONS

The header of the IP datagram is made of two parts: a fixed part and a The header of the IP datagram is made of two parts: a fixed part and a variable part. variable part.

The fixed part is 20 bytes & the variable part comprises the options that The fixed part is 20 bytes & the variable part comprises the options that can be a maximum of 40 bytes.can be a maximum of 40 bytes.

They can be used for network testing & debugging.They can be used for network testing & debugging.

Page 36: Chapter   8

TCP/IP Protocol Suite 36

Option format

Length: It define the total length of the option including the code field & the length field itself. This field is not present in all of the option types.

Data: It contains the data that specific options require. Like the length field , this field also not present in all option types.

Page 37: Chapter   8

TCP/IP Protocol Suite 37

Categories of options

Page 38: Chapter   8

TCP/IP Protocol Suite 38

No operation option

It is a 1-byte option used as a filler between options.For ex., it can be used to align the next option on a 16-bit or 32-bit boundary.

Page 39: Chapter   8

TCP/IP Protocol Suite 39

End of option

It is a 1-byte option used for padding at the end of the option field.

Only one end of option can be used. After this option, the receiver looks for the payload data.

Page 40: Chapter   8

TCP/IP Protocol Suite 40

Record route option

•It is used to record the internet routers that handle the datagram.•Pointer field is an offset integer field containing the byte number of the first empty entry.

Page 41: Chapter   8

TCP/IP Protocol Suite 41

Record route concept

Page 42: Chapter   8

TCP/IP Protocol Suite 42

Strict source route option

•It is used by the source to predetermine a route for the datagram as it travels through the Internet.•The sender can choose a route with a specific type of services, such as minimum delay or maximum throughput.•If a datagram specifies a strict route , all of the routers defined in the option must be visited by the datagram.

Page 43: Chapter   8

TCP/IP Protocol Suite 43

Strict source route concept

Page 44: Chapter   8

TCP/IP Protocol Suite 44

Loose source route option

•It is similar to strict source route, but it is more relaxed.

•In this each router in the list must be visited, but the datagram can visit other routers as well.

Page 45: Chapter   8

TCP/IP Protocol Suite 45

Timestamp option

•It is used to record the time of datagram processing by a router.•We can estimate the time it takes for a datagram to go from one router to another.•Although all routers may use Universal Time, their local clocks may not be synchronized. •Overflow field records the number of routers that could not add their timestamp.•Flag=0,each router adds only the timestamp in the provided field•Flag=1, each router must add its outgoing IP address & the timestamp.•Flag=3, IP addresses are given & each router must check given IP address with its own incoming IP address.

Page 46: Chapter   8

TCP/IP Protocol Suite 46

Use of flag in timestamp

Page 47: Chapter   8

TCP/IP Protocol Suite 47

Timestamp concept

Page 48: Chapter   8

TCP/IP Protocol Suite 48

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

Example 10

SolutionWe look at the first (left-most) bit of the code for each option.

a. No operation: Code is 00000001; not copied.b. End of option: Code is 00000000; not copied.c. Record route: Code is 00000111; not copied.d. Strict source route: Code is 10001001; copied.e. Loose source route: Code is 10000011; copied.f. Timestamp: Code is 01000100; not copied.

Page 49: Chapter   8

TCP/IP Protocol Suite 49

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

Example 11

SolutionWe look at the second and third (left-most) bits of the code.

a. No operation: Code is 00000001; datagram control.b. End of option: Code is 00000000; datagram control.c. Record route: Code is 00000111; datagram control.d. Strict source route: Code is 10001001; datagram control.e. Loose source route: Code is 10000011; datagram control.f. Time stamp: Code is 01000100; debugging and management control.

Page 50: Chapter   8

TCP/IP Protocol Suite 50

8.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.checksum.

•The checksum protects against the corruption that may occur during The checksum protects against the corruption that may occur during the transmission of a packet. the transmission of a packet.

•It is redundant information added to the packet.It is redundant information added to the packet.

•The checksum is calculated at the sender & the value obtained is sent The checksum is calculated at the sender & the value obtained is sent with the packet.with the packet.

•The receiver repeats the same calculation on the whole packet including The receiver repeats the same calculation on the whole packet including the checksum.the checksum.

•If the result is satisfactory, the packet is accepted; otherwise it is If the result is satisfactory, the packet is accepted; otherwise it is rejectedrejected

Page 51: Chapter   8

TCP/IP Protocol Suite 51

To create the checksum the sender does the following:

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

❏ All sections are added together using 1’s complement arithmetic.

❏ The final result is complemented to make the checksum.

Note:Note:

Page 52: Chapter   8

TCP/IP Protocol Suite 52

Checksum concept

Page 53: Chapter   8

TCP/IP Protocol Suite 53

Checksum in one’s complement arithmetic

Page 54: Chapter   8

TCP/IP Protocol Suite 54

Checksum in the IP packet

•First the value of checksum field is set to 0.

•The entire header is divided into 16-bit section & added together.

•The result (sum) is complemented & inserted into the checksum field.

•The checksum in the IP packet covers only the header not the data.

•The header of the IP packet changes with each visited router, but the

data does not.

•So the checksum includes only the part that has changed.

Page 55: Chapter   8

TCP/IP Protocol Suite 55

An example of a checksum calculation for an IP header without options. The header is divided into 16-bit sections. All the sections are added and the sum is complemented. The result is inserted in the checksum field.

Example 17

Page 56: Chapter   8

TCP/IP Protocol Suite 56

Example of checksum calculation in binary

Page 57: Chapter   8

TCP/IP Protocol Suite 57

Let us do the same example in hexadecimal. Each row has four hexadecimal digits. We calculate the sum first. Note that if an addition results in more than one hexadecimal digit, the right-most digit becomes the current-column digit and the rest are carried to other columns. From the sum, we make the checksum by complementing the sum.

Example 18

Page 58: Chapter   8

TCP/IP Protocol Suite 58

Example of checksum calculation in hexadecimal

Page 59: Chapter   8

TCP/IP Protocol Suite 59

8.5 IP PACKAGE

We give an example of a simplified IP software package to show its We give an example of a simplified IP software package to show its components and the relationships between the components. components and the relationships between the components.

This IP package involves eight modules:This IP package involves eight modules:

•Header-Adding ModuleHeader-Adding Module•Processing ModuleProcessing Module•QueuesQueues•Routing TableRouting Table•Forwarding ModuleForwarding Module•MTU TableMTU Table•Fragmentation ModuleFragmentation Module•Reassembly TableReassembly Table•Reassembly ModuleReassembly Module

Page 60: Chapter   8

TCP/IP Protocol Suite 60

IP Package

Page 61: Chapter   8

TCP/IP Protocol Suite 61

Header Adding Module:

•It receives data from an Upper layer protocol along with the destination IP address.

•Encapsulate the data in an IP datagram.

•Calculate the checksum & insert it in the checksum field.

•Send the data to the corresponding queue.

Page 62: Chapter   8

TCP/IP Protocol Suite 62

Processing Module:

•It is a heart of the IP package.

•It receives a datagram from an interface or from the header adding module.

•This module first check to see if the datagram is a loopback packet or a packet that

has reached its final destination.

•In either case, the packet is sent to the reassembly module.

Page 63: Chapter   8

TCP/IP Protocol Suite 63

Queue:

•It uses two types of queue: input queue and output queue.

•The input queue store the datagram coming from the data link layer or the upper

layer protocols.

•The output queue store the datagram going to the data link layer or the upper layer

protocols.

•The processing module dequeues (removes) the datagram from the input queues.

•The fragmentation & reassembly modules enqueue (add) the datagram into the

output queues.

Page 64: Chapter   8

TCP/IP Protocol Suite 64

MTU table

•This table is used by the fragmentation module to find the maximum transfer unit of a particular interface.

Page 65: Chapter   8

TCP/IP Protocol Suite 65

Reassembly table


Recommended