Transcript 7 th FLOOR
Understanding Network Protocols: The BitTorrent Case
Vishal Nehru
Computer Science 428
Understanding Network Protocols
What is common to Taco Bell, James Bond,
the US Postal Service and Protocols?
What are Protocols?
A set of rules governing communication
between electronics devices.
What are Protocols?
A set of rules governing communication
between electronics devices.
i.e., rules governing the syntax,
semantics and synchronization of
network communication.
What do protocols do?
Most protocols specify one or more of the following behaviors:
Detection of underlying physical connection.
Handshaking (agreeing on parameters such as transfer rate, parity, interrupts)
How to start and end a message
How to format a message
What to do with corrupted or improperly formatted messages (error correction)
How to detect unexpected loss of the connection, and what to do next
Termination of the session or connection
Protocol Layering
OSI model (Open Systems Interconnection) divides the
functions of a protocol into a series of 7 logical layers.
Each layer can be implemented in hardware or software.
Analogous to programming and electronic abstractions.
The 7 Protocol Layers
Application Layer: Interface between software and lower
layer network services, e.g. HTTP, SMTP, FTP, Telnet.
Presentation Layer: Relieves Application layer from burden
of managing syntactical differences in data representation
(compression/encryption/formatting), e.g. ASCII/MIDI/MPEG.
Session Layer: Managing dialogue between end-user
application processes (termination/restart procedures etc.),
e.g. NetBIOS
Transport Layer: Transparent transfer of data between end
users (controls reliability), e.g. TCP, UDP, RTP.
Network Layer: network routing, flow control,
segmentation/desegmentation, and error control, e.g. IP.
Data Link Layer: Functional/procedural means for
transferring data bridges and switches operate at this level,
e.g. Ethernet.
Physical Layer: defines all the electrical and physical
specifications for devices, e.g. hubs, ISDN, DSL, T1.
The 7 Protocol Layers
Application Layer: Interface between software and lower
layer network services, e.g. HTTP, SMTP, FTP, Telnet.
Presentation Layer: Relieves Application layer from burden
of managing syntactical differences in data representation
(compression/encryption/formatting), e.g. ASCII/MIDI/MPEG.
Session Layer: Managing dialogue between end-user
application processes (termination/restart procedures etc.),
e.g. NetBIOS
Transport Layer: Transparent transfer of data between end
users (controls reliability), e.g. TCP, UDP, RTP.
Network Layer: network routing, flow control,
segmentation/desegmentation, and error control, e.g. IP.
Data Link Layer: Functional/procedural means for
transferring data bridges and switches operate at this level,
e.g. Ethernet.
Physical Layer: defines all the electrical and physical
specifications for devices, e.g. hubs, ISDN, DSL, T1.
The 7 Protocol Layers
Application Layer: Interface between software and lower
layer network services, e.g. HTTP, SMTP, FTP, Telnet.
Presentation Layer: Relieves Application layer from burden
of managing syntactical differences in data representation
(compression/encryption/formatting), e.g. ASCII/MIDI/MPEG.
Session Layer: Managing dialogue between end-user
application processes (termination/restart procedures etc.),
e.g. NetBIOS
Transport Layer: Transparent transfer of data between end
users (controls reliability), e.g. TCP, UDP, RTP.
Network Layer: network routing, flow control,
segmentation/desegmentation, and error control, e.g. IP.
Data Link Layer: Functional/procedural means for
transferring data bridges and switches operate at this level,
e.g. Ethernet.
Physical Layer: defines all the electrical and physical
specifications for devices, e.g. hubs, ISDN, DSL, T1.
The 7 Protocol Layers
Application Layer: Interface between software and lower
layer network services, e.g. HTTP, SMTP, FTP, Telnet.
Presentation Layer: Relieves Application layer from burden
of managing syntactical differences in data representation
(compression/encryption/formatting), e.g. ASCII/MIDI/MPEG.
Session Layer: Managing dialogue between end-user
application processes (termination/restart procedures etc.),
e.g. NetBIOS
Transport Layer: Transparent transfer of data between end
users (controls reliability), e.g. TCP, UDP, RTP.
Network Layer: network routing, flow control,
segmentation/desegmentation, and error control, e.g. IP.
Data Link Layer: Functional/procedural means for
transferring data bridges and switches operate at this level,
e.g. Ethernet.
Physical Layer: defines all the electrical and physical
specifications for devices, e.g. hubs, ISDN, DSL, T1.
The 7 Protocol Layers
Application Layer: Interface between software and lower
layer network services, e.g. HTTP, SMTP, FTP, Telnet.
Presentation Layer: Relieves Application layer from burden
of managing syntactical differences in data representation
(compression/encryption/formatting), e.g. ASCII/MIDI/MPEG.
Session Layer: Managing dialogue between end-user
application processes (termination/restart procedures etc.),
e.g. NetBIOS
Transport Layer: Transparent transfer of data between end
users (controls reliability), e.g. TCP, UDP, RTP.
Network Layer: network routing, flow control,
segmentation/desegmentation, and error control, e.g. IP.
Data Link Layer: Functional/procedural means for
transferring data bridges and switches operate at this level,
e.g. Ethernet.
Physical Layer: defines all the electrical and physical
specifications for devices, e.g. hubs, ISDN, DSL, T1.
The 7 Protocol Layers
Application Layer: Interface between software and lower
layer network services, e.g. HTTP, SMTP, FTP, Telnet.
Presentation Layer: Relieves Application layer from burden
of managing syntactical differences in data representation
(compression/encryption/formatting), e.g. ASCII/MIDI/MPEG.
Session Layer: Managing dialogue between end-user
application processes (termination/restart procedures etc.),
e.g. NetBIOS
Transport Layer: Transparent transfer of data between end
users (controls reliability), e.g. TCP, UDP, RTP.
Network Layer: network routing, flow control,
segmentation/desegmentation, and error control, e.g. IP.
Data Link Layer: Functional/procedural means for
transferring data bridges and switches operate at this level,
e.g. Ethernet.
Physical Layer: defines all the electrical and physical
specifications for devices, e.g. hubs, ISDN, DSL, T1.
The 7 Protocol Layers
Application Layer: Interface between software and lower
layer network services, e.g. HTTP, SMTP, FTP, Telnet.
Presentation Layer: Relieves Application layer from burden
of managing syntactical differences in data representation
(compression/encryption/formatting), e.g. ASCII/MIDI/MPEG.
Session Layer: Managing dialogue between end-user
application processes (termination/restart procedures etc.),
e.g. NetBIOS
Transport Layer: Transparent transfer of data between end
users (controls reliability), e.g. TCP, UDP, RTP.
Network Layer: network routing, flow control,
segmentation/desegmentation, and error control, e.g. IP.
Data Link Layer: Functional/procedural means for
transferring data bridges and switches operate at this level,
e.g. Ethernet.
Physical Layer: defines all the electrical and physical
specifications for devices, e.g. hubs, ISDN, DSL, T1.
The 7 Protocol Layers
Application Layer: Interface between software and lower
layer network services, e.g. HTTP, SMTP, FTP, Telnet.
Presentation Layer: Relieves Application layer from burden
of managing syntactical differences in data representation
(compression/encryption/formatting), e.g. ASCII/MIDI/MPEG.
Session Layer: Managing dialogue between end-user
application processes (termination/restart procedures etc.),
e.g. NetBIOS
Transport Layer: Transparent transfer of data between end
users (controls reliability), e.g. TCP, UDP, RTP.
Network Layer: network routing, flow control,
segmentation/desegmentation, and error control, e.g. IP.
Data Link Layer: Functional/procedural means for
transferring data bridges and switches operate at this level,
e.g. Ethernet.
Physical Layer: defines all the electrical and physical
specifications for devices, e.g. hubs, ISDN, DSL, T1.
Taco Bell’s 7-layer Burrito
Protocols and James Bond
7th FLOOR: James Bond meets No.1, who gives Bond a secret
message that must get through to the US Embassy across town.
6th FLOOR: Message is translated into an intermediary language,
encrypted and miniaturized.
5th FLOOR: Security checks the message to be sure it is all there and
puts some checkpoints in the message so his counterpart at the US
end can be sure he’s got the whole message.
4th FLOOR: message is analyzed to see if it can be combined with
some other small messages that need to go to the US end. If message
is very large it might be broken into several small packages so other
spies can take it and have it reassembled on the other end.
Protocols and James Bond
7th FLOOR: James Bond meets No.1, who gives Bond a secret
message that must get through to the US Embassy across town.
6th FLOOR: Message is translated into an intermediary language,
encrypted and miniaturized.
5th FLOOR: Security checks the message to be sure it is all there and
puts some checkpoints in the message so his counterpart at the US
end can be sure he’s got the whole message.
4th FLOOR: message is analyzed to see if it can be combined with
some other small messages that need to go to the US end. If message
is very large it might be broken into several small packages so other
spies can take it and have it reassembled on the other end.
Protocols and James Bond
7th FLOOR: James Bond meets No.1, who gives Bond a secret
message that must get through to the US Embassy across town.
6th FLOOR: Message is translated into an intermediary language,
encrypted and miniaturized.
5th FLOOR: Security checks the message to be sure it is all there and
puts some checkpoints in the message so his counterpart at the US
end can be sure he’s got the whole message.
4th FLOOR: message is analyzed to see if it can be combined with
some other small messages that need to go to the US end. If message
is very large it might be broken into several small packages so other
spies can take it and have it reassembled on the other end.
Protocols and James Bond
7th FLOOR: James Bond meets No.1, who gives Bond a secret
message that must get through to the US Embassy across town.
6th FLOOR: Message is translated into an intermediary language,
encrypted and miniaturized.
5th FLOOR: Security checks the message to be sure it is all there and
puts some checkpoints in the message so his counterpart at the US
end can be sure he’s got the whole message.
4th FLOOR: message is analyzed to see if it can be combined with
some other small messages that need to go to the US end. If message
is very large it might be broken into several small packages so other
spies can take it and have it reassembled on the other end.
Protocols and James Bond
3rd FLOOR: personnel check the address on the message and
determine who the addressee is, and advises Bond of the fastest route
to the Embassy.
2nd FLOOR: message is put into a special courier pouch (packet). It
contains the message, the sender and destination ID. It also warns the
recipient if other pieces are still coming.
1st FLOOR: Q has prepared the BMW Z4 (with attractive lady
companion) for trip to the Embassy.
"Bond, please tell Number One I’ll be glad to meet him for dinner
tonight.”
Protocols and James Bond
3rd FLOOR: personnel check the address on the message and
determine who the addressee is, and advises Bond of the fastest route
to the Embassy.
2nd FLOOR: message is put into a special courier pouch (packet). It
contains the message, the sender and destination ID. It also warns the
recipient if other pieces are still coming.
1st FLOOR: Q has prepared the BMW Z4 (with attractive lady
companion) for trip to the Embassy.
"Bond, please tell Number One I’ll be glad to meet him for dinner
tonight.”
Protocols and James Bond
3rd FLOOR: personnel check the address on the message and
determine who the addressee is, and advises Bond of the fastest route
to the Embassy.
2nd FLOOR: message is put into a special courier pouch (packet). It
contains the message, the sender and destination ID. It also warns the
recipient if other pieces are still coming.
1st FLOOR: Q has prepared the BMW Z4 (with attractive lady
companion) for trip to the Embassy.
"Bond, please tell Number One I’ll be glad to meet him for dinner
tonight.”
Protocols and James Bond
3rd FLOOR: personnel check the address on the message and
determine who the addressee is, and advises Bond of the fastest route
to the Embassy.
2nd FLOOR: message is put into a special courier pouch (packet). It
contains the message, the sender and destination ID. It also warns the
recipient if other pieces are still coming.
1st FLOOR: Q has prepared the BMW Z4 (with attractive lady
companion) for trip to the Embassy.
"Bond, please tell Number One I’ll be glad to meet him for dinner
tonight.”
So what is BitTorrent?
An application level protocol (OSI Level 7).
Designed to distribute large amounts of data without consuming large server
and bandwidth resources.
Designed by Bram Cohen in Python, who also wrote the first BitTorrent
application, and is available Open Source.
BitTorrent Speak…
Common terms related to BitTorrent include:
Leeches - People who download files but do not share files on their own
computer with others
Seed or seeder - A computer with a complete copy of a BitTorrent file (At
least one seed computer is necessary for a BitTorrent download to operate.)
Swarm - A group of computers simultaneously sending (uploading) or
receiving (downloading) the same file
.torrent - A pointer file that directs your computer to the file you want to
download
Tracker - A server that manages the BitTorrent file-transfer process
How BitTorrent works: STEP 1
torrent metafile hosted on a
popular website: containing
information about the location
of the tracker and verification
hashes for the pieces of the
file.
User downloads torrent file.
If the .torrent association has
already been made on our web
browser, a click on the url of
the webpage is sufficient to
download it.
How BitTorrent works: STEP 2
Client sends a HTTP-GET
request to tracker.
The tracker is a server which
accepts requests for
information about other peers
on network.
GET Request advertises Peer
A's Peer id, IP address and
Port number to the tracker, so
other peers in the network can
connect with Peer A.
How BitTorrent works: STEP 3
Tracker responds with a list of
peers, (ip address and port
number), who are currently
downloading or uploading the
file.
Say, Peer A sees Peers B and
C in the response list from the
tracker. Also, as indicated, let
Peer C be a seed (peer that
has a complete copy of the
file).
How BitTorrent works: STEP 4
Peer A initiates TCP
connections with the peers in
the peer list it obtained from
the tracker.
Since B and C were on that
list, Peer A connects to both
and initiates a 3 way BitTorrent
handshake.
How BitTorrent works: STEP 5
Once connection has been
established and remote peer has
been authenticated, peers B and
C advertise what pieces they
already have with a BITFIELD
message.
Peer A expresses INTEREST
since it does not have any pieces
yet. Peer A then sends a
REQUEST message requesting
for a particular chunk of a piece.
When the remote peers
UNCHOKE Peer A, it starts
downloading from them. Initially
Peer A only downloads untill it
gets hold of a complete piece.
How BitTorrent works: STEP 6
After Peer A successfully
downloads a complete piece and
verifies it against the hash in the
.torrent file, it broadcasts HAVE
message indicating that it just got
a piece.
If other peers are interested then
they can obtain it from Peer A.
Now Peer A has boot strapped
into the file swarming network adn
starts exchanging portions of the
file with other leeches.
Note, that Peer C is a seed and
since it has a complete copy of the
file, it only uploads to other
leeches in the network.
How BitTorrent works: STEP 7
Peers periodically contact tracker
to discover more peers.
These ANNOUNCE messages
also act in advertising to the
tracker of the peer's progress. The
announce message consists of
fields to indicate how much the
peer has downloaded and how
much is left.
Finally, once Peer A completes
downloading the fie, it disconnects
from other seeds and becomes a
seed, offering the file to other
leeches in the network.
Traditional Client Server Downloading
Peer-To-Peer File Sharing
Problem: Leechers simply download.
What BitTorrent Does
BitTorrent downloads different pieces
of the file you want simultaneously
from multiple computers
Downloading pieces of the file at the
same time helps solve a common
problem with other peer-to-peer
download methods: Peers upload at a
much slower rate than they download.\
Downloading multiple pieces at the
same time improves overall speed.
The more computers involved in the
swarm, the faster the file transfer
occurs because there are more
sources of each piece of the file. For
this reason, BitTorrent is especially
useful for large, popular files.
Difference between BitTorrent and HTTP/FTP etc.
Contrasted with conventional file serving where high
demand saturates host's resources (bandwidth) to
transfer the file to many requesting downloaders.
In BitTorrent, high demand INCREASES throughput as
more bandwidth and additional “seeds” of the file
become available to the group.
Cohen claims that for very popular files, BitTorrent can
support about a thousand times as many downloads as
HTTP.
Legal Issues
Though there remains a potential for copyright infringement, legal uses abound:
BT used by different people in different ways LEGALLY:
Software developers ease bandwidth strain on their servers
Game sites offer legal game files via BitTorrent
Amateur/fan films distributing film copies via BitTorrent
Rock group Harvey Danger began distributing their third full-length album.
Open Source software releases: including FreeBSD, NetBSD version 1.6.2 and later.
NASA used BitTorrent to offer download of some of their larger space image files.
BitTorrent is overwhelmingly the most popular P2P protocol adopted officially for legal
uses.
Many adopters report that only BT’s dramatically reduced demands on networking
hardware and bandwidth, allows them to distribute such large files.
Conclusion and Recap
Protocols are the set of rules followed to enable inter-device
communication.
Protocols establish/terminate connections and transfer data (with/without
reliability).
OSI model helps us understand the protocol functions as a 7-level
abstracted model.
BitTorrent is one application level protocol.
BitTorrent protocol does not employ the traditional client-server or even the
P2P methodology. Higher strain and and greater requests actually increase
its efficiency.
Perfectly legal, has several useful/legal/uses.
Bram Cohen proves that the protocol’s technique is PARETO OPTIMAL.
Acknowledgements and Bibliography
Computer Networking: A top down approach to the
Internet, Kurose and Ross (2005).
www.howstuffworks.com – feature on BitTorrent.
www.wikipedia.com - feature on BitTorrent
Lewis Technology Inc. – OSI Model and James Bond