1321
Chapter 1 Chapter 1 Chapter 1 Chapter 1 Chapter 1 Chapter 1 Chapter 1 Chapter 1 Objectives Upon completion you will be able to: Introduction Introduction TCP/IP Protocol Suite 1 Understand how the Internet came into being Understand the meaning of the terms protocol and standard Understand the various organizations involved in the standards Understand the different levels of Internet service providers Understand the groups involved in Internet administration

TCP-IP

Embed Size (px)

Citation preview

Page 1: TCP-IP

Chapter 1Chapter 1Chapter 1Chapter 1Chapter 1Chapter 1Chapter 1Chapter 1

Objectives

Upon completion you will be able to:

IntroductionIntroduction

TCP/IP Protocol Suite 1

• Understand how the Internet came into being

• Understand the meaning of the terms protocol and standard

• Understand the various organizations involved in the standards

• Understand the different levels of Internet service providers

• Understand the groups involved in Internet administration

Page 2: TCP-IP

1.1 A Brief History

A network is a group of connected, communicating devices. An A network is a group of connected, communicating devices. An internetinternet

is two or more networks that can communicate with each other. The most is two or more networks that can communicate with each other. The most

notable internet is called the notable internet is called the InternetInternet. Millions of. Millions of people are users. Yet people are users. Yet

this extraordinary communication system only came into being in 1969.this extraordinary communication system only came into being in 1969.

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

TCP/IP Protocol Suite 2

ARPANETARPANET

Birth of the Internet Birth of the Internet

Transmission Control Protocol / Internetworking ProtocolTransmission Control Protocol / Internetworking Protocol

MILNETMILNET

CSNET, NSFNET & ANSNETCSNET, NSFNET & ANSNET

The Internet TodayThe Internet Today

Time LineTime Line

Growth of the InternetGrowth of the Internet

Page 3: TCP-IP

Figure 1.1 Internet today

TCP/IP Protocol Suite 3

Page 4: TCP-IP

1.2 Protocols and Standards

In this section, we define two widely used terms: protocols and standards. In this section, we define two widely used terms: protocols and standards.

First, we define protocol, which is synonymous with “rule.” Then we First, we define protocol, which is synonymous with “rule.” Then we

discuss standards, which are agreeddiscuss standards, which are agreed--upon rules.upon rules.

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

TCP/IP Protocol Suite 4

ProtocolsProtocols

StandardsStandards

Page 5: TCP-IP

1.3 Standards Organizations

Standards are developed through the cooperation of standards creation Standards are developed through the cooperation of standards creation

committees, forums, and government regulatory agencies.committees, forums, and government regulatory agencies.

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

TCP/IP Protocol Suite 5

Standards Creation CommitteesStandards Creation Committees

ForumsForums

Regulatory AgenciesRegulatory Agencies

Page 6: TCP-IP

The websites for the standardization The websites for the standardization

organizations are given in Appendix F.organizations are given in Appendix F.

Note:Note:

TCP/IP Protocol Suite 6

Page 7: TCP-IP

1.4 Internet Standards

An Internet standard is a thoroughly tested specification. There is a strict An Internet standard is a thoroughly tested specification. There is a strict

procedure by which a specification attains Internet standard status. A procedure by which a specification attains Internet standard status. A

specification begins as an Internet draft, working document with no specification begins as an Internet draft, working document with no

official status and a sixofficial status and a six--month lifetime. A draft may be published as a month lifetime. A draft may be published as a

Request for Comment (RFC). Request for Comment (RFC).

TCP/IP Protocol Suite 7

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

Maturity LevelsMaturity Levels

Requirement LevelsRequirement Levels

Page 8: TCP-IP

Figure 1.2 Maturity levels of an RFC

TCP/IP Protocol Suite 8

Page 9: TCP-IP

Figure 1.3 Requirement levels of an RFC

TCP/IP Protocol Suite 9

Page 10: TCP-IP

RFCs can be found at

www.faqs.org/rfcs

Note:Note:

TCP/IP Protocol Suite 10

Page 11: TCP-IP

1.5 Internet Administration

The Internet has evolved and gained a broader user base with significant The Internet has evolved and gained a broader user base with significant

commercial activity. Various groups that coordinate Internet issues have commercial activity. Various groups that coordinate Internet issues have

guided this growth and development. guided this growth and development.

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

TCP/IP Protocol Suite 11

Internet Society (ISOC)Internet Society (ISOC)

Internet Architecture Board (IAB)Internet Architecture Board (IAB)

Internet Engineering Task Force (IETF)Internet Engineering Task Force (IETF)

Internet Research Task Force (IRTF)Internet Research Task Force (IRTF)

Internet Assigned Numbers Authority (IANA)Internet Assigned Numbers Authority (IANA)

Names and Numbers (ICANN)Names and Numbers (ICANN)

Network Information Center (NIC)Network Information Center (NIC)

Page 12: TCP-IP

Figure 1.4 Internet administration

TCP/IP Protocol Suite 12

Page 13: TCP-IP

The websites for Internet

organizations can be found in

Appendix F.

Note:Note:

TCP/IP Protocol Suite 13

Appendix F.

Page 14: TCP-IP

Chapter 2Chapter 2Chapter 2Chapter 2Chapter 2Chapter 2Chapter 2Chapter 2

Upon completion you will be able to:

The OSI Model andThe OSI Model and

the TCP/IP Protocol the TCP/IP Protocol SuiteaSuitea

Objectives

TCP/IP Protocol Suite 14

Upon completion you will be able to:

• Understand the architecture of the OSI model

• Understand the layers of the OSI model and their functions

• Understand the architecture of the TCP/IP Protocol Suite

• Differentiate between the OSI model and the TCP/IP Suite

• Differentiate between the three types of Internet addresses

Page 15: TCP-IP

2.1 The OSI Model

Established in 1947, the Established in 1947, the International Standards Organization (ISO)International Standards Organization (ISO) is a is a

multinational body dedicated to worldwide agreement on international multinational body dedicated to worldwide agreement on international

standards. An ISO standard that covers all aspects of network standards. An ISO standard that covers all aspects of network

communications is the communications is the Open Systems Interconnection (OSI)Open Systems Interconnection (OSI) model. It model. It

was first introduced in the late 1970s.was first introduced in the late 1970s.

TCP/IP Protocol Suite 15

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

Layered ArchitectureLayered Architecture

PeerPeer--toto--Peer ProcessesPeer Processes

EncapsulationEncapsulation

Page 16: TCP-IP

ISO is the organization.

OSI is the model

Note:Note:

TCP/IP Protocol Suite 16

Page 17: TCP-IP

Figure 2.1 The OSI model

TCP/IP Protocol Suite 17

Page 18: TCP-IP

Figure 2.2 OSI layers

TCP/IP Protocol Suite 18

Page 19: TCP-IP

Figure 2.3 An exchange using the OSI model

TCP/IP Protocol Suite 19

Page 20: TCP-IP

2.2 Layers in the OSI Model

The functions of each layer in the OSI model is briefly described.The functions of each layer in the OSI model is briefly described.

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

Physical LayerPhysical Layer

Data Link LayerData Link Layer

Network LayerNetwork Layer

TCP/IP Protocol Suite 20

Network LayerNetwork Layer

Transport LayerTransport Layer

Session LayerSession Layer

Presentation LayerPresentation Layer

Application LayerApplication Layer

Summary of LayersSummary of Layers

Page 21: TCP-IP

Figure 2.4 Physical layer

TCP/IP Protocol Suite 21

Page 22: TCP-IP

The physical layer is responsible

for the movement of individual bits

from one hop (node) to the next.

Note:Note:

TCP/IP Protocol Suite 22

from one hop (node) to the next.

Page 23: TCP-IP

Figure 2.5 Data link layer

TCP/IP Protocol Suite 23

Page 24: TCP-IP

The data link layer is responsible for

moving frames from one hop (node) to

the next.

Note:Note:

TCP/IP Protocol Suite 24

the next.

Page 25: TCP-IP

Figure 2.6 Hop-to-hop delivery

TCP/IP Protocol Suite 25

Page 26: TCP-IP

Figure 2.7 Network layer

TCP/IP Protocol Suite 26

Page 27: TCP-IP

The network layer is responsible for

the delivery of individual packets from

the source host to the destination host.

Note:Note:

TCP/IP Protocol Suite 27

the source host to the destination host.

Page 28: TCP-IP

Figure 2.8 Source-to-destination delivery

TCP/IP Protocol Suite 28

Page 29: TCP-IP

Figure 2.9 Transport layer

TCP/IP Protocol Suite 29

Page 30: TCP-IP

The transport layer is responsible for

the delivery of a message from one

process to another.

Note:Note:

TCP/IP Protocol Suite 30

process to another.

Page 31: TCP-IP

Figure 2.10 Reliable process-to-process delivery of a message

TCP/IP Protocol Suite 31

Page 32: TCP-IP

Figure 2.11 Session layer

TCP/IP Protocol Suite 32

Page 33: TCP-IP

Figure 2.12 Presentation layer

TCP/IP Protocol Suite 33

Page 34: TCP-IP

Figure 2.13 Application layer

TCP/IP Protocol Suite 34

Page 35: TCP-IP

Figure 2.14 Summary of layers

TCP/IP Protocol Suite 35

Page 36: TCP-IP

2.3 TCP/IP Protocol Suite

The The TCP/IP protocol suiteTCP/IP protocol suite is made of five layers: physical, data link, is made of five layers: physical, data link,

network, transport, and application. The first four layers provide physical network, transport, and application. The first four layers provide physical

standards, network interface, internetworking, and transport functions standards, network interface, internetworking, and transport functions

that correspond to the first four layers of the OSI model. The three that correspond to the first four layers of the OSI model. The three

topmost layers in the OSI model, however, are represented in TCP/IP by topmost layers in the OSI model, however, are represented in TCP/IP by

a single layer called the application layer.a single layer called the application layer.

TCP/IP Protocol Suite 36

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

Physical and Data Link LayersPhysical and Data Link Layers

Network LayerNetwork Layer

Transport LayerTransport Layer

Application LayerApplication Layer

Page 37: TCP-IP

Figure 2.15 TCP/IP and OSI model

TCP/IP Protocol Suite 37

Page 38: TCP-IP

2.4 Addressing

Three different levels of addresses are used in an internet using the Three different levels of addresses are used in an internet using the

TCP/IP protocols: TCP/IP protocols: physical (link) addressphysical (link) address, , logical (IP) addresslogical (IP) address, and , and

port addressport address. .

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

TCP/IP Protocol Suite 38

Physical AddressPhysical Address

Logical AddressLogical Address

Port Address Port Address

Page 39: TCP-IP

Figure 2.16 Addresses in TCP/IP

TCP/IP Protocol Suite 39

Page 40: TCP-IP

Figure 2.17 Relationship of layers and addresses in TCP/IP

TCP/IP Protocol Suite 40

Page 41: TCP-IP

In Figure 2.18 a node with physical address 10 sends

a frame to a node with physical address 87. The two

nodes are connected by a link. At the data link level

this frame contains physical (link) addresses in the

header. These are the only addresses needed. The rest

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 41

header. These are the only addresses needed. The rest

of the header contains other information needed at

this level. The trailer usually contains extra bits

needed for error detection.

See Next Slide

Page 42: TCP-IP

Figure 2.18 Physical addresses

TCP/IP Protocol Suite 42

Page 43: TCP-IP

As we will see in Chapter 3, most local area networks

use a 48-bit (6 bytes) physical address written as 12

hexadecimal digits, with every 2 bytes separated by a

colon as shown below:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 43

07:01:02:01:2C:4B

A 6-byte (12 hexadecimal digits) physical address.

Page 44: TCP-IP

In Figure 2.19 we want to send data from a node with network

address A and physical address 10, located on one LAN, to a

node with a network address P and physical address 95, located

on another LAN. Because the two devices are located on

different networks, we cannot use link addresses only; the link

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 44

different networks, we cannot use link addresses only; the link

addresses have only local jurisdiction. What we need here are

universal addresses that can pass through the LAN

boundaries. The network (logical) addresses have this

characteristic.

See Next Slide

Page 45: TCP-IP

The packet at the network layer contains the logical addresses,

which remain the same from the original source to the final

destination (A and P, respectively, in the figure). They will not

change when we go from network to network. However, the

physical addresses will change as the packet moves from one

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3 3 3 3 (Continued)

TCP/IP Protocol Suite 45

physical addresses will change as the packet moves from one

network to another. The boxes labeled routers are

internetworking devices, which we will discuss in Chapter 3.

See Next Slide

Page 46: TCP-IP

Figure 2.19 IP addresses

TCP/IP Protocol Suite 46

Page 47: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 4444

As we will see in Chapter 4, an Internet address (in

IPv4) is 32 bits in length, normally written as four

decimal numbers, with each number representing 1

byte. The numbers are separated by a dot. Below is an

example of such an address.

TCP/IP Protocol Suite 47

example of such an address.

132.24.75.9

An internet address in IPv4 in decimal numbers

Page 48: TCP-IP

Figure 2.20 shows an example of transport layer

communication. Data coming from the upperlayers

have port addresses j and k ( j is the address of the

sending process, and k is the address of the receiving

process). Since the data size is larger than the network

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

TCP/IP Protocol Suite 48

process). Since the data size is larger than the network

layer can handle, the data are split into two packets,

each packet retaining the service-point addresses ( j

and k). Then in the network layer, network addresses

(A and P) are added to each packet.

See Next Slide

Page 49: TCP-IP

The packets can travel on different paths and arrive at

the destination either in order or out of order. The two

packets are delivered to the destination transport

layer, which is responsible for removing the network

layer headers and combining the two pieces of data

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5 5 5 5 (Χοντινυεδ)(Χοντινυεδ)(Χοντινυεδ)(Χοντινυεδ)

TCP/IP Protocol Suite 49

layer headers and combining the two pieces of data

for delivery to the upper layers.

See Next Slide

Page 50: TCP-IP

Figure 2.20 Port addresses

TCP/IP Protocol Suite 50

Page 51: TCP-IP

As we will see in Chapters 11, 12, and 13, a port

address is a 16-bit address represented by one decimal

number as shown below.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 6666

753

TCP/IP Protocol Suite 51

753

A 16-bit port address represented as one single number.

Page 52: TCP-IP

2.5 IP Versions

IP became the official protocol for the Internet in 1983. As the Internet IP became the official protocol for the Internet in 1983. As the Internet

has evolved, so has IP. There have been six versions since its inception. has evolved, so has IP. There have been six versions since its inception.

We look at the latter three versions here.We look at the latter three versions here.

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

TCP/IP Protocol Suite 52

Version 4Version 4

Version 5Version 5

Version 6Version 6

Page 53: TCP-IP

Chapter 3Chapter 3

Objectives

Upon completion you will be able to:

Underlying TechnologyUnderlying Technology

TCP/IP Protocol Suite 53

Upon completion you will be able to:

• Understand the different versions of wired Ethernet

• Understand wireless Ethernet

• Understand the types of point-to-point WANs

• Understand the types of switched WANs, especially ATM

• Differentiate between repeaters, bridges, routers, and hubs

Page 54: TCP-IP

Figure 3.1 Internet model

TCP/IP Protocol Suite 54

Page 55: TCP-IP

3.1 Local Area Networks

A A local area network (LAN)local area network (LAN) is a data communication system that allows is a data communication system that allows

a number of independent devices to communicate directly with each a number of independent devices to communicate directly with each

other in a limited geographic area such as a single department, a single other in a limited geographic area such as a single department, a single

building, or a campus. A large organization may need several connected building, or a campus. A large organization may need several connected

LANs.The most popular LANs are Ethernet and wireless LANs. We LANs.The most popular LANs are Ethernet and wireless LANs. We

briefly review these technologies in this section. briefly review these technologies in this section.

TCP/IP Protocol Suite 55

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

Wired LANs: Ethernet Wired LANs: Ethernet

Wireless LANs: IEEE 802.11Wireless LANs: IEEE 802.11

Page 56: TCP-IP

Figure 3.2 CSMA/CD

TCP/IP Protocol Suite 56

Page 57: TCP-IP

Figure 3.3 Ethernet layers

TCP/IP Protocol Suite 57

Page 58: TCP-IP

Figure 3.4 Ethernet frame

TCP/IP Protocol Suite 58

Page 59: TCP-IP

Figure 3.5 Ethernet implementations

TCP/IP Protocol Suite 59

Page 60: TCP-IP

Figure 3.6 Fast Ethernet implementations

TCP/IP Protocol Suite 60

Page 61: TCP-IP

Figure 3.7 Gigabit Ethernet implementations

TCP/IP Protocol Suite 61

Page 62: TCP-IP

Figure 3.8 BSSs

TCP/IP Protocol Suite 62

Page 63: TCP-IP

Figure 3.9 ESS

TCP/IP Protocol Suite 63

Page 64: TCP-IP

Figure 3.10 Physical layer

TCP/IP Protocol Suite 64

Page 65: TCP-IP

Figure 3.11 FHSS

TCP/IP Protocol Suite 65

Page 66: TCP-IP

Figure 3.12 DSSS

TCP/IP Protocol Suite 66

Page 67: TCP-IP

Figure 3.13 MAC layers in IEEE 802.11 standard

TCP/IP Protocol Suite 67

Page 68: TCP-IP

Figure 3.14 CSMA/CA

TCP/IP Protocol Suite 68

Page 69: TCP-IP

Figure 3.15 Frame

TCP/IP Protocol Suite 69

Page 70: TCP-IP

Table 3.1 Table 3.1 Addresses in IEEE 802.11Addresses in IEEE 802.11

TCP/IP Protocol Suite 70

Page 71: TCP-IP

3.2 Point-to-Point WANs

A second type of network we encounter in the Internet is the pointA second type of network we encounter in the Internet is the point--toto--

point wide area network. A point wide area network. A pointpoint--toto--point WANpoint WAN connects two remote connects two remote

devices using a line available from a public network such as a telephone devices using a line available from a public network such as a telephone

network. We discuss the physical and data link layers of these network. We discuss the physical and data link layers of these

technologies here..technologies here..

TCP/IP Protocol Suite 71

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

Physical LayerPhysical Layer

Data Link LayerData Link Layer

Page 72: TCP-IP

Figure 3.16 56K modem

TCP/IP Protocol Suite 72

Page 73: TCP-IP

ADSL is an asymmetric communication

technology designed for residential users;

Note:Note:

TCP/IP Protocol Suite 73

technology designed for residential users;

it is not suitable for businesses.

Page 74: TCP-IP

Figure 3.17 Bandwidth division

TCP/IP Protocol Suite 74

Page 75: TCP-IP

Figure 3.18 ADSL and DSLAM

TCP/IP Protocol Suite 75

Page 76: TCP-IP

Figure 3.19 Cable bandwidth

TCP/IP Protocol Suite 76

Page 77: TCP-IP

Figure 3.20 Cable modem configurations

TCP/IP Protocol Suite 77

Page 78: TCP-IP

Table 3.2 Table 3.2 T line ratesT line rates

TCP/IP Protocol Suite 78

Page 79: TCP-IP

Table 3.3 Table 3.3 SONET ratesSONET rates

TCP/IP Protocol Suite 79

Page 80: TCP-IP

Figure 3.21 PPP frame

TCP/IP Protocol Suite 80

Page 81: TCP-IP

3.3 Switched WANs

The backbone networks in the Internet are usually switched WANs. A The backbone networks in the Internet are usually switched WANs. A

switched WANswitched WAN is a wide area network that covers a large area (a state or is a wide area network that covers a large area (a state or

a country) and provides access at several points to the users. Inside the a country) and provides access at several points to the users. Inside the

network, there is a mesh of pointnetwork, there is a mesh of point--toto--point networks that connects point networks that connects

switches. The switches, multiple port connectors, allow the connection of switches. The switches, multiple port connectors, allow the connection of

several inputs and outputs. several inputs and outputs.

TCP/IP Protocol Suite 81

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

X.25X.25

Frame RelayFrame Relay

ATMATM

Page 82: TCP-IP

Figure 3.22 Frame Relay network

TCP/IP Protocol Suite 82

Page 83: TCP-IP

A cell network uses the cell as the basic unit A cell network uses the cell as the basic unit

of data exchange. A cell is defined as a of data exchange. A cell is defined as a

small, fixedsmall, fixed--size block of information.size block of information.

Note:Note:

TCP/IP Protocol Suite 83

small, fixedsmall, fixed--size block of information.size block of information.

Page 84: TCP-IP

Figure 3.23 ATM multiplexing

TCP/IP Protocol Suite 84

Page 85: TCP-IP

Figure 3.24 Architecture of an ATM network

TCP/IP Protocol Suite 85

Page 86: TCP-IP

Figure 3.25 Virtual circuits

TCP/IP Protocol Suite 86

Page 87: TCP-IP

Note that a virtual connection is defined by Note that a virtual connection is defined by

Note:Note:

TCP/IP Protocol Suite 87

Note that a virtual connection is defined by Note that a virtual connection is defined by

a pair of numbers: a pair of numbers:

the the VPIVPI and the and the VCIVCI..

Page 88: TCP-IP

Figure 3.26 An ATM cell

TCP/IP Protocol Suite 88

Page 89: TCP-IP

Figure 3.27 ATM layers

TCP/IP Protocol Suite 89

Page 90: TCP-IP

The IP protocol uses the The IP protocol uses the AAL5AAL5 sublayer.sublayer.

Note:Note:

TCP/IP Protocol Suite 90

The IP protocol uses the The IP protocol uses the AAL5AAL5 sublayer.sublayer.

Page 91: TCP-IP

Ωε ωιλλ δισχυσσ ΙΠ οϖερ ΑΤΜ ιν Ωε ωιλλ δισχυσσ ΙΠ οϖερ ΑΤΜ ιν Ωε ωιλλ δισχυσσ ΙΠ οϖερ ΑΤΜ ιν Ωε ωιλλ δισχυσσ ΙΠ οϖερ ΑΤΜ ιν

Νοτε:Νοτε:

TCP/IP Protocol Suite 91

Ωε ωιλλ δισχυσσ ΙΠ οϖερ ΑΤΜ ιν Ωε ωιλλ δισχυσσ ΙΠ οϖερ ΑΤΜ ιν Ωε ωιλλ δισχυσσ ΙΠ οϖερ ΑΤΜ ιν Ωε ωιλλ δισχυσσ ΙΠ οϖερ ΑΤΜ ιν Χηαπτερ 23.Χηαπτερ 23.Χηαπτερ 23.Χηαπτερ 23.

Page 92: TCP-IP

3.4 Connecting Devices

LANs or WANs do not normally operate in isolation. They are connected LANs or WANs do not normally operate in isolation. They are connected

to one another or to the Internet. To connect LANs or WANs, we use to one another or to the Internet. To connect LANs or WANs, we use

connecting devicesconnecting devices. Connecting devices can operate in different layers of . Connecting devices can operate in different layers of

the Internet model. We discuss three kinds of connecting devices: the Internet model. We discuss three kinds of connecting devices:

repeaters (or hubs),repeaters (or hubs), bridges (or twobridges (or two--layer switches),layer switches), and and routers (or routers (or

threethree--layer switcheslayer switches). Repeaters and hubs operate in the first layer of the ). Repeaters and hubs operate in the first layer of the

Internet model. Bridges and twoInternet model. Bridges and two--layer switches operate in the first two layer switches operate in the first two

TCP/IP Protocol Suite 92

Internet model. Bridges and twoInternet model. Bridges and two--layer switches operate in the first two layer switches operate in the first two

layers. Routers and threelayers. Routers and three--layer switches operate in the first three layerslayer switches operate in the first three layers

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

RepeatersRepeaters

HubsHubs

BridgesBridges

RouterRouter

Page 93: TCP-IP

Figure 3.28 Connecting devices

TCP/IP Protocol Suite 93

Page 94: TCP-IP

Figure 3.29 Repeater

TCP/IP Protocol Suite 94

Page 95: TCP-IP

A repeater connects segments of a LAN.A repeater connects segments of a LAN.

Note:Note:

TCP/IP Protocol Suite 95

Page 96: TCP-IP

A repeater forwards every bit; A repeater forwards every bit;

it has no filtering capability.it has no filtering capability.

Note:Note:

TCP/IP Protocol Suite 96

it has no filtering capability.it has no filtering capability.

Page 97: TCP-IP

A repeater is a regenerator, not an amplifier.

Note:Note:

TCP/IP Protocol Suite 97

A repeater is a regenerator, not an amplifier.

Page 98: TCP-IP

Figure 3.30 Function of a repeater

TCP/IP Protocol Suite 98

Page 99: TCP-IP

A bridge has a table used in filtering

decisions.

Note:Note:

TCP/IP Protocol Suite 99

decisions.

Page 100: TCP-IP

Figure 3.31 Bridge

TCP/IP Protocol Suite 100

Page 101: TCP-IP

A bridge does not change the physical

Note:Note:

TCP/IP Protocol Suite 101

A bridge does not change the physical

(MAC) addresses in a frame.

Page 102: TCP-IP

Figure 3.32 Learning bridge

TCP/IP Protocol Suite 102

Page 103: TCP-IP

A router is a three-layer

(physical, data link, and network)

Note:Note:

TCP/IP Protocol Suite 103

(physical, data link, and network)

device.

Page 104: TCP-IP

A repeater or a bridge connects segments of A repeater or a bridge connects segments of

a LAN.a LAN.

Note:Note:

TCP/IP Protocol Suite 104

A router connects independent LANs or A router connects independent LANs or

WANs to create an internetwork (internet).WANs to create an internetwork (internet).

Page 105: TCP-IP

Figure 3.33 Routing example

TCP/IP Protocol Suite 105

Page 106: TCP-IP

A router changes the physical addresses

Note:Note:

TCP/IP Protocol Suite 106

A router changes the physical addresses

in a packet.

Page 107: TCP-IP

Chapter 4Chapter 4Chapter 4Chapter 4Chapter 4Chapter 4Chapter 4Chapter 4

Objectives Upon completion you will be able to:

IP Addresses:IP Addresses:

Classful AddressingClassful Addressing

TCP/IP Protocol Suite 107

Upon completion you will be able to:

• Understand IPv4 addresses and classes

• Identify the class of an IP address

• Find the network address given an IP address

• Understand masks and how to use them

• Understand subnets and supernets

Page 108: TCP-IP

4.1 INTRODUCTION4.1 INTRODUCTION

The identifier used in the IP layer of the TCP/IP protocol suite to identify The identifier used in the IP layer of the TCP/IP protocol suite to identify

each device connected to the Internet is called the Internet address or IP each device connected to the Internet is called the Internet address or IP

address. An IP address is a address. An IP address is a 3232--bit addressbit address that uniquely and universally that uniquely and universally

defines the connection of a host or a router to the Internet. IP addresses defines the connection of a host or a router to the Internet. IP addresses

are unique. They are unique in the sense that each address defines one, are unique. They are unique in the sense that each address defines one,

and only one, connection to the Internet. Two devices on the Internet can and only one, connection to the Internet. Two devices on the Internet can

never have the same address. never have the same address.

TCP/IP Protocol Suite 108

never have the same address. never have the same address.

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

Address SpaceAddress Space

NotationNotation

Page 109: TCP-IP

An IP address is a 32-bit address.

Note:Note:

TCP/IP Protocol Suite 109

An IP address is a 32-bit address.

Page 110: TCP-IP

The IP addresses are unique.

Note:Note:

TCP/IP Protocol Suite 110

The IP addresses are unique.

Page 111: TCP-IP

The address space of IPv4 is

Note:Note:

TCP/IP Protocol Suite 111

The address space of IPv4 is

232 or 4,294,967,296.

Page 112: TCP-IP

Figure 4.1 Dotted-decimal notation

TCP/IP Protocol Suite 112

Page 113: TCP-IP

The binary, decimal, and hexadecimal

number systems are reviewed in

Note:Note:

TCP/IP Protocol Suite 113

number systems are reviewed in

Appendix B.

Page 114: TCP-IP

Change the following IP addresses from binary notation to

dotted-decimal notation.

a. 10000001 00001011 00001011 11101111

b. 11000001 10000011 00011011 11111111

c. 11100111 11011011 10001011 01101111

d. 11111001 10011011 11111011 00001111

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 114

d. 11111001 10011011 11111011 00001111

Solution

We replace each group of 8 bits with its equivalent decimal

number (see Appendix B) and add dots for separation:

a. 129.11.11.239 b. 193.131.27.255

c. 231.219.139.111 d. 249.155.251.15

Page 115: TCP-IP

Change the following IP addresses from dotted-decimal

notation to binary notation.

a. 111.56.45.78 b. 221.34.7.82

c. 241.8.56.12 d. 75.45.34.78

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 115

Solution

We replace each decimal number with its binary equivalent:

a. 01101111 00111000 00101101 01001110

b. 11011101 00100010 00000111 01010010

c. 11110001 00001000 00111000 00001100

d. 01001011 00101101 00100010 01001110

Page 116: TCP-IP

Find the error, if any, in the following IP addresses:

a. 111.56.045.78 b. 221.34.7.8.20

c. 75.45.301.14 d. 11100010.23.14.67

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

Solution

TCP/IP Protocol Suite 116

Solution

a. There are no leading zeroes in dotted-decimal notation (045).

b. We may not have more than four numbers in an IP address.

c. In dotted-decimal notation, each number is less than or equal

to 255; 301 is outside this range.

d. A mixture of binary notation and dotted-decimal notation is not

allowed.

Page 117: TCP-IP

Change the following IP addresses from binary notation to

hexadecimal notation.

a. 10000001 00001011 00001011 11101111

b. 11000001 10000011 00011011 11111111

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

Solution

TCP/IP Protocol Suite 117

Solution

We replace each group of 4 bits with its hexadecimal equivalent

(see Appendix B). Note that hexadecimal notation normally has

no added spaces or dots; however, 0X (or 0x) is added at the

beginning or the subscript 16 at the end to show that the

number is in hexadecimal.

a. 0X810B0BEF or 810B0BEF16

b. 0XC1831BFF or C1831BFF16

Page 118: TCP-IP

4.2 CLASSFUL ADDRESSING

IP addresses, when started a few decades ago, used the concept of IP addresses, when started a few decades ago, used the concept of

classes. This architecture is called classes. This architecture is called classful addressingclassful addressing. In the mid. In the mid--1990s, 1990s,

a new architecture, called classless addressing, was introduced and will a new architecture, called classless addressing, was introduced and will

eventually supersede the original architecture. However, part of the eventually supersede the original architecture. However, part of the

Internet is still using classful addressing, but the migration is very fast. Internet is still using classful addressing, but the migration is very fast.

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

TCP/IP Protocol Suite 118

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

Recognizing ClassesRecognizing Classes

Netid and HostidNetid and Hostid

Classes and BlocksClasses and Blocks

Network AddressesNetwork Addresses

Sufficient InformationSufficient Information

MaskMask

CIDR NotationCIDR Notation

Address DepletionAddress Depletion

Page 119: TCP-IP

Figure 4.2 Occupation of the address space

TCP/IP Protocol Suite 119

Page 120: TCP-IP

Table 4.1Table 4.1 Addresses per classAddresses per class

TCP/IP Protocol Suite 120

Page 121: TCP-IP

Figure 4.3 Finding the class in binary notation

TCP/IP Protocol Suite 121

Page 122: TCP-IP

Figure 4.4 Finding the address class

TCP/IP Protocol Suite 122

Page 123: TCP-IP

How can we prove that we have 2,147,483,648 addresses in

class A?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

TCP/IP Protocol Suite 123

Solution

In class A, only 1 bit defines the class. The remaining 31 bits

are available for the address. With 31 bits, we can have 231

or 2,147,483,648 addresses.

Page 124: TCP-IP

Find the class of each address:

a. 00000001 00001011 00001011 11101111

b. 11000001 10000011 00011011 11111111

c. 10100111 11011011 10001011 01101111

d. 11110011 10011011 11111011 00001111

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 6666

TCP/IP Protocol Suite 124

d. 11110011 10011011 11111011 00001111

Solution

See the procedure in Figure 4.4.

a. The first bit is 0. This is a class A address.

b. The first 2 bits are 1; the third bit is 0. This is a class C address.

c. The first bit is 0; the second bit is 1. This is a class B address.

d. The first 4 bits are 1s. This is a class E address..

Page 125: TCP-IP

Figure 4.5 Finding the class in decimal notation

TCP/IP Protocol Suite 125

Page 126: TCP-IP

Find the class of each address:

a. 227.12.14.87 b.193.14.56.22 c.14.23.120.8

d. 252.5.15.111 e.134.11.78.56

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 7777

Solution

TCP/IP Protocol Suite 126

Solution

a. The first byte is 227 (between 224 and 239); the class is D.

b. The first byte is 193 (between 192 and 223); the class is C.

c. The first byte is 14 (between 0 and 127); the class is A.

d. The first byte is 252 (between 240 and 255); the class is E.

e. The first byte is 134 (between 128 and 191); the class is B.

Page 127: TCP-IP

In Example 5 we showed that class A has 231 (2,147,483,648)

addresses. How can we prove this same fact using dotted-

decimal notation?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 8888

Solution

The addresses in class A range from 0.0.0.0 to 127.255.255.255.

TCP/IP Protocol Suite 127

The addresses in class A range from 0.0.0.0 to 127.255.255.255.

We need to show that the difference between these two numbers

is 2,147,483,648. This is a good exercise because it shows us

how to define the range of addresses between two addresses.

We notice that we are dealing with base 256 numbers here.

Each byte in the notation has a weight. The weights are as

follows (see Appendix B):

See Next Slide

Page 128: TCP-IP

2563, 2562, 2561, 2560

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 8 8 8 8 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

Last address: 127 × 2563 + 255 × 2562 +

255 × 2561 + 255 × 2560 = 2,147,483,647

Now to find the integer value of each number, we multiply each

byte by its weight:

TCP/IP Protocol Suite 128

255 × 2561 + 255 × 2560 = 2,147,483,647

First address: = 0

If we subtract the first from the last and add 1 to the result

(remember we always add 1 to get the range), we get

2,147,483,648 or 231.

Page 129: TCP-IP

Figure 4.6 Netid and hostid

TCP/IP Protocol Suite 129

Page 130: TCP-IP

Millions of class A addresses are

wasted.

Note:Note:

TCP/IP Protocol Suite 130

wasted.

Page 131: TCP-IP

Figure 4.7 Blocks in class A

TCP/IP Protocol Suite 131

Page 132: TCP-IP

Figure 4.8 Blocks in class B

TCP/IP Protocol Suite 132

Page 133: TCP-IP

Many class B addresses are wasted.

Note:Note:

TCP/IP Protocol Suite 133

Many class B addresses are wasted.

Page 134: TCP-IP

Figure 4.9 Blocks in class C

TCP/IP Protocol Suite 134

Page 135: TCP-IP

The number of addresses in class C is

smaller than the needs of most

organizations.

Note:Note:

TCP/IP Protocol Suite 135

organizations.

Page 136: TCP-IP

Class D addresses are used for

multicasting; there is only one block in

this class.

Note:Note:

TCP/IP Protocol Suite 136

this class.

Page 137: TCP-IP

Class E addresses are reserved for

future purposes; most of the block is

wasted.

Note:Note:

TCP/IP Protocol Suite 137

wasted.

Page 138: TCP-IP

In classful addressing, the network

address (the first address in the block)

is the one that is assigned to the

Note:Note:

TCP/IP Protocol Suite 138

is the one that is assigned to the

organization. The range of addresses

can automatically be inferred from the

network address.

Page 139: TCP-IP

Given the network address 17.0.0.0, find the class, the block,

and the range of the addresses.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 9999

Solution

TCP/IP Protocol Suite 139

Solution

The class is A because the first byte is between 0 and 127. The

block has a netid of 17. The addresses range from 17.0.0.0 to

17.255.255.255.

Page 140: TCP-IP

Given the network address 132.21.0.0, find the class, the block,

and the range of the addresses.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 10101010

TCP/IP Protocol Suite 140

Solution

The class is B because the first byte is between 128 and 191.

The block has a netid of 132.21. The addresses range from

132.21.0.0 to 132.21.255.255.

Page 141: TCP-IP

Given the network address 220.34.76.0, find the class, the

block, and the range of the addresses.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 11111111

TCP/IP Protocol Suite 141

Solution

The class is C because the first byte is between 192

and 223. The block has a netid of 220.34.76. The

addresses range from 220.34.76.0 to 220.34.76.255.

Page 142: TCP-IP

Figure 4.10 Masking concept

TCP/IP Protocol Suite 142

Page 143: TCP-IP

Figure 4.11 AND operation

TCP/IP Protocol Suite 143

Page 144: TCP-IP

Table 4.2 Default masksTable 4.2 Default masks

TCP/IP Protocol Suite 144

Page 145: TCP-IP

The network address is the beginning

address of each block. It can be found

by applying the default mask to any of

Note:Note:

TCP/IP Protocol Suite 145

by applying the default mask to any of

the addresses in the block (including

itself). It retains the netid of the block

and sets the hostid to zero.

Page 146: TCP-IP

Given the address 23.56.7.91, find the beginning address

(network address).

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12121212

TCP/IP Protocol Suite 146

Solution

The default mask is 255.0.0.0, which means that only the first

byte is preserved and the other 3 bytes are set to 0s. The

network address is 23.0.0.0.

Page 147: TCP-IP

Given the address 132.6.17.85, find the beginning address

(network address).

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 13131313

TCP/IP Protocol Suite 147

Solution

The default mask is 255.255.0.0, which means that the first 2

bytes are preserved and the other 2 bytes are set to 0s. The

network address is 132.6.0.0.

Page 148: TCP-IP

Given the address 201.180.56.5, find the beginning address

(network address).

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 14141414

TCP/IP Protocol Suite 148

Solution

The default mask is 255.255.255.0, which means that the first 3

bytes are preserved and the last byte is set to 0. The network

address is 201.180.56.0.

Page 149: TCP-IP

Note that we must not apply the

Note:Note:

TCP/IP Protocol Suite 149

Note that we must not apply the

default mask of one class to an address

belonging to another class.

Page 150: TCP-IP

4.3 OTHER ISSUES

In this section, we discuss some other issues that are related to In this section, we discuss some other issues that are related to

