0% found this document useful (0 votes)
59 views109 pages

Chapter 10 Accessible - Application Layer - N

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views109 pages

Chapter 10 Accessible - Application Layer - N

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 109

Because learning changes everything.

Chapter 10

Application Layer
Data Communications and
Networking, With TCP/IP
protocol suite
Sixth Edition
Behrouz A. Forouzan

© 2022 McGraw Hill, LLC. All rights reserved. Authorized only for instructor use in the classroom.
No reproduction or further distribution permitted without the prior written consent of McGraw Hill, LLC.
Chapter 10: Outline

10.1 Introduction

10.2 Client-Server Programming

10.3 Standard Applications

10.4 Peer-to-Peer Paradigm

© McGraw Hill, LLC 2


10.1 INTRODUCTION

The application layer provides services to the user. Communication


is provided using a logical connection, which means that the two
application layers assume that there is an imaginary direct
connection through which they can send and receive messages.
Figure 10.1 shows the idea behind this logical connection.

© McGraw Hill, LLC 3


Figure 10.1 Logical connection at the application layer

Access the text alternative for slide images.

© McGraw Hill, LLC 4


10.1.1 Providing Services

All communication networks that started before the Internet were


designed to provide services to network users. Most of these
networks, however, were originally designed to provide one specific
service. For example, the telephone network was originally
designed to provide voice service: to allow people all over the
world to talk to each other. This network, however, was later used
for some other services, such as facsimile (fax), enabled by users
adding some extra hardware at both ends.

© McGraw Hill, LLC 5


Standard and Nonstandard Protocols

To provide a smooth operation of the Internet, the protocols used in


the first four layers of the TCP/IP suite need to be standardized and
documented. They normally become part of the package that is
included in operating systems such as Windows or UNIX. To be
flexible, however, the application-layer protocols can be both
standard and nonstandard.

© McGraw Hill, LLC 6


10.1.2 Application-Layer Paradigms

It should be clear that to use the Internet we need two application


programs to interact with each other: one running on a computer
somewhere in the world, the other running on another computer
somewhere else in the world. The two programs need to send
messages to each other through the Internet infrastructure.
However, we have not discussed what the relationship should be
between these programs. Two paradigms have been developed: the
client-server paradigm and the peer-to-peer paradigm. We briefly
introduce these two paradigms here.

© McGraw Hill, LLC 7


Traditional Paradigm: Client-Server

The traditional paradigm is called the client-server paradigm. It


was the most popular paradigm until a few years ago. In this
paradigm, the service provider is an application program, called
the server process; it runs continuously, waiting for another
application program, called the client process, to make a
connection through the Internet and ask for service. There are
normally some server processes that can provide a specific type of
service, but there are many clients that request service from any of
these server processes. The server process must be running all the
time; the client process is started when the client needs to receive
service.

© McGraw Hill, LLC 8


Figure 10.2 Example of a client-server paradigm

Access the text alternative for slide images.

© McGraw Hill, LLC 9


New Paradigm: Peer-to-Peer

A new paradigm, called the peer-to-peer paradigm (often


abbreviated P2P paradigm) has emerged to respond to the needs of
some new applications. In this paradigm, there is no need for a
server process to be running all the time and waiting for the client
processes to connect. The responsibility is shared between peers. A
computer connected to the Internet can provide service at one time
and receive service at another time. A computer can even provide
and receive services at the same time. Figure 10.3 shows an
example of communication in this paradigm.

© McGraw Hill, LLC 10


Figure 10.3 Example of a peer-to-peer paradigm

Access the text alternative for slide images.

© McGraw Hill, LLC 11


Mixed Paradigm

An application may choose to use a mixture of the two paradigms


by combining the advantages of both. For example, a light-load
client-server communication can be used to find the address of the
peer that can offer a service. When the address of the peer is found,
the actual service can be received from the peer by using the peer-
to-peer paradigm.

© McGraw Hill, LLC 12


10.2 CLIENT-SERVER PROGRAMMING

In a client-server paradigm, communication at the application


layer is between two running application programs called
processes: a client and a server. A client is a running program that
initializes the communication by sending a request; a server is
another application program that waits for a request from a client.
The server handles the request received from a client, prepares a
result, and sends the result back to the client.

© McGraw Hill, LLC 13


