CSCI x760 - Computer Networks Spring 2016
Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu
source: computer-networks-webdesign.com
These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross
CSCI x760 - Computer Networks Spring 2016 Instructor: Prof. Roberto - - PowerPoint PPT Presentation
source: computer-networks-webdesign.com CSCI x760 - Computer Networks Spring 2016 Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross Chapter 2: Application
Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu
source: computer-networks-webdesign.com
These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross
} SMTP
Application 2-2
} transport-layer service
} client-server paradigm } peer-to-peer paradigm
} HTTP } FTP } SMTP / POP3 / IMAP } DNS
} socket API
Application 2-3
Application 2-4
} run on (different) end systems } communicate over network } e.g., web server software
} network-core devices do not run
} applications on end systems
application transport network data link physical application transport network data link physical application transport network data link physical
Application 2-5
Application 2-6
Application 2-7
} always-on host } permanent IP address } server farms for scaling
} communicate with server } may be intermittently connected } may have dynamic IP addresses } do not communicate directly
Application 2-8
Application 2-9
} voice-over-IP P2P application } centralized server: finding address of remote party: } client-client connection: direct (not through server)
} chatting between two users is P2P } centralized service: client presence detection/location
Application 2-10
Application 2-11
} sending process shoves message
} sending process relies on
process TCP with buffers, variables socket host or server process TCP with buffers, variables socket host or server Internet controlled by OS controlled by app developer
Application 2-12
Application 2-13
} HTTP server: 80 } Mail server: 25
} IP address: 128.119.245.12 } Port number: 80
} A: No, many processes can
Application 2-14
} e.g., request, response
} what fields in messages & how
} meaning of information in fields
Application 2-15
Application 2-16
Application 2-17
} connection-oriented: setup required
} reliable transport between sending
} flow control: sender won’t
} congestion control: throttle sender
} does not provide: timing, minimum
} unreliable data transfer
} does not provide: connection
Application 2-18
Application 2-19
} app architectures } app requirements
} SMTP
Application 2-20
Application 2-21
} Web’s application layer protocol } client/server model } client: browser that requests,
} server: Web server sends
PC running Firefox Server running Apache Web server Mac running Chrome
Application 2-22
} client initiates TCP connection
} server accepts TCP connection
} HTTP messages (application-layer
} TCP connection closed
} server maintains no
v past history (state) must
v if server/client crashes,
Application 2-23
Application 2-24
Application 2-25
Application 2-26
time to transmit file initiate TCP connection RTT request file RTT file received time time
Application 2-27
} requires 2 RTTs per object } OS overhead for each TCP
} server leaves connection open
} subsequent HTTP messages
} client sends requests as soon as
} as little as one RTT for all the
Application 2-28
} browsers can open parallel TCP
} Has advantages and disadvantages
Application 2-29
} ASCII (human-readable format)
Application 2-30
carriage return character line-feed character
Application 2-31
2: Application Layer 32
} web page often includes form
Application 2-33
} asks server to leave requested
} uploads file in entity body to
} deletes file specified in the URL
Application 2-34
Application 2-35
} request succeeded, requested object later in this msg
} requested object moved, new location specified later in this msg
} request msg not understood by server
} requested document not found on this server
Application 2-36
Application 2-37
} unique ID } entry in backend database
Application 2-38
ebay 8734
ebay 8734 amazon 1678
ebay 8734 amazon 1678
Application 2-39
Application 2-40
2: Application Layer 41
} Session cookies } Permanent cookies (tracking cookies)
} You visit www.example.com, which contains a banner from ads.clicks-
} in simple terms ads.clicks-for-me.net is third-party because it does not
} third-party sites should be denied setting or reading cookies
} The browser allows ads.clicks-for-me.net to drop a third-party
} Then you visit www.another-example.com , which also loads ads from
} ads.clicks-for-me.net can track the fact that you visited both
2: Application Layer 42
} An attacker may be able to “sniff” your authentication cookies } The attacker will be able to login as you on a website (e.g.,
} See FireSheep for a concrete example!
} http://codebutler.com/firesheep
2: Application Layer 43
} Session IDs are commonly used by web applications
} http://example.com/index.php?user_id=0F4C26A1&topic=networking
} Session IDs are typically passed in the URL (added to web app
} Cookies are passed through HTTP req/resp headers } Cookies are stored in the browser’s cache and have an
} Session IDs are volatile: never stored, only used until end of
} object in cache: cache
} else cache requests object
client
client
server
server
Application 2-44
} Splits the TCP connection!
Application 2-45
} average object size = 1M bits } avg. request rate from institution’s
} delay from “Internet router” to any
} utilization on LAN = 15% } utilization on access link = 100% } total delay = Internet delay + access
public Internet institutional network 100 Mbps LAN 15 Mbps access link
Application 2-46 Due to traffic intensity = 1
} increase bandwidth of access link
} utilization on LAN = 15% } utilization on access link = 15% } Total delay = Internet delay +
} often a costly upgrade
public Internet institutional network 100 Mbps LAN 100 Mbps access link
Application 2-47
} install cache
} suppose hit rate is 0.4
} 40% requests will be satisfied
} 60% requests satisfied by origin
} utilization of access link reduced
} total avg delay = Internet delay
public Internet institutional network 100 Mbps LAN 15 Mbps access link
Application 2-48
} Goal: don’t send object if cache
} cache: specify date of cached
} server: response contains no
If-modified-since: <date>
HTTP/1.0 304 Not Modified
If-modified-since: <date>
HTTP/1.0 200 OK
Application 2-49
In reality, cache entry validation and eviction policies are quite complex http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13
2: Application Layer 50
} The client sends multiple HTTP request without waiting for
} The server sends the response one after the other
} HTTP allows downloading pieces of objects } Example:
} 10MB image to be downloaded } We can open 10 different TCP connection and send 10 HTTP requests
} Download 1MB of data from each connection and stitch them back
} SMTP
Application 2-51
} transfer file to/from remote host } client/server model } client: side that initiates transfer (either to/from remote) } server: remote host } ftp: RFC 959 } ftp server: port 21
file transfer FTP server FTP user interface FTP client local file system remote file system user at host
Application 2-52
} FTP client contacts FTP server at
} client authorized over control
} client browses remote directory by
} when server receives file transfer
} after transferring one file, server
TCP control connection port 21 TCP data connection port 20
v server opens another TCP
v control connection: “out of
v FTP server maintains “state”:
Application 2-53
} Active FTP
} Passive FTP
TCP control connection port 21 TCP data connection to negotiated serv port
Application 2-54
TCP control connection port 21 TCP data connection from serv port 20
} sent as ASCII text over control
} USER username } PASS password } LIST return list of file in current
} RETR filename retrieves
} STOR filename stores (puts)
} status code and phrase (as in
} 331 Username OK,
} 125 data connection
} 425 Can’t open data
} 452 Error writing file
Application 2-55
} SMTP
Application 2-56
} user agents } mail servers } simple mail transfer protocol:
} a.k.a. “mail reader” } composing, editing, reading mail
} e.g., Eudora, Outlook, elm, Mozilla
} outgoing, incoming messages
user mailbox
message queue mail server user agent user agent user agent mail server user agent user agent mail server user agent
Application 2-57
} mailbox contains incoming
} message queue of outgoing (to be
} SMTP protocol between mail
} client: sending mail server } “server”: receiving mail server
mail server user agent user agent user agent mail server user agent user agent mail server user agent
Application 2-58
} uses TCP to reliably transfer email message from client to server,
} 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
Application 2-59
user agent mail server mail server user agent 1 2 3 4 5 6
Application 2-60
Application 2-61
Application 2-62
2: Application Layer 63
$ dig +short -t MX uga.edu 10 1282373658.mail.outlook.com. $ dig +short -x 198.137.20.113 h198-137-20-113.paws.uga.edu. $ telnet 1282373658.mail.outlook.com. 25 Trying 216.32.181.178... Connected to 1282373658.mail.outlook.com. Escape character is '^]'. 220 CH1EHSMHS014.bigfish.com Microsoft ESMTP MAIL Service ready at Tue, 29 Jan 2013 15:20:08 HELO h198-137-20-113.paws.uga.edu 250 CH1EHSMHS014.bigfish.com Hello [128.192.4.39] MAIL FROM: <perdisci@cs.uga.edu> 250 2.1.0 Sender OK RCPT TO: <perdisci@uga.edu> 250 2.1.5 Recipient OK DATA 354 Start mail input; end with <CRLF>.<CRLF> From: Roberto <perdisci@cs.uga.edu> To: Rob <perdisci@uga.edu> Subject: Quick question Do you like ketchup? . 250 2.6.0 <….ehs.local> [InternalId=21919093] Queued mail for delivery QUIT 221 2.0.0 Service closing transmission channel Connection closed by foreign host.
} header lines, e.g.,
} To: } From: } Subject:
} body
} the “message”, ASCII characters
Application 2-64
} SMTP uses persistent connections } SMTP requires message (header &
} SMTP server uses CRLF.CRLF to
} HTTP: pull } SMTP: push } both have ASCII command/
} HTTP: each object encapsulated in
} SMTP: multiple objects sent in
Application 2-65
} SMTP: delivery/storage to receiver’s server } mail access protocol: retrieval from server } POP: Post Office Protocol [RFC 1939] } authorization (agent <-->server) and download } IMAP: Internet Mail Access Protocol [RFC 1730] } more features (more complex) } manipulation of stored msgs on server } HTTP: gmail, Hotmail,
Yahoo! Mail, etc.
user agent sender’s mail server user agent
receiver’s mail server
The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again. The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.
Application 2-66
} client commands: } user: declare username } pass: password } server responses } +OK } -ERR
} list: list message numbers } retr: retrieve message by
} dele: delete } quit
Application 2-67
} names of folders and
Application 2-68
} SMTP
Application 2-69
} SSN, name, passport #
} IP address (32 bit) - used for
} “name”, e.g., ww.yahoo.com -
} distributed database implemented in
} application-layer protocol host,
} note: core Internet function,
} complexity at network’s “edge”
Application 2-70
} Canonical, alias names
} replicated Web servers: set of
Application 2-71
} 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
Application 2-72
} 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
b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA e NASA Mt View, CA f 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, VA c Cogent, Herndon, VA (also LA) d U Maryland College Park, MD g US DoD Vienna, VA h ARL Aberdeen, MD
j Verisign, ( 21 locations)
Application 2-73
} responsible for com, org, net, edu, aero, jobs, museums, and all
} Network Solutions maintains servers for com TLD } Educause for edu TLD
} organization’s DNS servers, providing authoritative hostname
} can be maintained by organization or service provider
Application 2-74
} also called “default name server”
} acts as proxy, forwards query into hierarchy
Application 2-75
gaia.cs.umass.edu
authoritative DNS server dns.cs.umass.edu
v contacted server
v “I don’t know this
Application 2-76
Query for gaia.cs.umass.edu
cis.poly.edu gaia.cs.umass.edu
dns.poly.edu
authoritative DNS server dns.cs.umass.edu
v puts burden of name
v heavy load?
Application 2-77
} cache entries timeout (disappear) after some time } TLD servers typically cached in local name servers
} Thus root name servers not often visited
Application 2-78
} name is domain (e.g. foo.com) } value is hostname of
Application 2-79
v identification: 16 bit #
v flags:
Application 2-80
Application 2-81
} provide names, IP addresses of authoritative name server (primary and
} registrar inserts two RRs into com TLD server:
Application 2-82
2: Application Layer 83
} Only check is on TXID
cis.poly.edu gaia.cs.umass.edu
dns.poly.edu authoritative DNS server dns.cs.umass.edu
2: Application Layer 84
} Port randomization } 0x20-Bit encoding
} Responses are digitally signed } They can be verified by following a chain of trust anchored at
} Not yet fully deployed