addressing in general and classful addressing in particular. addressing in general and classful addressing in particular.

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

Multihomed DevicesMultihomed Devices

TCP/IP Protocol Suite 150

Multihomed DevicesMultihomed Devices

Location, Not NamesLocation, Not Names

Special AddressesSpecial Addresses

Private AddressesPrivate Addresses

Unicast, Multicast, and Broadcast AddressesUnicast, Multicast, and Broadcast Addresses

Page 151: TCP-IP

Figure 4.12 Multihomed devices

TCP/IP Protocol Suite 151

Page 152: TCP-IP

Table 4.3 Special addressesTable 4.3 Special addresses

TCP/IP Protocol Suite 152

Page 153: TCP-IP

Figure 4.13 Network address

TCP/IP Protocol Suite 153

Page 154: TCP-IP

Figure 4.14 Example of direct broadcast address

TCP/IP Protocol Suite 154

Page 155: TCP-IP

Figure 4.15 Example of limited broadcast address

TCP/IP Protocol Suite 155

Page 156: TCP-IP

Figure 4.16 Examples of “this host on this network”

TCP/IP Protocol Suite 156

Page 157: TCP-IP

Figure 4.17 Example of “specific host on this network”

TCP/IP Protocol Suite 157

Page 158: TCP-IP

Figure 4.18 Example of loopback address

TCP/IP Protocol Suite 158

Page 159: TCP-IP

Table 4.5 Addresses for private networksTable 4.5 Addresses for private networks

TCP/IP Protocol Suite 159

Page 160: TCP-IP

Multicast delivery will be discussed in

depth in Chapter 15.

Note:Note:

TCP/IP Protocol Suite 160

depth in Chapter 15.

Page 161: TCP-IP

Table 4.5 Category addressesTable 4.5 Category addresses

TCP/IP Protocol Suite 161

Page 162: TCP-IP

Table 4.6 Addresses for conferencingTable 4.6 Addresses for conferencing

TCP/IP Protocol Suite 162

Page 163: TCP-IP

Figure 4.19 Sample internet

TCP/IP Protocol Suite 163

Page 164: TCP-IP

4.4 SUBNETTING AND SUPERNETTING

In the previous sections we discussed the problems associated with In the previous sections we discussed the problems associated with

classful addressing. Specifically, the network addresses available for classful addressing. Specifically, the network addresses available for

assignment to organizations are close to depletion. This is coupled with assignment to organizations are close to depletion. This is coupled with

the everthe ever--increasing demand for addresses from organizations that want increasing demand for addresses from organizations that want

connection to the Internet. In this section we briefly discuss two connection to the Internet. In this section we briefly discuss two

solutions: subnetting and supernetting.solutions: subnetting and supernetting.

TCP/IP Protocol Suite 164

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

SubnettingSubnetting

SupernettingSupernetting

Supernet MaskSupernet Mask

ObsolescenceObsolescence

Page 165: TCP-IP

IP addresses are designed with two

levels of hierarchy.

Note:Note:

TCP/IP Protocol Suite 165

levels of hierarchy.

Page 166: TCP-IP

Figure 4.20 A network with two levels of hierarchy (not subnetted)

TCP/IP Protocol Suite 166

Page 167: TCP-IP

Figure 4.21 A network with three levels of hierarchy (subnetted)

TCP/IP Protocol Suite 167

Page 168: TCP-IP

Figure 4.22 Addresses in a network with and without subnetting

TCP/IP Protocol Suite 168

Page 169: TCP-IP

Figure 4.23 Hierarchy concept in a telephone number

TCP/IP Protocol Suite 169

Page 170: TCP-IP

Figure 4.24 Default mask and subnet mask

TCP/IP Protocol Suite 170

Page 171: TCP-IP

What is the subnetwork address if the destination address is

200.45.34.56 and the subnet mask is 255.255.240.0?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 15151515

Solution

We apply the AND operation on the address and the subnet

TCP/IP Protocol Suite 171

We apply the AND operation on the address and the subnet

mask.

Address 11001000 00101101 00100010 00111000

Subnet Mask 11111111 11111111 11110000 00000000

Subnetwork Address 11001000 00101101 00100000 00000000.

Page 172: TCP-IP

Figure 4.25 Comparison of a default mask and a subnet mask

TCP/IP Protocol Suite 172

Page 173: TCP-IP

Figure 4.26 A supernetwork

TCP/IP Protocol Suite 173

Page 174: TCP-IP

In subnetting, we need the first

address of the subnet and the subnet

mask to define the range of addresses.

Note:Note:

TCP/IP Protocol Suite 174

mask to define the range of addresses.

In supernetting, we need the first

address of the supernet and the

supernet mask to define the range of

addresses.

Page 175: TCP-IP

Figure 4.27 Comparison of subnet, default, and supernet masks

TCP/IP Protocol Suite 175

Page 176: TCP-IP

The idea of subnetting and

supernetting of classful addresses is

Note:Note:

TCP/IP Protocol Suite 176

supernetting of classful addresses is

almost obsolete.

Page 177: TCP-IP

Chapter 5Chapter 5Chapter 5Chapter 5Chapter 5Chapter 5Chapter 5Chapter 5

Objectives

IP Addresses:IP Addresses:

Classless AddressingClassless Addressing

TCP/IP Protocol Suite 177

Upon completion you will be able to:

• Understand the concept of classless addressing

• Be able to find the first and last address given an IP address

• Be able to find the network address given a classless IP address

• Be able to create subnets from a block of classless IP addresses

• Understand address allocation and address aggregation

Page 178: TCP-IP

5.1 VARIABLE-LENGTH BLOCKS

In classless addressing variableIn classless addressing variable--length blocks are assigned that belong to length blocks are assigned that belong to

no class. In this architecture, the entire address space (232 addresses) is no class. In this architecture, the entire address space (232 addresses) is

divided into blocks of different sizes.divided into blocks of different sizes.

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

TCP/IP Protocol Suite 178

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

RestrictionsRestrictions

Finding the BlockFinding the Block

Granted BlockGranted Block

Page 179: TCP-IP

Figure 5.1 Variable-length blocks

TCP/IP Protocol Suite 179

Page 180: TCP-IP

Which of the following can be the beginning address

of a block that contains 16 addresses?

a. 205.16.37.32 b.190.16.42.44

c. 17.17.33.80 d.123.45.24.52

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 180

Solution

Only two are eligible (a and c). The address

205.16.37.32 is eligible because 32 is divisible by 16.

The address 17.17.33.80 is eligible because 80 is

divisible by 16.

Page 181: TCP-IP

Which of the following can be the beginning address

of a block that contains 256 addresses?

a.205.16.37.32 b.190.16.42.0

c.17.17.32.0 d.123.45.24.52

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 181

Solution

In this case, the right-most byte must be 0. As we

mentioned in Chapter 4, the IP addresses use base 256

arithmetic. When the right-most byte is 0, the total

address is divisible by 256. Only two addresses are

eligible (b and c).

Page 182: TCP-IP

Which of the following can be the beginning address

of a block that contains 1024 addresses?

a. 205.16.37.32 b.190.16.42.0

c. 17.17.32.0 d.123.45.24.52

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 182

Solution

In this case, we need to check two bytes because

1024 = 4 × 256. The right-most byte must be divisible

by 256. The second byte (from the right) must be

divisible by 4. Only one address is eligible (c).

Page 183: TCP-IP

Figure 5.2 Format of classless addressing address

TCP/IP Protocol Suite 183

Page 184: TCP-IP

Table 5.1 Table 5.1 Prefix lengthsPrefix lengths

TCP/IP Protocol Suite 184

Page 185: TCP-IP

Classful addressing is a special case of

classless addressing.

Note:Note:

TCP/IP Protocol Suite 185

classless addressing.

Page 186: TCP-IP

What is the first address in the block if one of the

addresses is 167.199.170.82/27?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

Solution

The prefix length is 27, which means that we must

TCP/IP Protocol Suite 186

Address in binary: 10100111 11000111 10101010 01010010

Keep the left 27 bits: 10100111 11000111 10101010 01000000

Result in CIDR notation: 167.199.170.64/27

The prefix length is 27, which means that we must

keep the first 27 bits as is and change the remaining

bits (5) to 0s. The following shows the process:

Page 187: TCP-IP

What is the first address in the block if one of the

addresses is 140.120.84.24/20?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

Solution

Figure 5.3 shows the solution. The first, second, and

TCP/IP Protocol Suite 187

See Next Slide

Figure 5.3 shows the solution. The first, second, and

fourth bytes are easy; for the third byte we keep the

bits corresponding to the number of 1s in that group.

The first address is 140.120.80.0/20.

Page 188: TCP-IP

Figure 5.3 Example 5

TCP/IP Protocol Suite 188

Page 189: TCP-IP

Find the first address in the block if one of the

addresses is 140.120.84.24/20.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 6666

Solution

The first, second, and fourth bytes are as defined in

the previous example. To find the third byte, we write

TCP/IP Protocol Suite 189

See Next Slide

the previous example. To find the third byte, we write

84 as the sum of powers of 2 and select only the

leftmost 4 (m is 4) as shown in Figure 5.4. The first

address is 140.120.80.0/20.

Page 190: TCP-IP

Figure 5.4 Example 6

TCP/IP Protocol Suite 190

Page 191: TCP-IP

Find the number of addresses in the block if one of

the addresses is 140.120.84.24/20.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 7777

Solution

TCP/IP Protocol Suite 191

Solution

The prefix length is 20. The number of addresses in

the block is 232−20 or 212 or 4096. Note that

this is a large block with 4096 addresses.

Page 192: TCP-IP

Using the first method, find the last address in the

block if one of the addresses is 140.120.84.24/20.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 8888

Solution

TCP/IP Protocol Suite 192

See Next Slide

Solution

We found in the previous examples that the first

address is 140.120.80.0/20 and the number of

addresses is 4096. To find the last address, we need to

add 4095 (4096 − 1) to the first address.

Page 193: TCP-IP

To keep the format in dotted-decimal notation, we

need to represent 4095 in base 256 (see Appendix B)

and do the calculation in base 256. We write 4095 as

15.255. We then add the first address to this number

(in base 255) to obtain the last address as shown

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 8 8 8 8 (Continued)

TCP/IP Protocol Suite 193

(in base 255) to obtain the last address as shown

below:

140 . 120 . 80 . 0

15 . 255

-------------------------

140 . 120 . 95 . 255

The last address is 140.120.95.255/20.

Page 194: TCP-IP

Using the second method, find the last address in the

block if one of the addresses is 140.120.84.24/20.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 9999

Solution

The mask has twenty 1s and twelve 0s. The

complement of the mask has twenty 0s and twelve 1s.

TCP/IP Protocol Suite 194

See Next Slide

complement of the mask has twenty 0s and twelve 1s.

In other words, the mask complement is

00000000 00000000 00001111 11111111

or 0.0.15.255. We add the mask complement to the

beginning address to find the last address.

Page 195: TCP-IP

140 . 120 . 80 . 0

0 . 0 . 15 . 255

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 9 9 9 9 (Continued)

We add the mask complement to the beginning

address to find the last address.

TCP/IP Protocol Suite 195

0 . 0 . 15 . 255

----------------------------

140 . 120 . 95 . 255

The last address is 140.120.95.255/20.

Page 196: TCP-IP

Find the block if one of the addresses is

190.87.140.202/29.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 10101010

Solution

We follow the procedure in the previous examples to

TCP/IP Protocol Suite 196

See Next Slide

We follow the procedure in the previous examples to

find the first address, the number of addresses, and

the last address. To find the first address, we notice

that the mask (/29) has five 1s in the last byte. So we

write the last byte as powers of 2 and retain only the

leftmost five as shown below:

Page 197: TCP-IP

202 128 + 64 + 0 + 0 + 8 + 0 + 2 + 0

The leftmost 5 numbers are 128 + 64 + 0 + 0 + 8

The first address is 190.87.140.200/29

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 10 10 10 10 (Continued)

TCP/IP Protocol Suite 197

The number of addresses is 232−29 or 8. To find the last address,

we use the complement of the mask. The mask has twenty-nine

1s; the complement has three 1s. The complement is 0.0.0.7. If

we add this to the first address, we get 190.87.140.207/29. In

other words, the first address is 190.87.140.200/29, the last

address is 190.87.140.207/20. There are only 8 addresses in this

block.

Page 198: TCP-IP

Show a network configuration for the block in the previous

example.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 11111111

Solution

The organization that is granted the block in the previous

example can assign the addresses in the block to the hosts in its

TCP/IP Protocol Suite 198

See Next Slide

example can assign the addresses in the block to the hosts in its

network. However, the first address needs to be used as the

network address and the last address is kept as a special

address (limited broadcast address). Figure 5.5 shows how the

block can be used by an organization. Note that the last

address ends with 207, which is different from the 255 seen in

classful addressing.

Page 199: TCP-IP

Figure 5.5 Example 11

TCP/IP Protocol Suite 199

Page 200: TCP-IP

In classless addressing, the last

address in the block does not

Note:Note:

TCP/IP Protocol Suite 200

address in the block does not

necessarily end in 255.

Page 201: TCP-IP

In CIDR notation, the block granted is

defined by the first address and the

Note:Note:

TCP/IP Protocol Suite 201

defined by the first address and the

prefix length.

Page 202: TCP-IP

5.2 SUBNETTING

When an organization is granted a block of addresses, it can create When an organization is granted a block of addresses, it can create

subnets to meet its needs. The prefix length increases to define the subnet subnets to meet its needs. The prefix length increases to define the subnet

prefix length.prefix length.

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

TCP/IP Protocol Suite 202

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

Finding the Subnet MaskFinding the Subnet Mask

Finding the Subnet AddressesFinding the Subnet Addresses

VariableVariable--Length SubnetsLength Subnets

Page 203: TCP-IP

In fixed-length subnetting, the number

of subnets is a power of 2.

Note:Note:

TCP/IP Protocol Suite 203

of subnets is a power of 2.

Page 204: TCP-IP

An organization is granted the block 130.34.12.64/26.

The organization needs 4 subnets. What is the subnet

prefix length?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12121212

TCP/IP Protocol Suite 204

Solution

We need 4 subnets, which means we need to add two

more 1s (log2 4 = 2) to the site prefix. The subnet

prefix is then /28.

Page 205: TCP-IP

What are the subnet addresses and the range of

addresses for each subnet in the previous example?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 13131313

Solution

Figure 5.6 shows one configuration.

TCP/IP Protocol Suite 205

See Next Slide

Figure 5.6 shows one configuration.

Page 206: TCP-IP

Figure 5.6 Example 13

TCP/IP Protocol Suite 206

Page 207: TCP-IP

The site has 232−26 = 64 addresses. Each subnet has

232–28 = 16 addresses. Now let us find the first and last

address in each subnet.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 13 13 13 13 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

1. The first address in the first subnet is 130.34.12.64/28,

TCP/IP Protocol Suite 207

See Next Slide

1. The first address in the first subnet is 130.34.12.64/28,

using the procedure we showed in the previous examples.

Note that the first address of the first subnet is the first

address of the block. The last address of the subnet can

be found by adding 15 (16 −1) to the first address. The

last address is 130.34.12.79/28.

Page 208: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 13 13 13 13 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

2.The first address in the second subnet is

130.34.12.80/28; it is found by adding 1 to the last

address of the previous subnet. Again adding 15 to

the first address, we obtain the last address,

130.34.12.95/28.

TCP/IP Protocol Suite 208

3. Similarly, we find the first address of the third

subnet to be 130.34.12.96/28 and the last to be

130.34.12.111/28.

4. Similarly, we find the first address of the fourth

subnet to be 130.34.12.112/28 and the last to be

130.34.12.127/28.

Page 209: TCP-IP

An organization is granted a block of addresses with the

beginning address 14.24.74.0/24. There are 232−24= 256

addresses in this block. The organization needs to have 11

subnets as shown below:

a. two subnets, each with 64 addresses.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 14141414

TCP/IP Protocol Suite 209

b. two subnets, each with 32 addresses.

c. three subnets, each with 16 addresses.

d. four subnets, each with 4 addresses.

Design the subnets.

See Next Slide For One Solution

Page 210: TCP-IP

Figure 5.7 Example 14

TCP/IP Protocol Suite 210

Page 211: TCP-IP

1. We use the first 128 addresses for the first two

subnets, each with 64 addresses. Note that the mask

for each network is /26. The subnet address for each

subnet is given in the figure.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 14 14 14 14 (CONTINUTED)(CONTINUTED)(CONTINUTED)(CONTINUTED)

TCP/IP Protocol Suite 211

2. We use the next 64 addresses for the next two

subnets, each with 32 addresses. Note that the mask

for each network is /27. The subnet address for each

subnet is given in the figure.

See Next Slide

Page 212: TCP-IP

3. We use the next 48 addresses for the next three

subnets, each with 16 addresses. Note that the mask

for each network is /28. The subnet address for each

subnet is given in the figure.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 14 14 14 14 (CONTINUTED)(CONTINUTED)(CONTINUTED)(CONTINUTED)

TCP/IP Protocol Suite 212

4. We use the last 16 addresses for the last four

subnets, each with 4 addresses. Note that the mask for

each network is /30. The subnet address for each

subnet is given in the figure.

Page 213: TCP-IP

As another example, assume a company has three

offices: Central, East, and West. The Central office is

connected to the East and West offices via private,

point-to-point WAN lines. The company is granted a

block of 64 addresses with the beginning address

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 15151515

TCP/IP Protocol Suite 213

block of 64 addresses with the beginning address

70.12.100.128/26. The management has decided to

allocate 32 addresses for the Central office and

divides the rest of addresses between the two offices.

Figure 5.8 shows the configuration designed by the

management.

See Next Slide

Page 214: TCP-IP

Figure 5.8 Example 15

TCP/IP Protocol Suite 214

Page 215: TCP-IP

The company will have three subnets, one at Central, one at

East, and one at West. The following lists the subblocks

allocated for each network:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 15 15 15 15 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

a. The Central office uses the network address

70.12.100.128/27. This is the first address, and the mask

/27 shows that there are 32 addresses in this network.

TCP/IP Protocol Suite 215See Next Slide

/27 shows that there are 32 addresses in this network.

Note that three of these addresses are used for the

routers and the company has reserved the last address

in the sub-block. The addresses in this subnet are

70.12.100.128/27 to 70.12.100.159/27. Note that the

interface of the router that connects the Central subnet

to the WAN needs no address because it is a point-to-

point connection.

Page 216: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 15 15 15 15 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

b. The West office uses the network address

70.12.100.160/28. The mask /28 shows that there are

only 16 addresses in this network. Note that one of these

addresses is used for the router and the company has

TCP/IP Protocol Suite 216

See Next Slide

reserved the last address in the sub-block. The

addresses in this subnet are 70.12.100.160/28 to

70.12.100.175/28. Note also that the interface of the

router that connects the West subnet to the WAN needs

no address because it is a point-to- point connection.

Page 217: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 15 15 15 15 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

c. The East office uses the network address

70.12.100.176/28. The mask /28 shows that there are

only 16 addresses in this network. Note that one of these

addresses is used for the router and the company has

TCP/IP Protocol Suite 217

reserved the last address in the sub-block. The

addresses in. this subnet are 70.12.100.176/28 to

70.12.100.191/28. Note also that the interface of the

router that connects the East subnet to the WAN needs

no address because it is a point-to-point connection.

Page 218: TCP-IP

5.3 ADDRESS ALLOCATION

Address allocation is the responsibility of a global authority called the Address allocation is the responsibility of a global authority called the

Internet Corporation for Assigned Names and Addresses (ICANN). It Internet Corporation for Assigned Names and Addresses (ICANN). It

usually assigns a large block of addresses to an ISP to be distributed to usually assigns a large block of addresses to an ISP to be distributed to

its Internet users. its Internet users.

TCP/IP Protocol Suite 218

Page 219: TCP-IP

An ISP is granted a block of addresses starting with

190.100.0.0/16 (65,536 addresses). The ISP needs to

distribute these addresses to three groups of customers

as follows:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 16161616

a. The first group has 64 customers; each needs 256

TCP/IP Protocol Suite 219

See Next Slide

a. The first group has 64 customers; each needs 256

addresses.

b. The second group has 128 customers; each needs 128

addresses

c. The third group has 128 customers; each needs 64

addresses.

Page 220: TCP-IP

Design the subblocks and find out how many

addresses are still available after these allocations.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 16 16 16 16 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

Solution

Figure 5.9 shows the situation.

TCP/IP Protocol Suite 220

See Next Slide

Figure 5.9 shows the situation.

Page 221: TCP-IP

Figure 5.9 Example 16

TCP/IP Protocol Suite 221

Page 222: TCP-IP

Group 1

For this group, each customer needs 256 addresses.

This means the suffix length is 8 (28 =256). The prefix

length is then 32 − 8 = 24. The addresses are:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 16 16 16 16 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 222

See Next Slide

1st Customer 190.100.0.0/24 190.100.0.255/24

2nd Customer 190.100.1.0/24 190.100.1.255/24

. . .

64th Customer 190.100.63.0/24 190.100.63.255/24

Total = 64 × 256 = 16,384

Page 223: TCP-IP

Group 2

For this group, each customer needs 128 addresses.

This means the suffix length is 7 (27 =128). The prefix

length is then 32 − 7 = 25. The addresses are:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 16 16 16 16 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 223

See Next Slide

1st Customer 190.100.64.0/25 190.100.64.127/25

2nd Customer 190.100.64.128/25 190.100.64.255/25

· · ·

128th Customer 190.100.127.128/25 190.100.127.255/25

Total = 128 × 128 = 16,384

Page 224: TCP-IP

Group 3

For this group, each customer needs 64 addresses.

This means the suffix length is 6 (26 = 64). The prefix

length is then 32 − 6 = 26. The addresses are:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 16 16 16 16 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 224

See Next Slide

1st Customer 190.100.128.0/26 190.100.128.63/26

2nd Customer 190.100.128.64/26 190.100.128.127/26

· · ·

128th Customer 190.100.159.192/26 190.100.159.255/26

Total = 128 × 64 = 8,192

Page 225: TCP-IP

Number of granted addresses to the ISP: 65,536

Number of allocated addresses by the ISP: 40,960

Number of available addresses: 24,576

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 16 16 16 16 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 225

Page 226: TCP-IP

Chapter 6Chapter 6Chapter 6Chapter 6Chapter 6Chapter 6Chapter 6Chapter 6

Upon completion you will be able to:

Delivery, Forwarding, Delivery, Forwarding,

and Routing of IP Packetsand Routing of IP Packets

Objectives

TCP/IP Protocol Suite 226

Upon completion you will be able to:

• Understand the different types of delivery and the connection

• Understand forwarding techniques in classful addressing

• Understand forwarding techniques in classless addressing

• Understand how a routing table works

• Understand the structure of a router

Page 227: TCP-IP

6.1 DELIVERY

The network layer supervises delivery, the handling of the packets by the The network layer supervises delivery, the handling of the packets by the

underlying physical networks. Two important concepts are the type of underlying physical networks. Two important concepts are the type of

connection and direct versus indirect delivery. connection and direct versus indirect delivery.

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

TCP/IP Protocol Suite 227

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

Connection TypesConnection Types

Direct Versus Indirect DeliveryDirect Versus Indirect Delivery

Page 228: TCP-IP

IP is a connectionless protocol.

Note:Note:

TCP/IP Protocol Suite 228

Page 229: TCP-IP

Figure 6.1 Direct delivery

TCP/IP Protocol Suite 229

Page 230: TCP-IP

Figure 6.2 Indirect delivery

TCP/IP Protocol Suite 230

Page 231: TCP-IP

6.2 FORWARDING

Forwarding means to place the packet in its route to its destination. Forwarding means to place the packet in its route to its destination.

Forwarding requires a host or a router to have a routing table. .Forwarding requires a host or a router to have a routing table. .

TCP/IP Protocol Suite 231

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

Forwarding TechniquesForwarding Techniques

Forwarding with Classful AddressingForwarding with Classful Addressing

Forwarding with Classless AddressingForwarding with Classless Addressing

CombinationCombination

Page 232: TCP-IP

Figure 6.3 Next-hop method

TCP/IP Protocol Suite 232

Page 233: TCP-IP

Figure 6.4 Network-specific method

TCP/IP Protocol Suite 233

Page 234: TCP-IP

Figure 6.5 Host-specific routing

TCP/IP Protocol Suite 234

Page 235: TCP-IP

Figure 6.6 Default routing

TCP/IP Protocol Suite 235

Page 236: TCP-IP

Figure 6.7 Simplified forwarding module in classful address without subnetting

TCP/IP Protocol Suite 236

Page 237: TCP-IP

Figure 6.8 shows an imaginary part of the Internet.

Show the routing tables for router R1.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 237

See Next Slide

Page 238: TCP-IP

Figure 6.8 Configuration for routing, Example 1

TCP/IP Protocol Suite 238

Page 239: TCP-IP

Solution

Figure 6.9 shows the three tables used by router R1.

Note that some entries in the next-hop address

column are empty because in these cases, the

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 239

destination is in the same network to which the router

is connected (direct delivery). In these cases, the next-

hop address used by ARP is simply the destination

address of the packet as we will see in Chapter 7.

See Next Slide

Page 240: TCP-IP

Figure 6.9 Tables for Example 1

TCP/IP Protocol Suite 240

Page 241: TCP-IP

Router R1 in Figure 6.8 receives a packet with

destination address 192.16.7.14. Show how the packet

is forwarded.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

Solution

The destination address in binary is 11000000 00010000

TCP/IP Protocol Suite 241

00000111 00001110. A copy of the address is shifted 28 bits to

the right. The result is 00000000 00000000 00000000 00001100

or 12. The destination network is class C. The network address

is extracted by masking off the leftmost 24 bits of the

destination address; the result is 192.16.7.0. The table for Class

C is searched. The network address is found in the first row.

The next-hop address 111.15.17.32. and the interface m0 are

passed to ARP.

Page 242: TCP-IP

Router R1 in Figure 6.8 receives a packet with destination

address 167.24.160.5. Show how the packet is forwarded.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

Solution

The destination address in binary is 10100111 00011000

10100000 00000101. A copy of the address is shifted 28 bits to

the right. The result is 00000000 00000000 00000000

TCP/IP Protocol Suite 242

the right. The result is 00000000 00000000 00000000

00001010 or 10. The class is B. The network address can be

found by masking off 16 bits of the destination address, the

result is 167.24.0.0. The table for Class B is searched. No

matching network address is found. The packet needs to be

forwarded to the default router (the network is somewhere else

in the Internet). The next-hop address 111.30.31.18 and the

interface number m0 are passed to ARP.

Page 243: TCP-IP

Figure 6.10 Simplified forwarding module in classful address with subnetting

TCP/IP Protocol Suite 243

Page 244: TCP-IP

Figure 6.11 shows a router connected to four subnets.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

See Next Slide

TCP/IP Protocol Suite 244

Page 245: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 4 4 4 4 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

Note several points. First, the site address is

145.14.0.0/16 (a class B address). Every packet with

destination address in the range 145.14.0.0 to

145.14.255.255 is delivered to the interface m4 and

distributed to the final destination subnet by the

TCP/IP Protocol Suite 245

distributed to the final destination subnet by the

router. Second, we have used the address x.y.z.t/n for

the interface m4 because we do not know to which

network this router is connected. Third, the table has

a default entry for packets that are to be sent out of

the site. The router is configured to apply the mask

/18 to any destination address.

Page 246: TCP-IP

Figure 6.11 Configuration for Example 4

TCP/IP Protocol Suite 246

Page 247: TCP-IP

The router in Figure 6.11 receives a packet with

destination address 145.14.32.78. Show how the

packet is forwarded.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

Solution

TCP/IP Protocol Suite 247

Solution

The mask is /18. After applying the mask, the subnet

address is 145.14.0.0. The packet is delivered to ARP

with the next-hop address 145.14.32.78 and the

outgoing interface m0.

Page 248: TCP-IP

A host in network 145.14.0.0 in Figure 6.11 has a

packet to send to the host with address 7.22.67.91.

Show how the packet is routed.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 6666

Solution

TCP/IP Protocol Suite 248

Solution

The router receives the packet and applies the mask

(/18). The network address is 7.22.64.0. The table is

searched and the address is not found. The router

uses the address of the default router (not shown in

figure) and sends the packet to that router.

Page 249: TCP-IP

In classful addressing we can have a

routing table with three columns;

Note:Note:

TCP/IP Protocol Suite 249

in classless addressing, we need at

least four columns.

Page 250: TCP-IP

Figure 6.12 Simplified forwarding module in classless address

TCP/IP Protocol Suite 250

Page 251: TCP-IP

Make a routing table for router R1 using the

configuration in Figure 6.13.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 7777

See Next Slide

TCP/IP Protocol Suite 251

Solution

Table 6.1 shows the corresponding table.

See the table after the figure.

Page 252: TCP-IP

Figure 6.13 Configuration for Example 7

TCP/IP Protocol Suite 252

Page 253: TCP-IP

Table 6.1 Routing table for router R1 in Figure 6.13Table 6.1 Routing table for router R1 in Figure 6.13

TCP/IP Protocol Suite 253

Page 254: TCP-IP

Show the forwarding process if a packet arrives at R1

in Figure 6.13 with the destination address

180.70.65.140.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 8888

Solution

TCP/IP Protocol Suite 254

Solution

The router performs the following steps:

1. The first mask (/26) is applied to the destination

address. The result is 180.70.65.128, which does not

match the corresponding network address.

See Next Slide

Page 255: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 8 8 8 8 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

2. The second mask (/25) is applied to the

destination address. The result is 180.70.65.128,

which matches the corresponding network address.