10.2.1 Application Programming Interface

How can a client process communicate with a server process? A


computer program is normally written in a computer language with
a predefined set of instructions that tells the computer what to do. If
we need a process to be able to communicate with another process,
we need a new set of instructions to tell the lowest four layers of the
TCP/IP suite to open the connection, send and receive data from
the other end, and close the connection. A set of instructions of this
kind is normally referred to as an application programming
interface (API).

© McGraw Hill, LLC 14


Figure 10.4 Position of the socket interface

Access the text alternative for slide images.

© McGraw Hill, LLC 15


Figure 10.5 A sockets used like other sources and sinks

Access the text alternative for slide images.

© McGraw Hill, LLC 16


Sockets

Although a socket is supposed to behave like a terminal or a file, it


is not a physical entity like them; it is an abstraction. It is a data
structure that is created and used by the application program.

© McGraw Hill, LLC 17


Figure 10.6 Use of sockets in process-to-process communication

Access the text alternative for slide images.

© McGraw Hill, LLC 18


Socket Addresses

The interaction between a client and a server is two-way


communication. In a two-way communication, we need a pair of
addresses: local (sender) and remote (receiver). The local address
in one direction is the remote address in the other direction and
vice versa. Since communication in the client-server paradigm is
between two sockets, we need a pair of socket addresses for
communication: a local socket address and a remote socket
address. However, we need to define a socket address in terms of
identifiers used in the TCP/IP protocol suite.

© McGraw Hill, LLC 19


Figure 10.7 A socket address

© McGraw Hill, LLC 20


Example 10.1

We can find a two-level address in telephone communication. A


telephone number can define an organization, and an extension can
define a specific connection in that organization. The telephone
number in this case is similar to the IP address, which defines the
whole organization; the extension is similar to the port number,
which defines the particular connection.

© McGraw Hill, LLC 21


Finding Socket Addresses

How can a client or a server find a pair of socket addresses for


communication? The situation is different for each site.

© McGraw Hill, LLC 22


10.2.2 Using Services of Transport Layer

A pair of processes provide services to the users of the Internet,


human or programs. A pair of processes, however, need to use the
services provided by the transport layer for communication
because there is no physical communication at the application
layer. As we discussed before, there are three common transport-
layer protocols in the TCP/IP suite: UDP, TCP, and SCTP. Most
standard applications have been designed to use the services of one
of these protocols.

© McGraw Hill, LLC 23


UDP Protocol

UDP provides connectionless, unreliable, datagram service.


Connectionless service means that there is no logical connection
between the two ends exchanging messages. Each message is an
independent entity encapsulated in a packet called a datagram.
UDP does not see any relation (connection) between consequent
datagrams coming from the same source and going to the same
destination.

© McGraw Hill, LLC 24


TCP Protocol

TCP provides connection-oriented, reliable, byte-stream service.


TCP requires that two ends first create a logical connection
between themselves by exchanging some connection-establishment
packets. This phase, which is sometimes called handshaking,
establishes some parameters between the two ends including the
size of the data packets to be exchanged, the size of buffers to be
used for holding the chunks of data until the whole message
arrives, and so on.

© McGraw Hill, LLC 25


SCTP Protocol

SCTP provides a service that is a combination of the two other


protocols. Like TCP, SCTP provides a connection-oriented, reliable
service, but it is not byte-stream oriented. It is a message-oriented
protocol like UDP. In addition, SCTP can provide multi-stream
service by providing multiple network-layer connections.

© McGraw Hill, LLC 26


10-3 STANDARD APPLICATIONS

During the lifetime of the Internet, several client-server application


programs have been developed. We do not have to redefine them,
but we need to understand what they do. For each application, we
also need to know the options available to us. The study of these
applications and the ways they provide different services can help
us to create customized applications in the future.

© McGraw Hill, LLC 27


10.3.1 World Wide Web and HTTP

In this section, we first introduce the World Wide Web (abbreviated


WWW or Web). We then discuss the HyperText Transfer Protocol
(HTTP), the most common client-server application program used
in relation to the Web.

© McGraw Hill, LLC 28


World Wide Web

The idea of the Web was first proposed by Tim Berners-Lee in 1989
at CERN, the European Organization for Nuclear Research, to
allow several researchers at different locations throughout Europe
to access each others’ researches. The commercial Web started in
the early 1990s.

