Client Server

Download Report

Transcript Client Server

Peer to Peer Protocol
CISC-856 TCP/IP & Upper Layer Protocols
Abuthahir
November 25, 2008
Acknowledgements
Prof. Paul Amer
Kurose and Ross
Peer to Peer
Client Server
1.Server is the central
entity and only provider
of service and content.
2.Server as the higher
performance system.
3.Clients as the lower
performance system.
Ex: WWW
1.Resources are shared between the peers
2.Resources can be accessed directly from the peers
3.Peer is provider and requestor.
Centralized P2P
Pure P2P
Hybrid P2P
DHT Based P2P
1.All features of
Peer to Peer
included.
2.Central entity is
necessary to
provide the service.
3.Central entity is
some kind of
index/group
database.
Ex: Napster
1.All features of Peer
to Peer included.
2.Any terminal entity
can be removed
without loss of
functionality
No central entities.
Ex: Gnutella 0.4
1.All features of Peer
to Peer included.
2.Any terminal entity
can be removed
without loss of
functionality.
-dynamic central
entities
Ex: Gnutella 0.6, JXTA
1.All features of Peer
to Peer included.
2.Any terminal entity
can be removed
without loss of
functionality
-no central entity
3.Connections in the
overlay are “fixed”
Ex: Chord,CAN
What is Gnutella?
• Gnutella is a protocol for
distributed search
• Each node in a Gnutella network
acts as both a client and server
• Nodes are called “Servents”
(Server and Client)
• Peer to Peer, decentralized model
for file sharing
• Any type of file can be shared
Peer Discovery
•
IP addresses of a peer in Gnutella
network:
- GWebCache server
IP Addresses
-Host Cache File
List of IP
addresses
Peer A
Peer B
Gnutella Connection
SYN
SYN + ACK
ACK
TCP Connection
Established
GNUTELLA
CONNECT/0.4
<CR> <LF>
TCP Connection
Established
GNUTELLA/0.4
OK <CR> <LF>
GNUTELLA/0.4
OK <CR> <LF>
Gnutella Connection
Established
Gnutella Connection
Established
Flooding
•
Node forwards Ping and Query
descriptors (Gnutella PDUs) to all
nodes connected to it
•
Except:
1. If descriptor’s TTL is decremented
to 0
2. Descriptor has already been
received before
- Loop detection is done by storing
Descriptor ID’s
•
Pong and QueryHit descriptors retrace
the exact path of their respective Ping
and Query descriptors
Ping/Pong Routing
Peer A
Peer B
Peer C
PING
PING
PONG
Peer A learns info
related to Peer B
PING
PONG
Peer B learns info
related to Peer A
PONG
PONG
Peer A learns info
related to Peer C
PING
Peer B updates info
related to Peer C
PING
PONG
PONG
Peer B updates info
related to Peer A
Peer C learns info
related to Peer A
TTL=0
What happens if TTL =4?
Peer C
Pong
TTL=2
Pong
TTL=1
Pong
Ping
Ping
Pong
Detection
Ping
Pong
Peer A
Loop
Peer B
Pong
Peer D
TTL=0
Querying
•
Servent sends Query descriptor to
nodes it is connected to.
•
Queried Servents check to see if
they have the file.
– If query match is found, a
QueryHit is sent back to
querying node
I have
Dhoo
m.mp3
Peer C
File download
using HTTP
Queryhit
Query
Querhit
Query
Query
Peer A
Peer B
Who has
Dhoom.mp3
Peer D
Firewalled Servents
Incoming
Connectio
n is
blocked
Downloading…
GIV
Peer C
HTTP GET
Push
Push
Peer A
Peer B
Peer D
Firewalled Servents
If a servent is behind a firewall, it does not permit incoming
connections to its Gnutella port.
The Servent attempting to download sends “push” message
to the servent which has sent the query hit message.
The servent on receipt of “push” message, opens a TCP/IP
connection and sends the following message:
GIV<File Index>:<Servent Identifier>/<Filename>\n\n
The Servent receives GIV message and sends a HTTP GET
message to download the file.
Graceful Termination
(optional)
Peer C
Bye
Peer A
Peer B
Peer D
Gnutella Terminology
• GUID:
Short for Global Unique Identifier, a randomized string that is
used to uniquely identify a host or message on the Gnutella
Network. This prevents duplicate messages from being sent on
the network.
• GWebCache:
a distributed system for helping servents connect to the Gnutella
network, thus solving the "bootstrapping" problem. Servents
query any of several hundred GWebCache servers to find the
addresses of other servents. GWebCache servers are typically
web servers running a special module.
• Host Catcher:
Pong responses allow servents to keep track of active gnutella
hosts
• On most servents, the default port for Gnutella is 6346
Gnutella Messages
Gnutella Message Header
Gnutella Message Header (Cont.)
Ping Descriptor
Pong Descriptor
Query Descriptor
Query Hit Descriptor
Query Hit Descriptor (cont.)
Push Descriptor
Advantages
• Simple Protocol
• No centralized server
- no single point of failure
- low maintenance overhead
• Anonymity of queries
• Support more flexible queries
Disadvantages
• Scales poorly: Querying and Pinging generate a lot of
unnecessary traffic
Example:
– If TTL = 10 and each site contacts six other sites
– Up to 10^6 (approximately 1 million) messages could be
generated.
•
•
•
•
•
Heavy messaging can result in poor performance
Vulnerable to denial-of-service attacks
TTL imposes a horizon
Upload speed << Download speed
Authentication
Exploiting heterogeneity: Gnutella 0.6
• Each peer is either a
supernode or assigned to a
supernode.
– TCP connection between
peer and its group leader.
– TCP connections between
some pairs of group
leaders.
• Supernode tracks the content
in all its children.
ordinary peer
group-leader peer
neighoring relationships
in overlay network
Gnutella 0.6 : Querying
• On connection client updates,supernode with all the files that the
client shares.
• Client sends keyword query to supernode
• Supernode responds with matches.
• Supernode forwards query to other supernodes
• Client then selects files for downloading
References
• www9.limewire.com/developer/gnutella_protocol_0.4.pdf
• rfc-gnutella.sourceforge.net/src/rfc-0_6-draft.html
• en.wikipedia.org/wiki/Gnutella
• computer.howstuffworks.com/file-sharing.htm
• Text book :Computer Networking: A Top-Down Approach
by James F. Kurose, Keith W. Ross