The next-hop address (the destination address of the

TCP/IP Protocol Suite 255

The next-hop address (the destination address of the

packet in this case) and the interface number m0

are passed to ARP for further processing.

Page 256: TCP-IP

Show the forwarding process if a packet arrives at R1

in Figure 6.13 with the destination address

201.4.22.35.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 9999

TCP/IP Protocol Suite 256

Solution

The router performs the following steps:

See Next Slide

Page 257: TCP-IP

1. The first mask (/26) is applied to the destination address. The

result is 201.4.22.0, which does not match the corresponding

network address (row 1).

2. The second mask (/25) is applied to the destination address.

The result is 201.4.22.0, which does not match the

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 9 9 9 9 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 257

The result is 201.4.22.0, which does not match the

corresponding network address (row 2).

3. The third mask (/24) is applied to the destination address.

The result is 201.4.22.0, which matches the corresponding

network address. The destination address of the package and

the interface number m3 are passed to ARP.

Page 258: TCP-IP

Show the forwarding process if a packet arrives at R1

in Figure 6.13 with the destination address

18.24.32.78.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 10101010

Solution

This time all masks are applied to the destination

TCP/IP Protocol Suite 258

This time all masks are applied to the destination

address, but no matching network address is found.

When it reaches the end of the table, the module gives

the next-hop address 180.70.65.200 and interface

number m2 to ARP. This is probably an outgoing

package that needs to be sent, via the default router, to

some place else in the Internet.

Page 259: TCP-IP

Now let us give a different type of example. Can we

find the configuration of a router, if we know only its

routing table? The routing table for router R1 is given

in Table 6.2. Can we draw its topology?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 11111111

TCP/IP Protocol Suite 259

See Next Slide

Page 260: TCP-IP

Table 6.2 Routing table for Example 11Table 6.2 Routing table for Example 11

TCP/IP Protocol Suite 260

Page 261: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 11 11 11 11

Solution

We know some facts but we don’t have all for a

definite topology. We know that router R1 has three

interfaces: m0, m1, and m2. We know that there are

three networks directly connected to router R1. We

know that there are two networks indirectly connected

(CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 261

know that there are two networks indirectly connected

to R1. There must be at least three other routers

involved (see next-hop column). We know to which

networks these routers are connected by looking at

their IP addresses. So we can put them at their

appropriate place.

See Next Slide

Page 262: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 11 11 11 11 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

We know that one router, the default router, is

connected to the rest of the Internet. But there is some

missing information. We do not know if network

130.4.8.0 is directly connected to router R2 or through

a point-to-point network (WAN) and another router.

TCP/IP Protocol Suite 262

a point-to-point network (WAN) and another router.

We do not know if network140.6.12.64 is connected to

router R3 directly or through a point-to-point network

(WAN) and another router. Point-to-point networks

normally do not have an entry in the routing table

because no hosts are connected to them. Figure 6.14

shows our guessed topology.See Next Slide

Page 263: TCP-IP

Figure 6.14 Guessed topology for Example 6

TCP/IP Protocol Suite 263

Page 264: TCP-IP

Figure 6.15 Address aggregation

TCP/IP Protocol Suite 264

Page 265: TCP-IP

Figure 6.16 Longest mask matching

TCP/IP Protocol Suite 265

Page 266: TCP-IP

As an example of hierarchical routing, let us consider Figure

6.17. A regional ISP is granted 16384 addresses starting from

120.14.64.0. The regional ISP has decided to divide this block

into four subblocks, each with 4096 addresses. Three of these

subblocks are assigned to three local ISPs, the second subblock

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12121212

TCP/IP Protocol Suite 266

subblocks are assigned to three local ISPs, the second subblock

is reserved for future use. Note that the mask for each block is

/20 because the original block with mask /18 is divided into 4

blocks.

See Next Slide

Page 267: TCP-IP

Figure 6.17 Hierarchical routing with ISPs

TCP/IP Protocol Suite 267

Page 268: TCP-IP

The first local ISP has divided its assigned subblock into 8

smaller blocks and assigned each to a small ISP. Each small

ISP provides services to 128 households (H001 to H128), each

using four addresses. Note that the mask for each small ISP is

now /23 because the block is further divided into 8 blocks.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12 12 12 12 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 268

now /23 because the block is further divided into 8 blocks.

Each household has a mask of /30, because a household has

only 4 addresses (232−30 is 4).

The second local ISP has divided its block into 4 blocks and

has assigned the addresses to 4 large organizations (LOrg01 to

LOrg04). Note that each large organization has 1024 addresses

and the mask is /22.

See Next Slide

Page 269: TCP-IP

The third local ISP has divided its block into 16 blocks and

assigned each block to a small organization (SOrg01 to

SOrg15). Each small organization has 256 addresses and the

mask is /24.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12 12 12 12 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 269

There is a sense of hierarchy in this configuration. All routers

in the Internet send a packet with destination address

120.14.64.0 to 120.14.127.255 to the regional ISP. The regional

ISP sends every packet with destination address 120.14.64.0 to

120.14.79.255 to Local ISP1. Local ISP1 sends every packet

with destination address 120.14.64.0 to 120.14.64.3 to H001.

Page 270: TCP-IP

6.3 ROUTING

Routing deals with the issues of creating and maintaining routing tables. Routing deals with the issues of creating and maintaining routing tables.

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

TCP/IP Protocol Suite 270

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

Static Versus Dynamic Routing TablesStatic Versus Dynamic Routing Tables

Routing Table Routing Table

Page 271: TCP-IP

Figure 6.18 Common fields in a routing table

TCP/IP Protocol Suite 271

Page 272: TCP-IP

One utility that can be used to find the contents of a

routing table for a host or router is netstat in UNIX or

LINUX. The following shows the listing of the

contents of the default server. We have used two

options, r and n. The option r indicates that we are

interested in the routing table and the option n

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 13131313

TCP/IP Protocol Suite 272

interested in the routing table and the option n

indicates that we are looking for numeric addresses.

Note that this is a routing table for a host, not a

router. Although we discussed the routing table for a

router throughout the chapter, a host also needs a

routing table.

See Next Slide

Page 273: TCP-IP

$ netstat -rn

Kernel IP routing table

Destination Gateway Mask Flags Iface

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 13 13 13 13 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 273

Destination Gateway Mask Flags Iface

153.18.16.0 0.0.0.0 255.255.240.0 U eth0

127.0.0.0 0.0.0.0 255.0.0.0 U lo

0.0.0.0 153.18.31. 254 0.0.0.0 UG eth0.

See Next Slide

Page 274: TCP-IP

More information about the IP address and physical address of

the server can be found using the ifconfig command on the

given interface (eth0).

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 13 13 13 13 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

$ ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:B0:D0:DF:09:5D

TCP/IP Protocol Suite 274

eth0 Link encap:Ethernet HWaddr 00:B0:D0:DF:09:5D

inet addr:153.18.17.11 Bcast:153.18.31.255 Mask:255.255.240.0

....

From the above information, we can deduce the configuration

of the server as shown in Figure 6.19.

See Next Slide

Page 275: TCP-IP

Figure 6.19 Configuration of the server for Example 13

TCP/IP Protocol Suite 275

Page 276: TCP-IP

6.4 STRUCTURE OF A ROUTER

WeWe representrepresent aa routerrouter asas aa blackblack boxbox thatthat acceptsaccepts incomingincoming packetspackets fromfrom

oneone ofof thethe inputinput portsports (interfaces),(interfaces), usesuses aa routingrouting tabletable toto findfind thethe

departingdeparting outputoutput port,port, andand sendssends thethe packetpacket fromfrom thisthis outputoutput portport..

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

TCP/IP Protocol Suite 276

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

Components Components

Page 277: TCP-IP

Figure 6.20 Router components

TCP/IP Protocol Suite 277

Page 278: TCP-IP

Figure 6.21 Input port

TCP/IP Protocol Suite 278

Page 279: TCP-IP

Figure 6.22 Output port

TCP/IP Protocol Suite 279

Page 280: TCP-IP

Figure 6.23 Crossbar switch

TCP/IP Protocol Suite 280

Page 281: TCP-IP

Figure 6.24 A banyan switch

TCP/IP Protocol Suite 281

Page 282: TCP-IP

Figure 6.25 Examples of routing in a banyan switch

TCP/IP Protocol Suite 282

Page 283: TCP-IP

Figure 6.26 Batcher-banyan switch

TCP/IP Protocol Suite 283

Page 284: TCP-IP

Chapter 7Chapter 7Chapter 7Chapter 7Chapter 7Chapter 7Chapter 7Chapter 7

Upon completion you will be able to:

ARP and RARPARP and RARP

Objectives

TCP/IP Protocol Suite 284

Upon completion you will be able to:

• Understand the need for ARP

• Understand the cases in which ARP is used

• Understand the components and interactions in an ARP package

• Understand the need for RARP

Page 285: TCP-IP

Figure 7.1 ARP and RARP

TCP/IP Protocol Suite 285

Page 286: TCP-IP

Figure 7.2 Position of ARP and RARP in TCP/IP protocol suite

TCP/IP Protocol Suite 286

Page 287: TCP-IP

7.1 ARP

ARPARP associatesassociates anan IPIP addressaddress withwith itsits physicalphysical addressaddress.. OnOn aa typicaltypical

physicalphysical network,network, suchsuch asas aa LAN,LAN, eacheach devicedevice onon aa linklink isis identifiedidentified byby aa

physicalphysical oror stationstation addressaddress thatthat isis usuallyusually imprintedimprinted onon thethe NICNIC..

TCP/IP Protocol Suite 287

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

Packet FormatPacket Format

Encapsulation Encapsulation

OperationOperation

ARP over ATMARP over ATM

Proxy ARPProxy ARP

Page 288: TCP-IP

Figure 7.3 ARP operation

TCP/IP Protocol Suite 288

Page 289: TCP-IP

Figure 7.4 ARP packet

TCP/IP Protocol Suite 289

Page 290: TCP-IP

Figure 7.5 Encapsulation of ARP packet

TCP/IP Protocol Suite 290

Page 291: TCP-IP

Figure 7.6 Four cases using ARP

TCP/IP Protocol Suite 291

Page 292: TCP-IP

An ARP request is broadcast;

an ARP reply is unicast.

Note:Note:

TCP/IP Protocol Suite 292

an ARP reply is unicast.

Page 293: TCP-IP

A host with IP address 130.23.43.20 and physical

address B2:34:55:10:22:10 has a packet to send to

another host with IP address 130.23.43.25 and

physical address A4:6E:F4:59:83:AB (which is

unknown to the first host). The two hosts are on the

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 293

unknown to the first host). The two hosts are on the

same Ethernet network. Show the ARP request and

reply packets encapsulated in Ethernet frames.

See Next Slide

Page 294: TCP-IP

Solution

Figure 7.7 shows the ARP request and reply packets.

Note that the ARP data field in this case is 28 bytes,

and that the individual addresses do not fit in the 4-

byte boundary. That is why we do not show the

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 294

byte boundary. That is why we do not show the

regular 4-byte boundaries for these addresses. Also

note that the IP addresses are shown in hexadecimal.

For information on binary or hexadecimal notation

see Appendix B.

See Next Slide

Page 295: TCP-IP

Figure 7.7 Example 1

TCP/IP Protocol Suite 295

Page 296: TCP-IP

Figure 7.8 Proxy ARP

TCP/IP Protocol Suite 296

Page 297: TCP-IP

7.2 ARP PACKAGE

InIn thisthis section,section, wewe givegive anan exampleexample ofof aa simplifiedsimplified ARPARP softwaresoftware packagepackage

toto showshow thethe componentscomponents andand thethe relationshipsrelationships betweenbetween thethe componentscomponents..

ThisThis ARPARP packagepackage involvesinvolves fivefive modulesmodules:: aa cachecache table,table, queues,queues, anan

outputoutput module,module, anan inputinput module,module, andand aa cachecache--controlcontrol modulemodule..

TCP/IP Protocol Suite 297

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

Cache TableCache Table

QueuesQueues

Output ModuleOutput Module

Input ModuleInput Module

CacheCache--Control ModuleControl Module

Page 298: TCP-IP

Figure 7.9 ARP components

TCP/IP Protocol Suite 298

Page 299: TCP-IP

Table 7.1 Table 7.1 Original cache table used for examplesOriginal cache table used for examples

TCP/IP Protocol Suite 299

Page 300: TCP-IP

The ARP output module receives an IP datagram

(from the IP layer) with the destination address

114.5.7.89. It checks the cache table and finds that an

entry exists for this destination with the RESOLVED

state (R in the table). It extracts the hardware address,

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 300

state (R in the table). It extracts the hardware address,

which is 457342ACAE32, and sends the packet and

the address to the data link layer for transmission.

The cache table remains the same.

Page 301: TCP-IP

Twenty seconds later, the ARP output module receives

an IP datagram (from the IP layer) with the

destination address 116.1.7.22. It checks the cache

table and does not find this destination in the table.

The module adds an entry to the table with the state

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 301

The module adds an entry to the table with the state

PENDING and the Attempt value 1. It creates a new

queue for this destination and enqueues the packet. It

then sends an ARP request to the data link layer for

this destination. The new cache table is shown in

Table 7.2.

See Next Slide

Page 302: TCP-IP

Table 7.2 Table 7.2 Updated cache table for Example 3Updated cache table for Example 3

TCP/IP Protocol Suite 302

Page 303: TCP-IP

Fifteen seconds later, the ARP input module receives

an ARP packet with target protocol (IP) address

188.11.8.71. The module checks the table and finds

this address. It changes the state of the entry to

RESOLVED and sets the time-out value to 900. The

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

TCP/IP Protocol Suite 303

RESOLVED and sets the time-out value to 900. The

module then adds the target hardware address

(E34573242ACA) to the entry. Now it accesses queue

18 and sends all the packets in this queue, one by one,

to the data link layer. The new cache table is shown in

Table 7.3.

See Next Slide

Page 304: TCP-IP

Table 7.3 Table 7.3 Updated cache table for Example 4Updated cache table for Example 4

TCP/IP Protocol Suite 304

Page 305: TCP-IP

Twenty-five seconds later, the cache-control module

updates every entry. The time-out values for the first

three resolved entries are decremented by 60. The

time-out value for the last resolved entry is

decremented by 25. The state of the next-to-the last

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

TCP/IP Protocol Suite 305

decremented by 25. The state of the next-to-the last

entry is changed to FREE because the time-out is

zero. For each of the three pending entries, the value

of the attempts

See Next Slide

Page 306: TCP-IP

Table 7.4 Table 7.4 Updated cache table for Example 5Updated cache table for Example 5

TCP/IP Protocol Suite 306

Page 307: TCP-IP

7.3 RARP

RARPRARP findsfinds thethe logicallogical addressaddress forfor aa machinemachine thatthat onlyonly knowsknows itsits

physicalphysical addressaddress..

TCP/IP Protocol Suite 307

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

Packet FormatPacket Format

EncapsulationEncapsulation

RARP ServerRARP Server

Alternative Solutions to RARPAlternative Solutions to RARP

Page 308: TCP-IP

The RARP request packets are broadcast;

Note:Note:

TCP/IP Protocol Suite 308

the RARP reply packets are unicast.

Page 309: TCP-IP

Figure 7.10 RARP operation

TCP/IP Protocol Suite 309

Page 310: TCP-IP

Figure 7.11 RARP packet

TCP/IP Protocol Suite 310

Page 311: TCP-IP

Figure 7.12 Encapsulation of RARP packet

TCP/IP Protocol Suite 311

Page 312: TCP-IP

Chapter 8Chapter 8Chapter 8Chapter 8Chapter 8Chapter 8Chapter 8Chapter 8

Upon completion you will be able to:

Internet ProtocolInternet Protocol

Objectives

TCP/IP Protocol Suite 312

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 313: TCP-IP

Figure 8.1 Position of IP in TCP/IP protocol suite

TCP/IP Protocol Suite 313

Page 314: TCP-IP

8.1 DATAGRAM

AA packetpacket inin thethe IPIP layerlayer isis calledcalled aa datagram,datagram, aa variablevariable--lengthlength packetpacket

consistingconsisting ofof twotwo partsparts:: headerheader andand datadata.. TheThe headerheader isis 2020 toto 6060 bytesbytes inin

lengthlength andand containscontains informationinformation essentialessential toto routingrouting andand deliverydelivery..

TCP/IP Protocol Suite 314

Page 315: TCP-IP

Figure 8.2 IP datagram

TCP/IP Protocol Suite 315

Page 316: TCP-IP

Figure 8.3 Service type or differentiated services

TCP/IP Protocol Suite 316

Page 317: TCP-IP

The precedence subfield was designed,

Note:Note:

TCP/IP Protocol Suite 317

The precedence subfield was designed,

but never used in version 4.

Page 318: TCP-IP

Table 8.1 Table 8.1 Types of serviceTypes of service

TCP/IP Protocol Suite 318

Page 319: TCP-IP

Table 8.2 Table 8.2 Default types of serviceDefault types of service

TCP/IP Protocol Suite 319

Page 320: TCP-IP

Table 8.3 Table 8.3 Values for codepointsValues for codepoints

TCP/IP Protocol Suite 320

Page 321: TCP-IP

The total length field defines the total

length of the datagram including the

Note:Note:

TCP/IP Protocol Suite 321

length of the datagram including the

header.

Page 322: TCP-IP

Figure 8.4 Encapsulation of a small datagram in an Ethernet frame

TCP/IP Protocol Suite 322

Page 323: TCP-IP

Figure 8.5 Multiplexing

TCP/IP Protocol Suite 323

Page 324: TCP-IP

Table 8.4 Table 8.4 ProtocolsProtocols

TCP/IP Protocol Suite 324

Page 325: TCP-IP

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

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

01000010

The receiver discards the packet. Why?

TCP/IP Protocol Suite 325

The receiver discards the packet. Why?

Solution

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.

Page 326: TCP-IP

In an IP packet, the value of HLEN is 1000 in binary. How

many bytes of options are being carried by this packet?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

Solution

TCP/IP Protocol Suite 326

Solution

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 base

header, the next 12 bytes are the options.

Page 327: TCP-IP

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?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

Solution

TCP/IP Protocol Suite 327

Solution

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

(40 − 20).

Page 328: TCP-IP

An IP packet has arrived with the first few hexadecimal digits

as shown below:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

45000028000100000102 . . .

How many hops can this packet travel before being dropped?

TCP/IP Protocol Suite 328

How many hops can this packet travel before being dropped?

The data belong to what upper layer protocol?

Solution

To find the time-to-live field, we 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 (see Table 8.4).

Page 329: TCP-IP

8.2 FRAGMENTATION

TheThe formatformat andand sizesize ofof aa frameframe dependdepend onon thethe protocolprotocol usedused byby thethe

physicalphysical networknetwork.. AA datagramdatagram maymay havehave toto bebe fragmentedfragmented toto fitfit thethe

protocolprotocol regulationsregulations..

TCP/IP Protocol Suite 329

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 330: TCP-IP

Figure 8.6 MTU

TCP/IP Protocol Suite 330

Page 331: TCP-IP

Table 8.5 Table 8.5 MTUs for some networksMTUs for some networks

TCP/IP Protocol Suite 331

Page 332: TCP-IP

Figure 8.7 Flags field

TCP/IP Protocol Suite 332

Page 333: TCP-IP

Figure 8.8 Fragmentation example

TCP/IP Protocol Suite 333

Page 334: TCP-IP

Figure 8.9 Detailed fragmentation example

TCP/IP Protocol Suite 334

Page 335: TCP-IP

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?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

TCP/IP Protocol Suite 335

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

considered the last fragment.

Page 336: TCP-IP

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?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 6666

Solution

TCP/IP Protocol Suite 336

Solution

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

Page 337: TCP-IP

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

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 7777

Solution

TCP/IP Protocol Suite 337

Solution

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.

Page 338: TCP-IP

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?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 8888

Solution

TCP/IP Protocol Suite 338

Solution

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.

Page 339: TCP-IP

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?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 9999

Solution

TCP/IP Protocol Suite 339

Solution

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 be 879.

Page 340: TCP-IP

8.3 OPTIONS

TheThe headerheader ofof thethe IPIP datagramdatagram isis mademade ofof twotwo partsparts:: aa fixedfixed partpart andand aa

variablevariable partpart.. TheThe variablevariable partpart comprisescomprises thethe optionsoptions thatthat cancan bebe aa

maximummaximum ofof 4040 bytesbytes..

TCP/IP Protocol Suite 340

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

FormatFormat

Option TypesOption Types

Page 341: TCP-IP

Figure 8.10 Option format

TCP/IP Protocol Suite 341

Page 342: TCP-IP

Figure 8.11 Categories of options

TCP/IP Protocol Suite 342

Page 343: TCP-IP

Figure 8.12 No operation option

TCP/IP Protocol Suite 343

Page 344: TCP-IP

Figure 8.13 End of option option

TCP/IP Protocol Suite 344

Page 345: TCP-IP

Figure 8.14 Record route option

TCP/IP Protocol Suite 345

Page 346: TCP-IP

Figure 8.15 Record route concept

TCP/IP Protocol Suite 346

Page 347: TCP-IP

Figure 8.16 Strict source route option

TCP/IP Protocol Suite 347

Page 348: TCP-IP

Figure 8.17 Strict source route concept

TCP/IP Protocol Suite 348

Page 349: TCP-IP

Figure 8.18 Loose source route option

TCP/IP Protocol Suite 349

Page 350: TCP-IP

Figure 8.19 Timestamp option

TCP/IP Protocol Suite 350

Page 351: TCP-IP

Figure 8.20 Use of flag in timestamp

TCP/IP Protocol Suite 351

Page 352: TCP-IP

Figure 8.21 Timestamp concept

TCP/IP Protocol Suite 352

Page 353: TCP-IP

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

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 10101010

Solution

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

a. No operation: Code is 00000001; not copied.

TCP/IP Protocol Suite 353

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 354: TCP-IP

Which of the six options are used for datagram control and

which are used for debugging and management?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 11111111

Solution

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

TCP/IP Protocol Suite 354

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 355: TCP-IP

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.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12121212

TCP/IP Protocol Suite 355

that the IP address of the host is 153.18.8.1.

$ ping fhda.edu

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

Page 356: TCP-IP

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

the record route option.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 13131313

$ 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 ms

RR: voyager.deanza.fhda.edu (153.18.17.11)

TCP/IP Protocol Suite 356

RR: 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.

Page 357: TCP-IP

The traceroute utility can also be used to keep track of the

route of a packet.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 14141414

$ 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

TCP/IP Protocol Suite 357

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.

Page 358: TCP-IP

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.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 15151515

TCP/IP Protocol Suite 358

$ 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

Page 359: TCP-IP

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.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 16161616

TCP/IP Protocol Suite 359

$ 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

Page 360: TCP-IP

8.4 CHECKSUM

TheThe errorerror detectiondetection methodmethod usedused byby mostmost TCP/IPTCP/IP protocolsprotocols isis calledcalled thethe

checksumchecksum.. TheThe checksumchecksum protectsprotects againstagainst thethe corruptioncorruption thatthat maymay occuroccur

duringduring thethe transmissiontransmission ofof aa packetpacket.. ItIt isis redundantredundant informationinformation addedadded toto

thethe packetpacket..

TCP/IP Protocol Suite 360

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 361: TCP-IP

To create the checksum the sender does the following:

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

Note:Note:

TCP/IP Protocol Suite 361

All sections are added together using 1’s complement

arithmetic.

The final result is complemented to make the

checksum.

Page 362: TCP-IP

Figure 8.22 Checksum concept

TCP/IP Protocol Suite 362

Page 363: TCP-IP

Figure 8.23 Checksum in one’s complement arithmetic

TCP/IP Protocol Suite 363

Page 364: TCP-IP

Figure 8.24 shows 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.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 17171717

TCP/IP Protocol Suite 364

See Next Slide

Page 365: TCP-IP

Figure 8.24 Example of checksum calculation in binary

TCP/IP Protocol Suite 365

Page 366: TCP-IP

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. However, note that we

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 18181818

TCP/IP Protocol Suite 366

checksum by complementing the sum. However, note that we

subtract each digit from 15 in hexadecimal arithmetic (just as

we subtract from 1 in binary arithmetic). This means the

complement of E (14) is 1 and the complement of 4 is B (11).

Figure 8.25 shows the calculation. Note that the result (8BB1)

is exactly the same as in Example 17.

See Next Slide

Page 367: TCP-IP

Figure 8.25 Example of checksum calculation in hexadecimal

TCP/IP Protocol Suite 367

Page 368: TCP-IP

Check Appendix C for a detailed

description of checksum calculation

and the handling of carries.

Note:Note:

TCP/IP Protocol Suite 368

and the handling of carries.

Page 369: TCP-IP

8.5 IP PACKAGE

WeWe givegive anan exampleexample ofof aa simplifiedsimplified IPIP softwaresoftware packagepackage toto showshow itsits

componentscomponents andand thethe relationshipsrelationships betweenbetween thethe componentscomponents.. ThisThis IPIP

packagepackage involvesinvolves eighteight modulesmodules..

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

HeaderHeader--Adding ModuleAdding Module

TCP/IP Protocol Suite 369

HeaderHeader--Adding ModuleAdding Module

Processing ModuleProcessing Module

QueuesQueues

Routing TableRouting Table

Forwarding ModuleForwarding Module

MTU TableMTU Table

Fragmentation ModuleFragmentation Module

Reassembly TableReassembly Table

Reassembly ModuleReassembly Module

Page 370: TCP-IP

Figure 8.26 IP components

TCP/IP Protocol Suite 370

Page 371: TCP-IP

Figure 8.27 MTU table

TCP/IP Protocol Suite 371

Page 372: TCP-IP

Figure 8.28 Reassembly table

TCP/IP Protocol Suite 372

Page 373: TCP-IP

Chapter 9Chapter 9Chapter 9Chapter 9Chapter 9Chapter 9Chapter 9Chapter 9

Upon completion you will be able to:

Internet Control Message Internet Control Message

ProtocolProtocol

Objectives

TCP/IP Protocol Suite 373

Upon completion you will be able to:

• Be familiar with the ICMP message format

• Know the types of error reporting messages

• Know the types of query messages

• Be able to calculate the ICMP checksum

• Know how to use the ping and traceroute commands

• Understand the modules and interactions of an ICMP package

Page 374: TCP-IP

Figure 9.1 Position of ICMP in the network layer

TCP/IP Protocol Suite 374

Page 375: TCP-IP

Figure 9.2 ICMP encapsulation

TCP/IP Protocol Suite 375

Page 376: TCP-IP

9.1 TYPES OF MESSAGES

ICMPICMP messagesmessages areare divideddivided intointo errorerror--reportingreporting messagesmessages andand queryquery

messagesmessages.. TheThe errorerror--reportingreporting messagesmessages reportreport problemsproblems thatthat aa routerrouter oror

aa hosthost (destination)(destination) maymay encounterencounter.. TheThe queryquery messagesmessages getget specificspecific

informationinformation fromfrom aa routerrouter oror anotheranother hosthost..

TCP/IP Protocol Suite 376

Page 377: TCP-IP

Figure 9.3 ICMP messages

TCP/IP Protocol Suite 377

Page 378: TCP-IP

Table 9.1 Table 9.1 ICMP messagesICMP messages

TCP/IP Protocol Suite 378

Page 379: TCP-IP

9.2 MESSAGE FORMAT

AnAn ICMPICMP messagemessage hashas anan 88--bytebyte headerheader andand aa variablevariable--sizesize datadata sectionsection..

AlthoughAlthough thethe generalgeneral formatformat ofof thethe headerheader isis differentdifferent forfor eacheach messagemessage

type,type, thethe firstfirst 44 bytesbytes areare commoncommon toto allall..

TCP/IP Protocol Suite 379

Page 380: TCP-IP

Figure 9.4 General format of ICMP messages

TCP/IP Protocol Suite 380

Page 381: TCP-IP

9.3 ERROR REPORTING

IP,IP, asas anan unreliableunreliable protocol,protocol, isis notnot concernedconcerned withwith errorerror checkingchecking andand

errorerror controlcontrol.. ICMPICMP waswas designed,designed, inin part,part, toto compensatecompensate forfor thisthis

shortcomingshortcoming.. ICMPICMP doesdoes notnot correctcorrect errors,errors, itit simplysimply reportsreports themthem..

TCP/IP Protocol Suite 381

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

Destination UnreachableDestination Unreachable

Source QuenchSource Quench

Time ExceededTime Exceeded

Parameter ProblemParameter Problem

RedirectionRedirection

Page 382: TCP-IP

ICMP always reports error messages

to the original source.

Note:Note:

TCP/IP Protocol Suite 382

to the original source.

Page 383: TCP-IP

Figure 9.5 Error-reporting messages

TCP/IP Protocol Suite 383

Page 384: TCP-IP

The following are important points about ICMP

error messages:

No ICMP error message will be generated in response

to a datagram carrying an ICMP error message.

Note:Note:

TCP/IP Protocol Suite 384

to a datagram carrying an ICMP error message.

No ICMP error message will be generated for a

fragmented datagram that is not the first fragment.

No ICMP error message will be generated for a

datagram having a multicast address.

No ICMP error message will be generated for a

datagram having a special address such as 127.0.0.0 or

0.0.0.0.

Page 385: TCP-IP

Figure 9.6 Contents of data field for the error messages

TCP/IP Protocol Suite 385

Page 386: TCP-IP

Figure 9.7 Destination-unreachable format

TCP/IP Protocol Suite 386

Page 387: TCP-IP

Destination-unreachable messages

with codes 2 or 3 can be created only

by the destination host.

Note:Note:

TCP/IP Protocol Suite 387

by the destination host.

Other destination-unreachable

messages can be created only by

routers.

Page 388: TCP-IP

A router cannot detect all problems

that prevent the delivery of a packet.

Note:Note:

TCP/IP Protocol Suite 388

that prevent the delivery of a packet.

Page 389: TCP-IP

There is no flow-control mechanism in

the IP protocol.

Note:Note:

TCP/IP Protocol Suite 389

the IP protocol.

Page 390: TCP-IP

Figure 9.8 Source-quench format

TCP/IP Protocol Suite 390

Page 391: TCP-IP

A source-quench message informs the

source that a datagram has been

discarded due to congestion in a router

Note:Note:

TCP/IP Protocol Suite 391

or the destination host.

The source must slow down the

sending of datagrams until the

congestion is relieved.

Page 392: TCP-IP

One source-quench message is sent for

each datagram that is discarded due to

congestion.

Note:Note:

TCP/IP Protocol Suite 392

congestion.

Page 393: TCP-IP

Whenever a router decrements a

datagram with a time-to-live value to

zero, it discards the datagram and

Note:Note:

TCP/IP Protocol Suite 393

zero, it discards the datagram and

sends a time-exceeded message to the

original source.

Page 394: TCP-IP

When the final destination does not

receive all of the fragments in a set

time, it discards the received fragments

Note:Note:

TCP/IP Protocol Suite 394

time, it discards the received fragments

and sends a time-exceeded message to

the original source.

Page 395: TCP-IP

In a time-exceeded message, code 0 is

used only by routers to show that the

value of the time-to-live field is zero.

Note:Note:

TCP/IP Protocol Suite 395

value of the time-to-live field is zero.

Code 1 is used only by the destination

host to show that not all of the

fragments have arrived within a set

time.

Page 396: TCP-IP

Figure 9.9 Time-exceeded message format

TCP/IP Protocol Suite 396

Page 397: TCP-IP

A parameter-problem message can be

created by a router or the destination

host.

Note:Note:

TCP/IP Protocol Suite 397

host.

Page 398: TCP-IP

Figure 9.10 Parameter-problem message format

TCP/IP Protocol Suite 398

Page 399: TCP-IP

Figure 9.11 Redirection concept

TCP/IP Protocol Suite 399

Page 400: TCP-IP

A host usually starts with a small

routing table that is gradually

augmented and updated. One of the

Note:Note:

TCP/IP Protocol Suite 400

augmented and updated. One of the

tools to accomplish this is the

redirection message.

Page 401: TCP-IP

Figure 9.12 Redirection message format

TCP/IP Protocol Suite 401

Page 402: TCP-IP

A redirection message is sent from a

router to a host on the same local

network.

Note:Note:

TCP/IP Protocol Suite 402

network.

Page 403: TCP-IP

9.4 QUERY

ICMPICMP cancan alsoalso diagnosediagnose somesome networknetwork problemsproblems throughthrough thethe queryquery

messages,messages, aa groupgroup ofof fourfour differentdifferent pairspairs ofof messagesmessages.. InIn thisthis typetype ofof

ICMPICMP message,message, aa nodenode sendssends aa messagemessage thatthat isis answeredanswered inin aa specificspecific

formatformat byby thethe destinationdestination nodenode..

TCP/IP Protocol Suite 403

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

Echo Request and ReplyEcho Request and Reply

Timestamp Request and ReplyTimestamp Request and Reply

AddressAddress--Mask Request and ReplyMask Request and Reply

Router Solicitation and AdvertisementRouter Solicitation and Advertisement

Page 404: TCP-IP

Figure 9.13 Query messages

TCP/IP Protocol Suite 404

Page 405: TCP-IP

An echo-request message can be sent

by a host or router. An echo-reply

message is sent by the host or router

Note:Note:

TCP/IP Protocol Suite 405

message is sent by the host or router

which receives an echo-request

message.

Page 406: TCP-IP

Echo-request and echo-reply messages

can be used by network managers to

check the operation of the IP protocol.

Note:Note:

TCP/IP Protocol Suite 406

check the operation of the IP protocol.

Page 407: TCP-IP

Echo-request and echo-reply messages

can test the reachability of a host. This

is usually done by invoking the ping

Note:Note:

TCP/IP Protocol Suite 407

is usually done by invoking the ping

command.

Page 408: TCP-IP

Figure 9.14 Echo-request and echo-reply messages

TCP/IP Protocol Suite 408

Page 409: TCP-IP

Figure 9.15 Timestamp-request and timestamp-reply message format

TCP/IP Protocol Suite 409

Page 410: TCP-IP

Timestamp-request and timestamp-

reply messages can be used to

calculate the round-trip time between

Note:Note:

TCP/IP Protocol Suite 410

calculate the round-trip time between

a source and a destination machine

even if their clocks are not

synchronized.

Page 411: TCP-IP

The timestamp-request and timestamp-

reply messages can be used to

synchronize two clocks in two

Note:Note:

TCP/IP Protocol Suite 411

synchronize two clocks in two

machines if the exact one-way time

duration is known.

Page 412: TCP-IP

Figure 9.16 Mask-request and mask-reply message format

TCP/IP Protocol Suite 412

Page 413: TCP-IP

Figure 9.17 Router-solicitation message format

TCP/IP Protocol Suite 413

Page 414: TCP-IP

Figure 9.18 Router-advertisement message format

TCP/IP Protocol Suite 414

Page 415: TCP-IP

9.5 CHECKSUM

InIn ICMPICMP thethe checksumchecksum isis calculatedcalculated overover thethe entireentire messagemessage (header(header

andand data)data)..

TCP/IP Protocol Suite 415

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

Checksum CalculationChecksum Calculation

Checksum TestingChecksum Testing

Page 416: TCP-IP

Figure 9.19 shows an example of checksum calculation for a

simple echo-request message (see Figure 9.14). We randomly

chose the identifier to be 1 and the sequence number to be 9.

The message is divided into 16-bit (2-byte) words. The words

are added together and the sum is complemented. Now the

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 416

are added together and the sum is complemented. Now the

sender can put this value in the checksum field.

See Next Slide

Page 417: TCP-IP

Figure 9.19 Example of checksum calculation

TCP/IP Protocol Suite 417

Page 418: TCP-IP

9.6 DEBUGGING TOOLS

WeWe introduceintroduce twotwo toolstools thatthat useuse ICMPICMP forfor debuggingdebugging:: pingping andand

traceroutetraceroute..

TCP/IP Protocol Suite 418

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

PingPing

Traceroute Traceroute

Page 419: TCP-IP

We use the ping program to test the server fhda.edu. The result

is shown below:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

$ ping fhda.edu

PING fhda.edu (153.18.8.1) 56 (84) bytes of data.

TCP/IP Protocol Suite 419

See Next Slide

PING fhda.edu (153.18.8.1) 56 (84) bytes of data.

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=0 ttl=62 time=1.91 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=1 ttl=62 time=2.04 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=2 ttl=62 time=1.90 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=3 ttl=62 time=1.97 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=4 ttl=62 time=1.93 ms

Page 420: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 2 2 2 2 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=5 ttl=62 time=2.00 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=6 ttl=62 time=1.94 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=7 ttl=62 time=1.94 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=8 ttl=62 time=1.97 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=9 ttl=62 time=1.89 ms

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=10 ttl=62 time=1.98 ms

TCP/IP Protocol Suite 420

64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=10 ttl=62 time=1.98 ms

--- fhda.edu ping statistics ---

11 packets transmitted, 11 received, 0% packet loss, time 10103ms

rtt min/avg/max = 1.899/1.955/2.041 ms

Page 421: TCP-IP

For the this example, we want to know if the adelphia.net mail

server is alive and running. The result is shown below:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

$ ping mail.adelphia.net

PING mail.adelphia.net (68.168.78.100) 56(84) bytes of data.

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=0 ttl=48 time=85.4 ms

TCP/IP Protocol Suite 421

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=0 ttl=48 time=85.4 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=1 ttl=48 time=84.6 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=2 ttl=48 time=84.9 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=3 ttl=48 time=84.3 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=4 ttl=48 time=84.5 ms

See Next Slide

Page 422: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 3 3 3 3 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=5 ttl=48 time=84.7 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=6 ttl=48 time=84.6 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=7 ttl=48 time=84.7 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=8 ttl=48 time=84.4 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=9 ttl=48 time=84.2 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=10 ttl=48 time=84.9 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=11 ttl=48 time=84.6 ms

TCP/IP Protocol Suite 422

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=11 ttl=48 time=84.6 ms

64 bytes from mail.adelphia.net (68.168.78.100): icmp_seq=12 ttl=48 time=84.5 ms

--- mail.adelphia.net ping statistics ---

14 packets transmitted, 13 received, 7% packet loss, time 13129ms

rtt min/avg/max/mdev = 84.207/84.694/85.469

Page 423: TCP-IP

Figure 9.20 The traceroute program operation

TCP/IP Protocol Suite 423

Page 424: TCP-IP

We use the traceroute program to find the route from the

computer voyager.deanza.edu to the server fhda.edu. The

following shows the result:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

$ traceroute fhda.edutraceroute to fhda.edu (153.18.8.1), 30 hops max, 38 byte packets

TCP/IP Protocol Suite 424

See Next Slide

traceroute to fhda.edu (153.18.8.1), 30 hops max, 38 byte packets

1 Dcore.fhda.edu (153.18.31.254) 0.995 ms 0.899 ms 0.878 ms

2 Dbackup.fhda.edu (153.18.251.4) 1.039 ms 1.064 ms 1.083 ms

3 tiptoe.fhda.edu (153.18.8.1) 1.797 ms 1.642 ms 1.757 ms

Page 425: TCP-IP

The un-numbered line after the command shows that the destination is

153.18.8.1. The TTL value is 30 hops. The packet contains 38 bytes: 20

bytes of IP header, 8 bytes of UDP header, and 10 bytes of application data.

The application data is used by traceroute to keep track of the packets.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4 4 4 4 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

The first line shows the first router visited. The router is named

Dcore.fhda.edu with IP address 153.18.31.254. The first round trip time was

0.995 milliseconds, the second was 0.899 milliseconds, and the third was

TCP/IP Protocol Suite 425

0.995 milliseconds, the second was 0.899 milliseconds, and the third was

0.878 milliseconds.

The second line shows the second router visited. The router is named

Dbackup.fhda.edu with IP address 153.18.251.4. The three round trip times

are also shown.

The third line shows the destination host. We know that this is the

destination host because there are no more lines. The destination host is the

server fhda.edu, but it is named tiptoe. fhda.edu with the IP address

153.18.8.1. The three round trip times are also shown.

Page 426: TCP-IP

In this example, we trace a longer route, the route to

xerox.com

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

$ traceroute xerox.comtraceroute to xerox.com (13.1.64.93), 30 hops max, 38 byte packets

1 Dcore.fhda.edu (153.18.31.254) 0.622 ms 0.891 ms 0.875 ms

2 Ddmz.fhda.edu (153.18.251.40) 2.132 ms 2.266 ms 2.094 ms

TCP/IP Protocol Suite 426

2 Ddmz.fhda.edu (153.18.251.40) 2.132 ms 2.266 ms 2.094 ms

...

18 alpha.Xerox.COM (13.1.64.93) 11.172 ms 11.048 ms 10.922 ms

Here there are 17 hops between source and destination. Note that some

round trip times look unusual. It could be that a router is too busy to

process the packet immediately.

Page 427: TCP-IP

An interesting point is that a host can send a traceroute packet

to itself. This can be done by specifying the host as the

destination. The packet goes to the loopback address as we

expect.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 6666

$ traceroute voyager.deanza.edu

TCP/IP Protocol Suite 427

$ traceroute voyager.deanza.edutraceroute to voyager.deanza.edu (127.0.0.1), 30 hops max, 38 byte packets

1 voyager (127.0.0.1) 0.178 ms 0.086 ms 0.055 ms

Page 428: TCP-IP

Finally, we use the traceroute program to find the route

between fhda.edu and mhhe.com (McGraw-Hill server). We

notice that we cannot find the whole route. When traceroute

does not receive a response within 5 seconds, it prints an

asterisk to signify a problem, and then tries the next hop..

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 7777

$ traceroute mhhe.com

TCP/IP Protocol Suite 428

$ traceroute mhhe.comtraceroute to mhhe.com (198.45.24.104), 30 hops max, 38 byte packets

1 Dcore.fhda.edu (153.18.31.254) 1.025 ms 0.892 ms 0.880 ms

2 Ddmz.fhda.edu (153.18.251.40) 2.141 ms 2.159 ms 2.103 ms

3 Cinic.fhda.edu (153.18.253.126) 2.159 ms 2.050 ms 1.992 ms

...

16 * * *

17 * * *

...............

Page 429: TCP-IP

9.7 ICMP PACKAGE

ToTo givegive anan ideaidea ofof howhow ICMPICMP cancan handlehandle thethe sendingsending andand receivingreceiving ofof

ICMPICMP messages,messages, wewe presentpresent ourour versionversion ofof anan ICMPICMP packagepackage mademade ofof

twotwo modulesmodules:: anan inputinput modulemodule andand anan outputoutput modulemodule..

TCP/IP Protocol Suite 429

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

Input ModuleInput Module

Output ModuleOutput Module

Page 430: TCP-IP

Figure 9.21 ICMP package

TCP/IP Protocol Suite 430

Page 431: TCP-IP

Chapter 10Chapter 10Chapter 10Chapter 10Chapter 10Chapter 10Chapter 10Chapter 10

Upon completion you will be able to:

Internet GroupInternet Group

Management ProtocolManagement Protocol

Objectives

TCP/IP Protocol Suite 431

Upon completion you will be able to:

• Know the purpose of IGMP

• Know the types of IGMP messages

• Understand how a member joins a group and leaves a group

• Understand membership monitoring

• Understand how an IGMP message is encapsulated

• Understand the interactions of the modules of an IGMP package

Page 432: TCP-IP

Figure 10.1 Position of IGMP in the network layer

TCP/IP Protocol Suite 432

Page 433: TCP-IP

10.1 GROUP MANAGEMENT

IGMPIGMP isis aa protocolprotocol thatthat managesmanages groupgroup membershipmembership.. TheThe IGMPIGMP

protocolprotocol givesgives thethe multicastmulticast routersrouters informationinformation aboutabout thethe membershipmembership

statusstatus ofof hostshosts (routers)(routers) connectedconnected toto thethe networknetwork.. ..

TCP/IP Protocol Suite 433

Page 434: TCP-IP

IGMP is a group management

protocol. It helps a multicast router

create and update a list of loyal

Note:Note:

TCP/IP Protocol Suite 434

create and update a list of loyal

members related to each router

interface.

Page 435: TCP-IP

10.2 IGMP MESSAGES

IGMPIGMP hashas threethree typestypes ofof messagesmessages:: thethe query,query, thethe membershipmembership report,report,

andand thethe leaveleave reportreport.. ThereThere areare twotwo typestypes ofof queryquery messages,messages, generalgeneral andand

specialspecial..

TCP/IP Protocol Suite 435

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

Message FormatMessage Format

Page 436: TCP-IP

Figure 10.2 IGMP message types

TCP/IP Protocol Suite 436

Page 437: TCP-IP

Figure 10.3 IGMP message format

TCP/IP Protocol Suite 437

Page 438: TCP-IP

Table 10.1 Table 10.1 IGMP type fieldIGMP type field

TCP/IP Protocol Suite 438

Page 439: TCP-IP

10.3 IGMP OPERATION

AA multicastmulticast routerrouter connectedconnected toto aa networknetwork hashas aa listlist ofof multicastmulticast

addressesaddresses ofof thethe groupsgroups withwith atat leastleast oneone loyalloyal membermember inin thatthat networknetwork..

ForFor eacheach group,group, therethere isis oneone routerrouter thatthat hashas thethe dutyduty ofof distributingdistributing thethe

multicastmulticast packetspackets destineddestined forfor thatthat groupgroup..

TCP/IP Protocol Suite 439

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

Joining a GroupJoining a Group

Leaving a GroupLeaving a Group

Monitoring MembershipMonitoring Membership

Page 440: TCP-IP

Figure 10.4 IGMP operation

TCP/IP Protocol Suite 440

Page 441: TCP-IP

Figure 10.5 Membership report

TCP/IP Protocol Suite 441

Page 442: TCP-IP

In IGMP, a membership report is sent

twice, one after the other.

Note:Note:

TCP/IP Protocol Suite 442

Page 443: TCP-IP

Figure 10.6 Leave report

TCP/IP Protocol Suite 443

Page 444: TCP-IP

The general query message does not

define a particular group.

Note:Note:

TCP/IP Protocol Suite 444

Page 445: TCP-IP

Figure 10.7 General query message

TCP/IP Protocol Suite 445

Page 446: TCP-IP

Imagine there are three hosts in a network as shown in Figure

10.8.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

A query message was received at time 0; the random delay time

(in tenths of seconds) for each group is shown next to the

TCP/IP Protocol Suite 446

See Next Slide

(in tenths of seconds) for each group is shown next to the

group address. Show the sequence of report messages.

Page 447: TCP-IP

Figure 10.8 Example 1

TCP/IP Protocol Suite 447

Page 448: TCP-IP

Solution

The events occur in this sequence:

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

a. Time 12: The timer for 228.42.0.0 in host A expires and a

membership report is sent, which is received by the router and every

host including host B which cancels its timer for 228.42.0.0.

b. Time 30: The timer for 225.14.0.0 in host A expires and a

TCP/IP Protocol Suite 448

b. Time 30: The timer for 225.14.0.0 in host A expires and a

membership report is sent, which is received by the router and every

host including host C which cancels its timer for 225.14.0.0.

c. Time 50: The timer for 238.71.0.0 in host B expires and a

membership report is sent, which is received by the router and every

host.

See Next Slide

Page 449: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

d. Time 70: The timer for 230.43.0.0 in host C expires and a

membership report is sent, which is received by the router and every

host including host A which cancels its timerfor 230.43.0.0.

TCP/IP Protocol Suite 449

Note that if each host had sent a report for every group in its

list, there would have been seven reports; with this strategy

only four reports are sent.

Page 450: TCP-IP

10.4 ENCAPSULATION

TheThe IGMPIGMP messagemessage isis encapsulatedencapsulated inin anan IPIP datagram,datagram, whichwhich isis itselfitself

encapsulatedencapsulated inin aa frameframe..

TCP/IP Protocol Suite 450

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

IP LayerIP Layer

Data Link LayerData Link Layer

Netstat UtilityNetstat Utility

Page 451: TCP-IP

Figure 10.9 Encapsulation of IGMP packet

TCP/IP Protocol Suite 451

Page 452: TCP-IP

The IP packet that carries an IGMP

packet has a value of 2 in its

protocol field.

Note:Note:

TCP/IP Protocol Suite 452

protocol field.

Page 453: TCP-IP

The IP packet that carries an IGMP

packet has a value of 1 in its

TTL field.

Note:Note:

TCP/IP Protocol Suite 453

TTL field.

Page 454: TCP-IP

Table 10.2 Table 10.2 Destination IP addressesDestination IP addresses

TCP/IP Protocol Suite 454

Page 455: TCP-IP

Figure 10.10 Mapping class D to Ethernet physical address

TCP/IP Protocol Suite 455

Page 456: TCP-IP

An Ethernet multicast physical

address is in the range

01:00:5E:00:00:00

Note:Note:

TCP/IP Protocol Suite 456

01:00:5E:00:00:00

to

01:00:5E:7F:FF:FF.

Page 457: TCP-IP

Change the multicast IP address 230.43.14.7 to an Ethernet

multicast physical

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

Solution

We can do this in two steps:

TCP/IP Protocol Suite 457

a. We write the rightmost 23 bits of the IP address in hexadecimal.

This can be done by changing the rightmost 3 bytes to hexadecimal

and then subtracting 8 from the leftmost digit if it is greater than or

equal to 8. In our example, the result is 2B:0E:07.

b. We add the result of part a to the starting Ethernet multicast

address, which is (01:00:5E:00:00:00). The result is

01:00:5Ε:2Β:0Ε:07

Page 458: TCP-IP

Change the multicast IP address 238.212.24.9 to an Ethernet

multicast address.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

Solution

a. The right-most three bytes in hexadecimal are D4:18:09. We need

TCP/IP Protocol Suite 458

a. The right-most three bytes in hexadecimal are D4:18:09. We need

to subtract 8 from the leftmost digit, resulting in 54:18:09..

b. We add the result of part a to the Ethernet multicast starting

address. The result is

01:00:5Ε:54:18:09

Page 459: TCP-IP

Figure 10.11 Tunneling

TCP/IP Protocol Suite 459

Page 460: TCP-IP

We use netstat with three options, -n, -r, and -a. The -n option gives the

numeric versions of IP addresses, the -r option gives the routing table, and

the -a option gives all addresses (unicast and multicast). Note that we show

only the fields relative to our discussion.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

$ netstat -nra

Kernel IP routing table

Destination Gateway Mask Flags Iface

TCP/IP Protocol Suite 460

Destination Gateway Mask Flags Iface

153.18.16.0 0.0.0.0 255.255.240.0 U eth0

169.254.0.0 0.0.0.0 255.255.0.0 U eth0

127.0.0.0 0.0.0.0 255.0.0.0 U lo

224.0.0.0 0.0.0.0 224.0.0.0 U eth0

0.0.0.0 153.18.31.254 0.0.0.0 UG eth0

Any packet with a multicast address from 224.0.0.0 to 239.255.255.255 is

masked and delivered to the Ethernet interface.

Page 461: TCP-IP

10.5 IGMP PACKAGE

WeWe cancan showshow howhow IGMPIGMP cancan handlehandle thethe sendingsending andand receivingreceiving ofof IGMPIGMP

packetspackets throughthrough ourour simplifiedsimplified versionversion ofof anan IGMPIGMP packagepackage.. InIn ourour

designdesign anan IGMPIGMP packagepackage involvesinvolves aa groupgroup table,table, aa setset ofof timers,timers, andand fourfour

softwaresoftware modulesmodules..

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

TCP/IP Protocol Suite 461

Group TableGroup Table

TimersTimers

GroupGroup--Joining ModuleJoining Module

GroupGroup--Leaving ModuleLeaving Module

Input ModuleInput Module

Output ModuleOutput Module

Page 462: TCP-IP

Figure 10.12 IGMP package

TCP/IP Protocol Suite 462

Page 463: TCP-IP

Figure 10.13 Group table

TCP/IP Protocol Suite 463

Page 464: TCP-IP

Chapter 11Chapter 11Chapter 11Chapter 11Chapter 11Chapter 11Chapter 11Chapter 11

Upon completion you will be able to:

User DatagramUser Datagram

ProtocolProtocol

Objectives

TCP/IP Protocol Suite 464

Upon completion you will be able to:

• Be able to explain process-to-process communication

• Know the format of a UDP user datagram

• Be able to calculate a UDP checksum

• Understand the operation of UDP

• Know when it is appropriate to use UDP

• Understand the modules in a UDP package

Page 465: TCP-IP

Figure 11.1 Position of UDP in the TCP/IP protocol suite

TCP/IP Protocol Suite 465

Page 466: TCP-IP

11.1 PROCESS-TO-PROCESS

COMMUNICATION

BeforeBefore wewe examineexamine UDP,UDP, wewe mustmust firstfirst understandunderstand hosthost--toto--hosthost

communicationcommunication andand processprocess--toto--processprocess communicationcommunication andand thethe

differencedifference betweenbetween themthem..

TCP/IP Protocol Suite 466

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

Port NumbersPort Numbers

Socket AddressesSocket Addresses

Page 467: TCP-IP

Figure 11.2 UDP versus IP

TCP/IP Protocol Suite 467

Page 468: TCP-IP

Figure 11.3 Port numbers

TCP/IP Protocol Suite 468

Page 469: TCP-IP

Figure 11.4 IP addresses versus port numbers

TCP/IP Protocol Suite 469

Page 470: TCP-IP

Figure 11.5 ICANN ranges

TCP/IP Protocol Suite 470

Page 471: TCP-IP

The well-known port numbers are less

Note:Note:

TCP/IP Protocol Suite 471

The well-known port numbers are less

than 1024.

Page 472: TCP-IP

Table 11.1 Table 11.1 WellWell--known ports used with UDPknown ports used with UDP

TCP/IP Protocol Suite 472

Page 473: TCP-IP

In UNIX, the well-known ports are stored in a file called

/etc/services. Each line in this file gives the name of the server

and the well-known port number. We can use the grep utility to

extract the line corresponding to the desired application. The

following shows the port for TFTP. Note TFTP can use port 69

on either UDP or TCP.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 473

on either UDP or TCP.

See Next Slide

$ grep tftp /etc/services

tftp 69/tcp

tftp 69/udp

Page 474: TCP-IP

SNMP uses two port numbers (161 and 162), each for a

different purpose, as we will see in Chapter 21.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

$ grep snmp /etc/services

snmp 161/tcp #Simple Net Mgmt Proto

TCP/IP Protocol Suite 474

snmp 161/tcp #Simple Net Mgmt Proto

snmp 161/udp #Simple Net Mgmt Proto

snmptrap 162/udp #Traps for SNMP

Page 475: TCP-IP

Figure 11.6 Socket address

TCP/IP Protocol Suite 475

Page 476: TCP-IP

11.2 USER DATAGRAM

UDPUDP packetspackets areare calledcalled useruser datagramsdatagrams andand havehave aa fixedfixed--sizesize headerheader ofof 88

bytesbytes..

TCP/IP Protocol Suite 476

Page 477: TCP-IP

Figure 11.7 User datagram format

TCP/IP Protocol Suite 477

Page 478: TCP-IP

UDP length =

IP length − IP header’s length

Note:Note:

TCP/IP Protocol Suite 478

IP length − IP header’s length

Page 479: TCP-IP

11.3 CHECKSUM

UDPUDP checksumchecksum calculationcalculation isis differentdifferent fromfrom thethe oneone forfor IPIP andand ICMPICMP..

HereHere thethe checksumchecksum includesincludes threethree sectionssections:: aa pseudoheader,pseudoheader, thethe UDPUDP

header,header, andand thethe datadata comingcoming fromfrom thethe applicationapplication layerlayer..

TCP/IP Protocol Suite 479

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

Checksum Calculation at SenderChecksum Calculation at Sender

Checksum Calculation at ReceiverChecksum Calculation at Receiver

Optional Use of the ChecksumOptional Use of the Checksum

Page 480: TCP-IP

Figure 11.8 Pseudoheader for checksum calculation

TCP/IP Protocol Suite 480

Page 481: TCP-IP

Figure 11.9 Checksum calculation of a simple UDP user datagram

TCP/IP Protocol Suite 481

Page 482: TCP-IP

11.4 UDP OPERATION

UDPUDP usesuses conceptsconcepts commoncommon toto thethe transporttransport layerlayer.. TheseThese conceptsconcepts willwill bebe

discusseddiscussed herehere briefly,briefly, andand thenthen expandedexpanded inin thethe nextnext chapterchapter onon thethe TCPTCP

protocolprotocol..

TCP/IP Protocol Suite 482

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

Connectionless ServicesConnectionless Services

Flow and Error ControlFlow and Error Control

Encapsulation and DecapsulationEncapsulation and Decapsulation

QueuingQueuing

Multiplexing and DemultiplexingMultiplexing and Demultiplexing

Page 483: TCP-IP

Figure 11.10 Encapsulation and decapsulation

TCP/IP Protocol Suite 483

Page 484: TCP-IP

Figure 11.11 Queues in UDP

TCP/IP Protocol Suite 484

Page 485: TCP-IP

Figure 11.12 Multiplexing and demultiplexing

TCP/IP Protocol Suite 485

Page 486: TCP-IP

11.5 USE OF UDP

WeWe discussdiscuss somesome usesuses ofof thethe UDPUDP protocolprotocol inin thisthis sectionsection..

TCP/IP Protocol Suite 486

Page 487: TCP-IP

11.6 UDP PACKAGE

ToTo showshow howhow UDPUDP handleshandles thethe sendingsending andand receivingreceiving ofof UDPUDP packets,packets,

wewe presentpresent aa simplesimple versionversion ofof thethe UDPUDP packagepackage.. TheThe UDPUDP packagepackage

involvesinvolves fivefive componentscomponents:: aa controlcontrol--blockblock table,table, inputinput queues,queues, aa controlcontrol--

blockblock module,module, anan inputinput module,module, andand anan outputoutput modulemodule..

TCP/IP Protocol Suite 487

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

ControlControl--Block TableBlock Table

Input QueuesInput Queues

ControlControl--Block ModuleBlock Module

Input ModuleInput Module

Output ModuleOutput Module

Page 488: TCP-IP

Figure 11.13 UDP design

TCP/IP Protocol Suite 488

Page 489: TCP-IP

Table 11.2 Table 11.2 The controlThe control--block table at the beginning of examplesblock table at the beginning of examples

TCP/IP Protocol Suite 489

Page 490: TCP-IP

The first activity is the arrival of a user datagram with

destination port number 52,012. The input module searches for

this port number and finds it. Queue number 38 has been

assigned to this port, which means that the port has been

previously used. The input module sends the data to queue 38.

The control-block table does not change.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 490

The control-block table does not change.

Page 491: TCP-IP

After a few seconds, a process starts. It asks the operating

system for a port number and is granted port number 52,014.

Now the process sends its ID (4,978) and the port number to

the control-block module to create an entry in the table. The

module takes the first FREE entry and inserts the information

received. The module does not allocate a queue at this moment

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 491

received. The module does not allocate a queue at this moment

because no user datagrams have arrived for this destination

(see Table 11.3).

See Next Slide

Page 492: TCP-IP

Table 11.3 Table 11.3 ControlControl--block table after Example 3block table after Example 3

TCP/IP Protocol Suite 492

Page 493: TCP-IP

A user datagram now arrives for port 52,011. The input module

checks the table and finds that no queue has been allocated for

this destination since this is the first time a user datagram has

arrived for this destination. The module creates a queue and

gives it a number (43). See Table 11.4.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

TCP/IP Protocol Suite 493

See Next Slide

Page 494: TCP-IP

Table 11.4 Table 11.4 ControlControl--block after Example 4block after Example 4

TCP/IP Protocol Suite 494

Page 495: TCP-IP

After a few seconds, a user datagram arrives for port 52,222.

The input module checks the table and cannot find an entry for

this destination. The user datagram is dropped and a request is

made to ICMP to send an “unreachable port” message to the

source.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

TCP/IP Protocol Suite 495

source.

Page 496: TCP-IP

Chapter 12Chapter 12Chapter 12Chapter 12Chapter 12Chapter 12Chapter 12Chapter 12

Upon completion you will be able to:

TransmissionTransmission

Control ProtocolControl Protocol

Objectives

TCP/IP Protocol Suite 496

Upon completion you will be able to:

• Be able to name and understand the services offered by TCP

• Understand TCP’s flow and error control and congestion control

• Be familiar with the fields in a TCP segment

• Understand the phases in a connection-oriented connection

• Understand the TCP transition state diagram

• Be able to name and understand the timers used in TCP

• Be familiar with the TCP options

Page 497: TCP-IP

Figure 12.1 TCP/IP protocol suite

TCP/IP Protocol Suite 497

Page 498: TCP-IP

12.1 TCP SERVICES

WeWe explainexplain thethe servicesservices offeredoffered byby TCPTCP toto thethe processesprocesses atat thethe applicationapplication

layerlayer..

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

TCP/IP Protocol Suite 498

ProcessProcess--toto--Process CommunicationProcess Communication

Stream Delivery ServiceStream Delivery Service

FullFull--Duplex CommunicationDuplex Communication

ConnectionConnection--Oriented ServiceOriented Service

Reliable ServiceReliable Service

Page 499: TCP-IP

Table 12.1 Table 12.1 WellWell--known ports used by TCPknown ports used by TCP

TCP/IP Protocol Suite 499

Page 500: TCP-IP

As we said in Chapter 11, in UNIX, the well-known ports are

stored in a file called /etc/services. Each line in this file gives

the name of the server and the well-known port number. We

can use the grep utility to extract the line corresponding to the

desired application. The following shows the ports for FTP.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 500

$ grep ftp /etc/services

ftp-data 20/tcp

ftp-control 21/tcp

Page 501: TCP-IP

Figure 12.2 Stream delivery

TCP/IP Protocol Suite 501

Page 502: TCP-IP

Figure 12.3 Sending and receiving buffers

TCP/IP Protocol Suite 502

Page 503: TCP-IP

Figure 12.4 TCP segments

TCP/IP Protocol Suite 503

Page 504: TCP-IP

12.2 TCP FEATURES

ToTo provideprovide thethe servicesservices mentionedmentioned inin thethe previousprevious section,section, TCPTCP hashas

severalseveral featuresfeatures thatthat areare brieflybriefly summarizedsummarized inin thisthis sectionsection..

TCP/IP Protocol Suite 504

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

Numbering System Numbering System

Flow ControlFlow Control

Error ControlError Control

Congestion ControlCongestion Control

Page 505: TCP-IP

The bytes of data being transferred in

each connection are numbered by TCP.

The numbering starts with a randomly

Note:Note:

TCP/IP Protocol Suite 505

The numbering starts with a randomly

generated number.

Page 506: TCP-IP

Suppose a TCP connection is transferring a file of 5000 bytes.

The first byte is numbered 10001. What are the sequence

numbers for each segment if data is sent in five segments, each

carrying 1000 bytes?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

Solution

The following shows the sequence number for each segment:

TCP/IP Protocol Suite 506

The following shows the sequence number for each segment:

Segment 1 Sequence Number: 10,001 (range: 10,001 to 11,000)

Segment 2 Sequence Number: 11,001 (range: 11,001 to 12,000)

Segment 3 Sequence Number: 12,001 (range: 12,001 to 13,000)

Segment 4 Sequence Number: 13,001 (range: 13,001 to 14,000)

Segment 5 Sequence Number: 14,001 (range: 14,001 to 15,000)

Page 507: TCP-IP

The value in the sequence number

field of a segment defines the number

of the first data byte contained

Note:Note:

TCP/IP Protocol Suite 507

of the first data byte contained

in that segment.

Page 508: TCP-IP

The value of the acknowledgment field

in a segment defines the number of the

next byte a party expects to receive.

Note:Note:

TCP/IP Protocol Suite 508

next byte a party expects to receive.

The acknowledgment number is

cumulative.

Page 509: TCP-IP

12.3 SEGMENT

AA packetpacket inin TCPTCP isis calledcalled aa segmentsegment

TCP/IP Protocol Suite 509

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

FormatFormat

EncapsulationEncapsulation

Page 510: TCP-IP

Figure 12.5 TCP segment format

TCP/IP Protocol Suite 510

Page 511: TCP-IP

Figure 12.6 Control field

TCP/IP Protocol Suite 511

Page 512: TCP-IP

II

Table 12.2 Table 12.2 Description of flags in the control fieldDescription of flags in the control field

TCP/IP Protocol Suite 512

II

Page 513: TCP-IP

Figure 12.7 Pseudoheader added to the TCP datagram

TCP/IP Protocol Suite 513

Page 514: TCP-IP

The inclusion of the checksum in TCP

Note:Note:

TCP/IP Protocol Suite 514

The inclusion of the checksum in TCP

is mandatory.

Page 515: TCP-IP

Figure 12.8 Encapsulation and decapsulation

TCP/IP Protocol Suite 515

Page 516: TCP-IP

12.4 A TCP CONNECTION

TCPTCP isis connectionconnection--orientedoriented.. AA connectionconnection--orientedoriented transporttransport protocolprotocol

establishesestablishes aa virtualvirtual pathpath betweenbetween thethe sourcesource andand destinationdestination.. AllAll ofof thethe

segmentssegments belongingbelonging toto aa messagemessage areare thenthen sentsent overover thisthis virtualvirtual pathpath.. AA

connectionconnection--orientedoriented transmissiontransmission requiresrequires threethree phasesphases:: connectionconnection

establishment,establishment, datadata transfer,transfer, andand connectionconnection terminationtermination..

TCP/IP Protocol Suite 516

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

Connection EstablishmentConnection Establishment

Data TransferData Transfer

Connection TerminationConnection Termination

Connection ResetConnection Reset

Page 517: TCP-IP

Figure 12.9 Connection establishment using three-way handshaking

TCP/IP Protocol Suite 517

Page 518: TCP-IP

A SYN segment cannot carry data, but

Note:Note:

TCP/IP Protocol Suite 518

A SYN segment cannot carry data, but

it consumes one sequence number.

Page 519: TCP-IP

A SYN + ACK segment cannot carry

data, but does consume one

Note:Note:

TCP/IP Protocol Suite 519

data, but does consume one

sequence number.

Page 520: TCP-IP

An ACK segment, if carrying no data,

consumes no sequence number.

Note:Note:

TCP/IP Protocol Suite 520

consumes no sequence number.

Page 521: TCP-IP

Figure 12.10 Data transfer

TCP/IP Protocol Suite 521

Page 522: TCP-IP

The FIN segment consumes one

sequence number if it does not carry

Note:Note:

TCP/IP Protocol Suite 522

sequence number if it does not carry

data.

Page 523: TCP-IP

Figure 12.11 Connection termination using three-way handshaking

TCP/IP Protocol Suite 523

Page 524: TCP-IP

The FIN + ACK segment consumes

one sequence number if it does not

Note:Note:

TCP/IP Protocol Suite 524

one sequence number if it does not

carry data.

Page 525: TCP-IP

Figure 12.12 Half-close

TCP/IP Protocol Suite 525

Page 526: TCP-IP

12.5 STATE TRANSITION DIAGRAM

ToTo keepkeep tracktrack ofof allall thethe differentdifferent eventsevents happeninghappening duringduring connectionconnection

establishment,establishment, connectionconnection termination,termination, andand datadata transfer,transfer, thethe TCPTCP

softwaresoftware isis implementedimplemented asas aa finitefinite statestate machinemachine.. ..

TCP/IP Protocol Suite 526

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

ScenariosScenarios

Page 527: TCP-IP

Table 12.3 Table 12.3 States for TCPStates for TCP

TCP/IP Protocol Suite 527

Page 528: TCP-IP

Figure 12.13 State transition diagram

TCP/IP Protocol Suite 528

Page 529: TCP-IP

Figure 12.14 Common scenario

TCP/IP Protocol Suite 529

Page 530: TCP-IP

The common value for MSL is

between 30 seconds and 1 minute.

Note:Note:

TCP/IP Protocol Suite 530

between 30 seconds and 1 minute.

Page 531: TCP-IP

Figure 12.15 Three-way handshake

TCP/IP Protocol Suite 531

Page 532: TCP-IP

Figure 12.16 Simultaneous open

TCP/IP Protocol Suite 532

Page 533: TCP-IP

Figure 12.17 Simultaneous close

TCP/IP Protocol Suite 533

Page 534: TCP-IP

Figure 12.18 Denying a connection

TCP/IP Protocol Suite 534

Page 535: TCP-IP

Figure 12.19 Aborting a connection

TCP/IP Protocol Suite 535

Page 536: TCP-IP

12.6 FLOW CONTROL

FlowFlow controlcontrol regulatesregulates thethe amountamount ofof datadata aa sourcesource cancan sendsend beforebefore

receivingreceiving anan acknowledgmentacknowledgment fromfrom thethe destinationdestination.. TCPTCP definesdefines aa

windowwindow thatthat isis imposedimposed onon thethe bufferbuffer ofof datadata delivereddelivered fromfrom thethe

applicationapplication programprogram..

TCP/IP Protocol Suite 536

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

Sliding Window ProtocolSliding Window Protocol

Silly Window SyndromeSilly Window Syndrome

Page 537: TCP-IP

Figure 12.20 Sliding window

TCP/IP Protocol Suite 537

Page 538: TCP-IP

A sliding window is used to make

transmission more efficient as well as

to control the flow of data so that the

destination does not become

Note:Note:

TCP/IP Protocol Suite 538

destination does not become

overwhelmed with data.

TCP’s sliding windows are byte

oriented.

Page 539: TCP-IP

What is the value of the receiver window (rwnd) for host A if

the receiver, host B, has a buffer size of 5,000 bytes and 1,000

bytes of received and unprocessed data?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 539

Solution

The value of rwnd = 5,000 − 1,000 = 4,000. Host B can receive

only 4,000 bytes of data before overflowing its buffer. Host B

advertises this value in its next segment to A.

Page 540: TCP-IP

What is the size of the window for host A if the value of rwnd is

3,000 bytes and the value of cwnd is 3,500 bytes?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

TCP/IP Protocol Suite 540

Solution

The size of the window is the smaller of rwnd and cwnd, which

is 3,000 bytes.

Page 541: TCP-IP

Figure 12.21 shows an unrealistic example of a sliding

window. The sender has sent bytes up to 202. We assume that

cwnd is 20 (in reality this value is thousands of bytes). The

receiver has sent an acknowledgment number of 200 with an

rwnd of 9 bytes (in reality this value is thousands of bytes). The

size of the sender window is the minimum of rwnd and cwnd or

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

TCP/IP Protocol Suite 541

size of the sender window is the minimum of rwnd and cwnd or

9 bytes. Bytes 200 to 202 are sent, but not acknowledged. Bytes

203 to 208 can be sent without worrying about

acknowledgment. Bytes 209 and above cannot be sent.

Page 542: TCP-IP

Figure 12.21 Example 5

TCP/IP Protocol Suite 542

Page 543: TCP-IP

In Figure 12.21 the server receives a packet with an

acknowledgment value of 202 and an rwnd of 9. The host has

already sent bytes 203, 204, and 205. The value of cwnd is still

20. Show the new window.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 6666

Solution

TCP/IP Protocol Suite 543

Solution

Figure 12.22 shows the new window. Note that this is a case in

which the window closes from the left and opens from the right

by an equal number of bytes; the size of the window has not

been changed. The acknowledgment value, 202, declares that

bytes 200 and 201 have been received and the sender needs not

worry about them; the window can slide over them.

Page 544: TCP-IP

Figure 12.22 Example 6

TCP/IP Protocol Suite 544

Page 545: TCP-IP

In Figure 12.22 the sender receives a packet with an

acknowledgment value of 206 and an rwnd of 12. The host has

not sent any new bytes. The value of cwnd is still 20. Show the

new window.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 7777

TCP/IP Protocol Suite 545

Solution

The value of rwnd is less than cwnd, so the size of the window

is 12. Figure 12.23 shows the new window. Note that the

window has been opened from the right by 7 and closed from

the left by 4; the size of the window has increased.

Page 546: TCP-IP

Figure 12.23 Example 7

TCP/IP Protocol Suite 546

Page 547: TCP-IP

In Figure 12.23 the host receives a packet with an

acknowledgment value of 210 and an rwnd of 5. The host has

sent bytes 206, 207, 208, and 209. The value of cwnd is still 20.

Show the new window.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 8888

TCP/IP Protocol Suite 547

Solution

The value of rwnd is less than cwnd, so the size of the window

is 5. Figure 12.24 shows the situation. Note that this is a case

not allowed by most implementations. Although the sender has

not sent bytes 215 to 217, the receiver does not know this.

Page 548: TCP-IP

Figure 12.24 Example 8

TCP/IP Protocol Suite 548

Page 549: TCP-IP

How can the receiver avoid shrinking the window in the

previous example?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 9999

Solution

The receiver needs to keep track of the last acknowledgment

number and the last rwnd. If we add the acknowledgment

TCP/IP Protocol Suite 549

number and the last rwnd. If we add the acknowledgment

number to rwnd we get the byte number following the right

wall. If we want to prevent the right wall from moving to the

left (shrinking), we must always have the following

relationship.

new ack + new rwnd ≥ last ack + last rwnd

or

new rwnd ≥ (last ack + last rwnd) − new ack

Page 550: TCP-IP

To avoid shrinking the sender window,

the receiver must wait until more

space is available in its buffer.

Note:Note:

TCP/IP Protocol Suite 550

space is available in its buffer.

Page 551: TCP-IP

Some points about TCP’s sliding windows:

The size of the window is the lesser of rwnd and cwnd.

The source does not have to send a full window’s

worth of data.

Note:Note:

TCP/IP Protocol Suite 551

The window can be opened or closed by the receiver,

but should not be shrunk.

The destination can send an acknowledgment at any

time as long as it does not result in a shrinking window.

The receiver can temporarily shut down the window;

the sender, however, can always send a segment of one

byte after the window is shut down.

Page 552: TCP-IP

12.7 ERROR CONTROL

TCPTCP providesprovides reliabilityreliability usingusing errorerror control,control, whichwhich detectsdetects corrupted,corrupted,

lost,lost, outout--ofof--order,order, andand duplicatedduplicated segmentssegments.. ErrorError controlcontrol inin TCPTCP isis

achievedachieved throughthrough thethe useuse ofof thethe checksum,checksum, acknowledgment,acknowledgment, andand timetime--

outout..

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

TCP/IP Protocol Suite 552

ChecksumChecksum

AcknowledgmentAcknowledgment

Acknowledgment TypeAcknowledgment Type

RetransmissionRetransmission

OutOut--ofof--Order Segments Order Segments

Some ScenariosSome Scenarios

Page 553: TCP-IP

ACK segments do not consume

sequence numbers and are not

Note:Note:

TCP/IP Protocol Suite 553

sequence numbers and are not

acknowledged.

Page 554: TCP-IP

In modern implementations, a

retransmission occurs if the

retransmission timer expires or three

Note:Note:

TCP/IP Protocol Suite 554

retransmission timer expires or three

duplicate ACK segments have arrived.

Page 555: TCP-IP

No retransmission timer is set for an

ACK segment.

Note:Note:

TCP/IP Protocol Suite 555

ACK segment.

Page 556: TCP-IP

Data may arrive out of order and be

temporarily stored by the receiving TCP,

but TCP guarantees that no out-of-order

Note:Note:

TCP/IP Protocol Suite 556

but TCP guarantees that no out-of-order

segment is delivered to the process.

Page 557: TCP-IP

Figure 12.25 Normal operation

TCP/IP Protocol Suite 557

Page 558: TCP-IP

Figure 12.26 Lost segment

TCP/IP Protocol Suite 558

Page 559: TCP-IP

The receiver TCP delivers only

Note:Note:

TCP/IP Protocol Suite 559

The receiver TCP delivers only

ordered data to the process.

Page 560: TCP-IP

Figure 12.27 Fast retransmission

TCP/IP Protocol Suite 560

Page 561: TCP-IP

Figure 12.28 Lost acknowledgment

TCP/IP Protocol Suite 561

Page 562: TCP-IP

Figure 12.29 Lost acknowledgment corrected by resending a segment

TCP/IP Protocol Suite 562

Page 563: TCP-IP

Lost acknowledgments may create

deadlock if they are not properly

Note:Note:

TCP/IP Protocol Suite 563

deadlock if they are not properly

handled.

Page 564: TCP-IP

12.8 CONGESTION CONTROL

CongestionCongestion controlcontrol refersrefers toto thethe mechanismsmechanisms andand techniquestechniques toto keepkeep thethe

loadload belowbelow thethe capacitycapacity..

TCP/IP Protocol Suite 564

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

Network PerformanceNetwork Performance

Congestion Control MechanismsCongestion Control Mechanisms

Congestion Control in TCPCongestion Control in TCP

Page 565: TCP-IP

Figure 12.30 Router queues

TCP/IP Protocol Suite 565

Page 566: TCP-IP

Figure 12.31 Packet delay and network load

TCP/IP Protocol Suite 566

Page 567: TCP-IP

Figure 12.32 Throughput versus network load

TCP/IP Protocol Suite 567

Page 568: TCP-IP

Figure 12.33 Slow start, exponential increase

TCP/IP Protocol Suite 568

Page 569: TCP-IP

In the slow start algorithm, the size of

the congestion window increases

exponentially until it reaches a

Note:Note:

TCP/IP Protocol Suite 569

exponentially until it reaches a

threshold.

Page 570: TCP-IP

Figure 12.34 Congestion avoidance, additive increase

TCP/IP Protocol Suite 570

Page 571: TCP-IP

In the congestion avoidance algorithm

the size of the congestion window

increases additively until

Note:Note:

TCP/IP Protocol Suite 571

increases additively until

congestion is detected.

Page 572: TCP-IP

Most implementations react differently to

congestion detection:

Note:Note:

TCP/IP Protocol Suite 572

If detection is by time-out, a new slow start phase

starts.

If detection is by three ACKs, a new congestion

avoidance phase starts.

Page 573: TCP-IP

Figure 12.35 TCP congestion policy summary

TCP/IP Protocol Suite 573

Page 574: TCP-IP

Figure 12.36 Congestion example

TCP/IP Protocol Suite 574

Page 575: TCP-IP

12.9 TCP TIMERS

ToTo performperform itsits operationoperation smoothly,smoothly, mostmost TCPTCP implementationsimplementations useuse atat

leastleast fourfour timerstimers..

TCP/IP Protocol Suite 575

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

Retransmission TimerRetransmission Timer

Persistence TimerPersistence Timer

Keepalive TimerKeepalive Timer

TIMETIME--WAIT TimerWAIT Timer

Page 576: TCP-IP

Figure 12.37 TCP timers

TCP/IP Protocol Suite 576

Page 577: TCP-IP

In TCP, there can be only be one RTT

measurement in progress at any time.

Note:Note:

TCP/IP Protocol Suite 577

measurement in progress at any time.

Page 578: TCP-IP

Let us give a hypothetical example. Figure 12.38 shows part of

a connection. The figure shows the connection establishment

and part of the data transfer phases.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 10101010

1. When the SYN segment is sent, there is no value for RTTM , RTTS , or

RTTD . The value of RTO is set to 6.00 seconds. The following shows the

TCP/IP Protocol Suite 578

RTTD . The value of RTO is set to 6.00 seconds. The following shows the

value of these variables at this moment:

RTTM = 1.5 RTTS = 1.5

RTTD = 1.5 / 2 = 0.75 RTO = 1.5 + 4 . 0.75 = 4.5

2. When the SYN+ACK segment arrives, RTTM is measured and is equal to

1.5 seconds. The next slide shows the values of these variables:

Page 579: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 10 10 10 10 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

RTTM = 1.5 RTTS = 1.5

RTTD = 1.5 / 2 = 0.75 RTO = 1.5 + 4 . 0.75 = 4.5

3.When the first data segment is sent, a new RTT measurement

starts. Note that the sender does not start an RTT measurement

when it sends the ACK segment, because it does not consume a

TCP/IP Protocol Suite 579

when it sends the ACK segment, because it does not consume a

sequence number and there is no time-out. No RTT

measurement starts for the second data segment because a

measurement is already in progress.

RTTM = 2.5

RTTS = 7/8 (1.5) + 1/8 (2.5) = 1.625

RTTD = 3/4 (7.5) + 1/4 |1.625 − 2.5| = 0.78

RTO = 1.625 + 4 (0.78) = 4.74

Page 580: TCP-IP

Figure 12.38 Example 10

TCP/IP Protocol Suite 580

Page 581: TCP-IP

TCP does not consider the RTT of a

retransmitted segment in its

Note:Note:

TCP/IP Protocol Suite 581

retransmitted segment in its

calculation of a new RTO.

Page 582: TCP-IP

Figure 12.39 is a continuation of the previous example. There

is retransmission and Karn’s algorithm is applied. The first

segment in the figure is sent, but lost. The RTO timer expires

after 4.74 seconds. The segment is retransmitted and the timer

is set to 9.48, twice the previous value of RTO. This time an

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 11111111

TCP/IP Protocol Suite 582

is set to 9.48, twice the previous value of RTO. This time an

ACK is received before the time-out. We wait until we send a

new segment and receive the ACK for it before recalculating

the RTO (Karn’s algorithm).

Page 583: TCP-IP

Figure 12.39 Example 11

TCP/IP Protocol Suite 583

Page 584: TCP-IP

12.10 OPTIONS

TheThe TCPTCP headerheader cancan havehave upup toto 4040 bytesbytes ofof optionaloptional informationinformation..

OptionsOptions conveyconvey additionaladditional informationinformation toto thethe destinationdestination oror alignalign otherother

optionsoptions..

TCP/IP Protocol Suite 584

Page 585: TCP-IP

Figure 12.40 Options

TCP/IP Protocol Suite 585

Page 586: TCP-IP

Figure 12.41 End-of-option option

TCP/IP Protocol Suite 586

Page 587: TCP-IP

EOP can be used only once.

Note:Note:

TCP/IP Protocol Suite 587

Page 588: TCP-IP

Figure 12.42 No-operation option

TCP/IP Protocol Suite 588

Page 589: TCP-IP

NOP can be used more than once.

Note:Note:

TCP/IP Protocol Suite 589

NOP can be used more than once.

Page 590: TCP-IP

Figure 12.43 Maximum-segment-size option

TCP/IP Protocol Suite 590

Page 591: TCP-IP

The value of MSS is determined

during connection establishment and

does not change during the

Note:Note:

TCP/IP Protocol Suite 591

does not change during the

connection.

Page 592: TCP-IP

Figure 12.44 Window-scale-factor option

TCP/IP Protocol Suite 592

Page 593: TCP-IP

The value of the window scale factor

can be determined only during

connection establishment; it does not

Note:Note:

TCP/IP Protocol Suite 593

connection establishment; it does not

change during the connection.

Page 594: TCP-IP

Figure 12.45 Timestamp option

TCP/IP Protocol Suite 594

Page 595: TCP-IP

One application of the timestamp

option is the calculation of round trip

time (RTT).

Note:Note:

TCP/IP Protocol Suite 595

time (RTT).

Page 596: TCP-IP

Figure 12.46 shows an example that calculates the round-trip

time for one end. Everything must be flipped if we want to

calculate the RTT for the other end.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12121212

The sender simply inserts the value of the clock (for example,

the number of seconds past from midnight) in the timestamp

TCP/IP Protocol Suite 596

the number of seconds past from midnight) in the timestamp