© McGraw Hill, LLC 29


Example 10.2

Assume we need to retrieve a scientific document that contains one


reference to another text file and one reference to a large image.
Figure 10.8 shows the situation.

© McGraw Hill, LLC 30


Figure 10.8 Example 10.2

Access the text alternative for slide images.

© McGraw Hill, LLC 31


Figure 10.9 Browser

Access the text alternative for slide images.

© McGraw Hill, LLC 32


HyperText Transfer Protocol (HTTP)

The HyperText Transfer Protocol (HTTP) is a protocol that is used


to define how the client-server programs can be written to retrieve
web pages from the Web. An HTTP client sends a request; an HTTP
server returns a response. The server uses the port number 80; the
client uses a temporary port number.

© McGraw Hill, LLC 34


Example 10.4

Figure 10.10 shows an example of a nonpersistent connection. The


client needs to access a file that contains one link to an image. The
text file and image are located on the same server. Here we need
two connections. For each connection, TCP requires at least three
handshake messages to establish the connection, but the request can
be sent with the third one. After the connection is established, the
object can be transferred. After receiving an object, another three
handshake messages are needed to terminate the connection.

© McGraw Hill, LLC 35


Figure 10.10 Example 10.4

Access the text alternative for slide images.

© McGraw Hill, LLC 36


Example 10.5

Figure 10.11 shows the same scenario as in Example 10.4, but


using a persistent connection. Only one connection establishment
and connection termination is used, but the request for the image is
sent separately.

© McGraw Hill, LLC 37


Figure 10.11 Example 10.5

Access the text alternative for slide images.

© McGraw Hill, LLC 38


Example 10.10

Figure 10.16 shows an example of a use of a proxy server in a local


network, such as the network on a campus or in a company. The
proxy server is installed in the local network. When an HTTP
request is created by any of the clients (browsers), the request is
first directed to the proxy server If the proxy server already has the
corresponding web page, it sends the response to the client.
Otherwise, the proxy server acts as a client and sends the request to
the web server in the Internet. When the response is returned, the
proxy server makes a copy and stores it in its cache before sending
it to the requesting client.

© McGraw Hill, LLC 39


Figure 10.16 Example of a proxy server

Access the text alternative for slide images.

© McGraw Hill, LLC 40


HTTP Security

HTTP per se does not provide security. However, HTTP can be run
over the Secure Socket Layer (SSL). In this case, HTTP is referred
to as HTTPS. HTTPS provides confidentiality, client and server
authentication, and data integrity.

© McGraw Hill, LLC 41


10.3.2 FTP

File Transfer Protocol (FTP) is the standard protocol provided by


TCP/IP for copying a file from one host to another. Although
transferring files from one system to another seems simple and
straightforward, some problems must be dealt with first. For
example, two systems may use different file name conventions. Two
systems may have different ways to represent data. Two systems
may have different directory structures. All of these problems have
been solved by FTP in a very simple and elegant approach.
Although we can transfer files using HTTP, FTP is a better choice
to transfer large files or to transfer files using different formats.

© McGraw Hill, LLC 42


Figure 10.17 FTP

Access the text alternative for slide images.

© McGraw Hill, LLC 43


Lifetimes of Two Connections

The two connections in FTP have different lifetimes. The control


connection remains connected during the entire interactive FTP
session. The data connection is opened and then closed for each
file transfer activity. It opens each time commands that involve
transferring files are used, and it closes when the file is transferred.
In other words, when a user starts an FTP session, the control
connection opens. While the control connection is open, the data
connection can be opened and closed multiple times if several files
are transferred. FTP uses two well-known TCP ports: port 21 is
used for the control connection, and port 20 is used for the data
connection.

© McGraw Hill, LLC 44


Control Connection

For control communication, FTP uses the same approach as


TELNET (discussed later). It uses the NVT ASCII character set as
used by TELNET. Communication is achieved through commands
and responses. This simple method is adequate for the control
connection because we send one command (or response) at a time.
Each line is terminated with a two-character (carriage return and
line feed) end-of-line token.

© McGraw Hill, LLC 45


Data Connection

The data connection uses the well-known port 20 at the server site.
However, the creation of a data connection is different from the
control connection. The following shows the steps:

