Академический Документы
Профессиональный Документы
Культура Документы
Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
2-1
Outline
principles of network
applications
Web and HTTP
FTP
electronic mail
SMTP, POP3, IMAP
DNS
2-2
Some network apps
e-mail voice over IP (e.g., Skype)
web real-time video
text messaging conferencing
remote login social networking
P2P file sharing search
multi-user network games …
streaming stored video …
(YouTube, Hulu, Netflix)
2-3
Creating a network app application
transport
network
data link
2-4
Application architectures
possible structure of applications:
client-server
peer-to-peer (P2P)
2-5
Client-server architecture
server:
always-on host
permanent IP address
clients:
communicate with server
may have dynamic IP
client/server addresses
do not communicate directly
with each other
2-6
P2P architecture
no always-on server peer-peer
arbitrary end systems
directly communicate
peers request service from
other peers, provide service
in return to other peers
self scalability – new
peers bring new service
capacity, as well as new
service demands
peers are intermittently
connected and change IP
addresses
complex management
2-7
Processes communicating
process: program running clients, servers
within a host client process: process that
within same host, two initiates communication
processes communicate server process: process that
using inter-process waits to be contacted
communication (defined by
OS)
processes in different hosts
communicate by exchanging aside: applications with P2P
messages architectures have client
processes & server
processes
2-8
Sockets
process sends/receives messages to/from its socket
socket analogous to door
sending process shoves message out door
sending process relies on transport infrastructure on
other side of door to deliver message to socket at
receiving process
application application
socket controlled by
process process app developer
transport transport
network network controlled
link by OS
link Internet
physical physical
2-9
Addressing processes
to receive messages, identifier includes both IP
process must have identifier address and port numbers
host device has unique 32- associated with process on
bit IP address host.
Q: does IP address of host example port numbers:
on which process runs HTTP server: 80
suffice for identifying the mail server: 25
process? to send HTTP message to
A: no, many processes gaia.cs.umass.edu web
can be running on same server:
host IP address: 128.119.245.12
port number: 80
more shortly…
2-10
App-layer protocol defines
types of messages open protocols:
exchanged, defined in RFCs
e.g., request, response e.g., HTTP, SMTP
message syntax: proprietary protocols:
what fields in messages e.g., Skype
& how fields are
delineated
message semantics
meaning of information
in fields
rules for when and how
processes send & respond
to messages
2-11
What transport service does an app need?
data integrity throughput
some apps (e.g., file transfer, some apps (e.g.,
web transactions) require multimedia) require
100% reliable data transfer minimum amount of
other apps (e.g., audio) can
throughput to be
tolerate some loss “effective”
other apps (“elastic apps”)
2-12
Transport service requirements: common apps
2-13
Internet transport protocols services
2-14
Internet apps: application, transport protocols
application underlying
application layer protocol transport protocol
2-15
Outline
principles of network
applications
app architectures
app requirements
Web and HTTP
FTP
electronic mail
SMTP, POP3, IMAP
DNS
2-16
Web and HTTP
First, a review…
web page consists of objects
object can be HTML file, JPEG image, Java applet,
audio file,…
web page consists of base HTML-file which
includes several referenced objects
each object is addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif
2-17
HTTP overview
HTTP: hypertext
transfer protocol
Web’s application layer
protocol PC running
client/server model Firefox browser
2-18
HTTP overview (continued)
uses TCP: HTTP is “stateless”
client initiates TCP server maintains no
connection (creates information about
socket) to server, port 80 past client requests
server accepts TCP
connection from client aside
protocols that maintain
HTTP messages “state” are complex!
(application-layer protocol
past history (state) must be
messages) exchanged maintained
between browser (HTTP if server/client crashes, their
client) and Web server views of “state” may be
(HTTP server) inconsistent, must be
TCP connection closed reconciled
2-19
HTTP connections
non-persistent HTTP persistent HTTP
at most one object multiple objects can
sent over TCP be sent over single
connection TCP connection
connection then between client, server
closed
downloading multiple
objects required
multiple connections
2-20
Non-persistent HTTP
suppose user enters URL: (contains text,
www.someSchool.edu/someDepartment/home.index references to 10
jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
(process) at 1b. HTTP server at host
www.someSchool.edu on port www.someSchool.edu waiting
80 for TCP connection at port 80.
“accepts” connection, notifying
2. HTTP client sends HTTP request client
message (containing URL) into
TCP connection socket. 3. HTTP server receives request
Message indicates that client message, forms response
wants object message containing requested
someDepartment/home.index object, and sends message into
its socket
time
2-21
Non-persistent HTTP (cont.)
4. HTTP server closes TCP
connection.
5. HTTP client receives response
message containing html file,
displays html. Parsing html file,
finds 10 referenced jpeg objects
time
6. Steps 1-5 repeated for each of
10 jpeg objects
2-22
Non-persistent HTTP: response time
connection RTT
2-23
Persistent HTTP
2-24
HTTP request message
~
~ entity body ~
~ body
2-26
Uploading form input
POST method:
web page often includes
form input
input is uploaded to
server in entity body
URL method:
uses GET method
input is uploaded in URL
field of request line:
www.somesite.com/animalsearch?monkeys&banana
2-27
Method types
HTTP/1.0: HTTP/1.1:
GET GET, POST, HEAD
POST PUT
HEAD uploads file in entity
asks server to leave body to path specified
requested object out in URL field
of response DELETE
deletes file specified in
the URL field
2-28
HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK\r\n
status phrase) Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
header ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
lines Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-8859-
1\r\n
\r\n
data, e.g., data data data data data ...
requested
HTML file
2-29
HTTP response status codes
status code appears in 1st line in server-to-
client response message.
some sample codes:
200 OK
request succeeded, requested object later in this msg
301 Moved Permanently
requested object moved, new location specified later in this msg
(Location:)
400 Bad Request
request msg not understood by server
404 Not Found
requested document not found on this server
505 HTTP Version Not Supported
2-30
Web caches (proxy server)
goal: satisfy client request without involving origin server
user sets browser: Web
accesses via cache
browser sends all HTTP proxy
requests to cache server
object in cache: cache client
origin
returns object server
else cache requests
object from origin
server, then returns
object to client
client origin
server
2-31
More about Web caching
cache acts as both why Web caching?
client and server reduce response time
server for original for client request
requesting client
client to origin server reduce traffic on an
typically cache is institution’s access link
installed by ISP Internet dense with
(university, company, caches: enables “poor”
residential ISP) content providers to
effectively deliver
content (so too does
P2P file sharing)
2-32
Caching Example (1)
Assumptions
Average object size = 100,000 bits origin
Avg. request rate from institution’s servers
browser to origin servers = 15/sec
public
Delay from institutional router to
Internet
any origin server and back to
router = 2 sec
Consequences
Utilization on LAN = 15% 1.5 Mbps
access link
Utilization on access link = 100% institutional
network
Total delay = Internet delay + access 10 Mbps LAN
2-33
Caching Example (2)
Possible solution
Increase bandwidth of access link origin
to, say, 10 Mbps servers
Often a costly upgrade
public
Internet
Consequences
Utilization on LAN = 15%
2-34
Caching Example (3)
Install cache
Suppose hit rate is .4 origin
Consequence servers
public
40% requests will be satisfied almost Internet
institutional
cache
2-35
Problems
Obvious fixes
SSL encrypted data is not cacheable
2-36
Content Distribution Networks (CDNs)
2-37
Outline
principles of network
applications
app architectures
app requirements
Web and HTTP
FTP
electronic mail
SMTP, POP3, IMAP
DNS
2-38
FTP: the file transfer protocol
file transfer
FTP FTP FTP
user client server
interface
user
at host remote file
local file system
system
2-40
FTP commands, responses
sample commands: sample return codes
sent as ASCII text over status code and phrase (as
control channel in HTTP)
USER username 331 Username OK,
PASS password password required
LIST return list of file in 125 data
current directory connection
already open;
RETR filename transfer starting
retrieves (gets) file 425 Can’t open
STOR filename stores data connection
(puts) file onto remote 452 Error writing
host file
2-41
Outline
principles of network
applications
app architectures
app requirements
Web and HTTP
FTP
electronic mail
SMTP, POP3, IMAP
DNS
2-42
Electronic mail outgoing
message queue
user mailbox
Three major components: user
agent
user agents
mail servers mail user
server agent
simple mail transfer
protocol: SMTP SMTP mail user
server agent
2-44
Electronic Mail: SMTP [RFC 2821]
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 (like HTTP, FTP)
commands: ASCII text
response: status code and phrase
messages must be in 7-bit ASCII
2-45
Scenario: Alice sends message to Bob
1) Alice uses UA to compose 4) SMTP client sends Alice’s
message “to” message over the TCP
bob@someschool.edu connection
2) Alice’s UA sends message 5) Bob’s mail server places the
to her mail server; message message in Bob’s mailbox
placed in message queue 6) Bob invokes his user agent
3) client side of SMTP opens to read message
TCP connection with Bob’s
mail server
2-47
Mail message format
2-48
Mail access protocols
user
mail access user
SMTP SMTP protocol
agent agent
(e.g., POP,
IMAP)
2-49
Outline
principles of network
applications
app architectures
app requirements
Web and HTTP
FTP
electronic mail
SMTP, POP3, IMAP
DNS
2-50
DNS: domain name system
people: many identifiers: Domain Name System:
ID#, name, passport # distributed database
Internet hosts, routers: implemented in hierarchy of
IP address (32 bit) - many name servers
used for addressing application-layer protocol: hosts,
datagrams name servers communicate to
“name”, e.g., resolve names (address/name
www.yahoo.com - translation)
used by humans note: core Internet function,
Q: how to map between IP implemented as application-
layer protocol
address and name, and
vice versa ? complexity at network’s
“edge”
2-51
DNS: services, structure
DNS services why not centralize DNS?
hostname to IP address single point of failure
translation traffic volume
host aliasing maintenance
canonical, alias names
mail server aliasing
load distribution A: doesn’t scale!
replicated Web
servers: many IP
addresses correspond
to one name
2-52
DNS: a distributed, hierarchical database
Root DNS Servers
… …
2-53
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
2-54
TLD, authoritative servers
top-level domain (TLD) servers:
responsible for com, org, net, edu, aero, jobs, museums,
and all top-level country domains, e.g.: pk, fr, ca, jp
Network Solutions maintains servers for .com TLD
Educause for .edu TLD
authoritative DNS servers:
organization’s own DNS server(s), providing
authoritative hostname to IP mappings for organization’s
named hosts
can be maintained by organization or service provider
2-55
Local DNS 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
has local cache of recent name-to-address translation
pairs (but may be out of date!)
acts as proxy, forwards query into hierarchy
2-56
DNS name root DNS server
resolution example
2
host at cis.poly.edu 3
TLD DNS server
wants IP address for 4
gaia.cs.umass.edu
5
gaia.cs.umass.edu
2-57
DNS name root DNS server
resolution example
2 3
recursive query: 7
6
puts burden of name TLD DNS
server
resolution on
contacted name local DNS server
server dns.poly.edu 5 4
gaia.cs.umass.edu
2-58
DNS: caching, updating records
once (any) name server learns mapping, it caches
mapping
cache entries timeout (disappear) after some time (TTL)
TLD servers typically cached in local name servers
• thus root name servers not often visited
cached entries may be out-of-date (best effort
name-to-address translation!)
if name host changes IP address, may not be known
Internet-wide until all TTLs expire
update/notify mechanisms proposed IETF standard
RFC 2136
2-59
DNS records
DNS: distributed db storing resource records (RR)
RR format: (name, value, type, ttl)
type=A type=CNAME
name is hostname name is alias name for some
value is IP address “canonical” (the real) name
type=NS www.ibm.com is canonical and
name is domain (e.g., servereast.backup2.ibm.com
foo.com) is alias
value is hostname of value is canonical name
authoritative name type=MX
server for this domain value is name of mailserver
associated with name
2-60
Inserting records into DNS
example: new startup “Network Utopia”
2-61
A real scenario
a) Alice wants to view the web f) The local DNS server then
page sends a DNS query to
www.networkutopia.com. 212.212.212.1, asking for the
b) Her host will first send a DNS type A record corresponding
query to her local DNS to www.networkutopia.com
server. g) This record provides the IP
c) The local DNS server will address of the desired web
then contact a TLD com server, say, 212.212.71.4,
server. which the local DNS server
d) TLD server contains the type passes back to Alice’s host.
NS and type A RRs h) Alice’s browser can now
e) The TLD server replies to initiate a TCP connection to
ALICE’s local DNS server, the host 212.212.71.4 and
with containing the two RRs. send an HTTP request over
the connection.
2-62