field for the first and second segment. When an

acknowledgment comes (the third segment), the value of the

clock is checked and the value of the echo reply field is

subtracted from the current time. RTT is 12 s in this scenario.

Page 597: TCP-IP

The receiver’s function is more involved. It keeps track of the

last acknowledgment sent (12000). When the first segment

arrives, it contains the bytes 12000 to 12099. The first byte is

the same as the value of lastack. It then copies the timestamp

value (4720) into the tsrecent variable. The value of lastack is

still 12000 (no new acknowledgment has been sent). When the

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12 12 12 12 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 597

still 12000 (no new acknowledgment has been sent). When the

second segment arrives, since none of the byte numbers in this

segment include the value of lastack, the value of the

timestamp field is ignored. When the receiver decides to send

an accumulative acknowledgment with acknowledgment

12200, it changes the value of lastack to 12200 and inserts the

value of tsrecent in the echo reply field. The value of tsrecent

will not change until it isreplaced by a new segment that

carries byte 12200 (next segment).

Page 598: TCP-IP

Note that as the example shows, the RTT calculated is the time

difference between sending the first segment and receiving the

third segment. This is actually the meaning of RTT: the time

difference between a packet sent and the acknowledgment

received. The third segment carries the acknowledgment for

the first and second segments.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 12 12 12 12 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 598

the first and second segments.

Page 599: TCP-IP

Figure 12.46 Example 12

TCP/IP Protocol Suite 599

Page 600: TCP-IP

The timestamp option can also be used

for PAWS.

Note:Note:

TCP/IP Protocol Suite 600

for PAWS.

Page 601: TCP-IP