1. The client, not the server, issues a passive open using an


ephemeral port.

2. Using the PORT command the client sends the port number to
the server..

3. The server receives the port number and issues an active open
using the well-known port 20 and the received ephemeral port
number.

© McGraw Hill, LLC 46


Example 10.11

Figure 10.18 shows an example of using FTP for retrieving a file.


The figure shows only one file to be transferred. The control
connection remains open all the time, but the data connection is
opened and closed repeatedly. We assume the file is transferred in
six sections. After all records have been transferred, the server
control process announces that the file transfer is done. Since the
client control process has no file to retrieve, it issues the QUIT
command, which causes the service connection to be closed.

© McGraw Hill, LLC 47


Security for FTP

The FTP protocol was designed when security was not a big issue.
Although FTP requires a password, the password is sent in
plaintext (unencrypted), which means it can be intercepted and
used by an attacker. The data transfer connection also transfers
data in plaintext, which is insecure. To be secure, one can add a
Secure Socket Layer between the FTP application layer and the
TCP layer. In this case FTP is called SSL-FTP. We also explore
some secure file transfer applications when we discuss SSH later in
the chapter.

© McGraw Hill, LLC 48


10.3.3 Electronic Mail

Electronic mail (or e-mail) allows users to exchange messages. The


nature of this application, however, is different from other
applications discussed so far. In an application such as HTTP or
FTP, the server program is running all the time, waiting for a
request from a client. When the request arrives, the server provides
the service. There is a request and there is a response. In the case
of electronic mail, the situation is different. First, e-mail is
considered a one-way transaction. When Alice sends an e-mail to
Bob, she may expect a response, but this is not a mandate.

© McGraw Hill, LLC 49


Architecture

To explain the architecture of e-mail, we give a common scenario,


as shown in Figure 10.19. Another possibility is the case in which
Alice or Bob is directly connected to the corresponding mail server,
in which LAN or WAN connection is not required, but this variation
in the scenario does not affect our discussion.

© McGraw Hill, LLC 50


Figure 10.19 Common scenario

© McGraw Hill, LLC 51


User Agent

The first component of an electronic mail system is the user agent


(UA). It provides service to the user to make the process of sending
and receiving a message easier. A user agent is a software package
(program) that composes, reads, replies to, and forwards messages.
It also handles local mailboxes on the user computers.

© McGraw Hill, LLC 52


Figure 10.20 Format of an e-mail

© McGraw Hill, LLC 53


Figure 10.21 E-mail address

Access the text alternative for slide images.

© McGraw Hill, LLC 54


Message Transfer Agent: SMTP

Based on the common scenario (Figure 10.19), we can say that the
e-mail is one of those applications that needs three uses of client-
server paradigms to accomplish its task. It is important that we
distinguish these three when we are dealing with e-mail. Figure
10.22 shows these three client-server applications. We refer to the
first and the second as Message Transfer Agents (MTAs), the third
as Message Access Agent (MAA).

© McGraw Hill, LLC 55


Figure 10.22 Protocols used in electronic mail

Access the text alternative for slide images.

© McGraw Hill, LLC 56


Example 10.13

To show the three mail transfer phases, we show all of the steps
described above using the information depicted in Figure 10.23. In
the figure, we have separated the messages related to the envelope,
header, and body in the data transfer section. Note that the steps in
this figure are repeated two times in each e-mail transfer: once from
the e-mail sender to the local mail server and once from the local
mail server to the remote mail server. The local mail server, after
receiving the whole e-mail message, may spool it and send it to the
remote mail server at another time.

© McGraw Hill, LLC 57


Message Access Agent: POP and IMAP

The first and second stages of mail delivery use SMTP. However,
SMTP is not involved in the third stage because SMTP is a push
protocol; it pushes the message from the client to the server. In
other words, the direction of the bulk data (messages) is from the
client to the server. On the other hand, the third stage needs a pull
protocol; the client must pull messages from the server. The
direction of the bulk data is from the server to the client. The third
stage uses a message access agent.

© McGraw Hill, LLC 58


Figure 10.24 POP3

Access the text alternative for slide images.

© McGraw Hill, LLC 59


Web-Based Mail

E-mail is such a common application that some websites today


