cours 7 (18 novembre 2011 dns, pair à pair. m2-internet 2 dns why not centralize dns? r single...
TRANSCRIPT
Cours 7(18 novembre 2011
DNS,Pair à pair
M2-Internet 2
DNS
Why not centralize DNS? single point of failure traffic volume distant centralized
database maintenance
doesn’t scale!
DNS services hostname to IP
address translation host aliasing
Canonical, alias names
mail server aliasing load distribution
replicated Web servers: set of IP addresses for one canonical name
H. Fauconnier
M2-Internet 3
Root DNS Servers
com DNS servers org DNS servers edu DNS servers
poly.eduDNS servers
umass.eduDNS servers
yahoo.comDNS servers
amazon.comDNS servers
pbs.orgDNS servers
Distributed, Hierarchical Database
Client wants IP for www.amazon.com; 1st approx: client queries a root server to find com DNS
server client queries com DNS server to get
amazon.com DNS server client queries amazon.com DNS server to get IP
address for www.amazon.comH. Fauconnier
M2-Internet 4
DNS: Root name servers contacted by local name server that can not resolve name root name server:
contacts authoritative name server if name mapping not known
gets mapping returns mapping to local name server
13 root name servers worldwide
b USC-ISI Marina del Rey, CAl ICANN Los Angeles, CA
e NASA Mt View, CAf Internet Software C. Palo Alto, CA (and 36 other locations)
i Autonomica, Stockholm (plus 28 other locations)
k RIPE London (also 16 other locations)
m WIDE Tokyo (also Seoul, Paris, SF)
a Verisign, Dulles, VAc Cogent, Herndon, VA (also LA)d U Maryland College Park, MDg US DoD Vienna, VAh ARL Aberdeen, MDj Verisign, ( 21 locations)
H. Fauconnier
M2-Internet 5
TLD and Authoritative Servers Top-level domain (TLD) servers:
responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp.
Network Solutions maintains servers for com TLD
Educause for edu TLD Authoritative DNS servers:
organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e.g., Web, mail).
can be maintained by organization or service provider
H. Fauconnier
M2-Internet 6
Local Name Server
does not strictly belong to hierarchy each ISP (residential ISP, company,
university) has one. also called “default name server”
when host makes DNS query, query is sent to its local DNS server acts as proxy, forwards query into hierarchy
H. Fauconnier
M2-Internet 7
requesting hostcis.poly.edu
gaia.cs.umass.edu
root DNS server
local DNS serverdns.poly.edu
1
23
4
5
6
authoritative DNS serverdns.cs.umass.edu
78
TLD DNS server
DNS name resolution example
Host at cis.poly.edu wants IP address for gaia.cs.umass.edu
iterated query: contacted server
replies with name of server to contact
“I don’t know this name, but ask this server”
H. Fauconnier
M2-Internet 8
requesting hostcis.poly.edu
gaia.cs.umass.edu
root DNS server
local DNS serverdns.poly.edu
1
2
45
6
authoritative DNS serverdns.cs.umass.edu
7
8
TLD DNS server
3recursive query: puts burden of name
resolution on contacted name server
heavy load?
DNS name resolution example
H. Fauconnier
M2-Internet 9
DNS: caching and updating records once (any) name server learns mapping, it
caches mapping cache entries timeout (disappear) after
some time TLD servers typically cached in local name
servers• Thus root name servers not often visited
update/notify mechanisms under design by IETF RFC 2136 http://www.ietf.org/html.charters/dnsind-charter.html
H. Fauconnier
M2-Internet 10
DNS records
DNS: distributed db storing resource records (RR)
Type=NS name is domain (e.g.
foo.com) value is hostname of
authoritative name server for this domain
RR format: (name, value, type, ttl)
Type=A name is hostname value is IP address
Type=CNAME name is alias name for some
“canonical” (the real) name www.ibm.com is really servereast.backup2.ibm.com value is canonical name
Type=MX value is name of mailserver
associated with name
H. Fauconnier
M2-Internet 11
DNS protocol, messagesDNS protocol : query and reply messages, both with same message format
msg header identification: 16 bit # for
query, reply to query uses same #
flags: query or reply recursion desired recursion available reply is authoritative
H. Fauconnier
M2-Internet 12
DNS protocol, messages
Name, type fields for a query
RRs in responseto query
records forauthoritative servers
additional “helpful”info that may be used
H. Fauconnier
M2-Internet 13
Inserting records into DNS
example: new startup “Network Utopia” register name networkuptopia.com at DNS
registrar (e.g., Network Solutions) provide names, IP addresses of authoritative name
server (primary and secondary) registrar inserts two RRs into com TLD server:
(networkutopia.com, dns1.networkutopia.com, NS)(dns1.networkutopia.com, 212.212.212.1, A)
create authoritative server Type A record for www.networkuptopia.com; Type MX record for networkutopia.com
How do people get IP address of your Web site?
H. Fauconnier
M2-Internet 14
Chapter 2: Application layer
2.1 Principles of network applications
2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail
SMTP, POP3, IMAP
2.5 DNS
2.6 P2P applications 2.7 Socket
programming with UDP
2.8 Socket programming with TCP
H. Fauconnier
M2-Internet 15
P2P file sharing
Example Alice runs P2P client
application on her notebook computer
Intermittently connects to Internet; gets new IP address for each connection
Asks for “Hey Jude” Application displays
other peers that have copy of Hey Jude.
Alice chooses one of the peers, Bob.
File is copied from Bob’s PC to Alice’s notebook: HTTP
While Alice downloads, other users uploading from Alice.
Alice’s peer is both a Web client and a transient Web server.
All peers are servers = highly scalable!
H. Fauconnier
M2-Internet 16
Pair à pair
quelques principes les nœuds offrent des fonctionnalités identiques (pair) volatilité importante (apparition/disparition) grande échelle et dispersion géographique dynamicité importante
applications partage de fichiers messagerie téléphone (Skype) …
différent du client-serveur
H. Fauconnier
M2-Internet 17
Partage de fichiers
Communication basée sur deux types de protocoles différents découverte et localisation des fichiers
• recherche des données• mettre en contact deux (ou plusieurs) utilisateurs
parmi des millions téléchargement des fichiers
H. Fauconnier
M2-Internet 18
Découverte-localisation
Base publication des fichiers partagés avec des
méta-données découverte des fichiers disponibles localisation des sources à télécharger (En plus
• identification des doublons• détection des fichiers corrompus• forums)
H. Fauconnier
M2-Internet 19
Architecture du réseau
Centralisée: un serveur ou un cluster sur lequel les clients se connectent (Napster)
Décentralisée: il n'y a que des clients (Gnutella)
Faiblement centralisée: des clients et des serveurs (Edonkey)
Hybride: les clients peuvent devenir des serveurs
H. Fauconnier
M2-Internet 20
P2P: problems with centralized directory
Single point of failure Performance
bottleneck Copyright
infringement
file transfer is decentralized, but locating content is highly centralized
H. Fauconnier
M2-Internet 21
Pure P2P architecture
no always-on server arbitrary end systems
directly communicate peers are intermittently
connected and change IP addresses
Three topics: File distribution Searching for information Case Study: Skype
peer-peer
H. Fauconnier
M2-Internet 22
File Distribution: Server-Client vs P2PQuestion : How much time to distribute file
from one server to N peers?
us
u2d1 d2u1
uN
dN
Server
Network (with abundant bandwidth)
File, size F
us: server upload bandwidth
ui: peer i upload bandwidth
di: peer i download bandwidth
H. Fauconnier
M2-Internet 23
File distribution time: server-client
us
u2d1 d2u1
uN
dN
Server
Network (with abundant bandwidth)
F server sequentially sends N copies: NF/us time
client i takes F/di
time to download
increases linearly in N(for large N)
= dcs = max { NF/us, F/min(di) }i
Time to distribute F to N clients using
client/server approach
H. Fauconnier
M2-Internet 24
File distribution time: P2P
us
u2d1 d2u1
uN
dN
Server
Network (with abundant bandwidth)
F server must send one
copy: F/us time
client i takes F/di time to download
NF bits must be downloaded (aggregate) fastest possible upload rate: us + ui
dP2P = max { F/us, F/min(di) , NF/(us + ui) }i
H. Fauconnier
M2-Internet 25
0
0.5
1
1.5
2
2.5
3
3.5
0 5 10 15 20 25 30 35
N
Min
imu
m D
istr
ibut
ion
Tim
e P2P
Client-Server
Server-client vs. P2P: example
Client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us
H. Fauconnier
Quelques exemples
M2-Internet 26H. Fauconnier
M2-Internet 27
Query flooding: Gnutella
fully distributed no central server
public domain protocol
many Gnutella clients implementing protocol
overlay network: graph edge between peer X
and Y if there’s a TCP connection
all active peers and edges is overlay net
Edge is not a physical link
Given peer will typically be connected with < 10 overlay neighbors
H. Fauconnier
M2-Internet 28
Gnutella: protocol
Query
QueryHit
Query
Query
QueryHit
Query
Query
QueryHit
File transfer:HTTP Query message
sent over existing TCPconnections peers forwardQuery message QueryHit sent over reversepath
Scalability:limited scopeflooding
H. Fauconnier
M2-Internet 29
Gnutella: Peer joining
1. Joining peer X must find some other peer in Gnutella network: use list of candidate peers
2. X sequentially attempts to make TCP with peers on list until connection setup with Y
3. X sends Ping message to Y; Y forwards Ping message.
4. All peers receiving Ping message respond with Pong message
5. X receives many Pong messages. It can then setup additional TCP connections
H. Fauconnier
M2-Internet 30
Exploiting heterogeneity: KaZaA
Each peer is either a group leader or assigned to a group leader. TCP connection
between peer and its group leader.
TCP connections between some pairs of group leaders.
Group leader tracks the content in all its children.
ordinary peer
group-leader peer
neighoring re la tionshipsin overlay network
H. Fauconnier
M2-Internet 31
KaZaA: Querying
Each file has a hash and a descriptor Client sends keyword query to its group
leader Group leader responds with matches:
For each match: metadata, hash, IP address If group leader forwards query to other
group leaders, they respond with matches
Client then selects files for downloading HTTP requests using hash as identifier sent
to peers holding desired file
H. Fauconnier
M2-Internet 32
KaZaA tricks
Limitations on simultaneous uploads Request queuing Incentive priorities Parallel downloading
H. Fauconnier
M2-Internet 33
File distribution: BitTorrent
tracker: tracks peers participating in torrent
torrent: group of peers exchanging chunks of a file
obtain listof peers
trading chunks
peer
P2P file distribution
H. Fauconnier
M2-Internet 34
BitTorrent (1)
file divided into 256KB chunks. peer joining torrent:
has no chunks, but will accumulate them over time
registers with tracker to get list of peers, connects to subset of peers (“neighbors”)
while downloading, peer uploads chunks to other peers.
peers may come and go once peer has entire file, it may (selfishly) leave
or (altruistically) remainH. Fauconnier
M2-Internet 35
BitTorrent (2)
Pulling Chunks at any given time,
different peers have different subsets of file chunks
periodically, a peer (Alice) asks each neighbor for list of chunks that they have.
Alice sends requests for her missing chunks rarest first
Sending Chunks: tit-for-tat Alice sends chunks to
four neighbors currently sending her chunks at the highest rate re-evaluate top 4
every 10 secs every 30 secs: randomly
select another peer, starts sending chunks newly chosen peer
may join top 4 “optimistically
unchoke”
H. Fauconnier
M2-Internet 36
BitTorrent: Tit-for-tat(1) Alice “optimistically unchokes” Bob
(2) Alice becomes one of Bob’s top-four providers; Bob reciprocates
(3) Bob becomes one of Alice’s top-four providers
With higher upload rate, can find better trading partners & get file faster!
H. Fauconnier
Rechercher
M2-Internet 37H. Fauconnier
M2-Internet 38
Recherche par diffusion simple les clients ne publient rien et ne font
que des requêtes une requête est diffusée à tous les clients:
• avec une limite de portée (TTL)• en évitant les cycles (identification unique de la
requête, la requête contient le son chemin …)• recherche en profondeur ou en largeur
un client répond par le chemin emprunté par la requête
H. Fauconnier
M2-Internet 39
Filtres de Bloom
Principe:un ensemble E de n élémentsk fonctions de hachage hi de E sur
{1,m}un vecteur de m bits (le filtre)tester si x appartient à E si
• si le bit hi(x)=0 pour un i non• si le bit hi(x)=1 pour tout i oui (mais peut
être faux-positif)On diminue les faux positifs en utilisant
plusieurs fonctions de hachage• Pour m et n donné le k optimal est m/n ln 2 et la
probabilité de faux-positifs est (1/2)k
H. Fauconnier
Exemple: Filtres de Bloom
Trois fonctions de hachage W n’appartient pas à E
H. Fauconnier M2-Internet 40
Filtres de Bloom
Utilisation: Si le client possède le document les bits des
mot-clés correspondant sont à 1 Les clients s'échangent les filtres Les requêtes ne sont propagées que vers les
clients qui ont le bon filtre
M2-Internet 41H. Fauconnier
M2-Internet 42
Recherche par indexation
Les clients publient les fichiers qu'ils partagent sur les serveurs sur lesquels ils sont connectés
Les serveurs indexent les descriptions des fichiers
Les clients envoient des requêtes aux serveurs pour trouver les fichiers et les localiser
H. Fauconnier
M2-Internet 43
Recherche par DHT
Distributed Hash Table:Des nœuds et des données
• Un espace de clés (exemple: clés de 160 bits)
• Un répartition des clés (qui possède les clés?)
• Un "overlay" de connexion entre les nœuds pour qui permet de savoir quel nœud possède quelle clé.
H. Fauconnier
Distributed Hash Table (DHT)
DHT = base de données pour P2P Contient des couples (key, value)
key: numero SS; value: nom key: content type; value: adresse IP
Un pair query la DHT par une key retourne les values correspondant à la key
Un pair peut aussi inserer des couples (key, value)
H. Fauconnier 44M2-Internet
DHT
Stocker un fichier f de contenu data: Un hachage (SHA1 par exemple) produit
une clé de 160 bits k à partir du nom f Par un put(k, data) sur l'overlay trouver le
nœud responsable pour la clé k et lui transférer les données
Rechercher un fichier f: Par hachage (SHA1) obtenir la clé k associée
à f Rechercher sur l'overlay le nœud
responsable de k et récupérer les données
M2-Internet 45H. Fauconnier
DHT: hachage consistant
On associe à chaque document (ou mot-clé) un identificateur unique (hachage)
On associe à chaque client un identificateur unique de même taille ID
On définit une métrique pour définir la distance d entre les clés-ID
Un nœud ID i possède les clés j telles que d(j,i) est minimal parmi les ID (chaque nœud possède les clés les plus proches)
Le retrait ou l’ajout d'un nœud ne modifie que les voisins
M2-Internet 46H. Fauconnier
DHT
notion d'overlay: chaque nœud maintient des liens vers d'autres nœuds, on obtient ainsi un overlay. Comment obtenir un routage efficace
Un nœud soit possède la clé soit connaît un nœud plus près de la clé: on peut utiliser algorithme glouton basé sur la clé.
On peut aussi définir d'autres algorithmes de routage sur des overlays (et définir des topologies d'overlays ayant de bonnes propriétés –degré et taille des routes).
M2-Internet 47H. Fauconnier
DHT Identifiers
Assign integer identifier to each peer in range [0,2n-1]. Each identifier can be represented by n bits.
Require each key to be an integer in same range.
To get integer keys, hash original key. eg, key = h(“Led Zeppelin IV”) This is why they call it a distributed “hash” table
H. Fauconnier 48M2-Internet
How to assign keys to peers?
Central issue: Assigning (key, value) pairs to peers.
Rule: assign key to the peer that has the closest ID.
Convention in lecture: closest is the immediate successor of the key.
Ex: n=4; peers: 1,3,4,5,8,10,12,14; key = 13, then successor peer = 14 key = 15, then successor peer = 1
H. Fauconnier 49M2-Internet
1
3
4
5
810
12
15
Circular DHT (1)
Each peer only aware of immediate successor and predecessor.
“Overlay network”H. Fauconnier 50M2-Internet
Circle DHT (2)
0001
0011
0100
0101
10001010
1100
1111
Who’s resp
for key 1110 ?I am
O(N) messageson avg to resolvequery, when thereare N peers
1110
1110
1110
1110
1110
1110
Define closestas closestsuccessor
H. Fauconnier 51M2-Internet
DHT
exemple Chord: points sur un cercle la distance est la longueur
de l'arc orienté. L'espace des clés est décomposé en segments. Si i et j sont des nœuds adjacents, i a toutes les clés comprises entre i et j
Anneau de taille 2m (clés de 0 à 2m-1) Hachage par SHA1 (ID-clés réparties de façon
uniforme) Chaque nœud maintient une liste de K
successeurs et K prédécesseurs sur l'anneau
M2-Internet 52H. Fauconnier
Peer Churn
Peer 5 abruptly leaves Peer 4 detects; makes 8 its immediate successor;
asks 8 who its immediate successor is; makes 8’s immediate successor its second successor.
What if peer 13 wants to join?
1
3
4
5
810
12
15
•To handle peer churn, require each peer to know the IP address of its two successors. • Each peer periodically pings its two successors to see if they
are still alive.
H. Fauconnier 53M2-Internet
Circular DHT with Shortcuts
Each peer keeps track of IP addresses of predecessor, successor, short cuts.
Reduced from 6 to 2 messages. Possible to design shortcuts so O(log N) neighbors,
O(log N) messages in query
1
3
4
5
810
12
15
Who’s resp for key 1110?
H. Fauconnier 54M2-Internet
Chord
H. Fauconnier M2-Internet 55
Chaque nœud maintient une table de nœuds à distance(n + 2i) mod 2m
ChordChercher le successeur de k pour nœud n: Soit C(k) le premier nœud successeur de
(n+ 2 k-1) mod 2 m
Si k appartient à ]n, successor]: trouvé Sinon transmettre la demande au plus près
prédécesseur f de k dans C(k)
Si les nœuds sont répartis uniformément on y arrive en m étapes (et donc en log de la taille =(2m)) à chaque appel la distance entre le nœud et k divisée par 2.
M2-Internet 56H. Fauconnier
M2-Internet 57
Un autre exemple: CAN“Content-Addressable Network”
tore de dimension d
join
degré = O(d)diamètre moyen = O(d n1/d)
H. Fauconnier
M2-Internet 58
Téléchargement
protocoles ad-hoc (Edonkey, Bittorrent) ou http
Swarming (essaim) téléchargement d'un fichier en
téléchargeant différentes parties en parallèle depuis plusieurs clients
téléchargement multiple le fichier est décomposé en n blocs calcul du hachage de chaque bloc fichier est identifié par le hachage des blocs
H. Fauconnier
M2-Internet 59
Succès…
June 19, 2005 - 23:00 Network Users eDonkey2K 4,379,883 FastTrack 2,482,130 Gnutella 1,598,329 Overnet 745,472 DirectConnect 294,255 MP2P 251,137 Filetopia 3,455
H. Fauconnier
M2-Internet 60
Quelques réseaux
Napster (historique) Protocole:
• architecture centralisée• recherche par indexation
Fasttrack clients: Kazaa Mldonkey architecture hybride recherche par indexation et diffusion entre ultrapeers identification faible des fichiers (MD5 sur 300ko puis
hachage sur 32 bits) http (+ swarming)
H. Fauconnier
M2-Internet 61
Quelques réseaux
Edonkey Clients: Edonkeys, Emule protocole
• faiblement centralisée• recherche par indexation TCP• recherche multi-serveurs par UDP• téléchargement en duplex avec bitmaps, streaming et
swarming (Bittorrent dans les dernières versions)• système de crédits pour inciter au partage
Overnet/Kad télécharement Edonkey décentralisé DHT (Kademlia)
H. Fauconnier
M2-Internet 62
Quelques réseaux
Gnutella architecture hybride Recherche par diffusion courte (TTL <8) avec filtres
de Bloom Gnutella et Gnutella2 téléchargement par http avec possibilité de swarming
Bittorrent pas de découverte, un fichier .torrent contient les
infos sur le fichier localisation centralisée pour chaque fichier (tracker) téléchargementavec bitmaps
• le client commence à forunir du contenu à ses voisins• au bout d'un certain temps il bloque les voisins qui ne
répondent pas et conserve les quatre meilleurs
H. Fauconnier
M2-Internet 63
Quelques réseaux
Freenet complètement distribué publication par copie recherche par diffusion en profondeur protocole et contenu cryptés documents signés par signature digitale axé sur l'anonymat
H. Fauconnier
M2-Internet 64
P2P Case study: Skype
inherently P2P: pairs of users communicate.
proprietary application-layer protocol (inferred via reverse engineering)
hierarchical overlay with SNs
Index maps usernames to IP addresses; distributed over SNs
Skype clients (SC)
Supernode (SN)
Skype login server
H. Fauconnier
M2-Internet 65
Peers as relays
Problem when both Alice and Bob are behind “NATs”. NAT prevents an
outside peer from initiating a call to insider peer
Solution: Using Alice’s and Bob’s
SNs, Relay is chosen Each peer initiates
session with relay. Peers can now
communicate through NATs via relay
H. Fauconnier