Chapter 2
Chapter 2
Chapter 2
Application Layer 2.1 principles of network 2.6 P2P applications
applications 2.7 socket programming
2.2 Web and HTTP with UDP and TCP
2.3 FTP
A note on the use of these ppt slides:
We’re making these slides freely available to all (faculty, students, readers). Computer 2.4 electronic mail
They’re in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs. Networking: A Top § SMTP, POP3, IMAP
They obviously represent a lot of work on our part. In return for use, we only
ask the following: Down Approach 2.5 DNS
v If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
6th edition
v If you post any slides on a www site, that you note that they are adapted Jim Kurose, Keith Ross
from (or perhaps identical to) our slides, and note our copyright of this Addison-Wesley
material.
March 2012
Thanks and enjoy! JFK/KWR
v two types of HTTP messages: request, response method sp URL sp version cr lf request
v HTTP request message: line
header field name value cr lf
§ ASCII (human-readable format)
carriage return character header
line-feed character ~
~ ~
~ lines
request line
(GET, POST, GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n header field name value cr lf
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n cr lf
header Accept-Language: en-us,en;q=0.5\r\n
lines Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n ~
~ entity body ~
~ body
carriage return, Keep-Alive: 115\r\n
Connection: keep-alive\r\n
line feed at start
\r\n
of line indicates
end of header lines
Application Layer 2-27 Application Layer 2-28
Uploading form input Method types
POST method:
v web page often includes HTTP/1.0: HTTP/1.1:
form input v GET v GET, POST, HEAD
v input is uploaded to v POST v PUT
server in entity body v HEAD § uploads file in entity
§ asks server to leave body to path specified
URL method: requested object out in URL field
v uses GET method of response v DELETE
v input is uploaded in URL § deletes file specified in
field of request line: the URL field
www.somesite.com/animalsearch?monkeys&banana
Conditional GET
Chapter 2: outline
client server
v Goal: don’t send object if
cache has up-to-date 2.1 principles of network 2.6 P2P applications
cached version HTTP request msg
object applications 2.7 socket programming
If-modified-since: <date>
§ no object transmission not § app architectures with UDP and TCP
delay modified
§ lower link utilization HTTP response
before
§ app requirements
HTTP/1.0
v cache: specify date of 304 Not Modified
<date> 2.2 Web and HTTP
cached copy in HTTP 2.3 FTP
request
If-modified-since: 2.4 electronic mail
<date> HTTP request msg § SMTP, POP3, IMAP
server: response contains If-modified-since: <date> object
v
modified 2.5 DNS
no object if cached copy after
HTTP response
is up-to-date: HTTP/1.0 200 OK <date>
HTTP/1.0 304 Not <data>
Modified
Application Layer 2-43 Application Layer 2-44
FTP: the file transfer protocol FTP: separate control, data connections
file transfer
FTP TCP control connection,
user
FTP FTP v FTP client contacts FTP server server port 21
client server at port 21, using TCP
interface
user v client authorized over control
at host remote file TCP data connection,
local file system connection FTP server port 20 FTP
system client server
v client browses remote
directory, sends commands
over control connection v server opens another TCP
v transfer file to/from remote host v when server receives file
data connection to transfer
client/server model another file
v transfer command, server
§ client: side that initiates transfer (either to/from remote) opens 2nd TCP data v control connection: “out of
connection (for file) to client band”
§ server: remote host
v after transferring one file, v FTP server maintains
v ftp: RFC 959 server closes data connection “state”: current directory,
v ftp server: port 21 earlier authentication
Electronic Mail: SMTP [RFC 2821] Scenario: Alice sends message to Bob
1) Alice uses UA to compose 4) SMTP client sends Alice’s
v uses TCP to reliably transfer email message from message “to” message over the TCP
client to server, port 25 [email protected] connection
v direct transfer: sending server to receiving 2) Alice’s UA sends message 5) Bob’s mail server places the
server to her mail server; message message in Bob’s mailbox
placed in message queue 6) Bob invokes his user agent
v three phases of transfer 3) client side of SMTP opens to read message
§ handshaking (greeting) TCP connection with Bob’s
§ transfer of messages mail server
§ closure
v command/response interaction (like HTTP, FTP) 1 user mail user
mail agent
§ commands: ASCII text agent server server
2
§ response: status code and phrase 3 4 6
client wants IP for www.amazon.com; 1st approx: j. Verisign, Dulles VA (69 other sites ) i. Netnod, Stockholm (37 other sites)
v client queries amazon.com DNS server to get IP address for a. Verisign, Los Angeles CA 13 root name
www.amazon.com (5 other sites)
b. USC-ISI Marina del Rey, CA
“servers”
l. ICANN Los Angeles, CA worldwide
(41 other sites)
g. US DoD Columbus,
OH (5 other sites)
DNS name root DNS server DNS name root DNS server
resolution example resolution example
2 2 3
v host at cis.poly.edu 3
TLD DNS server recursive query: 7
6
wants IP address for 4
gaia.cs.umass.edu v puts burden of name TLD DNS
5 server
resolution on
local DNS server contacted name local DNS server
iterated query: dns.poly.edu server dns.poly.edu 5 4
v contacted server 7 6
replies with name of
1 8 v heavy load at upper 1 8
additional info (variable # of RRs) additional “helpful” additional info (variable # of RRs)
info that may be used
Application Layer 2-71 Application Layer 2-72
Inserting records into DNS Attacking DNS
v example: new startup “Network Utopia”
DDoS attacks Redirect attacks
v register name networkuptopia.com at DNS registrar
v Bombard root servers v Man-in-middle
(e.g., Network Solutions)
§ provide names, IP addresses of authoritative name server
with traffic § Intercept queries
(primary and secondary) § Not successful to date v DNS poisoning
§ registrar inserts two RRs into .com TLD server: § Traffic Filtering § Send bogus relies to
(networkutopia.com, dns1.networkutopia.com, NS) § Local DNS servers DNS server, which
(dns1.networkutopia.com, 212.212.212.1, A) cache IPs of TLD caches
v create authoritative server type A record for servers, allowing root Exploit DNS for DDoS
www.networkuptopia.com; type MX record for server bypass
v Send queries with
networkutopia.com v Bombard TLD servers
spoofed source
§ Potentially more
dangerous address: target IP
v Requires amplification
Application Layer 2-73 Application Layer 2-74
time to distribute F
to N clients using DP2P > max{F/us,,F/dmin,,NF/(us + Sui)}
P2P approach
increases linearly in N …
… but so does this, as each peer brings service capacity
Application Layer 2-79 Application Layer 2-80
P2P file distribution: BitTorrent P2P file distribution: BitTorrent
v file divided into 256Kb chunks
v peer joining torrent:
v peers in torrent send/receive file chunks
§ has no chunks, but will
tracker: tracks peers torrent: group of peers accumulate them over time
participating in torrent exchanging chunks of a file from other peers
§ registers with tracker to get
list of peers, connects to
subset of peers
(“neighbors”)
v while downloading, peer uploads chunks to other peers
Alice arrives … v peer may change peers with whom it exchanges chunks
… obtains list v churn: peers may come and go
of peers from tracker
… and begins exchanging v once peer has entire file, it may (selfishly) leave or
file chunks with peers in torrent (altruistically) remain in torrent
Chapter 2: summary
most importantly: learned about protocols!
OS
packet Transport (TCP/UDP)
copy of all Network (IP)
capture Ethernet
frames Link (Ethernet)
(pcap) sent/receive
d Physical