provide this service to anyone who accesses the site. Three common
sites are Hotmail, Yahoo, and Google mail. The idea is very simple.
Figure 10.29 shows two cases.

© McGraw Hill, LLC 60


Figure 10.29 Web-based e-mail, cases I and II

Access the text alternative for slide images.

© McGraw Hill, LLC 61


E-Mail Security

The protocol discussed in this chapter does not provide any


security provisions per se. However, e-mail exchanges can be
secured using two application-layer securities designed in
particular for e-mail systems. Two of these protocols, Pretty Good
Privacy (PGP) and Secure/Multipurpose Internet Mail Extensions
(S/MIME), are discussed in Chapter 13 after we have discussed
basic network security.

© McGraw Hill, LLC 62


10.3.4 TELNET

A server program can provide a specific service to its


corresponding client program. However, it is impossible to have a
client/server pair for each type of service we need; the number of
servers soon becomes intractable. One of the original remote
logging protocols is TELNET, which is an abbreviation for
TErminaL NETwork. Although TELNET requires a logging name
and password, it is vulnerable to hacking because it sends all data
including the password in plaintext (not encrypted).

© McGraw Hill, LLC 63


Local versus Remote Logging

We first discuss the concept of local and remote logging as shown


in Figure 10.30.

© McGraw Hill, LLC 64


Figure 10.30 Local versus remote logging

Access the text alternative for slide images.

© McGraw Hill, LLC 65


Network Virtual Terminal (NVT)

The mechanism to access a remote computer is complex. This is


because every computer and its operating system accepts a special
combination of characters as tokens. For example, the end-of-file
token in a computer running the DOS operating system is Ctrl+z,
while the UNIX operating system recognizes Ctrl+d.

© McGraw Hill, LLC 66


Figure 10.31 Concept of NVT

Access the text alternative for slide images.

© McGraw Hill, LLC 67


Operation

TELNET lets the client and server negotiate options before or


during the use of the service. Options are extra features available
to a user with a more sophisticated terminal. Users with simpler
terminals can use default features.

© McGraw Hill, LLC 68


User Interface

The operating system (UNIX, for example) defines an interface with


user-friendly commands. An example of such a set of commands
can be found in Table 10.11.

© McGraw Hill, LLC 69


Table 10.11 Examples of interface commands

Command Meaning Command Meaning


open Connect to a remote computer set Set the operating parameters
close Close the connection status Display the status information
display Show the operating parameters send Send special characters
mode Change to line or character mode quit Exit TELNET

© McGraw Hill, LLC 70


10.3.5 Secure Shell (SSH)

Although Secure Shell (SSH) is a secure application program that


can be used today for several purposes such as remote logging and
file transfer, it was originally designed to replace TELNET. There
are two versions of SSH: SSH-1 and SSH-2, which are totally
incompatible. The first version, SSH-1, is now deprecated because
of security flaws in it. In this section, we discuss only SSH-2.

© McGraw Hill, LLC 71


Components

SSH is an application-layer protocol with three components, as


shown in Figure 10.32.

© McGraw Hill, LLC 72


Figure 10.32 Components of SSH

© McGraw Hill, LLC 73


Applications 1

Although SSH is often thought of as a replacement for TELNET,


SSH is, in fact, a general-purpose protocol that provides a secure
connection between a client and server.

© McGraw Hill, LLC 74


Port Forwarding

One of the interesting services provided by the SSH protocol is port


forwarding. We can use the secured channels available in SSH to
access an application program that does not provide security
services. Applications such as TELNET and Simple Mail Transfer
Protocol (SMTP), which are discussed later, can use the services of
the SSH port forwarding mechanism. The SSH port forwarding
mechanism creates a tunnel through which the messages belonging
to other protocols can travel. For this reason, this mechanism is
sometimes referred to as SSH tunneling. Figure 10.33 shows the
concept of port forwarding for securing the FTP application.

© McGraw Hill, LLC 75


Figure 10.33 Port forwarding

Access the text alternative for slide images.

© McGraw Hill, LLC 76


Format of the SSH Packets

Figure 10.34 shows the format of packets used by the SSH


protocols.

© McGraw Hill, LLC 77


Figure 10.34 SSH packet format

Access the text alternative for slide images.

© McGraw Hill, LLC 78


10.3.6 Domain Name System (DNS)