Figure 12.47 SACK

TCP/IP Protocol Suite 601

Page 602: TCP-IP

Let us see how the SACK option is used to list out-of-order blocks. In

Figure 12.48 an end has received five segments of data.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 13131313

The first and second segments are in consecutive order. An accumulative

acknowledgment can be sent to report the reception of these two segments.

Segments 3, 4, and 5, however, are out of order with a gap between the

TCP/IP Protocol Suite 602

Segments 3, 4, and 5, however, are out of order with a gap between the

second and third and a gap between the fourth and the fifth. An ACK and a

SACK together can easily clear the situation for the sender. The value of

ACK is2001, which means that the sender need not worry about bytes 1 to

2000. The SACK has two blocks. The first block announces that bytes 4001

to 6000 have arrived out of order. The second block shows that bytes 8001 to

9000 have also arrived out of order. This means that bytes 2001 to 4000 and

bytes 6001 to 8000 are lost or discarded. The sender can resend only these

bytes.

Page 603: TCP-IP

Figure 12.48 Example 13

TCP/IP Protocol Suite 603

Page 604: TCP-IP

The example in Figure 12.49 shows how a duplicate segment

can be detected with a combination of ACK and SACK. In this

case, we have some out-of-order segments (in one block) and

one duplicate segment. To show both out-of-order and

duplicate data, SACK uses the first block, in this case, to show

the duplicate data and other blocks to show out-of-order data.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 14141414

TCP/IP Protocol Suite 604

the duplicate data and other blocks to show out-of-order data.

Note that only the first block can be used for duplicate data.

The natural question is how the sender, when it receives these

ACK and SACK values knows that the first block is for

duplicate data (compare this example with the previous

example). The answer is that the bytes in the first block are

already acknowledged in the ACK field; therefore, this block

must be a duplicate.

Page 605: TCP-IP

Figure 12.49 Example 14

TCP/IP Protocol Suite 605

Page 606: TCP-IP

The example in Figure 12.50 shows what happens if one of the

segments in the out-of-order section is also duplicated. In this

example, one of the segments (4001:5000) is duplicated. The

SACK option announces this duplicate data first and then the

out-of-order block. This time, however, the duplicated block is

not yet acknowledged by ACK, but because it is part of the out-

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 15151515

TCP/IP Protocol Suite 606

not yet acknowledged by ACK, but because it is part of the out-

of-order block (4001:5000 is part of 4001:6000), it is

understood by the sender that it defines the duplicate data.

Page 607: TCP-IP

Figure 12.50 Example 15

TCP/IP Protocol Suite 607

Page 608: TCP-IP

12.11 TCP PACKAGE

WeWe presentpresent aa simplified,simplified, barebare--bonesbones TCPTCP packagepackage toto simulatesimulate thethe heartheart ofof

TCPTCP.. TheThe packagepackage involvesinvolves tablestables calledcalled transmissiontransmission controlcontrol blocks,blocks, aa

setset ofof timers,timers, andand threethree softwaresoftware modulesmodules..

TCP/IP Protocol Suite 608

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

Transmission Control Blocks (TCBs)Transmission Control Blocks (TCBs)

TimersTimers

Main ModuleMain Module

Input Processing ModuleInput Processing Module

Output Processing ModuleOutput Processing Module

Page 609: TCP-IP

Figure 12.51 TCP package

TCP/IP Protocol Suite 609

Page 610: TCP-IP

Figure 12.52 TCBs

TCP/IP Protocol Suite 610

Page 611: TCP-IP

Chapter 13Chapter 13Chapter 13Chapter 13Chapter 13Chapter 13Chapter 13Chapter 13

Upon completion you will be able to:

Stream ControlStream Control

Transmission ProtocolTransmission Protocol

Objectives

TCP/IP Protocol Suite 611

Upon completion you will be able to:

• Be able to name and understand the services offered by SCTP

• Understand SCTP’s flow and error control and congestion control

• Be familiar with the fields in a SCTP segment

• Understand the phases in an SCTP association

• Understand the SCTP state transition diagram

Page 612: TCP-IP

Figure 13.1 TCP/IP protocol suite

TCP/IP Protocol Suite 612

Page 613: TCP-IP

SCTP is a message-oriented, reliable

protocol that combines the

Note:Note:

TCP/IP Protocol Suite 613

protocol that combines the

good features of UDP and TCP.

Page 614: TCP-IP

13.1 SCTP SERVICES

WeWe explainexplain thethe servicesservices offeredoffered byby SCTPSCTP toto thethe applicationapplication layerlayer

processesprocesses..

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

TCP/IP Protocol Suite 614

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

ProcessProcess--toto--Process CommunicationProcess Communication

Multiple StreamsMultiple Streams

MultihomingMultihoming

FullFull--Duplex CommunicationDuplex Communication

ConnectionConnection--Oriented ServiceOriented Service

Reliable ServiceReliable Service

Page 615: TCP-IP

Table 13.1 Table 13.1 Some SCTP applicationsSome SCTP applications

TCP/IP Protocol Suite 615

Page 616: TCP-IP

Figure 13.2 Multiple-stream concept

TCP/IP Protocol Suite 616

Page 617: TCP-IP

An association in SCTP can involve

multiple streams.

Note:Note:

TCP/IP Protocol Suite 617

multiple streams.

Page 618: TCP-IP

Figure 13.3 Multihoming concept

TCP/IP Protocol Suite 618

Page 619: TCP-IP

SCTP association allows multiple IP

addresses for each end.

Note:Note:

TCP/IP Protocol Suite 619

addresses for each end.

Page 620: TCP-IP

13.2 SCTP FEATURES

WeWe discussdiscuss thethe generalgeneral featuresfeatures ofof SCTPSCTP andand thenthen comparecompare themthem withwith

thosethose ofof TCPTCP..

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

Transmission Sequence Number (TSN) Transmission Sequence Number (TSN)

Stream Identifier (SI) Stream Identifier (SI)

TCP/IP Protocol Suite 620

Stream Identifier (SI) Stream Identifier (SI)

Stream Sequence Number (SSN) Stream Sequence Number (SSN)

Packets Packets

Acknowledgment Number Acknowledgment Number

Flow Control Flow Control

Error Control Error Control

Congestion Control Congestion Control

Page 621: TCP-IP

In SCTP, a data chunk is numbered

using a TSN.

Note:Note:

TCP/IP Protocol Suite 621

Page 622: TCP-IP

To distinguish between different

streams, SCTP uses a SI.

Note:Note:

TCP/IP Protocol Suite 622

Page 623: TCP-IP

To distinguish between different data

chunks belonging to the same stream,

SCTP uses SSNs.

Note:Note:

TCP/IP Protocol Suite 623

SCTP uses SSNs.

Page 624: TCP-IP

Figure 13.4 Comparison between a TCP segment and an SCTP packet

TCP/IP Protocol Suite 624

Page 625: TCP-IP

TCP has segments;

SCTP has packets.

Note:Note:

TCP/IP Protocol Suite 625

Page 626: TCP-IP

In SCTP, control information and data

information are carried in separate

chunks.

Note:Note:

TCP/IP Protocol Suite 626

chunks.

Page 627: TCP-IP

Figure 13.5 Packet, data chunks, and streams

TCP/IP Protocol Suite 627

Page 628: TCP-IP

Data chunks are identified by three

identifiers: TSN, SI, and SSN.

TSN is a cumulative number

Note:Note:

TCP/IP Protocol Suite 628

TSN is a cumulative number

identifying the association; SI defines

the stream; SSN defines the chunk in

a stream.

Page 629: TCP-IP

In SCTP, acknowledgment numbers

are used to acknowledge only data

chunks; control chunks are

Note:Note:

TCP/IP Protocol Suite 629

chunks; control chunks are

acknowledged by other control chunks

if necessary.

Page 630: TCP-IP

13.3 PACKET FORMAT

WeWe showshow thethe formatformat ofof aa packetpacket andand differentdifferent typestypes ofof chunkschunks.. AnAn SCTPSCTP

packetpacket hashas aa mandatorymandatory generalgeneral headerheader andand aa setset ofof blocksblocks calledcalled

chunkschunks.. ThereThere areare twotwo typestypes ofof chunkschunks:: controlcontrol chunkschunks andand datadata chunkschunks..

TCP/IP Protocol Suite 630

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

General HeaderGeneral Header

ChunksChunks

Page 631: TCP-IP

Figure 13.6 SCTP packet format

TCP/IP Protocol Suite 631

Page 632: TCP-IP

In an SCTP packet, control chunks

come before data chunks.

Note:Note:

TCP/IP Protocol Suite 632

come before data chunks.

Page 633: TCP-IP

Figure 13.7 General header

TCP/IP Protocol Suite 633

Page 634: TCP-IP

Figure 13.8 Common layout of a chunk

TCP/IP Protocol Suite 634

Page 635: TCP-IP

Chunks need to terminate on a 32-bit

(4 byte) boundary.

Note:Note:

TCP/IP Protocol Suite 635

(4 byte) boundary.

Page 636: TCP-IP

Table 13.2 Table 13.2 ChunksChunks

TCP/IP Protocol Suite 636

Page 637: TCP-IP

The number of padding bytes are not

included in the value of

Note:Note:

TCP/IP Protocol Suite 637

included in the value of

the length field.

Page 638: TCP-IP

Figure 13.9 DATA chunk

TCP/IP Protocol Suite 638

Page 639: TCP-IP

A DATA chunk cannot carry data belonging

to more than one message, but a message

can be split into several chunks.

Note:Note:

TCP/IP Protocol Suite 639

The data field of the DATA chunk must

carry at least one byte of data, which means

the value of length field cannot be

less than 17.

Page 640: TCP-IP

Figure 13.10 INIT chunk

TCP/IP Protocol Suite 640

Page 641: TCP-IP

No other chunk can be carried in a

packet that carries an INIT chunk.

Note:Note:

TCP/IP Protocol Suite 641

packet that carries an INIT chunk.

Page 642: TCP-IP

Figure 13.11 INIT ACK chunk

TCP/IP Protocol Suite 642

Page 643: TCP-IP

No other chunk can be carried in a

packet that carries an

Note:Note:

TCP/IP Protocol Suite 643

packet that carries an

INIT ACK chunk.

Page 644: TCP-IP

Figure 13.12 COOKIE ECHO chunk

TCP/IP Protocol Suite 644

Page 645: TCP-IP

Figure 13.13 COOKIE ACK

TCP/IP Protocol Suite 645

Page 646: TCP-IP

Figure 13.14 SACK chunk

TCP/IP Protocol Suite 646

Page 647: TCP-IP

Figure 13.15 HEARTBEAT and HEARTBEAT ACK chunks

TCP/IP Protocol Suite 647

Page 648: TCP-IP

Figure 13.16 SHUTDOWN, SHUTDOWN ACK, and SHUTDOWN

COMPLETE chunks

TCP/IP Protocol Suite 648

Page 649: TCP-IP

Figure 13.17 ERROR chunk

TCP/IP Protocol Suite 649

Page 650: TCP-IP

Table 13.3 Table 13.3 ErrorsErrors

TCP/IP Protocol Suite 650

Page 651: TCP-IP

Figure 13.18 ABORT chunk

TCP/IP Protocol Suite 651

Page 652: TCP-IP

13.4 AN SCTP ASSOCIATION

SCTP,SCTP, likelike TCP,TCP, isis aa connectionconnection--orientedoriented protocolprotocol.. However,However, aa

connectionconnection inin SCTPSCTP isis calledcalled anan associationassociation toto emphasizeemphasize multihomingmultihoming

TCP/IP Protocol Suite 652

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

Association Establishment Association Establishment

Data Transfer Data Transfer

Association Termination Association Termination

Association Abortion Association Abortion

Page 653: TCP-IP

A connection in SCTP is called an

association.

Note:Note:

TCP/IP Protocol Suite 653

association.

Page 654: TCP-IP

Figure 13.19 Four-way handshaking

TCP/IP Protocol Suite 654

Page 655: TCP-IP

No other chunk is allowed in a packet

carrying an INIT or INIT ACK chunk.

Note:Note:

TCP/IP Protocol Suite 655

A COOKIE ECHO or a COOKIE ACK

chunk can carry DATA chunks.

Page 656: TCP-IP

In SCTP, only DATA chunks consume

TSNs;

Note:Note:

TCP/IP Protocol Suite 656

DATA chunks are the only chunks that

are acknowledged.

Page 657: TCP-IP

Figure 13.20 Simple data transfer

TCP/IP Protocol Suite 657

Page 658: TCP-IP

The acknowledgment in SCTP defines

the cumulative TSN, the TSN of the

last DATA chunk received in order.

Note:Note:

TCP/IP Protocol Suite 658

last DATA chunk received in order.

Page 659: TCP-IP

Figure 13.21 Association termination

TCP/IP Protocol Suite 659

Page 660: TCP-IP

Figure 13.22 Association abortion

TCP/IP Protocol Suite 660

Page 661: TCP-IP

13.5 STATE TRANSITION DIAGRAM

ToTo keepkeep tracktrack ofof allall thethe differentdifferent eventsevents happeninghappening duringduring associationassociation

establishment,establishment, associationassociation termination,termination, andand datadata transfer,transfer, thethe SCTPSCTP

software,software, likelike TCP,TCP, isis implementedimplemented asas aa finitefinite statestate machinemachine..

TCP/IP Protocol Suite 661

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

Scenarios Scenarios

Simultaneous Close Simultaneous Close

Page 662: TCP-IP

Figure 13.23 State transition diagram

TCP/IP Protocol Suite 662

Page 663: TCP-IP

Table 13.4 Table 13.4 States for SCTPStates for SCTP

TCP/IP Protocol Suite 663

Page 664: TCP-IP

Figure 13.24 A common scenario of states

TCP/IP Protocol Suite 664

Page 665: TCP-IP

Figure 13.25 Simultaneous open

TCP/IP Protocol Suite 665

Page 666: TCP-IP

Figure 13.26 Simultaneous close

TCP/IP Protocol Suite 666

Page 667: TCP-IP

13.6 FLOW CONTROL

FlowFlow controlcontrol inin SCTPSCTP isis similarsimilar toto thatthat inin TCPTCP.. InIn SCTP,SCTP, wewe needneed toto

handlehandle twotwo unitsunits ofof data,data, thethe bytebyte andand thethe chunkchunk..

TCP/IP Protocol Suite 667

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

Receiver Site Receiver Site

Sender Site Sender Site

A Scenario A Scenario

Page 668: TCP-IP

Figure 13.27 Flow control, receiver site

TCP/IP Protocol Suite 668

Page 669: TCP-IP

Figure 13.28 Flow control, sender site

TCP/IP Protocol Suite 669

Page 670: TCP-IP

Figure 13.29 Flow control scenario

TCP/IP Protocol Suite 670

Page 671: TCP-IP

13.7 ERROR CONTROL

SCTPSCTP usesuses aa SACKSACK chunkchunk toto reportreport thethe statestate ofof thethe receiverreceiver bufferbuffer toto thethe

sendersender.. EachEach implementationimplementation usesuses aa differentdifferent setset ofof entitiesentities andand timerstimers

forfor thethe receiverreceiver andand sendersender sitessites..

TCP/IP Protocol Suite 671

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

Receiver Site Receiver Site

Sender Site Sender Site

Sending Data Chunks Sending Data Chunks

Generating SACK Chunks Generating SACK Chunks

Page 672: TCP-IP

Figure 13.30 Error control, receiver site

TCP/IP Protocol Suite 672

Page 673: TCP-IP

Figure 13.31 Error control, sender site

TCP/IP Protocol Suite 673

Page 674: TCP-IP

Figure 13.32 New state at the sender site after receiving a SACK chunk

TCP/IP Protocol Suite 674

Page 675: TCP-IP

13.8 CONGESTION CONTROL

SCTPSCTP usesuses thethe samesame strategiesstrategies forfor congestioncongestion controlcontrol asas TCPTCP.. SCTPSCTP usesuses

slowslow start,start, congestioncongestion avoidance,avoidance, andand congestioncongestion detectiondetection phasesphases.. SCTPSCTP

alsoalso usesuses fastfast retransmissionretransmission andand fastfast recoveryrecovery..

TCP/IP Protocol Suite 675

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

Congestion Control and Multihoming Congestion Control and Multihoming

Explicit Congestion Notification Explicit Congestion Notification

Page 676: TCP-IP

Chapter 14Chapter 14Chapter 14Chapter 14Chapter 14Chapter 14Chapter 14Chapter 14

Upon completion you will be able to:

Unicast Routing Protocols:Unicast Routing Protocols:

RIP, OSPF, and BGPRIP, OSPF, and BGP

Objectives

TCP/IP Protocol Suite 676

Upon completion you will be able to:

• Distinguish between intra and interdomain routing

• Understand distance vector routing and RIP

• Understand link state routing and OSPF

• Understand path vector routing and BGP

Page 677: TCP-IP

14.1 INTRA- AND INTERDOMAIN

ROUTING

RoutingRouting insideinside anan autonomousautonomous systemsystem isis referredreferred toto asas intradomainintradomain

routingrouting.. RoutingRouting betweenbetween autonomousautonomous systemssystems isis referredreferred toto asas

interdomaininterdomain routingrouting..

TCP/IP Protocol Suite 677

Page 678: TCP-IP

Figure 14.1 Autonomous systems

TCP/IP Protocol Suite 678

Page 679: TCP-IP

Figure 14.2 Popular routing protocols

TCP/IP Protocol Suite 679

Page 680: TCP-IP

14.2 DISTANCE VECTOR ROUTING

InIn distancedistance vectorvector routing,routing, thethe leastleast costcost routeroute betweenbetween anyany twotwo nodesnodes isis

thethe routeroute withwith minimumminimum distancedistance.. InIn thisthis protocolprotocol eacheach nodenode maintainsmaintains aa

vectorvector (table)(table) ofof minimumminimum distancesdistances toto everyevery nodenode

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

TCP/IP Protocol Suite 680

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

Initialization Initialization

Sharing Sharing

Updating Updating

When to Share When to Share

TwoTwo--Node Loop Instability Node Loop Instability

ThreeThree--Node Instability Node Instability

Page 681: TCP-IP

Figure 14.3 Distance vector routing tables

TCP/IP Protocol Suite 681

Page 682: TCP-IP

Figure 14.4 Initialization of tables in distance vector routing

TCP/IP Protocol Suite 682

Page 683: TCP-IP

In distance vector routing, each node

shares its routing table with its

immediate neighbors periodically and

Note:Note:

TCP/IP Protocol Suite 683

immediate neighbors periodically and

when there is a change.

Page 684: TCP-IP

Figure 14.5 Updating in distance vector routing

TCP/IP Protocol Suite 684

Page 685: TCP-IP

Figure 14.6 Two-node instability

TCP/IP Protocol Suite 685

Page 686: TCP-IP

Figure 14.7 Three-node instability

TCP/IP Protocol Suite 686

Page 687: TCP-IP

14.3 RIP

TheThe RoutingRouting InformationInformation ProtocolProtocol (RIP)(RIP) isis anan intradomainintradomain routingrouting

protocolprotocol usedused insideinside anan autonomousautonomous systemsystem.. ItIt isis aa veryvery simplesimple protocolprotocol

basedbased onon distancedistance vectorvector routingrouting..

TCP/IP Protocol Suite 687

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

RIP Message Format RIP Message Format

Requests and Responses Requests and Responses

Timers in RIP Timers in RIP

RIP Version 2 RIP Version 2

Encapsulation Encapsulation

Page 688: TCP-IP

Figure 14.8 Example of a domain using RIP

TCP/IP Protocol Suite 688

Page 689: TCP-IP

Figure 14.9 RIP message format

TCP/IP Protocol Suite 689

Page 690: TCP-IP

Figure 14.10 Request messages

TCP/IP Protocol Suite 690

Page 691: TCP-IP

Figure 14.11 shows the update message sent from router R1 to

router R2 in Figure 14.8. The message is sent out of interface

130.10.0.2.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

The message is prepared with the combination of split horizon

and poison reverse strategy in mind. Router R1 has obtained

information about networks 195.2.4.0, 195.2.5.0, and 195.2.6.0

TCP/IP Protocol Suite 691

See Next Slide

information about networks 195.2.4.0, 195.2.5.0, and 195.2.6.0

from router R2. When R1 sends an update message to R2, it

replaces the actual value of the hop counts for these three

networks with 16 (infinity) to prevent any confusion for R2.

The figure also shows the table extracted from the message.

Router R2 uses the source address of the IP datagram carrying

the RIP message from R1 (130.10.02) as the next hop address.

Page 692: TCP-IP

Figure 14.11 Solution to Example 1

TCP/IP Protocol Suite 692

Page 693: TCP-IP

Figure 14.12 RIP timers

TCP/IP Protocol Suite 693

Page 694: TCP-IP

A routing table has 20 entries. It does not receive information

about five routes for 200 s. How many timers are running at

this time?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

Solution

TCP/IP Protocol Suite 694

Solution

The 21 timers are listed below:

Periodic timer: 1

Expiration timer: 20 − 5 = 15

Garbage collection timer: 5

Page 695: TCP-IP

Figure 14.13 RIP version 2 format

TCP/IP Protocol Suite 695

Page 696: TCP-IP

Figure 14.14 Authentication

TCP/IP Protocol Suite 696

Page 697: TCP-IP

RIP uses the services of UDP on

Note:Note:

TCP/IP Protocol Suite 697

RIP uses the services of UDP on

well-known port 520.

Page 698: TCP-IP

14.4 LINK STATE ROUTING

InIn linklink statestate routing,routing, ifif eacheach nodenode inin thethe domaindomain hashas thethe entireentire topologytopology

ofof thethe domain,domain, thethe nodenode cancan useuse Dijkstra’sDijkstra’s algorithmalgorithm toto buildbuild aa routingrouting

tabletable..

TCP/IP Protocol Suite 698

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

Building Routing Tables Building Routing Tables

Page 699: TCP-IP

Figure 14.15 Concept of link state routing

TCP/IP Protocol Suite 699

Page 700: TCP-IP

Figure 14.16 Link state knowledge

TCP/IP Protocol Suite 700

Page 701: TCP-IP

Figure 14.17 Dijkstra algorithm

TCP/IP Protocol Suite 701

Page 702: TCP-IP

Figure 14.18 Example of formation of shortest path tree

TCP/IP Protocol Suite 702

Page 703: TCP-IP

Table 14.1 Table 14.1 Routing table for node ARouting table for node A

TCP/IP Protocol Suite 703

Page 704: TCP-IP

14.5 OSPF

TheThe OpenOpen ShortestShortest PathPath FirstFirst (OSPF)(OSPF) protocolprotocol isis anan intradomainintradomain routingrouting

protocolprotocol basedbased onon linklink statestate routingrouting.. ItsIts domaindomain isis alsoalso anan autonomousautonomous

systemsystem..

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

TCP/IP Protocol Suite 704

Areas Areas

Metric Metric

Types of Links Types of Links

Graphical Representation Graphical Representation

OSPF Packets OSPF Packets

Link State Update Packet Link State Update Packet

Other Packets Other Packets

Encapsulation Encapsulation

Page 705: TCP-IP

Figure 14.19 Areas in an autonomous system

TCP/IP Protocol Suite 705

Page 706: TCP-IP

Figure 14.20 Types of links

TCP/IP Protocol Suite 706

Page 707: TCP-IP

Figure 14.21 Point-to-point link

TCP/IP Protocol Suite 707

Page 708: TCP-IP

Figure 14.22 Transient link

TCP/IP Protocol Suite 708

Page 709: TCP-IP

Figure 14.23 Stub link

TCP/IP Protocol Suite 709

Page 710: TCP-IP

Figure 14.24 Example of an AS and its graphical representation in OSPF

TCP/IP Protocol Suite 710

Page 711: TCP-IP

Figure 14.25 Types of OSPF packets

TCP/IP Protocol Suite 711

Page 712: TCP-IP

Figure 14.26 OSPF common header

TCP/IP Protocol Suite 712

Page 713: TCP-IP

Figure 14.27 Link state update packet

TCP/IP Protocol Suite 713

Page 714: TCP-IP

Figure 14.28 LSA general header

TCP/IP Protocol Suite 714

Page 715: TCP-IP

Figure 14.29 Router link

TCP/IP Protocol Suite 715

Page 716: TCP-IP

Figure 14.30 Router link LSA

TCP/IP Protocol Suite 716

Page 717: TCP-IP

Table 14.2 Table 14.2 Link types, link identification, and link dataLink types, link identification, and link data

TCP/IP Protocol Suite 717

Page 718: TCP-IP

Give the router link LSA sent by router 10.24.7.9 in

Figure 14.31.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

See Next Slide

TCP/IP Protocol Suite 718

Solution

This router has three links: two of type 1 (point-to-

point) and one of type 3 (stub network). Figure 14.32

shows the router link LSA.

See Figure 14.32

Page 719: TCP-IP

Figure 14.31 Example 3

TCP/IP Protocol Suite 719

Page 720: TCP-IP

Figure 14.32 Solution to Example 3

TCP/IP Protocol Suite 720

Page 721: TCP-IP

Figure 14.33 Network link

TCP/IP Protocol Suite 721

Page 722: TCP-IP

Figure 14.34 Network link advertisement format

TCP/IP Protocol Suite 722

Page 723: TCP-IP

Give the network link LSA in Figure 14.35.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

See Next Slide

TCP/IP Protocol Suite 723

Solution.

See Figure 14.36

Page 724: TCP-IP

Figure 14.35 Example 4

TCP/IP Protocol Suite 724

Page 725: TCP-IP

Figure 14.36 Solution to Example 4

TCP/IP Protocol Suite 725

Page 726: TCP-IP

In Figure 14.37, which router(s) sends out router link LSAs?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

See Next Slide

TCP/IP Protocol Suite 726

Solution

All routers advertise router link LSAs.

a. R1 has two links, N1 and N2.

b. R2 has one link, N1.

c. R3 has two links, N2 and N3.

Page 727: TCP-IP

Figure 14.37 Example 5 and Example 6

TCP/IP Protocol Suite 727

Page 728: TCP-IP

In Figure 14.37, which router(s) sends out the network link

LSAs?

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 6666

Solution

All three network must advertise network links:

TCP/IP Protocol Suite 728

All three network must advertise network links:

a. Advertisement for N1 is done by R1 because it is the only

attached router and therefore the designated router.

b. Advertisement for N2 can be done by either R1, R2, or R3,

depending on which one is chosen as the designated router.

c. Advertisement for N3 is done by R3 because it is the only

attached router and therefore the designated router.

Page 729: TCP-IP

Figure 14.38 Summary link to network

TCP/IP Protocol Suite 729

Page 730: TCP-IP

Figure 14.39 Summary link to network LSA

TCP/IP Protocol Suite 730

Page 731: TCP-IP

Figure 14.40 Summary link to AS boundary router

TCP/IP Protocol Suite 731

Page 732: TCP-IP

Figure 14.41 Summary link to AS boundary router LSA

TCP/IP Protocol Suite 732

Page 733: TCP-IP

Figure 14.42 External link

TCP/IP Protocol Suite 733

Page 734: TCP-IP

Figure 14.43 External link LSA

TCP/IP Protocol Suite 734

Page 735: TCP-IP

Figure 14.44 Hello packet

TCP/IP Protocol Suite 735

Page 736: TCP-IP

Figure 14.45 Database description packet

TCP/IP Protocol Suite 736

Page 737: TCP-IP

Figure 14.46 Link state request packet

TCP/IP Protocol Suite 737

Page 738: TCP-IP

Figure 14.47 Link state acknowledgment packet

TCP/IP Protocol Suite 738

Page 739: TCP-IP

OSPF packets are encapsulated in IP

Note:Note:

TCP/IP Protocol Suite 739

OSPF packets are encapsulated in IP

datagrams.

Page 740: TCP-IP

14.6 PATH VECTOR ROUTING

PathPath vectorvector routingrouting isis similarsimilar toto distancedistance vectorvector routingrouting.. ThereThere isis atat leastleast

oneone node,node, calledcalled thethe speakerspeaker node,node, inin eacheach ASAS thatthat createscreates aa routingrouting tabletable

andand advertisesadvertises itit toto speakerspeaker nodesnodes inin thethe neighboringneighboring ASsASs....

TCP/IP Protocol Suite 740

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

Initialization Initialization

Sharing Sharing

Updating Updating

Page 741: TCP-IP

Figure 14.48 Initial routing tables in path vector routing

TCP/IP Protocol Suite 741

Page 742: TCP-IP

Figure 14.49 Stabilized tables for four autonomous systems

TCP/IP Protocol Suite 742

Page 743: TCP-IP

14.7 BGP

BorderBorder GatewayGateway ProtocolProtocol (BGP)(BGP) isis anan interdomaininterdomain routingrouting protocolprotocol

usingusing pathpath vectorvector routingrouting.. ItIt firstfirst appearedappeared inin 19891989 andand hashas gonegone throughthrough

fourfour versionsversions..

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

TCP/IP Protocol Suite 743

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

Types of Autonomous Systems Types of Autonomous Systems

Path Attributes Path Attributes

BGP Sessions BGP Sessions

External and Internal BGP External and Internal BGP

Types of Packets Types of Packets

Packet Format Packet Format

Encapsulation Encapsulation

Page 744: TCP-IP

Figure 14.50 Internal and external BGP sessions

TCP/IP Protocol Suite 744

Page 745: TCP-IP

Figure 14.51 Types of BGP messages

TCP/IP Protocol Suite 745

Page 746: TCP-IP

Figure 14.52 BGP packet header

TCP/IP Protocol Suite 746

Page 747: TCP-IP

Figure 14.53 Open message

TCP/IP Protocol Suite 747

Page 748: TCP-IP

Figure 14.54 Update message

TCP/IP Protocol Suite 748

Page 749: TCP-IP

BGP supports classless addressing and

Note:Note:

TCP/IP Protocol Suite 749

BGP supports classless addressing and

CIDR.

Page 750: TCP-IP

Figure 14.55 Keepalive message

TCP/IP Protocol Suite 750

Page 751: TCP-IP

Figure 14.56 Notification message

TCP/IP Protocol Suite 751

Page 752: TCP-IP

Table 14.3 Table 14.3 Error codesError codes

TCP/IP Protocol Suite 752

Page 753: TCP-IP

BGP uses the services of TCP

on port 179.

Note:Note:

TCP/IP Protocol Suite 753

on port 179.

Page 754: TCP-IP

Chapter 15Chapter 15Chapter 15Chapter 15Chapter 15Chapter 15Chapter 15Chapter 15

Upon completion you will be able to:

Multicasting andMulticasting and

Multicast Routing ProtocolsMulticast Routing Protocols

Objectives

TCP/IP Protocol Suite 754

Upon completion you will be able to:

• Differentiate between a unicast, multicast, and broadcast message

• Know the many applications of multicasting

• Understand multicast link state routing and MOSPF

• Understand multicast link state routing and DVMRP

• Understand the Core-Based Tree Protocol

• Understand the Protocol Independent Multicast Protocols

• Understand the MBONE concept

Page 755: TCP-IP

15.1 UNICAST, MULTICAST,

AND BROADCAST

AA messagemessage cancan bebe unicast,unicast, multicast,multicast, oror broadcastbroadcast.. LetLet usus clarifyclarify thesethese

termsterms asas theythey relaterelate toto thethe InternetInternet..

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

TCP/IP Protocol Suite 755

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

Unicasting Unicasting

Multicasting Multicasting

Broadcasting Broadcasting

Multicasting versus Multiple Unicasting Multicasting versus Multiple Unicasting

Page 756: TCP-IP

Figure 15.1 Unicasting

TCP/IP Protocol Suite 756

Page 757: TCP-IP

In unicasting, the router forwards the

received packet through only

one of its interfaces.

Note:Note:

TCP/IP Protocol Suite 757

one of its interfaces.

Page 758: TCP-IP

Figure 15.2 Multicasting

TCP/IP Protocol Suite 758

Page 759: TCP-IP

In multicasting, the router may

forward the received packet

through several of its interfaces.

Note:Note:

TCP/IP Protocol Suite 759

through several of its interfaces.

Page 760: TCP-IP

Figure 15.3 Multicasting versus multiple unicasting

TCP/IP Protocol Suite 760

Page 761: TCP-IP

Emulation of multicasting through

multiple unicasting is not efficient and

may create long delays, particularly

Note:Note:

TCP/IP Protocol Suite 761

may create long delays, particularly

with a large group.

Page 762: TCP-IP

15.2 MULTICAST APPLICATIONS

MulticastingMulticasting hashas manymany applicationsapplications todaytoday suchsuch asas accessaccess toto distributeddistributed

databases,databases, informationinformation dissemination,dissemination, teleconferencing,teleconferencing, andand distancedistance

learninglearning..

TCP/IP Protocol Suite 762

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

Access to Distributed Databases Access to Distributed Databases

Information Dissemination Information Dissemination

Dissemination of News Dissemination of News

Teleconferencing Teleconferencing

Distance Learning Distance Learning

Page 763: TCP-IP

15.3 MULTICAST ROUTING

InIn thisthis section,section, wewe firstfirst discussdiscuss thethe ideaidea ofof optimaloptimal routing,routing, commoncommon inin

allall multicastmulticast protocolsprotocols.. WeWe thenthen givegive anan overviewoverview ofof multicastmulticast routingrouting

protocolsprotocols..

TCP/IP Protocol Suite 763

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

Optimal Routing: Shortest Path Trees Optimal Routing: Shortest Path Trees

Routing Protocols Routing Protocols

Page 764: TCP-IP

In unicast routing, each router in the

domain has a table that defines a

shortest path tree to possible

Note:Note:

TCP/IP Protocol Suite 764

shortest path tree to possible

destinations.

Page 765: TCP-IP

Figure 15.4 Shortest path tree in unicast routing

TCP/IP Protocol Suite 765

Page 766: TCP-IP

In multicast routing, each involved

router needs to construct a shortest

path tree for each group.

Note:Note:

TCP/IP Protocol Suite 766

path tree for each group.

Page 767: TCP-IP

In the source-based tree approach,

each router needs to have one shortest

path tree for each group.

Note:Note:

TCP/IP Protocol Suite 767

path tree for each group.

Page 768: TCP-IP

Figure 15.5 Source-based tree approach

TCP/IP Protocol Suite 768

Page 769: TCP-IP

Figure 15.6 Group-shared tree approach

TCP/IP Protocol Suite 769

Page 770: TCP-IP

In the group-shared tree approach,

only the core router, which has a

shortest path tree for each group, is

Note:Note:

TCP/IP Protocol Suite 770

shortest path tree for each group, is

involved in multicasting.

Page 771: TCP-IP

Figure 15.7 Taxonomy of common multicast protocols

TCP/IP Protocol Suite 771

Page 772: TCP-IP

15.4 MULTICAST LINK STATE

ROUTING: MOSPF

InIn thisthis section,section, wewe brieflybriefly discussdiscuss multicastmulticast linklink statestate routingrouting andand itsits

implementationimplementation inin thethe Internet,Internet, MOSPFMOSPF..

TCP/IP Protocol Suite 772

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

Multicast Link State Routing Multicast Link State Routing

MOSPF MOSPF

Page 773: TCP-IP

Multicast link state routing uses the

source-based tree approach.

Note:Note:

TCP/IP Protocol Suite 773

Page 774: TCP-IP

15.5 MULTICAST DISTANCE

VECTOR: DVMRP

InIn thisthis section,section, wewe brieflybriefly discussdiscuss multicastmulticast distancedistance vectorvector routingrouting andand

itsits implementationimplementation inin thethe Internet,Internet, DVMRPDVMRP..

TCP/IP Protocol Suite 774

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

Multicast Distance Vector Routing Multicast Distance Vector Routing

DVMRPDVMRP

Page 775: TCP-IP

Flooding broadcasts packets, but

creates loops in the systems.

Note:Note:

TCP/IP Protocol Suite 775

Page 776: TCP-IP

RPF eliminates the loop in the

flooding process.

Note:Note:

TCP/IP Protocol Suite 776

Page 777: TCP-IP

Figure 15.8 RPF

TCP/IP Protocol Suite 777

Page 778: TCP-IP

Figure 15.9 Problem with RPF

TCP/IP Protocol Suite 778

Page 779: TCP-IP

Figure 15.10 RPF versus RPB

TCP/IP Protocol Suite 779

Page 780: TCP-IP

RPB creates a shortest path broadcast

tree from the source to each destination.

Note:Note:

TCP/IP Protocol Suite 780

It guarantees that each destination

receives one and only one

copy of the packet.

Page 781: TCP-IP

Figure 15.11 RPF, RPB, and RPM

TCP/IP Protocol Suite 781

Page 782: TCP-IP

RPM adds pruning and grafting to

RPB to create a multicast shortest path

tree that supports dynamic

Note:Note:

TCP/IP Protocol Suite 782

tree that supports dynamic

membership changes.

Page 783: TCP-IP

15.6 CBT

TheThe CoreCore--BasedBased TreeTree (CBT)(CBT) protocolprotocol isis aa groupgroup--sharedshared protocolprotocol thatthat

usesuses aa corecore asas thethe rootroot ofof thethe treetree.. TheThe autonomousautonomous systemsystem isis divideddivided intointo

regionsregions andand aa corecore (center(center routerrouter oror rendezvousrendezvous router)router) isis chosenchosen forfor

eacheach regionregion..

TCP/IP Protocol Suite 783

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

Formation of the Tree Formation of the Tree

Sending Multicast Packets Sending Multicast Packets

Selecting the Rendezvous Router Selecting the Rendezvous Router

Page 784: TCP-IP

Figure 15.12 Group-shared tree with rendezvous router

TCP/IP Protocol Suite 784

Page 785: TCP-IP

Figure 15.13 Sending a multicast packet to the rendezvous router

TCP/IP Protocol Suite 785

Page 786: TCP-IP

In CBT, the source sends the multicast

packet (encapsulated in a unicast packet)

to the core router.

Note:Note:

TCP/IP Protocol Suite 786

The core router decapsulates the packet

and forwards it to all interested

interfaces.

Page 787: TCP-IP

15.7 PIM

ProtocolProtocol IndependentIndependent MulticastMulticast (PIM)(PIM) isis thethe namename givengiven toto twotwo

