Академический Документы
Профессиональный Документы
Культура Документы
Computer Networks I
application
transport
physical
Francisco.Moya@uclm.es
Most of this presentation was based on the official slides of the Kurose&Ross textbook
Presentation based on slides by
available at Pearson:
http://www.pearsonhighered.com/educator/product/Computer-Networking-A-TopDown-Approach/
Contents
3
Logical connection
● The Application
Layer provides
services to the user
● Logical connection
between app layers
on both sides
● But physically,
connection takes
place through the
physical layer
App-layer protocol defines
5
Client-server paradigm
clients: server:
● communicate with server ● always-on host
● may be intermittently connected ● permanent IP address,
port listening
● may have dynamic IP addresses
● difficult to scale
● do not communicate directly with each other
– Server farms
6
Peer-to-peer paradigm
● no always-on server
● arbitrary end systems directly communicate
● peers are intermittently connected and change IP addresses
● Highly scalable but difficult to manage
7
Hybrid of client-server and P2P
Skype
● Internet telephony app
● Finding address of remote party: centralized server(s)
● Client-client connection is direct (not through server)
Instant messaging
● Chatting between two users can be P2P
● Presence detection/location centralized:
– User registers its IP address with central server when it comes online
– User contacts central server to find IP addresses of buddies
8
What transport service does an app
need?
9
Transport service requirements of common
apps
10
Internet transport protocols services
11
Internet apps: application, transport protocols
Application Underlying
Application layer protocol transport protocol
12
Web and HTTP
RFC1945 (HTTP/1.0)
RFC2616 (HTTP/1.1)
13
World Wide Web
14
Web browser
15
Uniform Resource Locator (URL)
http://www.someschool.edu/someDept/pic.gif
16
Web documents
17
Web documents
● Dynamic document
● Created by the server
upon request
● May vary from request to
request
● Programs used:
– Common Gateway
Interface - CGI (obsolete)
– Java Server Pages (JSP)
– Active Server Pages (ASP)
18
Web documents
19
HTTP overview
20
HTTP connections
21
Nonpersistent HTTP connection
22
Persistent HTTP connection
● Same example:
● Only one connection
● Image request sent separately
23
HTTP message format
●
Two types of HTTP messages: request, response
●
HTTP request message: 4 sections
●
ASCII (human-readable format)
24
HTTP request message
25
HTTP request message
●
Some of the method types (not a complete list):
●
GET: request a message
– Most used. Empty body
– May upload information using the URL field of the request line
●
http://www.somesite.com/animalsearch?monkeys&banana
● HEAD: request only info about the document
– Ex: last modification time
– Empty body in the response
●
PUT: sends a document to the server (only HTTP 1.1)
– Inverse of the GET
●
POST: sends information to the server
– Sends information to be added to the web page, or to modify it
●
Ex.: web page with an input form
●
Input is uploaded in the body, not as part of the URL
26
HTTP request message
● Request header:
● Optional, from 0 to several lines
● Additional information sent to the server
Header Description
User-agent Identifies the client program
Accept Shows the media format the client can accept
Accept-charset Shows the character set the client can handle
Accept-encoding Shows the encoding scheme the client cant handle
Accept-language Shows the language the client can accept
Authorization Shows what permissions the client has
Host Shows the host and port number of the client
Date Shows the current date
Upgrade Speifies the preferred communication protocol
Cookie Returns the cookie to the server
If-Modified-Since If the file is modificed since a specific date
27
HTTP response message
HTTP/1.1 200 OK
Connection: close
Date: Thu, 06 Aug 1998 12:00:15 GMT
Server: Apache/1.3.0 (Unix)
Last-Modified: Mon, 22 Jun 1998 …...
Content-Length: 6821
Content-Type: text/html
data,
e.g., requested HTML file
28
HTTP response status codes
29
HTTP request message
● Response header:
● Optional, from 0 to several lines
● Additional information sent from the server
Header Description
Date Shows the current date
Upgrade Specifies the preferred communication protocol
Server Gives information about the server
Set-Cookie The server asks the client to save a cookie
Content-Encoding Specifies the encoding scheme
Content-Language Specifies the language
Content-Length Shows the length of the document
Content-Type Specifies the media type
Location To ask the client to send the request to another site
Accept-Ranges The server will accept the requested byte-ranges
Last-modified Gives the date and time of the last change
30
HTTP GET request example
31
HTTP PUT request example
32
HTTP conditional requests
33
Cookies
34
Cookies
●
Cookie creation process
● The server receives a request from a client and stores certain information
(cookie) in a database
– Domain name, user name, timestamp, etc
● The server includes the cookie in the response
– In the header line
● The client stores the cookie locally
– Local filesystem and associated to the user profile
● Use of the cookie
● On the request the browser looks for a locally stored cookie
● If it exists, it is sent to the server that will “recognize” the user
– In the header line
35
Cookies example
36
Web caches (proxy server)
client
origin
server
37
More about Web caching
38
Caching example
origin
Assumptions
servers
● average object size = 100,000 bits
● avg. request rate from institution’s public
browsers to origin servers = 15/sec Internet
● delay from institutional router to any
origin server and back to router = 2
sec
1.5 Mbps
Consequences
access link
● utilization on LAN = 15%
● utilization on access link = 100% institutional
network
● total delay = Internet delay + access 10 Mbps LAN
delay + LAN delay
= 2 sec + minutes + milliseconds
institutional
cache
39
Caching example (cont)
origin
Possible solution
servers
● increase bandwidth of access link to,
say, 10 Mbps public
Consequences Internet
● utilization on LAN = 15%
● utilization on access link = 15%
● Total delay = Internet delay + access
delay + LAN delay 10 Mbps
access link
= 2 sec + msecs + msecs
● often a costly upgrade institutional
network
10 Mbps LAN
institutional
cache
40
Caching example (cont)
origin
Install cache servers
● suppose hit rate is .4 public
Consequence Internet
● 40% requests will be satisfied
almost immediately
● 60% requests satisfied by origin
server
● utilization of access link reduced to 1.5 Mbps
60%, resulting in negligible delays access link
(say 10 msec)
● total avg delay = Internet delay + institutional
access delay + LAN delay = . network
10 Mbps LAN
6*(2.01) secs + .4*milliseconds <
1.4 secs
institutional
cache
41
Electronic mail
RFC5321 (SMTP)
RFC1939 (POP3)
RFC3501 (IMAP4)
42
Electronic Mail outgoing
message queue
user mailbox
user
Three major components: agent
● user agents mail
user
● mail servers server
agent
● simple mail transfer protocol: SMTP
SMTP mail
User Agent server user
● a.k.a. “mail reader” SMTP agent
● composing, editing, reading mail
messages SMTP
e.g., outlook, pine, mutt, thunderbird user
●
mail
server agent
● outgoing, incoming messages stored
on server
user
agent
user
agent
43
Electronic Mail: mail servers
Mail Servers
● mailbox contains incoming messages
for user
● message queue of outgoing (to be
sent) mail messages
● SMTP protocol between mail servers
to send email messages
● client: sending mail server
● server: receiving mail server
44
RFC
RFC
Electronic Mail: SMTP 282
282
11
● Uses TCP to reliably transfer email message from client to server, port 25
● Direct transfer: sending server to receiving server
● Three phases of transfer
● handshaking (greeting)
● transfer of messages
● closure
● Command/response interaction
● commands: ASCII text
● response: status code and phrase
● Messages must be in 7-bit ASCII
45
Scenario:
Alice sends message to Bob
1 mail
mail
server user
user server
agent
agent 2 3 6
4
5
46
Sample SMTP interaction
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you
C: MAIL FROM: <alice@crepes.fr>
S: 250 alice@crepes.fr... Sender ok
C: RCPT TO: <bob@hamburger.edu>
S: 250 bob@hamburger.edu ... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: From: Alice <alice@crepes.fr>
C: To: Bob <bob@hamburger.edu>
C: Subject: Toppings
C:
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection
47
Try SMTP interaction for yourself:
● ncat servername 25
● see 220 reply from server
●
enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands
above lets you send email without using email client (reader)
48
SMTP: final words
49
Mail message format
50
Message format: multimedia extensions
RFC
RFC
● MIME: multimedia mail extension.
2045
2045
● additional lines in msg header declare MIME content type 2056
2056
From: alice@crepes.fr
MIME version To: bob@hamburger.edu
Subject: Picture of yummy crepe.
method used MIME-Version: 1.0
to encode data Content-Transfer-Encoding: base64
Content-Type: image/jpeg
multimedia data
type, subtype, base64 encoded data .....
parameter declaration .........................
......base64 encoded data
encoded data
51
Mail access protocols
52
POP3 protocol
S: +OK POP3 server ready
C: user bob
S: +OK
authorization phase C: pass hungry
● client commands: S: +OK user successfully logged on
● user: declare username
● pass: password C: list
S: 1 498
● server responses
S: 2 912
● +OK S: .
● -ERR C: retr 1
S: <message 1 contents>
transaction phase, client: S: .
● list: list message numbers C: dele 1
● retr: retrieve message by number C: retr 2
S: <message 2 contents>
● dele: delete
S: .
● quit C: dele 2
C: quit
S: +OK POP3 server signing off
53
POP3 (more) and IMAP
54
DNS
RFC1034/RFC1035
55
DNS: Domain Name System
56
DNS
57
Distributed, Hierarchical Database
Root DNS Servers
58
DNS: Root name servers
a Verisign, Dulles, VA
c Cogent, Herndon, VA (also Los Angeles)
d U Maryland College Park, MD k RIPE London (also Amsterdam, Frankfurt)
g US DoD Vienna, VA
h ARL Aberdeen, MD i Autonomica, Stockholm (plus 3 other
j Verisign, ( 11 locations)
locations)
m WIDE Tokyo
e NASA Mt View, CA
f Internet Software C. Palo Alto, CA
(and 17 other locations)
59
TLD and Authoritative Servers
60
Local Name Server
61
Example root DNS server
5
local DNS server
dns.poly.edu
7 6
1 8
www.uwaterloo.ca
62
Recursive queries
root DNS server
recursive query:
□ puts burden of name 2 3
resolution on contacted 6
name server 7
□ heavy load? TLD DNS server
www.uwaterloo.ca
63
DNS: caching and updating records
64
DNS records
□ Type=A □ Type=CNAME
♦ name is hostname ♦ name is alias name for some “canonical”
♦ value is IP address (the real) name
♦ www.ibm.com is really
□ Type=NS servereast.backup2.ibm.com
♦ name is domain (e.g. foo.com) ♦ value is canonical name
♦ value is hostname of authoritative
name server for this domain
□ Type=MX
♦ value is name of mailserver associated
with name
65
DNS protocol, messages
DNS 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
66
DNS protocol, messages
RRs in response
to query
records for
authoritative servers
additional “helpful”
info that may be used
67
Inserting records into DNS
68
P2P Sharing
RFC5694
69
P2P file sharing
70
P2P: centralized directory
2 1
Alice
71
P2P: problems with centralized directory
72
Query flooding: Gnutella
73
Gnutella: protocol
File transfer:
□ Query message HTTP
sent over existing TCP
connections
Query
□ Peers forward QueryHit
Query message
□ QueryHit
sent over
reverse
Query
path
QueryHit
Scalability:
limited scope
flooding
74
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
75
Exploiting heterogeneity: KaZaA
o r d in a r y p e e r
g r o u p - le a d e r p e e r
n e ig h o r in g r e la tio n s h ip s
in o v e r la y n e tw o r k
76
KaZaA: Querying
77
KaZaA tricks
● Incentive priorities
● Parallel downloading
78
BitTorrent
79
BitTorrent
en_Wikipedia
80
References
81