The last client-server application program we discuss has been


designed to help other application programs. The Internet needs to
have a directory system that can map a name to an address. This is
analogous to the telephone network. Figure 10.35 shows how
TCP/IP uses a DNS client and a DNS server to map a name to an
address.

© McGraw Hill, LLC 79


Name Space

To be unambiguous, the names assigned to machines must be


carefully selected from a name space with complete control over
the binding between the names and IP addresses. In other words,
the names must be unique because the addresses are unique. A
name space that maps each address to a unique name can be
organized in two ways: flat or hierarchical.

© McGraw Hill, LLC 80


Figure 10.36 Domain name space

Access the text alternative for slide images.

© McGraw Hill, LLC 81


Figure 10.37 Domain names and labels

Access the text alternative for slide images.

© McGraw Hill, LLC 82


Figure 10.38 Domains

Access the text alternative for slide images.

© McGraw Hill, LLC 83


Figure 10.39 Hierarchy of name servers

Access the text alternative for slide images.

© McGraw Hill, LLC 84


Figure 10.40 Zone

Access the text alternative for slide images.

© McGraw Hill, LLC 85


DNS in the Internet

DNS is a protocol that can be used in different platforms. In the


Internet, the domain name space (tree) was originally divided into
three different sections: generic domains, country domains, and the
inverse domains. However, due to the rapid growth of the Internet,
it became extremely difficult to keep track of the inverse domains,
which could be used to find the name of a host when given the IP
address. The inverse domains are now deprecated. We, therefore,
concentrate on the first two.

© McGraw Hill, LLC 86


Resolution

Mapping a name to an address is called name-address resolution.


DNS is designed as a client-server application. A host that needs to
map an address to a name or a name to an address calls a DNS
client called a resolver. The resolver accesses the closest DNS
server with a mapping request. If the server has the information, it
satisfies the resolver; otherwise, it either refers the resolver to
other servers or asks other servers to provide the information.

© McGraw Hill, LLC 87


Figure 10.43 Recursive resolution

Access the text alternative for slide images.

© McGraw Hill, LLC 88


Figure 10.44 Iterative resolution

Access the text alternative for slide images.

© McGraw Hill, LLC 89


Resource Records

The zone information associated with a server is implemented as a


set of resource records. In other words, a name server stores a
database of resource records. A resource record is a 5-tuple
structure, as shown below:

(Domain Name, Type, Class, TTL, Value)

© McGraw Hill, LLC 90


Table 10.13 DNS types

Type Interpretation of value


A A 32-bit IPv4 address (see Chapter 7)
NS Identifies the authoritative servers for a zone
CNAME Defines an alias for the official name of a host
SOA Marks the beginning of a zone
MX Redirects mail to a mail server
AAAA An IPv6 address (see Chapter 7)

© McGraw Hill, LLC 91


DNS Messages

To retrieve information about hosts, DNS uses two types of


messages: query and response. Both types have the same format as
shown in Figure 10.45.

© McGraw Hill, LLC 92


Figure 10.45 DNS message

Access the text alternative for slide images.

© McGraw Hill, LLC 93


Example 10.14

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.

$nslookup www.forouzan.biz
Name: www.forouzan.biz
Address: 198.170.240.179

© McGraw Hill, LLC 94


Encapsulation

DNS can use either UDP or TCP. In both cases the well-known port
used by the server is port 53. UDP is used when the size of the
response message is less than 512 bytes because most UDP
packages have a 512-byte packet size limit. If the size of the
response message is more than 512 bytes, a TCP connection is
used. In that case, one of two scenarios can occur.

© McGraw Hill, LLC 95


Registrars

How are new domains added to DNS? This is done through a


registrar, a commercial entity accredited by ICANN. A registrar
first verifies that the requested domain name is unique and then
enters it into the DNS database.

© McGraw Hill, LLC 96


DDNS

When the DNS was designed, no one predicted that there would be
so many address changes. In DNS, when there is a change, such as
adding a new host, removing a host, or changing an IP address, the
change must be made to the DNS master file. These types of
changes involve a lot of manual updating. The size of today’s
Internet does not allow for this kind of manual operation.

© McGraw Hill, LLC 97


Security of DNS

DNS is one of the most important systems in the Internet