independentindependent multicastmulticast routingrouting protocolsprotocols:: ProtocolProtocol IndependentIndependent

Multicast,Multicast, DenseDense ModeMode (PIM(PIM--DM)DM) andand ProtocolProtocol IndependentIndependent Multicast,Multicast,

SparseSparse ModeMode (PIM(PIM--SM)SM)..

TCP/IP Protocol Suite 787

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

PIMPIM--DM DM

PIMPIM--SM SM

Page 788: TCP-IP

PIM-DM is used in a dense multicast

environment, such as a LAN.

Note:Note:

TCP/IP Protocol Suite 788

Page 789: TCP-IP

PIM-DM uses RPF and

pruning/grafting strategies to handle

multicasting.

Note:Note:

TCP/IP Protocol Suite 789

multicasting.

However, it is independent from the

underlying unicast protocol.

Page 790: TCP-IP

PIM-SM is used in a sparse multicast

environment such as a WAN.

Note:Note:

TCP/IP Protocol Suite 790

Page 791: TCP-IP

PIM-SM is similar to CBT but uses a

simpler procedure.

Note:Note:

TCP/IP Protocol Suite 791

Page 792: TCP-IP

15.8 MBONE

AA multicastmulticast routerrouter maymay notnot findfind anotheranother multicastmulticast routerrouter inin thethe

neighborhoodneighborhood toto forwardforward thethe multicastmulticast packetpacket.. AA solutionsolution forfor thisthis

problemproblem isis tunnelingtunneling.. WeWe makemake aa multicastmulticast backbonebackbone (MBONE)(MBONE) outout ofof

thesethese isolatedisolated routersrouters usingusing thethe conceptconcept ofof tunnelingtunneling..

TCP/IP Protocol Suite 792

Page 793: TCP-IP

Figure 15.14 Logical tunneling

TCP/IP Protocol Suite 793

Page 794: TCP-IP

Figure 15.15 MBONE

TCP/IP Protocol Suite 794

Page 795: TCP-IP

Chapter 16Chapter 16Chapter 16Chapter 16Chapter 16Chapter 16Chapter 16Chapter 16

Upon completion you will be able to:

Host Configuration:Host Configuration:

BOOTP and DHCPBOOTP and DHCP

Objectives

TCP/IP Protocol Suite 795

Upon completion you will be able to:

• Know the types of information required by a system on boot-up

• Know how BOOTP operates

• Know how DHCP operates

• Understand the differences between BOOTP and DHCP

• Understand the DHCP transition state diagram

Page 796: TCP-IP

16.1 BOOTP

TheThe BootstrapBootstrap ProtocolProtocol (BOOTP)(BOOTP) isis aa client/serverclient/server protocolprotocol thatthat

configuresconfigures aa disklessdiskless computercomputer oror aa computercomputer thatthat isis bootedbooted forfor thethe firstfirst

timetime.. BOOTPBOOTP providesprovides thethe IPIP address,address, netnet mask,mask, thethe addressaddress ofof aa defaultdefault

router,router, andand thethe addressaddress ofof aa namename serverserver..

TCP/IP Protocol Suite 796

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

Operation Operation

Packet Format Packet Format

Page 797: TCP-IP

Figure 16.1 Client and server on the same network

TCP/IP Protocol Suite 797

Page 798: TCP-IP

Figure 16.2 Client and server on two different networks

TCP/IP Protocol Suite 798

Page 799: TCP-IP

Figure 16.3 Use of UDP ports

TCP/IP Protocol Suite 799

Page 800: TCP-IP

Figure 16.4 BOOTP packet format

TCP/IP Protocol Suite 800

Page 801: TCP-IP

Figure 16.5 Option format

TCP/IP Protocol Suite 801

Page 802: TCP-IP

Table 16.1 Table 16.1 Options for BOOTPOptions for BOOTP

TCP/IP Protocol Suite 802

Page 803: TCP-IP

16.2 DHCP

TheThe DynamicDynamic HostHost ConfigurationConfiguration ProtocolProtocol (DHCP)(DHCP) providesprovides staticstatic andand

dynamicdynamic addressaddress allocationallocation thatthat cancan bebe manualmanual oror automaticautomatic..

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

TCP/IP Protocol Suite 803

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

Static Address Allocation Static Address Allocation

Dynamic Address Allocation Dynamic Address Allocation

Manual and Automatic Configuration Manual and Automatic Configuration

Packet Format Packet Format

Transition States Transition States

Exchanging Messages Exchanging Messages

Page 804: TCP-IP

DHCP provides static and dynamic

address allocation that can be manual

or automatic.

Note:Note:

TCP/IP Protocol Suite 804

or automatic.

Page 805: TCP-IP

Figure 16.6 DHCP packet

TCP/IP Protocol Suite 805

Page 806: TCP-IP

Table 16.2 Table 16.2 Options for DHCPOptions for DHCP

TCP/IP Protocol Suite 806

Page 807: TCP-IP

Figure 16.7 DHCP transition diagram

TCP/IP Protocol Suite 807

Page 808: TCP-IP

Figure 16.8 Exchanging messages

TCP/IP Protocol Suite 808

Page 809: TCP-IP

Chapter 17Chapter 17Chapter 17Chapter 17Chapter 17Chapter 17Chapter 17Chapter 17

Upon completion you will be able to:

Domain NameDomain Name

System: DNSSystem: DNS

Objectives

TCP/IP Protocol Suite 809

Upon completion you will be able to:

• Understand how the DNS is organized

• Know the domains in the DNS

• Know how a name or address is resolved

• Be familiar with the query and response formats

• Understand the need for DDNS

Page 810: TCP-IP

17.1 NAME SPACE

TheThe namesnames assignedassigned toto machinesmachines mustmust bebe uniqueunique becausebecause thethe addressesaddresses

areare uniqueunique.. AA namename spacespace thatthat mapsmaps eacheach addressaddress toto aa uniqueunique namename cancan

bebe organizedorganized inin twotwo waysways:: flatflat oror hierarchicalhierarchical..

TCP/IP Protocol Suite 810

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

Flat Name Space Flat Name Space

Hierarchical Name Space Hierarchical Name Space

Page 811: TCP-IP

17.2 DOMAIN NAME SPACE

TheThe domaindomain namename spacespace isis hierarchicalhierarchical inin designdesign.. TheThe namesnames areare defineddefined

inin anan invertedinverted--treetree structurestructure withwith thethe rootroot atat thethe toptop.. TheThe treetree cancan havehave

128128 levelslevels:: levellevel 00 (root)(root) toto levellevel 127127..

TCP/IP Protocol Suite 811

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

Label Label

Domain Name Domain Name

Domain Domain

Page 812: TCP-IP

Figure 17.1 Domain name space

TCP/IP Protocol Suite 812

Page 813: TCP-IP

Figure 17.2 Domain names and labels

TCP/IP Protocol Suite 813

Page 814: TCP-IP

Figure 17.3 FQDN and PQDN

TCP/IP Protocol Suite 814

Page 815: TCP-IP

Figure 17.4 Domains

TCP/IP Protocol Suite 815

Page 816: TCP-IP

17.3 DISTRIBUTION OF

NAME SPACE

TheThe informationinformation containedcontained inin thethe domaindomain namename spacespace isis distributeddistributed

amongamong manymany computerscomputers calledcalled DNSDNS serversservers..

TCP/IP Protocol Suite 816

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

Hierarchy of Name Servers Hierarchy of Name Servers

Zone Zone

Root Server Root Server

Primary and Secondary Servers Primary and Secondary Servers

Page 817: TCP-IP

Figure 17.5 Hierarchy of name servers

TCP/IP Protocol Suite 817

Page 818: TCP-IP

Figure 17.6 Zones and domains

TCP/IP Protocol Suite 818

Page 819: TCP-IP

A primary server loads all information

from the disk file; the secondary server

loads all information from the primary

Note:Note:

TCP/IP Protocol Suite 819

server. When the secondary downloads

information from the primary, it is called

zone transfer.

Page 820: TCP-IP

17.4 DNS IN THE INTERNET

TheThe domaindomain namename spacespace (tree)(tree) isis divideddivided intointo threethree differentdifferent sectionssections::

genericgeneric domains,domains, countrycountry domains,domains, andand thethe inverseinverse domaindomain..

TCP/IP Protocol Suite 820

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

Generic Domains Generic Domains

Country Domains Country Domains

Inverse Domain Inverse Domain

Registrar Registrar

Page 821: TCP-IP

Figure 17.7 DNS used in the Internet

TCP/IP Protocol Suite 821

Page 822: TCP-IP

Figure 17.8 Generic domains

TCP/IP Protocol Suite 822

Page 823: TCP-IP

Table 17.1 Table 17.1 Generic domain labelsGeneric domain labels

TCP/IP Protocol Suite 823

Page 824: TCP-IP

Table 17.1 Table 17.1 Generic domain labels (Continued)Generic domain labels (Continued)

TCP/IP Protocol Suite 824

Page 825: TCP-IP

Figure 17.9 Country domains

TCP/IP Protocol Suite 825

Page 826: TCP-IP

Figure 17.10 Inverse domain

TCP/IP Protocol Suite 826

Page 827: TCP-IP

17.5 RESOLUTION

MappingMapping aa namename toto anan addressaddress oror anan addressaddress toto aa namename isis calledcalled namename--

addressaddress resolutionresolution..

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

TCP/IP Protocol Suite 827

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

Resolver Resolver

Mapping Names to Addresses Mapping Names to Addresses

Mapping Addresses to Names Mapping Addresses to Names

Recursive Resolution Recursive Resolution

Iterative Resolution Iterative Resolution

Caching Caching

Page 828: TCP-IP

Figure 17.11 Recursive resolution

TCP/IP Protocol Suite 828

Page 829: TCP-IP

Figure 17.12 Iterative resolution

TCP/IP Protocol Suite 829

Page 830: TCP-IP

17.6 DNS MESSAGES

TheThe DNSDNS queryquery messagemessage consistsconsists ofof aa headerheader andand questionquestion recordsrecords;; thethe

DNSDNS responseresponse messagemessage consistsconsists ofof aa header,header, questionquestion records,records, answeranswer

records,records, authoritativeauthoritative records,records, andand additionaladditional recordsrecords..

TCP/IP Protocol Suite 830

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

Header Header

Page 831: TCP-IP

Figure 17.13 DNS messages

TCP/IP Protocol Suite 831

Page 832: TCP-IP

Figure 17.14 Query and response messages

TCP/IP Protocol Suite 832

Page 833: TCP-IP

Figure 17.15 Header format

TCP/IP Protocol Suite 833

Page 834: TCP-IP

Figure 17.16 Flags field

TCP/IP Protocol Suite 834

Page 835: TCP-IP

Table 17.2 Table 17.2 Values of rCodeValues of rCode

TCP/IP Protocol Suite 835

Page 836: TCP-IP

17.7 TYPES OF RECORDS

TwoTwo typestypes ofof recordsrecords areare usedused inin DNSDNS.. TheThe questionquestion recordsrecords areare usedused inin

thethe questionquestion sectionsection ofof thethe queryquery andand responseresponse messagesmessages.. TheThe resourceresource

recordsrecords areare usedused inin thethe answer,answer, authoritative,authoritative, andand additionaladditional informationinformation

sectionssections ofof thethe responseresponse messagemessage..

TCP/IP Protocol Suite 836

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

Question Record Question Record

Resource Record Resource Record

Page 837: TCP-IP

Figure 17.17 Question record format

TCP/IP Protocol Suite 837

Page 838: TCP-IP

Figure 17.18 Query name format

TCP/IP Protocol Suite 838

Page 839: TCP-IP

Table 17.3 Table 17.3 TypesTypes

TCP/IP Protocol Suite 839

Page 840: TCP-IP

Table 17.4 Table 17.4 ClassesClasses

TCP/IP Protocol Suite 840

Page 841: TCP-IP

Figure 17.19 Resource record format

TCP/IP Protocol Suite 841

Page 842: TCP-IP

17.8 COMPRESSION

DNSDNS requiresrequires thatthat aa domaindomain namename bebe replacedreplaced byby anan offsetoffset pointerpointer ifif itit isis

repeatedrepeated.. DNSDNS definesdefines aa 22--bytebyte offsetoffset pointerpointer thatthat pointspoints toto aa previousprevious

occurrenceoccurrence ofof thethe domaindomain namename oror partpart ofof itit..

TCP/IP Protocol Suite 842

Page 843: TCP-IP

Figure 17.20 Format of an offset pointer

TCP/IP Protocol Suite 843

Page 844: TCP-IP

A resolver sends a query message to a local server to find the

IP address for the host “chal.fhda.edu.”. We discuss the query

and response messages separately.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

Figure 17.21 shows the query message sent by the resolver. The first 2 bytes

show the identifier (1333). It is used as a sequence number and relates a

response to a query. Because a resolver may even send many queries to the

TCP/IP Protocol Suite 844

QR OpCode AA TC RD RA Reserved rCode

0 0000 0 0 1 0 000 0000

response to a query. Because a resolver may even send many queries to the

same server, the identifier helps to sort responses that arrive out of order.

The next bytes contain the flags with the value of 0x0100 in hexadecimal.

In binary it is 0000000100000000, but it is more meaningful to divide it into

the fields as shown below:

Page 845: TCP-IP

Figure 17.21 Example 1: Query message

TCP/IP Protocol Suite 845

Page 846: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

The QR bit defines the message as a query. The OpCode is 0000, which

defines a standard query. The recursion desired (RD) bit is set. (Refer back

to Figure 17.16 for the flags field descriptions.) The message contains only

one question record. The domain name is 4chal4fhda3edu0. The next 2

bytes define the query type as an IP address; the last 2 bytes define the class

as the Internet.

TCP/IP Protocol Suite 846

QR OpCode AA TC RD RA Reserved rCode

1 0000 0 0 1 1 000 0000

Figure 17.22 shows the response of the server. The response is similar to the

query except that the flags are different and the number of answer records

is one. The flags value is 0x8180 in hexadecimal. In binary it is

1000000110000000, but again we divide it into fields as shown below:

Page 847: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

The QR bit defines the message as a response. The OpCode is 0000, which

defines a standard response. The recursion available (RA) and RD bits are

set. The message contains one question record and one answer record. The

question record is repeated from the query message. The answer record has

a value of 0xC00C (split in two lines), which points to the question record

instead of repeating the domain name. The next field defines the domain

type (address). The field after that defines the class (Internet). The field with

TCP/IP Protocol Suite 847

type (address). The field after that defines the class (Internet). The field with

the value 12,000 is the TTL (12,000 s). The next field is the length of the

resource data, which is an IP address (153.18.8.105).

Page 848: TCP-IP

Figure 17.22 Example 1: Response message

TCP/IP Protocol Suite 848

Page 849: TCP-IP

An FTP server has received a packet from an FTP client with

IP address 153.2.7.9. The FTP server wants to verify that the

FTP client is an authorized client. The FTP server can consult

a file containing the list of authorized clients. However, the file

consists only of domain names. The FTP server has only the IP

address of the requesting client, which was the source IP

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 849

address of the requesting client, which was the source IP

address in the received IP datagram. The FTP server asks the

resolver (DNS client) to send an inverse query to a DNS server

to ask for the name of the FTP client. We discuss the query and

response messages separately.

Page 850: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 2 2 2 2 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

QR OpCode AA TC RD RA Reserved rCode

Figure 17.23 shows the query message sent from the resolver to the server.

The first 2 bytes show the identifier (0x1200). The flags value is 0x0900 in

hexadecimal. In binary it is 0000100100000000, and we divide it into fields

as shown below:

TCP/IP Protocol Suite 850

QR OpCode AA TC RD RA Reserved rCode

0 0001 0 0 1 0 000 0000

The OpCode is 0001, which defines an inverse query. The message contains

only one question record. The domain name is 19171231537in-addr4arpa.

The next 2 bytes define the query type as PTR, and the last 2 bytes define

the class as the Internet.

Page 851: TCP-IP

Figure 17.23 Example 2: Inverse query message

TCP/IP Protocol Suite 851

Page 852: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 2 2 2 2 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

QR OpCode AA TC RD RA Reserved rCode

1 0001 1 0 1 1 000 0000

Figure 17.24 shows the response. The flags value is 0x8D80 in

hexadecimal. In binary it is 1000110110000000, and we divide it into fields

as shown below:

TCP/IP Protocol Suite 852

1 0001 1 0 1 1 000 0000

Page 853: TCP-IP

Figure 17.24 Example 2: Inverse response message

TCP/IP Protocol Suite 853

Page 854: TCP-IP

In UNIX and Windows, the nslookup utility can be used to

retrieve address/name mapping. The following shows how we

can retrieve an address when the domain name is given.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

$ nslookup fhda.eduName: fhda.edu

Address: 153.18.8.1

TCP/IP Protocol Suite 854

Address: 153.18.8.1

The nslookup utility can also be used to retrieve the domain

name when the address is given as shown below:

$ nslookup 153.18.8.11.8.18.153.in-addr.arpa name = tiptoe.fhda.edu.

Page 855: TCP-IP

17.9 DDNS

TheThe DynamicDynamic DomainDomain NameName SystemSystem (DDNS)(DDNS) updatesupdates thethe DNSDNS mastermaster

filefile dynamicallydynamically..

TCP/IP Protocol Suite 855

Page 856: TCP-IP

17.10 ENCAPSULATION

DNSDNS usesuses UDPUDP asas thethe transporttransport protocolprotocol whenwhen thethe sizesize ofof thethe responseresponse

messagemessage isis lessless thanthan 512512 bytesbytes.. IfIf thethe sizesize ofof thethe responseresponse messagemessage isis

moremore thanthan 512512 bytes,bytes, aa TCPTCP connectionconnection isis usedused..

TCP/IP Protocol Suite 856

Page 857: TCP-IP

DNS can use the services of UDP or

TCP using the well-known port 53.

Note:Note:

TCP/IP Protocol Suite 857

Page 858: TCP-IP

Chapter 18Chapter 18Chapter 18Chapter 18Chapter 18Chapter 18Chapter 18Chapter 18

Upon completion you will be able to:

Remote Login:Remote Login:

TelnetTelnet

Objectives

TCP/IP Protocol Suite 858

Upon completion you will be able to:

• Understand how TELNET works

• Understand the role of NVT in a TELNET communication

• Understand TELNET option and suboption negotiation

• Know how control characters are used

• Know the TELNET modes of operation

Page 859: TCP-IP

TELNET is a general-purpose

client-server application program.

Note:Note:

TCP/IP Protocol Suite 859

client-server application program.

Page 860: TCP-IP

18.1 CONCEPT

TELNETTELNET enablesenables thethe establishmentestablishment ofof aa connectionconnection toto aa remoteremote systemsystem

inin suchsuch aa wayway thatthat thethe locallocal terminalterminal appearsappears toto bebe aa terminalterminal atat thethe

remoteremote systemsystem..

TCP/IP Protocol Suite 860

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

TimeTime--Sharing Environment Sharing Environment

Login Login

Page 861: TCP-IP

Figure 18.1 Local login

TCP/IP Protocol Suite 861

Page 862: TCP-IP

Figure 18.2 Remote login

TCP/IP Protocol Suite 862

Page 863: TCP-IP

18.2 NETWORK VIRTUAL

TERMINAL (NVT)

ViaVia aa universaluniversal interfaceinterface calledcalled thethe NetworkNetwork VirtualVirtual TerminalTerminal (NVT)(NVT)

charactercharacter set,set, thethe TELNETTELNET clientclient translatestranslates characterscharacters (data(data oror

commands)commands) thatthat comecome fromfrom thethe locallocal terminalterminal intointo NVTNVT formform andand

deliversdelivers themthem toto thethe networknetwork.. TheThe TELNETTELNET serverserver translatestranslates datadata andand

commandscommands fromfrom NVTNVT formform intointo thethe formform acceptableacceptable byby thethe remoteremote

computercomputer..

TCP/IP Protocol Suite 863

Page 864: TCP-IP

Figure 18.3 Concept of NVT

TCP/IP Protocol Suite 864

Page 865: TCP-IP

18.3 NVT CHARACTER SET

NVTNVT usesuses twotwo setssets ofof characters,characters, oneone forfor datadata andand oneone forfor controlcontrol.. BothBoth

areare 88--bitbit bytesbytes..

TCP/IP Protocol Suite 865

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

Data Characters Data Characters

Control Characters Control Characters

Page 866: TCP-IP

Figure 18.4 Format of data characters

TCP/IP Protocol Suite 866

Page 867: TCP-IP

Figure 18.5 Format of control characters

TCP/IP Protocol Suite 867

Page 868: TCP-IP

Table 18.1 Table 18.1 Some NVT control charactersSome NVT control characters

TCP/IP Protocol Suite 868

Page 869: TCP-IP

18.4 EMBEDDING

TheThe samesame connectionconnection isis usedused byby TELNETTELNET forfor sendingsending bothboth datadata andand

controlcontrol characterscharacters.. TELNETTELNET accomplishesaccomplishes thisthis byby embeddingembedding thethe controlcontrol

characterscharacters inin thethe datadata streamstream..

TCP/IP Protocol Suite 869

Page 870: TCP-IP

Figure 18.6 An example of embedding

TCP/IP Protocol Suite 870

Page 871: TCP-IP

18.5 OPTIONS

TELNETTELNET letslets thethe clientclient andand serverserver negotiatenegotiate optionsoptions beforebefore oror duringduring thethe

useuse ofof thethe serviceservice.. OptionsOptions areare extraextra featuresfeatures availableavailable toto aa useruser withwith aa

moremore sophisticatedsophisticated terminalterminal..

TCP/IP Protocol Suite 871

Page 872: TCP-IP

Table 18.2 Table 18.2 OptionsOptions

TCP/IP Protocol Suite 872

Page 873: TCP-IP

18.6 OPTION NEGOTIATION

ToTo useuse anyany ofof thethe optionsoptions firstfirst requiresrequires optionoption negotiationnegotiation betweenbetween thethe

clientclient andand thethe serverserver.. FourFour controlcontrol characterscharacters areare usedused forfor thisthis purposepurpose..

TCP/IP Protocol Suite 873

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

Enabling an Option Enabling an Option

Disabling an Option Disabling an Option

Symmetry Symmetry

Page 874: TCP-IP

Table 18.3 Table 18.3 NVT character set for option negotiationNVT character set for option negotiation

TCP/IP Protocol Suite 874

Page 875: TCP-IP

Figure 18.7 Offer to enable an option

TCP/IP Protocol Suite 875

Page 876: TCP-IP

Figure 18.8 Request to enable an option

TCP/IP Protocol Suite 876

Page 877: TCP-IP

Figure 18.9 Offer to disable an option

TCP/IP Protocol Suite 877

Page 878: TCP-IP

Figure 18.10 Request to disable an option

TCP/IP Protocol Suite 878

Page 879: TCP-IP

Figure 18.11 shows an example of option negotiation. In this

example, the client wants the server to echo each character

sent to the server. In other words, when a character is typed at

the user keyboard terminal, it goes to the server and is sent

back to the screen of the user before being processed. The echo

option is enabled by the server because it is the server that

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 879

option is enabled by the server because it is the server that

sends the characters back to the user terminal. Therefore, the

client should request from the server the enabling of the option

using DO. The request consists of three characters: IAC, DO,

and ECHO. The server accepts the request and enables the

option. It informs the client by sending the three character

approval: IAC, WILL, and ECHO.

See Next Slide

Page 880: TCP-IP

Figure 18.11 Example 1: Echo option

TCP/IP Protocol Suite 880

Page 881: TCP-IP

18.7 SUBOPTION NEGOTIATION

SomeSome optionsoptions requirerequire additionaladditional informationinformation.. TheThe clientclient andand serverserver agreeagree

throughthrough aa processprocess calledcalled suboptionsuboption negotiationnegotiation..

TCP/IP Protocol Suite 881

Page 882: TCP-IP

Table 18.4 Table 18.4 NVT character set for suboption negotiationNVT character set for suboption negotiation

TCP/IP Protocol Suite 882

Page 883: TCP-IP

Figure 18.12 Example of suboption negotiation

TCP/IP Protocol Suite 883

Page 884: TCP-IP

18.8 CONTROLLING THE SERVER

ControlControl characterscharacters cancan bebe usedused toto controlcontrol thethe remoteremote serverserver..

TCP/IP Protocol Suite 884

Page 885: TCP-IP

Table 18.5 Table 18.5 Characters used to control the applicationCharacters used to control the application

program running on remote serverprogram running on remote server

TCP/IP Protocol Suite 885

Page 886: TCP-IP

Figure 18.13 Example of interrupting an application program

TCP/IP Protocol Suite 886

Page 887: TCP-IP

18.9 OUT-OF-BAND SIGNALING

ToTo makemake controlcontrol characterscharacters effectiveeffective inin specialspecial situations,situations, TELNETTELNET usesuses

outout--ofof--bandband signaling,signaling, aa techniquetechnique inin whichwhich thethe controlcontrol characterscharacters areare

precededpreceded byby IACIAC andand areare sentsent outout ofof orderorder toto thethe remoteremote processprocess..

TCP/IP Protocol Suite 887

Page 888: TCP-IP

Figure 18.14 Out-of-band signaling

TCP/IP Protocol Suite 888

Page 889: TCP-IP

18.10 ESCAPE CHARACTER

WhenWhen aa useruser wantswants characterscharacters interpretedinterpreted byby thethe clientclient insteadinstead ofof thethe

server,server, hehe cancan useuse anan escapeescape character,character, normallynormally Ctrl+]Ctrl+] (shown(shown asas ^])^])..

TCP/IP Protocol Suite 889

Page 890: TCP-IP

Figure 18.15 Two different interruptions

TCP/IP Protocol Suite 890

Page 891: TCP-IP

18.11 MODE OF OPERATION

MostMost TELNETTELNET implementationsimplementations operateoperate inin oneone ofof threethree modesmodes:: defaultdefault

mode,mode, charactercharacter mode,mode, oror lineline modemode..

TCP/IP Protocol Suite 891

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

Default ModeDefault Mode

Character Mode Character Mode

Line Mode Line Mode

Page 892: TCP-IP

In this example, we use the default mode to show the concept

and its deficiencies even though it is almost obsolete today. The

client and the server negotiate the terminal type and terminal

speed and then the server checks the login and password of the

user (see Figure 18.16).

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 892

user (see Figure 18.16).

See Next Slide

Page 893: TCP-IP

Figure 18.16 Example 2

TCP/IP Protocol Suite 893

Page 894: TCP-IP

In this example, we show how the client switches to the

character mode. This requires that the client request the server

to enable the SUPPRESS GO AHEAD and ECHO options (see

Figure 18.17).

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 894

See Next Slide

Page 895: TCP-IP

Figure 18.17 Example 3

TCP/IP Protocol Suite 895

Page 896: TCP-IP

18.12 USER INTERFACE

TheThe operatingoperating systemsystem (UNIX,(UNIX, forfor example)example) definesdefines anan interfaceinterface toto

TELNETTELNET withwith useruser--friendlyfriendly commandscommands.. TheThe interfaceinterface isis responsibleresponsible forfor

translatingtranslating thethe useruser--friendlyfriendly commandscommands toto thethe TELNETTELNET commandscommands..

TCP/IP Protocol Suite 896

Page 897: TCP-IP

Table 18.6 Table 18.6 Examples of interface commandsExamples of interface commands

TCP/IP Protocol Suite 897

Page 898: TCP-IP

18.13 SECURITY ISSUE

TELNETTELNET sufferssuffers fromfrom securitysecurity problemsproblems.. TELNETTELNET requiresrequires aa loginlogin

namename andand passwordpassword (when(when exchangingexchanging text)text).. AA microcomputermicrocomputer connectedconnected

toto aa broadcastbroadcast LANLAN cancan easilyeasily eavesdropeavesdrop usingusing snoopersnooper softwaresoftware toto

capturecapture aa loginlogin namename andand thethe correspondingcorresponding passwordpassword (even(even ifif itit isis

encrypted)encrypted)..

TCP/IP Protocol Suite 898

Page 899: TCP-IP

Chapter 19Chapter 19Chapter 19Chapter 19Chapter 19Chapter 19Chapter 19Chapter 19

Upon completion you will be able to:

File Transfer:File Transfer:

FTP and TFTPFTP and TFTP

Objectives

TCP/IP Protocol Suite 899

Upon completion you will be able to:

• Understand the connections needed for FTP file transfer

• Be familiar with FTP commands and responses

• Know the differences between FTP and TFTP

• Be familiar with TFTP message types

• Understand TFTP flow and error control

Page 900: TCP-IP

19.1 FILE TRANSFER

PROTOCOL (FTP)

FileFile TransferTransfer ProtocolProtocol (FTP)(FTP) isis thethe standardstandard mechanismmechanism providedprovided byby

TCP/IPTCP/IP forfor copyingcopying aa filefile fromfrom oneone hosthost toto anotheranother..

TCP/IP Protocol Suite 900

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

Connections Connections

Communication Communication

Command Processing Command Processing

File Transfer File Transfer

Anonymous FTP Anonymous FTP

Page 901: TCP-IP

FTP uses the services of TCP. It needs

two TCP connections.

Note:Note:

TCP/IP Protocol Suite 901

The well-known port 21 is used for the

control connection and the well-

known port 20 for the data connection.

Page 902: TCP-IP

Figure 19.1 FTP

TCP/IP Protocol Suite 902

Page 903: TCP-IP

Figure 19.2 Opening the control connection

TCP/IP Protocol Suite 903

Page 904: TCP-IP

Figure 19.3 Creating the data connection

TCP/IP Protocol Suite 904

Page 905: TCP-IP

Figure 19.4 Using the control connection

TCP/IP Protocol Suite 905

Page 906: TCP-IP

Figure 19.5 Using the data connection

TCP/IP Protocol Suite 906

Page 907: TCP-IP

Figure 19.6 Command processing

TCP/IP Protocol Suite 907

Page 908: TCP-IP

Table 19.1 Table 19.1 Access commandsAccess commands

TCP/IP Protocol Suite 908

Page 909: TCP-IP

Table 19.2 Table 19.2 File management commandsFile management commands

TCP/IP Protocol Suite 909

Page 910: TCP-IP

Table 19.3 Table 19.3 Data formatting commandsData formatting commands

TCP/IP Protocol Suite 910

Page 911: TCP-IP

Table 19.4 Table 19.4 Port defining commandsPort defining commands

TCP/IP Protocol Suite 911

Page 912: TCP-IP

Table 19.5 Table 19.5 File transfer commandsFile transfer commands

TCP/IP Protocol Suite 912

Page 913: TCP-IP

Table 19.5 Table 19.5 File transfer commands (continued)File transfer commands (continued)

TCP/IP Protocol Suite 913

Page 914: TCP-IP

Table 19.6 Table 19.6 Miscellaneous commandsMiscellaneous commands

TCP/IP Protocol Suite 914

Page 915: TCP-IP

Table 19.7 Table 19.7 ResponsesResponses

TCP/IP Protocol Suite 915

Page 916: TCP-IP

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

TCP/IP Protocol Suite 916

Page 917: TCP-IP

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

TCP/IP Protocol Suite 917

Page 918: TCP-IP

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

TCP/IP Protocol Suite 918

Page 919: TCP-IP

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

Table 19.7 Table 19.7 Responses (continued)Responses (continued)

TCP/IP Protocol Suite 919

Page 920: TCP-IP

Figure 19.7 File transfer

TCP/IP Protocol Suite 920

Page 921: TCP-IP

Figure 19.8 shows an example of using FTP for retrieving a

list of items in a directory.

1. After the control connection to port 21 is created, the FTP

server sends the 220 (service ready) response on the control

connection.

2. The client sends the USER command.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 921

2. The client sends the USER command.

3. The server responds with 331 (user name is OK, password is

required).

4. The client sends the PASS command.

5. The server responds with 230 (user login is OK)

See Next Slide

Page 922: TCP-IP

6. The client issues a passive open on an ephemeral port for the

data connection and sends the PORT command (over the

control connection) to give this port number to the server.

7. The server does not open the connection at this time, but it

prepares itself for issuing an active open on the data

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 922

prepares itself for issuing an active open on the data

connection between port 20 (server side) and the ephemeral

port received from the client. It sends response 150 (data

connection will open shortly).

8. The client sends the LIST message.

9. Now the server responds with 125 and opens the data

connection.

See Next Slide

Page 923: TCP-IP

10. The server then sends the list of the files or directories (as a

file) on the data connection. When the whole list (file) is

sent, the server responds with 226 (closing data connection)

over the control connection.

11. The client now has two choices. It can use the QUIT

command to request the closing of the

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 923

control connection or it can send another command to

start another activity (and eventually open another data

connection). In our example, the client sends a QUIT

command.

12. After receiving the QUIT command, the server responds

with 221 (service closing) and then closes the control

connection.

See Next Slide

Page 924: TCP-IP

Figure 19.8 Example 1

TCP/IP Protocol Suite 924

Page 925: TCP-IP

The following shows an actual FTP session that parallels

Example 1. The colored lines show the responses from the

server control connection; the black lines show the commands

sent by the client. The lines in white with black background

shows data transfer.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 925

See Next Slide

$ ftp voyager.deanza.fhda.eduConnected to voyager.deanza.fhda.edu.

220 (vsFTPd 1.2.1)

530 Please login with USER and PASS.

Name (voyager.deanza.fhda.edu:forouzan): forouzan

331 Please specify the password.

Page 926: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 2222

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> ls reports

227 Entering Passive Mode (153,18,17,11,238,169)

150 Here comes the directory listing.

TCP/IP Protocol Suite 926

150 Here comes the directory listing.

drwxr-xr-x 2 3027 411 4096 Sep 24 2002 business

drwxr-xr-x 2 3027 411 4096 Sep 24 2002 personal

drwxr-xr-x 2 3027 411 4096 Sep 24 2002 school

226 Directory send OK.

ftp> quit

221 Goodbye.

Page 927: TCP-IP

Figure 19.9 shows an example of how an image (binary) file is

stored.

1. After the control connection to port 21 is created, the FTP

server sends the 220 (service

ready) response on the control connection.

2. The client sends the USER command.

3. The server responds with 331 (user name is OK, a password

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 927

3. The server responds with 331 (user name is OK, a password

is required).

4. The client sends the PASS command.

5. The server responds with 230 (user login is OK).

6. The client issues a passive open on an ephemeral port for

the data connection and sends the PORT command (over

the control connection) to give this port number to the server.

See Next Slide

Page 928: TCP-IP

7. The server does not open the connection at this time, but

prepares itself for issuing an active

open on the data connection between port 20 (server side)

and the ephemeral port received

from the client. It sends the response 150 (data connection

will open shortly).

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3 3 3 3 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 928

will open shortly).

8. The client sends the TYPE command.

9. The server responds with the response 200 (command OK).

10. The client sends the STRU command.

11. The server responds with 200 (command OK).

12. The client sends the STOR command.

13. The server opens the data connection and sends the

response 250.

See Next Slide

Page 929: TCP-IP

14. The client sends the file on the data connection. After the

entire file is sent, the data connection is closed. Closing the

data connection means end-of-file.

15. The server sends the response 226 on the control

connection.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3 3 3 3 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

TCP/IP Protocol Suite 929

connection.

16. The client sends the QUIT command or uses other

commands to open another data connection

for transferring another file. In our example, the QUIT

command is sent.

17. The server responds with 221 (service closing) and it closes

the control connection.

See Next Slide

Page 930: TCP-IP

Figure 19.9 Example 3

TCP/IP Protocol Suite 930

Page 931: TCP-IP

We show an example of anonymous FTP. We assume that

some public data are available at internic.net.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

$ ftp internic.netConnected to internic.net

220 Server ready

TCP/IP Protocol Suite 931

See Next Slide

220 Server ready

Name: anonymous

331 Guest login OK, send “guest” as password

Password: guest

ftp > pwd

257 ’/’ is current directory

Page 932: TCP-IP

bin

. . .

. . .

. . .

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

ftp > close

221 Goodbye

TCP/IP Protocol Suite 932

221 Goodbye

ftp > quit

Page 933: TCP-IP

19.2 TRIVIAL FILE TRANSFER

PROTOCOL (TFTP)

TrivialTrivial FileFile TransferTransfer ProtocolProtocol (TFTP)(TFTP) isis aa simplesimple filefile transfertransfer protocolprotocol

withoutwithout thethe sophisticatedsophisticated featuresfeatures ofof FTPFTP..

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

Messages Messages

Connection Connection

TCP/IP Protocol Suite 933

Connection Connection

Data Transfer Data Transfer

UDP Ports UDP Ports

TFTP Example TFTP Example

TFTP Options TFTP Options

Security Security

Applications Applications

Page 934: TCP-IP

TFTP uses the services of UDP on the

Note:Note:

TCP/IP Protocol Suite 934

TFTP uses the services of UDP on the

well-known port 69.

Page 935: TCP-IP

Figure 19.10 Message categories

TCP/IP Protocol Suite 935

Page 936: TCP-IP

Figure 19.11 RRQ format

TCP/IP Protocol Suite 936

Page 937: TCP-IP

Figure 19.12 WRQ format

TCP/IP Protocol Suite 937

Page 938: TCP-IP

Figure 19.13 DATA format

TCP/IP Protocol Suite 938

Page 939: TCP-IP

Figure 19.14 ACK format

TCP/IP Protocol Suite 939

Page 940: TCP-IP

Figure 19.15 ERROR format

TCP/IP Protocol Suite 940

Page 941: TCP-IP

Table 19.8 Table 19.8 Error numbers and their meaningsError numbers and their meanings

TCP/IP Protocol Suite 941

Page 942: TCP-IP

Figure 19.16 Connection establishment

TCP/IP Protocol Suite 942

Page 943: TCP-IP

Figure 19.17 Sorcerer’s apprentice bug

TCP/IP Protocol Suite 943

Page 944: TCP-IP

Figure 19.18 UDP port numbers used by TFTP

TCP/IP Protocol Suite 944

Page 945: TCP-IP

Figure 19.19 TFTP example

TCP/IP Protocol Suite 945

Page 946: TCP-IP

Figure 19.20 Use of TFTP with BOOTP

TCP/IP Protocol Suite 946

Page 947: TCP-IP