infrastructure; it provides crucial services to Internet users.
Applications such as Web access or e-mail are heavily dependent
on the proper operation of DNS.

© McGraw Hill, LLC 98


10-4 PEER-TO-PERR PARADIGM

In this section, we discuss the peer-to peer paradigm. Peer-to-peer


gained popularity with Napster, an online music file. Napster paved
the way for peer-to-peer file-distribution models that came later.
Gnutella was followed by Fast-Track, BitTorrent, WinMX, and
GNUnet.

© McGraw Hill, LLC 99


10.4.1 P2P Networks

Internet users that are ready to share their resources become peers
and form a network. When a peer in the network has a file) to
share, it makes it available to the rest of the peers. An interested
peer can connect itself to the computer where the file is stored and
download it. After a peer downloads a file, it can make it available
for other peers to download. As more peers join and download that
file, more copies of the file become available to the group.

© McGraw Hill, LLC 100


Centralized Networks

In a centralized P2P network, the directory uses the client-server


paradigm, but the storing and downloading of the files are done
using the peer-to-peer paradigm. For this reason, a centralized
P2P network is sometimes referred to as a hybrid P2P network.
Napster was an example of a centralized P2P. In this type of
network, a peer first registers itself with a central server. The peer
then provides its IP address and a list of files it has to share. To
avoid system collapse, Napster used several servers for this
purpose, but we show only one in Figure 10.46.

© McGraw Hill, LLC 101


Figure 10.46 Centralized network

Access the text alternative for slide images.

© McGraw Hill, LLC 102


Decentralized Network

A decentralized P2P network does not depend on a centralized


directory system. In this model, peers arrange themselves into an
overlay network, which is a logical network made on top of the
physical network. Depending on how the nodes in the overlay
network are linked, a decentralized P2P network is classified as
either unstructured or structured.

© McGraw Hill, LLC 103


10.4.2 Distributed Hash Function

A Distributed Hash Table (DHT) distributes data among a set of


nodes according to some predefined rules. Each peer in a DHT-
based network becomes responsible for a range of data items. To
avoid the flooding overhead that we discussed for unstructured
P2P networks, DHT-based networks allow each peer to have a
partial knowledge about the whole network. This knowledge can be
used to route the queries about the data items to the responsible
nodes using effective and scalable procedures.

© McGraw Hill, LLC 104


Address Space

In a DHT-based network, each data item and the peer is mapped to


a point in a large address of size 2m. The address space is designed
using modular arithmetic, which means that we can think of points
in the address space as distributed evenly on a circle with 2m
points (0 to 2m - 1) using clockwise direction as shown in Figure
10.47. Most of the DHT implementations use m = 160.

© McGraw Hill, LLC 105


Figure 10.47 Address space

Access the text alternative for slide images.

© McGraw Hill, LLC 106


Example 10.15

Although the normal value of m is 160, for the purpose of


demonstration, we use m = 5 to make our examples tractable. In
Figure 2.48, we assume that several peers have already joined the
group. The node N5 with IP address 110.34.56.20 has a file named
Liberty that wants to share with its peers. The node makes a hash of
the file name, “Liberty,” to get the key = 14. Since the closest node
to key 14 is node N17, N5 creates a reference to file name (key), its
IP address, and the port number (and possibly some other
information about the file) and sends this reference to be stored in
node N17. In other words, the file is stored in N5, the key of the
file is k14 (a point in the DHT ring), but the reference to the file is
stored in node N17.

© McGraw Hill, LLC 107


Figure 10.48 Example 10.15

Access the text alternative for slide images.

© McGraw Hill, LLC 108


10.4.6 A Popular P2P Network: BitTorrent

BitTorrent is a P2P protocol, designed by Bram Cohen, for sharing


a large file among a set of peers. However, the term sharing in this
context is different from other file sharing protocols. Instead of one
peer allowing another peer to download the whole file, a group of
peers takes part in the process to give all peers in the group a copy
of the file. File sharing is done in a collaborating process called a
torrent.

© McGraw Hill, LLC 109


Because learning changes everything. ®

www.mheducation.com

© 2022 McGraw Hill, LLC. All rights reserved. Authorized only for instructor use in the classroom.
No reproduction or further distribution permitted without the prior written consent of McGraw Hill, LLC.

You might also like