Chapter 20Chapter 20Chapter 20Chapter 20Chapter 20Chapter 20Chapter 20Chapter 20

Upon completion you will be able to:

Electronic Mail:Electronic Mail:

SMTP, POP, and IMAPSMTP, POP, and IMAP

Objectives

TCP/IP Protocol Suite 947

Upon completion you will be able to:

• Understand four configurations of email architecture

• Understand the functions and formats of a user agent

• Understand MIME and its capabilities and data types

• Understand the functions and commands of an MTA

• Understand the function of POP3 and IMAP4

Page 948: TCP-IP

20.1 ARCHITECTURE

ToTo explainexplain thethe architecturearchitecture ofof email,email, wewe givegive fourfour scenariosscenarios.. WeWe beginbegin

withwith thethe simplestsimplest situationsituation andand addadd complexitycomplexity asas wewe proceedproceed.. TheThe fourthfourth

scenarioscenario isis thethe mostmost commoncommon inin thethe exchangeexchange ofof emailemail..

TCP/IP Protocol Suite 948

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

First Scenario First Scenario

Second Scenario Second Scenario

Third Scenario Third Scenario

Fourth Scenario Fourth Scenario

Page 949: TCP-IP

Figure 20.1 First scenario

TCP/IP Protocol Suite 949

Page 950: TCP-IP

When the sender and the receiver of

an email are on the same system, we

need only two user agents.

Note:Note:

TCP/IP Protocol Suite 950

need only two user agents.

Page 951: TCP-IP

Figure 20.2 Second scenario

TCP/IP Protocol Suite 951

Page 952: TCP-IP

When the sender and the receiver of

an email are on different systems, we

need two UAs and a pair of MTAs

Note:Note:

TCP/IP Protocol Suite 952

need two UAs and a pair of MTAs

(client and server).

Page 953: TCP-IP

Figure 20.3 Third scenario

TCP/IP Protocol Suite 953

Page 954: TCP-IP

When the sender is connected to the

mail server via a LAN or a WAN, we

need two UAs and two pairs of MTAs

Note:Note:

TCP/IP Protocol Suite 954

need two UAs and two pairs of MTAs

(client and server).

Page 955: TCP-IP

Figure 20.4 Fourth scenario

TCP/IP Protocol Suite 955

Page 956: TCP-IP

Figure 20.5 Push vs. pull

TCP/IP Protocol Suite 956

Page 957: TCP-IP

When both sender and receiver are

connected to the mail server via a LAN

or a WAN, we need two UAs, two pairs

Note:Note:

TCP/IP Protocol Suite 957

or a WAN, we need two UAs, two pairs

of MTAs (client and server), and a pair

of MAAs (client and server). This is

the most common situation today.

Page 958: TCP-IP

20.2 USER AGENT

TheThe useruser agentagent (UA)(UA) providesprovides serviceservice toto thethe useruser toto makemake thethe processprocess ofof

sendingsending andand receivingreceiving aa messagemessage easiereasier..

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

TCP/IP Protocol Suite 958

Services Provided by a User Agent Services Provided by a User Agent

User Agent Types User Agent Types

Sending Mail Sending Mail

Receiving Mail Receiving Mail

Addresses Addresses

Mailing List Mailing List

MIME MIME

Page 959: TCP-IP

Figure 20.6 User agent

TCP/IP Protocol Suite 959

Page 960: TCP-IP

Some examples of command-driven

user agents are mail, pine, and elm

Note:Note:

TCP/IP Protocol Suite 960

Page 961: TCP-IP

Some examples of GUI-based user

agents are Eudora, Outlook, and

Netscape.

Note:Note:

TCP/IP Protocol Suite 961

Netscape.

Page 962: TCP-IP

Figure 20.7 Format of an email

TCP/IP Protocol Suite 962

Page 963: TCP-IP

Figure 20.8 Email address

TCP/IP Protocol Suite 963

Page 964: TCP-IP

Figure 20.9 MIME

TCP/IP Protocol Suite 964

Page 965: TCP-IP

Figure 20.10 MIME header

TCP/IP Protocol Suite 965

Page 966: TCP-IP

Table 20.1 Table 20.1 Data types and subtypes in MIMEData types and subtypes in MIME

TCP/IP Protocol Suite 966

Page 967: TCP-IP

Table 20.1 Table 20.1 Data types and subtypes in MIME (Continued)Data types and subtypes in MIME (Continued)

TCP/IP Protocol Suite 967

Page 968: TCP-IP

Table 20.2 Table 20.2 ContentContent--transfertransfer--encodingencoding

TCP/IP Protocol Suite 968

Page 969: TCP-IP

Figure 20.11 Base64

TCP/IP Protocol Suite 969

Page 970: TCP-IP

Table 20.3 Table 20.3 Base64 encoding tableBase64 encoding table

TCP/IP Protocol Suite 970

Page 971: TCP-IP

Figure 20.12 Quoted-printable

TCP/IP Protocol Suite 971

Page 972: TCP-IP

20.3 MESSAGE TRANSFER AGENT:

SMTP

TheThe actualactual mailmail transfertransfer requiresrequires messagemessage transfertransfer agentsagents (MTAs)(MTAs).. TheThe

protocolprotocol thatthat definesdefines thethe MTAMTA clientclient andand serverserver inin thethe InternetInternet isis calledcalled

SimpleSimple MailMail TransferTransfer ProtocolProtocol (SMTP)(SMTP)..

TCP/IP Protocol Suite 972

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

Commands and Responses Commands and Responses

Mail Transfer Phases Mail Transfer Phases

Page 973: TCP-IP

Figure 20.13 SMTP range

TCP/IP Protocol Suite 973

Page 974: TCP-IP

Figure 20.14 Commands and responses

TCP/IP Protocol Suite 974

Page 975: TCP-IP

Figure 20.15 Command format

TCP/IP Protocol Suite 975

Page 976: TCP-IP

Table 20.4 Table 20.4 CommandsCommands

TCP/IP Protocol Suite 976

Page 977: TCP-IP

Table 20.5 Table 20.5 ResponsesResponses

TCP/IP Protocol Suite 977

Page 978: TCP-IP

Table 20.5 Table 20.5 Responses (Continued)Responses (Continued)

TCP/IP Protocol Suite 978

Page 979: TCP-IP

Figure 20.16 Connection establishment

TCP/IP Protocol Suite 979

Page 980: TCP-IP

Figure 20.17 Message transfer

TCP/IP Protocol Suite 980

Page 981: TCP-IP

Figure 20.18 Connection termination

TCP/IP Protocol Suite 981

Page 982: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 1111

$ telnet mail.adelphia.net 25

Let us see how we can directly use SMTP to send an email and simulate the

commands and responses we described in this section. We use TELNET to

log into port 25 (the well-known port for SMTP). We then use the

commands directly to send an email. In this example,

[email protected] is sending an email to himself. The first few lines

show TELNET trying to connect to the adelphia mail server.

TCP/IP Protocol Suite 982

$ telnet mail.adelphia.net 25Trying 68.168.78.100...

Connected to mail.adelphia.net (68.168.78.100).

After connection, we can type the SMTP commands and then receive the

responses as shown below. We have shown the commands in black and the

responses in color. Note that we have added for clarification some comment

lines, designated by the “=” sign. These lines are not part of the email

procedure.

Page 983: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

================== Connection Establishment ================

220 mta13.adelphia.net SMTP server ready Fri, 6 Aug 2004 . . .

HELO mail.adelphia.net

250 mta13.adelphia.net

===================== Envelope ===================

MAIL FROM: [email protected]

250 Sender <[email protected]> Ok

TCP/IP Protocol Suite 983

250 Sender <[email protected]> Ok

RCPT TO: [email protected]

250 Recipient <[email protected]> Ok

=================== Header and Body ==================

DATA

354 Ok Send data ending with <CRLF>.<CRLF>

From: Forouzan

TO: Forouzan

This is a test message

to show SMTP in action.

.

Page 984: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 1 1 1 1 (CONTINUED)(CONTINUED)(CONTINUED)(CONTINUED)

============= Connection Termination===============

250 Message received: [email protected]

QUIT

221 mta13.adelphia.net SMTP server closing connection

TCP/IP Protocol Suite 984

Connection closed by foreign host.

Page 985: TCP-IP

20.4 MESSAGE ACCESS AGENT:

POP AND IMAP

TheThe thirdthird stagestage ofof mailmail deliverydelivery usesuses aa messagemessage accessaccess agentagent;; thethe clientclient

mustmust pullpull messagesmessages fromfrom thethe serverserver.. CurrentlyCurrently twotwo messagemessage accessaccess

protocolsprotocols areare availableavailable:: PostPost OfficeOffice Protocol,Protocol, versionversion 33 (POP(POP33)) andand

InternetInternet MailMail AccessAccess Protocol,Protocol, versionversion 44..

TCP/IP Protocol Suite 985

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

POP3 POP3

IMAP4 IMAP4

Page 986: TCP-IP

Figure 20.19 POP3 and IMAP4

TCP/IP Protocol Suite 986

Page 987: TCP-IP

Figure 20.20 POP3

TCP/IP Protocol Suite 987

Page 988: TCP-IP

20.5 WEB-BASED MAIL

SomeSome websiteswebsites suchsuch asas HotmailHotmail andand YahooYahoo provideprovide emailemail serviceservice toto

anyoneanyone whowho accessesaccesses thethe sitesite.. MailMail transfertransfer andand retrievalretrieval requiresrequires thethe useuse

ofof HTTPHTTP..

TCP/IP Protocol Suite 988

Page 989: TCP-IP

Chapter 21Chapter 21Chapter 21Chapter 21Chapter 21Chapter 21Chapter 21Chapter 21

Upon completion you will be able to:

Network Management:Network Management:

SNMPSNMP

Objectives

TCP/IP Protocol Suite 989

Upon completion you will be able to:

• Understand the SNMP manager and the SNMP agent

• Understand the roles of SMI and MIB in network management

• Be familiar with SMI object attributes and encoding methods

• Know how an MIB variable is accessed

• Be familiar with the SNMP PDU and format

Page 990: TCP-IP

21.1 CONCEPT

SNMPSNMP definesdefines aa manager,manager, usuallyusually aa host,host, thatthat controlscontrols andand monitorsmonitors aa

setset ofof agents,agents, usuallyusually routersrouters..

TCP/IP Protocol Suite 990

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

Managers and Agents Managers and Agents

Page 991: TCP-IP

Figure 21.1 SNMP concept

TCP/IP Protocol Suite 991

Page 992: TCP-IP

21.2 MANAGEMENT COMPONENTS

SNMPSNMP requiresrequires thethe useuse ofof twotwo otherother protocolsprotocols:: StructureStructure ofof ManagementManagement

InformationInformation (SMI)(SMI) andand ManagementManagement InformationInformation BaseBase (MIB)(MIB).. NetworkNetwork

managementmanagement onon thethe InternetInternet isis donedone throughthrough thethe cooperationcooperation ofof SNMP,SNMP,

SMI,SMI, andand MIBMIB..

TCP/IP Protocol Suite 992

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

Role of SNMP Role of SNMP

Role of SMI Role of SMI

Role of MIB Role of MIB

An Analogy An Analogy

An Overview An Overview

Page 993: TCP-IP

Figure 21.2 Components of network management on the Internet

TCP/IP Protocol Suite 993

Page 994: TCP-IP

SNMP defines the format of packets

exchanged between a manager and an

agent. It reads and changes the status

Note:Note:

TCP/IP Protocol Suite 994

agent. It reads and changes the status

(values) of objects (variables) in

SNMP packets.

Page 995: TCP-IP

SMI defines the general rules for naming

objects, defining object types (including

range and length), and showing how to

encode objects and values. SMI defines

Note:Note:

TCP/IP Protocol Suite 995

encode objects and values. SMI defines

neither the number of objects an entity

should manage, nor names the objects to

be managed nor defines the association

between the objects and their values.

Page 996: TCP-IP

MIB creates a collection of named

objects, their types, and their

relationships to each other in an entity

Note:Note:

TCP/IP Protocol Suite 996

relationships to each other in an entity

to be managed.

Page 997: TCP-IP

We can compare the task of network

management to the task of writing a

program.

Both tasks need rules. In network management

Note:Note:

TCP/IP Protocol Suite 997

Both tasks need rules. In network management

this is handled by SMI.

Both tasks need variable declarations. In network

management this is handled by MIB.

Both tasks have actions performed by statements.

In network management this is handled by SNMP.

Page 998: TCP-IP

Figure 21.3 Management overview

TCP/IP Protocol Suite 998

Page 999: TCP-IP

21.3 SMI

SMISMI isis aa componentcomponent usedused inin networknetwork managementmanagement.. ItIt namesnames objects,objects,

definesdefines thethe typetype ofof datadata thatthat cancan bebe storedstored inin anan object,object, andand showsshows howhow

datadata cancan bebe encodedencoded forfor transmissiontransmission overover thethe networknetwork

TCP/IP Protocol Suite 999

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

Name Name

Type Type

Encoding Method Encoding Method

Page 1000: TCP-IP

Figure 21.4 Object attributes

TCP/IP Protocol Suite 1000

Page 1001: TCP-IP

Figure 21.5 Object identifier

TCP/IP Protocol Suite 1001

Page 1002: TCP-IP

All objects managed by SNMP are

given an object identifier.

Note:Note:

TCP/IP Protocol Suite 1002

The object identifier always starts with

1.3.6.1.2.1.

Page 1003: TCP-IP

Figure 21.6 Data type

TCP/IP Protocol Suite 1003

Page 1004: TCP-IP

Table 21.1 Table 21.1 Data typesData types

TCP/IP Protocol Suite 1004

Page 1005: TCP-IP

Figure 21.7 Conceptual data types

TCP/IP Protocol Suite 1005

Page 1006: TCP-IP

Figure 21.8 Encoding format

TCP/IP Protocol Suite 1006

Page 1007: TCP-IP

Table 21.2 Table 21.2 Codes for data typesCodes for data types

TCP/IP Protocol Suite 1007

Page 1008: TCP-IP

Figure 21.9 Length format

TCP/IP Protocol Suite 1008

Page 1009: TCP-IP

Figure 21.10 shows how to define INTEGER 14.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

See Next Slide

TCP/IP Protocol Suite 1009

Page 1010: TCP-IP

Figure 21.10 Example 1, INTEGER 14

TCP/IP Protocol Suite 1010

Page 1011: TCP-IP

EXAMPLEEXAMPLEEXAMPLE 2222

See Next Slide

Figure 21.11 shows how to define the OCTET STRING

“HI.”

TCP/IP Protocol Suite 1011

See Next Slide

Page 1012: TCP-IP

Figure 21.11 Example 2, OCTET STRING “HI”

TCP/IP Protocol Suite 1012

Page 1013: TCP-IP

Figure 21.12 shows how to define ObjectIdentifier

1.3.6.1 (iso.org.dod.internet).

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

See Next Slide

TCP/IP Protocol Suite 1013

See Next Slide

Page 1014: TCP-IP

Figure 21.12 Example 3, ObjectIdentifier 1.3.6.1

TCP/IP Protocol Suite 1014

Page 1015: TCP-IP

Figure 21.13 shows how to define IPAddress

131.21.14.8.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 4444

See Next Slide

TCP/IP Protocol Suite 1015

See Next Slide

Page 1016: TCP-IP

Figure 21.13 Example 4, IPAddress 131.21.14.8

TCP/IP Protocol Suite 1016

Page 1017: TCP-IP

21.4 MIB

MIBMIB isis aa componentcomponent usedused inin networknetwork managementmanagement.. EachEach agentagent hashas itsits

ownown MIB,MIB, aa collectioncollection ofof allall thethe objectsobjects thatthat thethe managermanager cancan managemanage..

TCP/IP Protocol Suite 1017

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

Accessing MIB Variables Accessing MIB Variables

Lexicographic Ordering Lexicographic Ordering

Page 1018: TCP-IP

Figure 21.14 mib-2

TCP/IP Protocol Suite 1018

Page 1019: TCP-IP

Figure 21.15 udp group

TCP/IP Protocol Suite 1019

Page 1020: TCP-IP

Figure 21.16 udp variables and tables

TCP/IP Protocol Suite 1020

Page 1021: TCP-IP

Figure 21.17 Indexes for udpTable

TCP/IP Protocol Suite 1021

Page 1022: TCP-IP

Figure 21.18 Lexicographic ordering

TCP/IP Protocol Suite 1022

Page 1023: TCP-IP

21.5 SNMP

SNMPSNMP isis anan applicationapplication programprogram thatthat allowsallows 11)) aa managermanager toto retrieveretrieve thethe

valuevalue ofof anan objectobject defineddefined inin anan agentagent;; 22)) aa managermanager toto storestore aa valuevalue inin

anan objectobject defineddefined inin anan agentagent;; andand 33)) anan agentagent toto sendsend anan alarmalarm messagemessage

aboutabout anan abnormalabnormal situationsituation toto thethe managermanager

TCP/IP Protocol Suite 1023

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

PDUs PDUs

Format Format

Page 1024: TCP-IP

Figure 21.19 SNMP PDUs

TCP/IP Protocol Suite 1024

Page 1025: TCP-IP

Figure 21.20 SNMP PDU format

TCP/IP Protocol Suite 1025

Page 1026: TCP-IP

Table 21.3 Table 21.3 Types of errorsTypes of errors

TCP/IP Protocol Suite 1026

Page 1027: TCP-IP

21.6 MESSAGES

AA messagemessage inin SNMPSNMP isis mademade ofof fourfour elementselements:: version,version, header,header, securitysecurity

parameters,parameters, andand datadata (which(which includesincludes thethe encodedencoded PDU)PDU)..

TCP/IP Protocol Suite 1027

Page 1028: TCP-IP

Figure 21.21 SNMP message

TCP/IP Protocol Suite 1028

Page 1029: TCP-IP

Table 21.4 Table 21.4 Codes for SNMP messagesCodes for SNMP messages

TCP/IP Protocol Suite 1029

Page 1030: TCP-IP

In this example, a manager station (SNMP client) uses the

GetRequest message to retrieve the number of UDP datagrams

that a router has received. There is only one VarBind entity.

The corresponding MIB variable related to this information is

udpInDatagrams with the object identifier 1.3.6.1.2.1.7.1.0.

The manager wants to retrieve a value (not to store a value), so

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

TCP/IP Protocol Suite 1030

The manager wants to retrieve a value (not to store a value), so

the value defines a null entity. Figure 21.22 shows the

conceptual view of the packet showing the hierarchical nature

of sequences. We have used white and color boxes for the

sequence and a gray one for the PDU.

See Next Slide

Page 1031: TCP-IP

The VarBind list has only one VarBind. The variable is of type

06 and length 09. The value is of type 05 and length 00. The

whole is a sequence of length 0D (13). The VarBind list is also

a sequence of length 0F (15). The GetRequest PDU is of length

1D (29). Now we have three OCTET STRINGs related to

security parameter, security model, and flags. Then we have

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 5555

TCP/IP Protocol Suite 1031

security parameter, security model, and flags. Then we have

two integers defining maximum size (1024) and message ID

(64). The header is a sequence of length 12, which we left

blank for simplicity. There is one integer, version (version 3).

The whole message is a sequence of 52 bytes. Figure 21.23

shows the actual message sent by the manager station (client)

to the agent (server).

See Next Slide

Page 1032: TCP-IP

Figure 21.22 Example 5

TCP/IP Protocol Suite 1032

Page 1033: TCP-IP

Figure 21.23 GetRequest message

TCP/IP Protocol Suite 1033

Page 1034: TCP-IP

21.7 UDP PORTS

SNMPSNMP usesuses thethe servicesservices ofof UDPUDP onon twotwo wellwell--knownknown ports,ports, 161161 andand 162162..

TheThe wellwell--knownknown portport 161161 isis usedused byby thethe serverserver (agent),(agent), andand thethe wellwell--

knownknown portport 162162 isis usedused byby thethe clientclient (manager)(manager)..

TCP/IP Protocol Suite 1034

Page 1035: TCP-IP

Figure 21.24 Port numbers for SNMP

TCP/IP Protocol Suite 1035

Page 1036: TCP-IP

21.8 SECURITY

TheThe mainmain differencedifference betweenbetween SNMPvSNMPv33 andand SNMPvSNMPv22 isis thethe enhancedenhanced

securitysecurity.. SNMPvSNMPv33 providesprovides twotwo typestypes ofof securitysecurity:: generalgeneral andand specificspecific..

SNMPvSNMPv33 providesprovides messagemessage authentication,authentication, privacy,privacy, andand managermanager

authorizationauthorization..

TCP/IP Protocol Suite 1036

Page 1037: TCP-IP

Chapter 22Chapter 22Chapter 22Chapter 22Chapter 22Chapter 22Chapter 22Chapter 22

Upon completion you will be able to:

World Wide Web:World Wide Web:

HTTPHTTP

Objectives

TCP/IP Protocol Suite 1037

Upon completion you will be able to:

• Understand the components of a browser and a server

• Understand the function of the URL and cookies

• Understand how HTML is related to static documents

• Understand how CGI is related to dynamic documents

• Understand how Java is related to active documents

• Know how HTTP accesses data on the WWW

Page 1038: TCP-IP

22.1 ARCHITECTURE

TheThe WWWWWW isis aa distributeddistributed clientclient--serverserver service,service, inin whichwhich aa clientclient usingusing aa

browserbrowser cancan accessaccess aa serviceservice usingusing aa serverserver.. TheThe serviceservice providedprovided isis

distributeddistributed overover manymany locationslocations calledcalled sitessites..

TCP/IP Protocol Suite 1038

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

Client (Browser) Client (Browser)

Server Server

Uniform Resource Locator (URL) Uniform Resource Locator (URL)

Cookies Cookies

Page 1039: TCP-IP

Figure 22.1 Architecture of WWW

TCP/IP Protocol Suite 1039

Page 1040: TCP-IP

Figure 22.2 Browser

TCP/IP Protocol Suite 1040

Page 1041: TCP-IP

Figure 22.3 URL

TCP/IP Protocol Suite 1041

Page 1042: TCP-IP

22.2 WEB DOCUMENTS

TheThe documentsdocuments inin thethe WWWWWW cancan bebe groupedgrouped intointo threethree broadbroad categoriescategories::

static,static, dynamic,dynamic, andand activeactive.. TheThe categorycategory isis basedbased onon thethe timetime thethe

contentscontents ofof thethe documentdocument areare determineddetermined..

TCP/IP Protocol Suite 1042

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

Static Documents Static Documents

Dynamic Documents Dynamic Documents

Active Documents Active Documents

Page 1043: TCP-IP

Figure 22.4 Static document

TCP/IP Protocol Suite 1043

Page 1044: TCP-IP

Figure 22.5 Boldface tags

TCP/IP Protocol Suite 1044

Page 1045: TCP-IP

Figure 22.6 Effect of boldface tags

TCP/IP Protocol Suite 1045

Page 1046: TCP-IP

Figure 22.7 Beginning and ending tags

TCP/IP Protocol Suite 1046

Page 1047: TCP-IP

Figure 22.8 Dynamic document using CGI

TCP/IP Protocol Suite 1047

Page 1048: TCP-IP

Figure 22.9 Dynamic document using server-site script

TCP/IP Protocol Suite 1048

Page 1049: TCP-IP

Dynamic documents are sometimes

referred to as server-site dynamic

documents.

Note:Note:

TCP/IP Protocol Suite 1049

documents.

Page 1050: TCP-IP

Figure 22.10 Active document using Java applet

TCP/IP Protocol Suite 1050

Page 1051: TCP-IP

Figure 22.11 Active document using client-site script

TCP/IP Protocol Suite 1051

Page 1052: TCP-IP

Active documents are sometimes

referred to as client-site dynamic

documents.

Note:Note:

TCP/IP Protocol Suite 1052

documents.

Page 1053: TCP-IP

22.3 HTTP

TheThe HypertextHypertext TransferTransfer ProtocolProtocol (HTTP)(HTTP) isis aa protocolprotocol usedused mainlymainly toto

accessaccess datadata onon thethe WorldWorld WideWide WebWeb.. HTTPHTTP functionsfunctions likelike aa combinationcombination

ofof FTPFTP andand SMTPSMTP..

TCP/IP Protocol Suite 1053

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

HTTP Transaction HTTP Transaction

Persistent versus Nonpersistent Connection Persistent versus Nonpersistent Connection

Proxy Server Proxy Server

Page 1054: TCP-IP

HTTP uses the services of TCP on

Note:Note:

TCP/IP Protocol Suite 1054

HTTP uses the services of TCP on

well-known port 80.

Page 1055: TCP-IP

Figure 22.12 HTTP transaction

TCP/IP Protocol Suite 1055

Page 1056: TCP-IP

Figure 22.13 Request and response messages

TCP/IP Protocol Suite 1056

Page 1057: TCP-IP

Figure 22.14 Request and status lines

TCP/IP Protocol Suite 1057

Page 1058: TCP-IP

Table 22.1 Table 22.1 MethodsMethods

TCP/IP Protocol Suite 1058

Page 1059: TCP-IP

Table 22.2 Table 22.2 Status codesStatus codes

TCP/IP Protocol Suite 1059

Page 1060: TCP-IP

Table 22.2 Table 22.2 Status codes (continued)Status codes (continued)

TCP/IP Protocol Suite 1060

Page 1061: TCP-IP

Figure 22.15 Header format

TCP/IP Protocol Suite 1061

Page 1062: TCP-IP

Table 22.3 Table 22.3 General headersGeneral headers

TCP/IP Protocol Suite 1062

Page 1063: TCP-IP

Table 22.4 Table 22.4 Request headersRequest headers

TCP/IP Protocol Suite 1063

Page 1064: TCP-IP

Table 22.5 Table 22.5 Response headersResponse headers

TCP/IP Protocol Suite 1064

Page 1065: TCP-IP

Table 22.6 Table 22.6 Entity headersEntity headers

TCP/IP Protocol Suite 1065

Page 1066: TCP-IP

This example retrieves a document. We use the GET method to

retrieve an image with the path /usr/bin/image1. The request

line shows the method (GET), the URL, and the HTTP version

(1.1). The header has two lines that show that the client can

accept images in the GIF or JPEG format. The request does

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 1066

accept images in the GIF or JPEG format. The request does

not have a body. The response message contains the status line

and four lines of header. The header lines define the date,

server, MIME version, and length of the document. The body

of the document follows the header (see Figure 22.16).

See Next Slide

Page 1067: TCP-IP

Figure 22.16 Example 1

TCP/IP Protocol Suite 1067

Page 1068: TCP-IP

In this example, the client wants to send data to the server. We

use the POST method. The request line shows the method

(POST), URL, and HTTP version (1.1). There are four lines of

headers. The request body contains the input information. The

response message contains the status line and four lines of

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 2222

TCP/IP Protocol Suite 1068

response message contains the status line and four lines of

headers. The created document, which is a CGI document, is

included as the body (see Figure 22.17).

See Next Slide

Page 1069: TCP-IP

Figure 22.17 Example 2

TCP/IP Protocol Suite 1069

Page 1070: TCP-IP

HTTP uses ASCII characters. A client can directly connect to a

server using TELNET, which logs into port 80. The next three

lines shows that the connection is successful. We then type

three lines. The first shows the request line (GET method), the

second is the header (defining the host), the third is a blank

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 1070

second is the header (defining the host), the third is a blank

terminating the request. The server response is seven lines

starting with the status line. The blank line at the end

terminates the server response. The file of 14230 lines is

received after the blank line (not shown here). The last line is

the output by the client.

See Next Slide

Page 1071: TCP-IP

$ telnet www.mhhe.com 80Trying 198.45.24.104...

Connected to www.mhhe.com (198.45.24.104).

Escape character is '^]'.

GET /engcs/compsci/forouzan HTTP/1.1

From: [email protected]

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 3333

TCP/IP Protocol Suite 1071

From: [email protected]

HTTP/1.1 200 OK

Date: Thu, 28 Oct 2004 16:27:46 GMT

Server: Apache/1.3.9 (Unix) ApacheJServ/1.1.2 PHP/4.1.2 PHP/3.0.18

MIME-version:1.0

Content-Type: text/html

Last-modified: Friday, 15-Oct-04 02:11:31 GMT

Content-length: 14230

Connection closed by foreign host.

Page 1072: TCP-IP

HTTP version 1.1 specifies a persistent

Note:Note:

TCP/IP Protocol Suite 1072

HTTP version 1.1 specifies a persistent

connection by default.

Page 1073: TCP-IP

Chapter 23Chapter 23Chapter 23Chapter 23Chapter 23Chapter 23Chapter 23Chapter 23

Upon completion you will be able to:

IP Over ATMIP Over ATM

Objectives

TCP/IP Protocol Suite 1073

Upon completion you will be able to:

• Review the features of an ATM WAN

• Understand how an a datagram can pass through an ATM WAN

• Understand how an IP packet is encapsulated in cells

• Understand how cells are routed in an ATM network

• Understand the function of ATMARP

Page 1074: TCP-IP

23.1 ATM WANS

WeWe reviewreview somesome featuresfeatures ofof thethe ATMATM WANWAN neededneeded toto understandunderstand IPIP overover

ATMATM.. TheThe onlyonly AALAAL usedused byby thethe InternetInternet isis AALAAL55,, sometimessometimes calledcalled thethe

simplesimple andand efficientefficient adaptationadaptation layerlayer (SEAL)(SEAL)..

TCP/IP Protocol Suite 1074

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

Layers Layers

Page 1075: TCP-IP

Figure 23.1 An ATM WAN in the Internet

TCP/IP Protocol Suite 1075

Page 1076: TCP-IP

Figure 23.2 ATM layers in routers and switches

TCP/IP Protocol Suite 1076

Page 1077: TCP-IP

End devices such as routers use all

three layers, while switches use only

the bottom two layers.

Note:Note:

TCP/IP Protocol Suite 1077

the bottom two layers.

Page 1078: TCP-IP

Figure 23.3 AAL5

TCP/IP Protocol Suite 1078

Page 1079: TCP-IP

The AAL layer used by the IP protocol

is AAL5.

Note:Note:

TCP/IP Protocol Suite 1079

is AAL5.

Page 1080: TCP-IP

Figure 23.4 ATM layer

TCP/IP Protocol Suite 1080

Page 1081: TCP-IP

Figure 23.5 ATM headers

TCP/IP Protocol Suite 1081

Page 1082: TCP-IP

23.2 CARRYING A DATAGRAM

IN CELLS

WeWe showshow howhow anan exampleexample ofof aa datagramdatagram encapsulatedencapsulated inin fourfour cellscells andand

transmittedtransmitted throughthrough anan ATMATM networknetwork..

TCP/IP Protocol Suite 1082

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

Why Use AAL5? Why Use AAL5?

Page 1083: TCP-IP

Figure 23.6 Fragmentation

TCP/IP Protocol Suite 1083

Page 1084: TCP-IP

Only the last cell carries the 8-byte

trailer added to the IP datagram.

Padding can be added only to the last

Note:Note:

TCP/IP Protocol Suite 1084

Padding can be added only to the last

cell or the last two cells.

Page 1085: TCP-IP

The value of the PT field is 000 in all

cells carrying an IP datagram

fragment except for the last cell;

Note:Note:

TCP/IP Protocol Suite 1085

fragment except for the last cell;

the value is 001 in the last cell.

Page 1086: TCP-IP

Figure 23.7 ATM cells

TCP/IP Protocol Suite 1086

Page 1087: TCP-IP

23.3 ROUTING THE CELLS

TheThe ATMATM networknetwork createscreates aa routeroute betweenbetween twotwo routersrouters.. WeWe callcall thesethese

routersrouters enteringentering--pointpoint andand exitingexiting--pointpoint routersrouters..

TCP/IP Protocol Suite 1087

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

Addresses Addresses

Address Binding Address Binding

Page 1088: TCP-IP

Figure 23.8 Entering-point and exiting-point routers

TCP/IP Protocol Suite 1088

Page 1089: TCP-IP

23.4 ATMARP

ATMARPATMARP findsfinds (maps)(maps) thethe physicalphysical addressaddress ofof thethe exitingexiting--pointpoint routerrouter

givengiven thethe IPIP addressaddress ofof thethe exitingexiting--pointpoint routerrouter.. NoNo broadcastingbroadcasting isis

involvedinvolved..

TCP/IP Protocol Suite 1089

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

Packet Format Packet Format

ATMARP Operation ATMARP Operation

Page 1090: TCP-IP

Figure 23.9 ATMARP packet

TCP/IP Protocol Suite 1090

Page 1091: TCP-IP

Table 23.1 Table 23.1 OPER fieldOPER field

TCP/IP Protocol Suite 1091

Page 1092: TCP-IP

The inverse request and inverse reply

messages can bind the physical

address to an IP address in a PVC

Note:Note:

TCP/IP Protocol Suite 1092

address to an IP address in a PVC

situation.

Page 1093: TCP-IP

Figure 23.10 Binding with PVC

TCP/IP Protocol Suite 1093

Page 1094: TCP-IP

Figure 23.11 Binding with ATMARP

TCP/IP Protocol Suite 1094

Page 1095: TCP-IP

The request and reply message can be

used to bind a physical address to an

IP address in an SVC situation.

Note:Note:

TCP/IP Protocol Suite 1095

IP address in an SVC situation.

Page 1096: TCP-IP

The inverse request and inverse reply

can also be used to build the server’s

mapping table.

Note:Note:

TCP/IP Protocol Suite 1096

mapping table.

Page 1097: TCP-IP

Figure 23.12 Building a table

TCP/IP Protocol Suite 1097

Page 1098: TCP-IP

23.5 LOGICAL IP SUBNET (LIS)

AnAn ATMATM networknetwork cancan bebe divideddivided intointo logicallogical (not(not physical)physical) subnetworkssubnetworks..

ThisThis facilitatesfacilitates thethe operationoperation ofof ATMARPATMARP andand otherother protocolsprotocols (such(such asas

IGMP)IGMP) thatthat needneed toto simulatesimulate broadcastingbroadcasting onon anan ATMATM networknetwork..

TCP/IP Protocol Suite 1098

Page 1099: TCP-IP

Figure 23.13 LIS

TCP/IP Protocol Suite 1099

Page 1100: TCP-IP

LIS allows an ATM network to be

divided into several logical subnets. To

use ATMARP, we need a separate

Note:Note:

TCP/IP Protocol Suite 1100

use ATMARP, we need a separate

server for each subnet.

Page 1101: TCP-IP

Chapter 24Chapter 24Chapter 24Chapter 24Chapter 24Chapter 24Chapter 24Chapter 24

Upon completion you will be able to:

Mobile IPMobile IP

Objectives

TCP/IP Protocol Suite 1101

Upon completion you will be able to:

• Understand the addressing scheme for mobile hosts.

• To define home, care-of, and co-located care-of addresses

• Understand the interactions between a home and a foreign agent

• Know the three phases involved in mobile communication

• Understand why mobile IP communication can be inefficient

Page 1102: TCP-IP

24.1 ADDRESSING

TheThe mainmain problemproblem thatthat mustmust bebe solvedsolved inin providingproviding mobilemobile

communicationcommunication usingusing thethe IPIP protocolprotocol isis addressingaddressing..

TCP/IP Protocol Suite 1102

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

Stationary Hosts Stationary Hosts

Mobile Hosts Mobile Hosts

Page 1103: TCP-IP

The IP addresses are designed to work

with stationary hosts because part of

the address defines the network to

Note:Note:

TCP/IP Protocol Suite 1103

the address defines the network to

which the host is attached.

Page 1104: TCP-IP

Figure 24.1 Home address and care-of address

TCP/IP Protocol Suite 1104

Page 1105: TCP-IP

Mobile IP has two addresses for a

mobile host: one home address and

one care-of address. The home address

Note:Note:

TCP/IP Protocol Suite 1105

one care-of address. The home address

is permanent; the care-of address

changes as the mobile host moves

from one network to another.

Page 1106: TCP-IP

24.2 AGENTS

ToTo makemake thethe changechange ofof addressaddress transparenttransparent toto thethe restrest ofof thethe InternetInternet

requiresrequires aa homehome agentagent andand aa foreignforeign agentagent.. TheThe specificspecific functionfunction ofof anan

agentagent isis performedperformed inin thethe applicationapplication layerlayer..

TCP/IP Protocol Suite 1106

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

Home Agent Home Agent

Foreign Agent Foreign Agent

Page 1107: TCP-IP

Figure 24.2 Home agent and foreign agent

TCP/IP Protocol Suite 1107

Page 1108: TCP-IP

When the mobile host and the foreign

agent are the same, the care-of address

is called a co-located care-of address.

Note:Note:

TCP/IP Protocol Suite 1108

is called a co-located care-of address.

Page 1109: TCP-IP

24.3 THREE PHASES

ToTo communicatecommunicate withwith aa remoteremote host,host, aa mobilemobile hosthost goesgoes throughthrough threethree

phasesphases:: agentagent discovery,discovery, registration,registration, andand datadata transfertransfer..

TCP/IP Protocol Suite 1109

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

Agent Discovery Agent Discovery

Registration Registration

Data Transfer Data Transfer

Page 1110: TCP-IP

Figure 24.3 Remote host and mobile host communication

TCP/IP Protocol Suite 1110

Page 1111: TCP-IP

Mobile IP does not use a new packet

type for agent advertisement; it uses

the router advertisement packet of

Note:Note:

TCP/IP Protocol Suite 1111

the router advertisement packet of

ICMP, and appends an agent

advertisement message.

Page 1112: TCP-IP

Figure 24.4 Agent advertisement

TCP/IP Protocol Suite 1112

Page 1113: TCP-IP

Table 24.1 Table 24.1 Code bitsCode bits

TCP/IP Protocol Suite 1113

Page 1114: TCP-IP

Mobile IP does not use a new packet

type for agent solicitation; it uses the

router solicitation packet of ICMP.

Note:Note:

TCP/IP Protocol Suite 1114

router solicitation packet of ICMP.

Page 1115: TCP-IP

Figure 24.5 Registration request and reply

TCP/IP Protocol Suite 1115

Page 1116: TCP-IP

Figure 24.6 Registration request format

TCP/IP Protocol Suite 1116

Page 1117: TCP-IP

Table 24.2 Table 24.2 Registration request flag field bitsRegistration request flag field bits

TCP/IP Protocol Suite 1117

Page 1118: TCP-IP

Figure 24.7 Registration reply format

TCP/IP Protocol Suite 1118

Page 1119: TCP-IP

A registration request or reply is sent by

UDP using the well-known port 434.

Note:Note:

TCP/IP Protocol Suite 1119

UDP using the well-known port 434.

Page 1120: TCP-IP

Figure 24.8 Data transfer

TCP/IP Protocol Suite 1120

Page 1121: TCP-IP

The movement of the mobile host is

transparent to the rest of the Internet.

Note:Note:

TCP/IP Protocol Suite 1121

transparent to the rest of the Internet.

Page 1122: TCP-IP

24.4 INEFFICIENCY IN MOBILE IP

CommunicationCommunication involvinginvolving mobilemobile IPIP cancan bebe inefficientinefficient.. AA severesevere casecase isis

calledcalled doubledouble crossingcrossing oror 22XX.. AA moderatemoderate casecase isis calledcalled triangletriangle routingrouting

oror dogdog--legleg routingrouting..

TCP/IP Protocol Suite 1122

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

Double Crossing Double Crossing

Triangle Routing Triangle Routing

Solution Solution

Page 1123: TCP-IP

Figure 24.9 Double crossing

TCP/IP Protocol Suite 1123

Page 1124: TCP-IP

Figure 24.10 Triangle routing

TCP/IP Protocol Suite 1124

Page 1125: TCP-IP

Chapter 25Chapter 25Chapter 25Chapter 25Chapter 25Chapter 25Chapter 25Chapter 25

Upon completion you will be able to:

MultimediaMultimedia

Objectives

TCP/IP Protocol Suite 1125

Upon completion you will be able to:

• Know the characteristics of the 3 types of services

• Understand the methods of digitizing and compressing.

• Understand jitter, translation, and mixing in real-time traffic

• Understand the role of RTP and RTCP in real-time traffic

• Understand how the Internet can be used as a telephone network

Page 1126: TCP-IP

Figure 25.1 Internet audio/video

TCP/IP Protocol Suite 1126

Page 1127: TCP-IP

Streaming stored audio/video refers to

on-demand requests for compressed

Note:Note:

TCP/IP Protocol Suite 1127

on-demand requests for compressed

audio/video files.

Page 1128: TCP-IP

Streaming live audio/video refers to

the broadcasting of radio and TV

Note:Note:

TCP/IP Protocol Suite 1128

the broadcasting of radio and TV

programs through the Internet.

Page 1129: TCP-IP

Interactive audio/video refers to the

use of the Internet for interactive

Note:Note:

TCP/IP Protocol Suite 1129

use of the Internet for interactive

audio/video applications.

Page 1130: TCP-IP

25.1 DIGITIZING AUDIO AND VIDEO

BeforeBefore audioaudio oror videovideo signalssignals cancan bebe sentsent onon thethe Internet,Internet, theythey needneed toto bebe

digitizeddigitized.. WeWe discussdiscuss audioaudio andand videovideo separatelyseparately..

TCP/IP Protocol Suite 1130

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

Digitizing Audio Digitizing Audio

Digitizing Video Digitizing Video

Page 1131: TCP-IP

Compression is needed to send video

over the Internet.

Note:Note:

TCP/IP Protocol Suite 1131

over the Internet.

Page 1132: TCP-IP

25.2 AUDIO AND VIDEO COMPRESSION

ToTo sendsend audioaudio oror videovideo overover thethe InternetInternet requiresrequires compressioncompression..

TCP/IP Protocol Suite 1132

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

Audio Compression Audio Compression

Video Compression Video Compression

Page 1133: TCP-IP

Figure 25.2 JPEG gray scale

TCP/IP Protocol Suite 1133

Page 1134: TCP-IP

Figure 25.3 JPEG process

TCP/IP Protocol Suite 1134

Page 1135: TCP-IP

Figure 25.4 Case 1: uniform gray scale

TCP/IP Protocol Suite 1135

Page 1136: TCP-IP

Figure 25.5 Case 2: two sections

TCP/IP Protocol Suite 1136

Page 1137: TCP-IP

Figure 25.6 Case 3: gradient gray scale

TCP/IP Protocol Suite 1137

Page 1138: TCP-IP

Figure 25.7 Reading the table

TCP/IP Protocol Suite 1138

Page 1139: TCP-IP

Figure 25.8 MPEG frames

TCP/IP Protocol Suite 1139

Page 1140: TCP-IP

Figure 25.9 MPEG frame construction

TCP/IP Protocol Suite 1140

Page 1141: TCP-IP

25.3 STREAMING STORED

AUDIO/VIDEO

WeWe turnturn ourour attentionattention toto aa specificspecific applicationsapplications calledcalled streamingstreaming storedstored

audioaudio andand videovideo.. WeWe useuse fourfour approachesapproaches toto showshow howhow aa filefile cancan bebe

downloaded,downloaded, eacheach withwith aa differentdifferent complexitycomplexity..

TCP/IP Protocol Suite 1141

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

First Approach: Using a Web Server First Approach: Using a Web Server

Second Approach: Using a Web Server with Metafile Second Approach: Using a Web Server with Metafile

Third Approach: Using a Media Server Third Approach: Using a Media Server

Fourth Approach: Using a Media Server and RTSP Fourth Approach: Using a Media Server and RTSP

Page 1142: TCP-IP

Figure 25.10 Using a Web server

TCP/IP Protocol Suite 1142

Page 1143: TCP-IP

Figure 25.11 Using a Web server with a metafile

TCP/IP Protocol Suite 1143

Page 1144: TCP-IP

Figure 25.12 Using a media server

TCP/IP Protocol Suite 1144

Page 1145: TCP-IP

Figure 25.13 Using a media server and RTSP

TCP/IP Protocol Suite 1145

Page 1146: TCP-IP

25.4 STREAMING LIVE

AUDIO/VIDEOInIn streamingstreaming livelive audio/videoaudio/video thethe stationsstations broadcastbroadcast throughthrough thethe InternetInternet..

CommunicationCommunication isis multicastmulticast andand livelive.. LiveLive streamingstreaming isis betterbetter suitedsuited toto

thethe multicastmulticast servicesservices ofof IPIP andand thethe useuse ofof protocolsprotocols suchsuch asas UDPUDP andand

RTPRTP..

TCP/IP Protocol Suite 1146

Page 1147: TCP-IP

25.5 REAL-TIME INTERACTIVE

AUDIO/VIDEO

InIn realreal--timetime interactiveinteractive audio/video,audio/video, peoplepeople communicatecommunicate visuallyvisually andand

orallyorally withwith oneone anotheranother inin realreal timetime.. ExamplesExamples includeinclude videovideo

conferencingconferencing andand thethe InternetInternet phonephone oror voicevoice overover IPIP..

TCP/IP Protocol Suite 1147

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

Characteristics Characteristics

Page 1148: TCP-IP

Figure 25.14 Time relationship

TCP/IP Protocol Suite 1148

Page 1149: TCP-IP

Jitter is introduced in real-time data by

the delay between packets.

Note:Note:

TCP/IP Protocol Suite 1149

Page 1150: TCP-IP

Figure 25.15 Jitter

TCP/IP Protocol Suite 1150

Page 1151: TCP-IP

Figure 25.16 Timestamp

TCP/IP Protocol Suite 1151

Page 1152: TCP-IP

To prevent jitter, we can timestamp the

packets and separate the arrival time

from the playback time.

Note:Note:

TCP/IP Protocol Suite 1152

from the playback time.

Page 1153: TCP-IP

Figure 25.17 Playback buffer

TCP/IP Protocol Suite 1153

Page 1154: TCP-IP

A playback buffer is required for

Note:Note:

TCP/IP Protocol Suite 1154

A playback buffer is required for

real-time traffic.

Page 1155: TCP-IP

A sequence number on each packet is

required for real-time traffic.

Note:Note:

TCP/IP Protocol Suite 1155

required for real-time traffic.

Page 1156: TCP-IP

Real-time traffic needs the support of

multicasting.

Note:Note:

TCP/IP Protocol Suite 1156

multicasting.

Page 1157: TCP-IP

Translation means changing the

encoding of a payload to a lower

quality to match the bandwidth

Note:Note:

TCP/IP Protocol Suite 1157

quality to match the bandwidth

of the receiving network.

Page 1158: TCP-IP

Mixing means combining several

streams of traffic into one stream.

Note:Note:

TCP/IP Protocol Suite 1158

streams of traffic into one stream.

Page 1159: TCP-IP

TCP, with all its sophistication, is not

suitable for interactive multimedia

traffic because we cannot allow

Note:Note:

TCP/IP Protocol Suite 1159

traffic because we cannot allow

retransmission of packets.

Page 1160: TCP-IP

UDP is more suitable than TCP for

interactive traffic. However, we need

the services of RTP, another transport

Note:Note:

TCP/IP Protocol Suite 1160

the services of RTP, another transport

layer protocol, to make up for the

deficiencies of UDP.

Page 1161: TCP-IP

25.6 RTP

RealReal--timetime TransportTransport ProtocolProtocol (RTP)(RTP) isis thethe protocolprotocol designeddesigned toto handlehandle

realreal--timetime traffictraffic onon thethe InternetInternet.. RTPRTP doesdoes notnot havehave aa deliverydelivery

mechanismmechanism;; itit mustmust bebe usedused withwith UDPUDP..

TCP/IP Protocol Suite 1161

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

RTP Packet Format RTP Packet Format

UDP Port UDP Port

Page 1162: TCP-IP

Figure 25.18 RTP

TCP/IP Protocol Suite 1162

Page 1163: TCP-IP

Figure 25.19 RTP packet header format

TCP/IP Protocol Suite 1163

Page 1164: TCP-IP

Table 25.1 Table 25.1 Payload typesPayload types

TCP/IP Protocol Suite 1164

Page 1165: TCP-IP

RTP uses a temporary even-numbered

UDP port.

Note:Note:

TCP/IP Protocol Suite 1165

UDP port.

Page 1166: TCP-IP

25.7 RTCP

RealReal--timetime TransportTransport ControlControl ProtocolProtocol (RTCP)(RTCP) isis aa protocolprotocol thatthat allowsallows

messagesmessages thatthat controlcontrol thethe flowflow andand qualityquality ofof datadata.. RTCPRTCP hashas fivefive typestypes

ofof messagesmessages..

TCP/IP Protocol Suite 1166

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

Sender Report Sender Report

Receiver Report Receiver Report

Source Description Message Source Description Message

Bye Message Bye Message

Application Specific Message Application Specific Message

UDP Port UDP Port

Page 1167: TCP-IP

Figure 25.20 RTCP message types

TCP/IP Protocol Suite 1167

Page 1168: TCP-IP

RTCP uses an odd-numbered UDP

port number that follows the port

Note:Note:

TCP/IP Protocol Suite 1168

port number that follows the port

number selected for RTP.

Page 1169: TCP-IP

25.8 VOICE OVER IP

VoiceVoice overover IP,IP, oror InternetInternet telephonytelephony isis anan applicationapplication thatthat allowsallows

communicationcommunication betweenbetween twotwo partiesparties overover thethe packetpacket--switchedswitched InternetInternet..

TwoTwo protocolsprotocols havehave beenbeen designeddesigned toto handlehandle thisthis typetype ofof communicationcommunication::

SIPSIP andand HH..323323..

TCP/IP Protocol Suite 1169

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

SIP SIP

H.323 H.323

Page 1170: TCP-IP

Figure 25.21 SIP messages

TCP/IP Protocol Suite 1170

Page 1171: TCP-IP

Figure 25.22 SIP formats

TCP/IP Protocol Suite 1171

Page 1172: TCP-IP

Figure 25.23 SIP simple session

TCP/IP Protocol Suite 1172

Page 1173: TCP-IP

Figure 25.24 Tracking the callee

TCP/IP Protocol Suite 1173

Page 1174: TCP-IP

Figure 25.25 H.323 architecture

TCP/IP Protocol Suite 1174

Page 1175: TCP-IP

Figure 25.26 H.323 protocols

TCP/IP Protocol Suite 1175

Page 1176: TCP-IP

Figure 25.27 H.323 example

TCP/IP Protocol Suite 1176

Page 1177: TCP-IP

Chapter 26Chapter 26Chapter 26Chapter 26Chapter 26Chapter 26Chapter 26Chapter 26

Upon completion you will be able to:

Virtual Private Networks andVirtual Private Networks and

Network Address Translation Network Address Translation

Objectives

TCP/IP Protocol Suite 1177

Upon completion you will be able to:

• Understand the difference between an internet and an extranet

• Understand private, hybrid, and virtual private networks

• Understand how VPN can guarantee privacy

• Understand the mechanism of NAT

Page 1178: TCP-IP

26.1 PRIVATE NETWORKS

AA privateprivate networknetwork isis designeddesigned toto bebe usedused onlyonly insideinside anan organizationorganization.. ItIt

allowsallows accessaccess toto sharedshared resourcesresources and,and, atat thethe samesame time,time, providesprovides privacyprivacy..

TCP/IP Protocol Suite 1178

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

Intranet Intranet

Extranet Extranet

Addressing Addressing

Page 1179: TCP-IP

Table 26.1 Table 26.1 Addresses for private networksAddresses for private networks

TCP/IP Protocol Suite 1179

Page 1180: TCP-IP

26.2 VIRTUAL PRIVATE

NETWORKS (VPN)

VirtualVirtual privateprivate networknetwork (VPN)(VPN) isis aa technologytechnology forfor largelarge organizationsorganizations

thatthat useuse thethe globalglobal InternetInternet forfor bothboth intraintra-- andand interorganizationinterorganization

communication,communication, butbut requirerequire privacyprivacy inin theirtheir intraorganizationintraorganization

communicationcommunication..

TCP/IP Protocol Suite 1180

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

Achieving Privacy Achieving Privacy

VPN Technology VPN Technology

Page 1181: TCP-IP

Figure 26.1 Private network

TCP/IP Protocol Suite 1181

Page 1182: TCP-IP

Figure 26.2 Hybrid network

TCP/IP Protocol Suite 1182

Page 1183: TCP-IP

Figure 26.3 Virtual private network

TCP/IP Protocol Suite 1183

Page 1184: TCP-IP

Figure 26.4 Tunneling

TCP/IP Protocol Suite 1184

Page 1185: TCP-IP

Figure 26.5 Addressing in a VPN

TCP/IP Protocol Suite 1185

Page 1186: TCP-IP

26.3 NETWORK ADDRESS

TRANSLATION (NAT)

NetworkNetwork addressaddress translationtranslation (NAT)(NAT) allowsallows aa sitesite toto useuse aa setset ofof privateprivate

addressesaddresses forfor internalinternal communicationcommunication andand aa setset ofof globalglobal InternetInternet

addressesaddresses forfor communicationcommunication withwith anotheranother sitesite.. TheThe sitesite mustmust havehave onlyonly

oneone singlesingle connectionconnection toto thethe globalglobal InternetInternet throughthrough aa routerrouter thatthat runsruns

NATNAT softwaresoftware..

TCP/IP Protocol Suite 1186

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

Address Translation Address Translation

Translation Table Translation Table

NAT and ISP NAT and ISP

Page 1187: TCP-IP

Figure 26.6 NAT

TCP/IP Protocol Suite 1187

Page 1188: TCP-IP

Figure 26.7 Address translation

TCP/IP Protocol Suite 1188

Page 1189: TCP-IP

Figure 26.8 Translation

TCP/IP Protocol Suite 1189

Page 1190: TCP-IP

Table 26.2 Table 26.2 FiveFive--column translation tablecolumn translation table

TCP/IP Protocol Suite 1190

Page 1191: TCP-IP

Figure 26.9 An ISP and NAT

TCP/IP Protocol Suite 1191

Page 1192: TCP-IP

Chapter 27Chapter 27Chapter 27Chapter 27Chapter 27Chapter 27Chapter 27Chapter 27

Upon completion you will be able to:

Next Generation:Next Generation:

IPv6 and ICMPv6IPv6 and ICMPv6

Objectives

TCP/IP Protocol Suite 1192

Upon completion you will be able to:

• Understand the shortcomings of IPv4

• Know the IPv6 address format, address types, and abbreviations

• Be familiar with the IPv6 header format

• Know the extension header types

• Know the differences between ICMPv4 and ICMPv6

• Know the strategies for transitioning from IPv4 to IPv6

Page 1193: TCP-IP

27.1 IPv6

IPv6 has these advantages over IPv4: IPv6 has these advantages over IPv4:

1. 1. larger address space larger address space

2. 2. better header format better header format

3. 3. new optionsnew options

4. 4. allowance for extensionallowance for extension

5. 5. support for resource allocation support for resource allocation

6. 6. support for more securitysupport for more security

TCP/IP Protocol Suite 1193

6. 6. support for more securitysupport for more security

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

IPv6 Addresses IPv6 Addresses

Address Space Assignment Address Space Assignment

Packet Format Packet Format

Comparison between IPv4 and IPv6 Comparison between IPv4 and IPv6

Page 1194: TCP-IP

Figure 27.1 IPv6 address

TCP/IP Protocol Suite 1194

Page 1195: TCP-IP

Figure 27.2 Abbreviated address

TCP/IP Protocol Suite 1195

Page 1196: TCP-IP

Figure 27.3 Abbreviated address with consecutive zeros

TCP/IP Protocol Suite 1196

Page 1197: TCP-IP

Figure 27.4 CIDR address

TCP/IP Protocol Suite 1197

Page 1198: TCP-IP

Figure 27.5 Address structure

TCP/IP Protocol Suite 1198

Page 1199: TCP-IP

Table 27.1 Table 27.1 Type prefixes for IPv6 addressesType prefixes for IPv6 addresses

TCP/IP Protocol Suite 1199

Page 1200: TCP-IP

Figure 27.6 Provider-based address

TCP/IP Protocol Suite 1200

Page 1201: TCP-IP

Figure 27.7 Address hierarchy

TCP/IP Protocol Suite 1201

Page 1202: TCP-IP

Figure 27.8 Unspecified address

TCP/IP Protocol Suite 1202

Page 1203: TCP-IP

Figure 27.9 Loopback address

TCP/IP Protocol Suite 1203

Page 1204: TCP-IP

Figure 27.10 Compatible address

TCP/IP Protocol Suite 1204

Page 1205: TCP-IP

Figure 27.11 Mapped address

TCP/IP Protocol Suite 1205

Page 1206: TCP-IP

Figure 27.12 Link local address

TCP/IP Protocol Suite 1206

Page 1207: TCP-IP

Figure 27.13 Site local address

TCP/IP Protocol Suite 1207

Page 1208: TCP-IP

Figure 27.14 Multicast address

TCP/IP Protocol Suite 1208

Page 1209: TCP-IP

Figure 27.15 IPv6 datagram

TCP/IP Protocol Suite 1209

Page 1210: TCP-IP

Figure 27.16 Format of an IPv6 datagram

TCP/IP Protocol Suite 1210

Page 1211: TCP-IP

Table 27.2 Table 27.2 Next header codesNext header codes

TCP/IP Protocol Suite 1211

Page 1212: TCP-IP

Table 27.3 Table 27.3 Priorities for congestionPriorities for congestion--controlled controlled

traffictraffic

TCP/IP Protocol Suite 1212

Page 1213: TCP-IP

Table 27.4 Table 27.4 Priorities for noncongestionPriorities for noncongestion--controlledcontrolled

traffictraffic

TCP/IP Protocol Suite 1213

Page 1214: TCP-IP

Table 27.5 Table 27.5 Comparison between IPv4 and IPv6 packet headerComparison between IPv4 and IPv6 packet header

TCP/IP Protocol Suite 1214

Page 1215: TCP-IP

Figure 27.17 Extension header format

TCP/IP Protocol Suite 1215

Page 1216: TCP-IP

Figure 27.18 Extension header types

TCP/IP Protocol Suite 1216

Page 1217: TCP-IP

Figure 27.19 Hop-by-hop option header format

TCP/IP Protocol Suite 1217

Page 1218: TCP-IP

Figure 27.20 The format of options in a hop-by-hop option header

TCP/IP Protocol Suite 1218

Page 1219: TCP-IP

Figure 27.21 Pad1

TCP/IP Protocol Suite 1219

Page 1220: TCP-IP

Figure 27.22 PadN

TCP/IP Protocol Suite 1220

Page 1221: TCP-IP

Figure 27.23 Jumbo payload

TCP/IP Protocol Suite 1221

Page 1222: TCP-IP

Figure 27.24 Source routing

TCP/IP Protocol Suite 1222

Page 1223: TCP-IP

Figure 27.25 Source routing example

TCP/IP Protocol Suite 1223

Page 1224: TCP-IP

Figure 27.26 Fragmentation

TCP/IP Protocol Suite 1224

Page 1225: TCP-IP

Figure 27.27 Authentication

TCP/IP Protocol Suite 1225

Page 1226: TCP-IP

Figure 27.28 Calculation of authentication data

TCP/IP Protocol Suite 1226

Page 1227: TCP-IP

Figure 27.29 Encrypted security payload

TCP/IP Protocol Suite 1227

Page 1228: TCP-IP

Figure 27.30 Transport mode encryption

TCP/IP Protocol Suite 1228

Page 1229: TCP-IP

Figure 27.31 Tunnel-mode encryption

TCP/IP Protocol Suite 1229

Page 1230: TCP-IP

Table 27.6 Table 27.6 Comparison between IPv4 options and IPv6 extensionComparison between IPv4 options and IPv6 extension

headersheaders

TCP/IP Protocol Suite 1230

Page 1231: TCP-IP

27.2 ICMPv6

ICMPvICMPv66,, whilewhile similarsimilar inin strategystrategy toto ICMPvICMPv44,, hashas changeschanges thatthat makesmakes itit

moremore suitablesuitable forfor IPvIPv66.. ICMPvICMPv66 hashas absorbedabsorbed somesome protocolsprotocols thatthat werewere

independentindependent inin versionversion 44..

TCP/IP Protocol Suite 1231

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

Error Reporting Error Reporting

Query Query

Page 1232: TCP-IP

Figure 27.32 Comparison of network layers in version 4 and version 6

TCP/IP Protocol Suite 1232

Page 1233: TCP-IP

Figure 27.33 Categories of ICMPv6 messages

TCP/IP Protocol Suite 1233

Page 1234: TCP-IP

Figure 27.34 General format of ICMP messages

TCP/IP Protocol Suite 1234

Page 1235: TCP-IP

Figure 27.35 Error-reporting messages

TCP/IP Protocol Suite 1235

Page 1236: TCP-IP

Table 27.7 Table 27.7 Comparison of errorComparison of error--reporting messages in ICMPv4 reporting messages in ICMPv4

and ICMPv6and ICMPv6

TCP/IP Protocol Suite 1236

Page 1237: TCP-IP

Figure 27.36 Destination-unreachable message format

TCP/IP Protocol Suite 1237

Page 1238: TCP-IP

Figure 27.37 Packet-too-big message format

TCP/IP Protocol Suite 1238

Page 1239: TCP-IP

Figure 27.38 Time-exceeded message format

TCP/IP Protocol Suite 1239

Page 1240: TCP-IP

Figure 27.39 Parameter-problem message format

TCP/IP Protocol Suite 1240

Page 1241: TCP-IP

Figure 27.40 Redirection message format

TCP/IP Protocol Suite 1241

Page 1242: TCP-IP

Figure 27.41 Query messages

TCP/IP Protocol Suite 1242

Page 1243: TCP-IP

Table 27.8 Table 27.8 Comparison of query messages in ICMPv4 Comparison of query messages in ICMPv4

and ICMPv6and ICMPv6

TCP/IP Protocol Suite 1243

Page 1244: TCP-IP

Figure 27.42 Echo request and reply messages

TCP/IP Protocol Suite 1244

Page 1245: TCP-IP

Figure 27.43 Router-solicitation and advertisement message formats

TCP/IP Protocol Suite 1245

Page 1246: TCP-IP

Figure 27.44 Neighbor-solicitation and advertisement message formats

TCP/IP Protocol Suite 1246

Page 1247: TCP-IP

Figure 27.45 Group-membership messages

TCP/IP Protocol Suite 1247

Page 1248: TCP-IP

Figure 27.46 Group-membership message formats

TCP/IP Protocol Suite 1248

Page 1249: TCP-IP

Figure 27.47 Four situations of group-membership operation

TCP/IP Protocol Suite 1249

Page 1250: TCP-IP

27.3 TRANSITION FROM IPv4

TO IPv6

ThreeThree strategiesstrategies havehave beenbeen deviseddevised byby thethe IETFIETF toto provideprovide forfor aa smoothsmooth

transitiontransition fromfrom IPvIPv44 toto IPvIPv66..

TCP/IP Protocol Suite 1250

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

Dual Stack Dual Stack

Tunneling Tunneling

Header Translation Header Translation

Page 1251: TCP-IP

Figure 27.48 Three transition strategies

TCP/IP Protocol Suite 1251

Page 1252: TCP-IP

Figure 27.49 Dual stack

TCP/IP Protocol Suite 1252

Page 1253: TCP-IP

Figure 27.50 Automatic tunneling

TCP/IP Protocol Suite 1253

Page 1254: TCP-IP

Figure 27.51 Configured tunneling

TCP/IP Protocol Suite 1254

Page 1255: TCP-IP

Figure 27.52 Header translation

TCP/IP Protocol Suite 1255

Page 1256: TCP-IP

Table 27.9 Table 27.9 Header translationHeader translation

TCP/IP Protocol Suite 1256

Page 1257: TCP-IP

Chapter 28Chapter 28Chapter 28Chapter 28Chapter 28Chapter 28Chapter 28Chapter 28

Upon completion you will be able to:

SecuritySecurity

Objectives

TCP/IP Protocol Suite 1257

Upon completion you will be able to:

• Differentiate between two categories of cryptography schemes

• Understand four aspects of security

• Understand the concept of digital signature

• Understand the role of key management in entity authentication

• Know how and where IPSec, TLS, and PPG provide security

Page 1258: TCP-IP

28.1 CRYPTOGRAPHY

TheThe wordword cryptographycryptography inin GreekGreek meansmeans “secret“secret writingwriting..”” TheThe termterm todaytoday

refersrefers toto thethe sciencescience andand artart ofof transformingtransforming messagesmessages toto makemake themthem

securesecure andand immuneimmune toto attacksattacks..

TCP/IP Protocol Suite 1258

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

SymmetricSymmetric--Key Cryptography Key Cryptography

AsymmetricAsymmetric--Key Cryptography Key Cryptography

Comparison Comparison

Page 1259: TCP-IP

Figure 28.1 Cryptography components

TCP/IP Protocol Suite 1259

Page 1260: TCP-IP

In cryptography, the

encryption/decryption algorithms are

public; the keys are secret.

Note:Note:

TCP/IP Protocol Suite 1260

public; the keys are secret.

Page 1261: TCP-IP

In symmetric-key cryptography, the

same key is used by the sender (for

encryption) and the receiver (for

Note:Note:

TCP/IP Protocol Suite 1261

encryption) and the receiver (for

decryption). The key is shared.

Page 1262: TCP-IP

Figure 28.2 Symmetric-key cryptography

TCP/IP Protocol Suite 1262

Page 1263: TCP-IP

In symmetric-key cryptography, the

same key is used in both directions.

Note:Note:

TCP/IP Protocol Suite 1263

Page 1264: TCP-IP

Figure 28.3 Caesar cipher

TCP/IP Protocol Suite 1264

Page 1265: TCP-IP

Figure 28.4 Transpositional cipher

TCP/IP Protocol Suite 1265

Page 1266: TCP-IP

Figure 28.5 DES

TCP/IP Protocol Suite 1266

Page 1267: TCP-IP

Figure 28.6 Iteration block

TCP/IP Protocol Suite 1267

Page 1268: TCP-IP

Figure 28.7 Triple DES

TCP/IP Protocol Suite 1268

Page 1269: TCP-IP

The DES cipher uses the same concept

as the Caesar cipher, but the

encryption/ decryption algorithm is

Note:Note:

TCP/IP Protocol Suite 1269

encryption/ decryption algorithm is

much more complex.

Page 1270: TCP-IP

Figure 28.8 Public-key cryptography

TCP/IP Protocol Suite 1270

Page 1271: TCP-IP

Figure 28.9 RSA

TCP/IP Protocol Suite 1271

Page 1272: TCP-IP

Symmetric-key cryptography is often

Note:Note:

TCP/IP Protocol Suite 1272

Symmetric-key cryptography is often

used for long messages.

Page 1273: TCP-IP

Asymmetric-key algorithms are more

efficient for short messages.

Note:Note:

TCP/IP Protocol Suite 1273

efficient for short messages.

Page 1274: TCP-IP

28.2 PRIVACY

PrivacyPrivacy meansmeans thatthat thethe sendersender andand thethe receiverreceiver expectexpect confidentialityconfidentiality..

TheThe transmittedtransmitted messagemessage mustmust makemake sensesense toto onlyonly thethe intendedintended receiverreceiver..

ToTo allall others,others, thethe messagemessage mustmust bebe unintelligibleunintelligible..

TCP/IP Protocol Suite 1274

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

Privacy with SymmetricPrivacy with Symmetric--Key Cryptography Key Cryptography

Privacy with AsymmetricPrivacy with Asymmetric--Key Cryptography Key Cryptography

Page 1275: TCP-IP

Figure 28.10 Privacy using symmetric-key encryption

TCP/IP Protocol Suite 1275

Page 1276: TCP-IP

Figure 28.11 Privacy using asymmetric-key encryption

TCP/IP Protocol Suite 1276

Page 1277: TCP-IP

Digital signature can provide

authentication, integrity, and

Note:Note:

TCP/IP Protocol Suite 1277

authentication, integrity, and

nonrepudiation for a message.

Page 1278: TCP-IP

28.3 DIGITAL SIGNATURE

DigitalDigital signaturesignature cancan provideprovide authentication,authentication, integrity,integrity, andand

nonrepudiationnonrepudiation forfor aa messagemessage..

TCP/IP Protocol Suite 1278

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

Signing the Whole Document Signing the Whole Document

Signing the Digest Signing the Digest

Page 1279: TCP-IP

Figure 28.12 Signing the whole document

TCP/IP Protocol Suite 1279

Page 1280: TCP-IP

Digital signature does not provide

privacy. If there is a need for privacy,

another layer of encryption/decryption

Note:Note:

TCP/IP Protocol Suite 1280

another layer of encryption/decryption

must be applied.

Page 1281: TCP-IP

Figure 28.13 Hash function

TCP/IP Protocol Suite 1281

Page 1282: TCP-IP

Figure 28.14 Sender site

TCP/IP Protocol Suite 1282

Page 1283: TCP-IP

Figure 28.15 Receiver site

TCP/IP Protocol Suite 1283

Page 1284: TCP-IP

28.4 ENTITY AUTHENTICATION

EntityEntity authenticationauthentication isis aa procedureprocedure thatthat verifiesverifies thethe identityidentity ofof oneone entityentity

forfor anotheranother.. AnAn entityentity cancan bebe aa person,person, aa process,process, aa client,client, oror aa serverserver.. InIn

entityentity authentication,authentication, thethe identityidentity isis verifiedverified onceonce forfor thethe entireentire durationduration

ofof systemsystem accessaccess..

TCP/IP Protocol Suite 1284

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

Entity Authentication with SymmetricEntity Authentication with Symmetric--Key Cryptography Key Cryptography

Entity Authentication with AsymmetricEntity Authentication with Asymmetric--Key Cryptography Key Cryptography

Page 1285: TCP-IP

Figure 28.16 Using a symmetric key only

TCP/IP Protocol Suite 1285

Page 1286: TCP-IP

Figure 28.17 Using a nonce

TCP/IP Protocol Suite 1286

Page 1287: TCP-IP

Figure 28.18 Bidirectional authentication

TCP/IP Protocol Suite 1287

Page 1288: TCP-IP

28.5 KEY MANAGEMENT

InIn thisthis sectionsection wewe explainexplain howhow symmetricsymmetric keyskeys areare distributeddistributed andand howhow

publicpublic keyskeys areare certifiedcertified..

TCP/IP Protocol Suite 1288

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

SymmetricSymmetric--Key Distribution Key Distribution

PublicPublic--Key Certification Key Certification

Kerberos Kerberos

Page 1289: TCP-IP

A symmetric key between two parties is

useful if it is used only once; it must be

created for one session and destroyed

Note:Note:

TCP/IP Protocol Suite 1289

created for one session and destroyed

when the session is over.

Page 1290: TCP-IP

Figure 28.19 Diffie-Hellman method

TCP/IP Protocol Suite 1290

Page 1291: TCP-IP

The symmetric (shared) key in the

Diffie-Hellman protocol is

K = G xy mod N.

Note:Note:

TCP/IP Protocol Suite 1291

K = G xy mod N.

Page 1292: TCP-IP

Let us give an example to make the procedure clear. Our example uses small

numbers, but note that in a real situation, the numbers are very large. Assume G

= 7 and N = 23. The steps are as follows:

1. Alice chooses x = 3 and calculates R1 = 73 mod 23 = 21.

2. Alice sends the number 21 to Bob.

EXAMPLEEXAMPLEEXAMPLEEXAMPLE 1111

TCP/IP Protocol Suite 1292

3. Bob chooses y = 6 and calculates R2 = 76 mod 23 = 4.

4. Bob sends the number 4 to Alice.

5. Alice calculates the symmetric key K = 43 mod 23 = 18.

6. Bob calculates the symmetric key K = 216 mod 23 = 18.

The value of K is the same for both Alice and Bob; G xy mod N = 718 mod 23

= 18.

Page 1293: TCP-IP

Figure 28.20 Man-in-the-middle attack

TCP/IP Protocol Suite 1293

Page 1294: TCP-IP

Figure 28.21 First approach using KDC

TCP/IP Protocol Suite 1294

Page 1295: TCP-IP

Figure 28.22 Needham-Schroeder protocol

TCP/IP Protocol Suite 1295

Page 1296: TCP-IP

Figure 28.23 Otway-Rees protocol

TCP/IP Protocol Suite 1296

Page 1297: TCP-IP

In public-key cryptography, everyone

Note:Note:

TCP/IP Protocol Suite 1297

In public-key cryptography, everyone

has access to everyone’s public key.

Page 1298: TCP-IP

Table 28.1 X.509 fieldsTable 28.1 X.509 fields

TCP/IP Protocol Suite 1298

Page 1299: TCP-IP

Figure 28.24 PKI hierarchy

TCP/IP Protocol Suite 1299

Page 1300: TCP-IP

Figure 28.25 Kerberos servers

TCP/IP Protocol Suite 1300

Page 1301: TCP-IP

Figure 28.26 Kerberos example

TCP/IP Protocol Suite 1301

Page 1302: TCP-IP

28.6 SECURITY IN THE INTERNET

InIn thisthis sectionsection wewe discussdiscuss aa securitysecurity methodmethod forfor eacheach ofof thethe toptop 33 layerslayers

ofof thethe InternetInternet modelmodel.. AtAt thethe IPIP levellevel wewe discussdiscuss aa protocolprotocol calledcalled IPSecIPSec;;

atat thethe transporttransport layerlayer wewe discussdiscuss aa protocolprotocol thatthat “glues”“glues” aa newnew layerlayer toto

thethe transporttransport layerlayer;; atat thethe applicationapplication layerlayer wewe discussdiscuss aa securitysecurity methodmethod

calledcalled PGPPGP..

TCP/IP Protocol Suite 1302

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

IP Level Security: IPSec IP Level Security: IPSec

Transport Layer Security Transport Layer Security

Application Layer Security: PGP Application Layer Security: PGP

Page 1303: TCP-IP

Figure 28.27 Transport mode

TCP/IP Protocol Suite 1303

Page 1304: TCP-IP

Figure 28.28 Tunnel mode

TCP/IP Protocol Suite 1304

Page 1305: TCP-IP

Figure 28.29 AH

TCP/IP Protocol Suite 1305

Page 1306: TCP-IP

The AH protocol provides message

authentication and integrity,

but not privacy.

Note:Note:

TCP/IP Protocol Suite 1306

but not privacy.

Page 1307: TCP-IP

Figure 28.30 ESP

TCP/IP Protocol Suite 1307

Page 1308: TCP-IP

ESP provides message authentication,

integrity, and privacy.

Note:Note:

TCP/IP Protocol Suite 1308

Page 1309: TCP-IP

Figure 28.31 Position of TLS

TCP/IP Protocol Suite 1309

Page 1310: TCP-IP

Figure 28.32 TLS layers

TCP/IP Protocol Suite 1310

Page 1311: TCP-IP

Figure 28.33 Handshake protocol

TCP/IP Protocol Suite 1311

Page 1312: TCP-IP

Figure 28.34 Record Protocol

TCP/IP Protocol Suite 1312

Page 1313: TCP-IP

Figure 28.35 PGP at the sender site

TCP/IP Protocol Suite 1313

Page 1314: TCP-IP

Figure 28.36 PGP at the receiver site

TCP/IP Protocol Suite 1314

Page 1315: TCP-IP

28.7 FIREWALLS

AA firewallfirewall isis aa devicedevice (usually(usually aa routerrouter oror aa computer)computer) installedinstalled betweenbetween

thethe internalinternal networknetwork ofof anan organizationorganization andand thethe restrest ofof thethe InternetInternet.. ItIt isis

designeddesigned toto forwardforward somesome packetspackets andand filterfilter (not(not forward)forward) othersothers..

TCP/IP Protocol Suite 1315

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

PacketPacket--Filter Firewall Filter Firewall

Proxy Firewall Proxy Firewall

Page 1316: TCP-IP

Figure 28.37 Firewall

TCP/IP Protocol Suite 1316

Page 1317: TCP-IP

Figure 28.38 Packet-filter firewall

TCP/IP Protocol Suite 1317

Page 1318: TCP-IP

A packet-filter firewall filters at the

network or transport layer.

Note:Note:

TCP/IP Protocol Suite 1318

Page 1319: TCP-IP

Figure 28.39 Proxy firewall

TCP/IP Protocol Suite 1319

Page 1320: TCP-IP

A proxy firewall filters at the

application layer.

Note:Note:

TCP/IP Protocol Suite 1320

Page 1321: TCP-IP