Chapter 2 APPLICATIONS. Computer Networks Timothy Roscoe Summer 2007

Similar documents
Lecture 7 Application Layer. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

WWW: the http protocol

Chapter 2: Application layer

Application Layer Chapter 2

Lecture 6 Application Layer. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

Application Layer. Applications and application-layer protocols. Goals:

Applications & Application-Layer Protocols: FTP and (SMTP & POP)

Internet and Intranet Protocols and Applications

Chapter 2 part B: outline

Networking. Layered Model. DoD Model. Application Layer. ISO/OSI Model

Chapter 2 Application Layer

Computer Networking Introduction

CSC 4900 Computer Networks:

Layered Model. DoD Model. ISO/OSI Model

Review of Previous Lecture

Application Layer: , DNS

Chapter 2: Application Layer

Chapter 2: outline. 2.6 P2P applications 2.7 socket programming with UDP and TCP

FTP. Mail. File Transfer Protocol (FTP) FTP commands, responses. Electronic Mail. TDTS06: Computer Networks

Application Layer. Goals: Service models. Conceptual aspects of network application protocols Client server paradigm

Chapter 2 Application Layer

Lecture 6: Application Layer Web proxies, , and SMTP

Electronic Mail. Three Components: SMTP SMTP. SMTP mail server. 1. User Agents. 2. Mail Servers. 3. SMTP protocol

Chapter 2 Application Layer

CSCE 463/612 Networks and Distributed Processing Spring 2018

CSC 401 Data and Computer Communications Networks

Lecture 05: Application Layer (Part 02) Domain Name System. Dr. Anis Koubaa

CMSC 332 Computer Networking Web and FTP

Course on Computer Communication and

Application-layer Protocols

Application Layer. Goals:

Application Layer. Applications and application-layer protocols. Goals:

Application Layer Protocols

Computer Networks. Wenzhong Li. Nanjing University

Chapter 2: Application Layer. Chapter 2 Application Layer. Some network apps. Application architectures. Chapter 2: Application layer

The Application Layer: SMTP, FTP

Applications & Application-Layer Protocols: (SMTP) and DNS

SCS3004 Networking Technologies Application Layer Protocols

Application Layer. Pure P2P architecture. Client-server architecture. Processes communicating. Hybrid of client-server and P2P. Creating a network app

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

Internet Protocol Stack! Principles of Network Applications! Some Network Apps" (and Their Protocols)! Application-Layer Protocols! Our goals:!

Chapter 2: outline. 2.6 P2P applications 2.7 socket programming with UDP and TCP

Chapter 2 Application Layer

Internet applications. 2: Application Layer 1

Application Layer. Pure P2P architecture. Client-server architecture. Processes communicating. Hybrid of client-server and P2P. Creating a network app

Computer Networks 2 *+ # $ $!,( -. ( - ( - # ( / $!

Chapter 2 Application Layer

Application Layer: HTTP

Web, HTTP and Web Caching

Different Layers Lecture 21

CSEN 404 Introduction to Networks. Mervat AbuElkheir Mohamed Abdelrazik. ** Slides are attributed to J. F. Kurose

CSC358 Week 2. Adapted from slides by J.F. Kurose and K. W. Ross. All material copyright J.F Kurose and K.W. Ross, All Rights Reserved

Chapter 2 outline. 2.1 Principles of app layer protocols

Chapter 2 Application Layer. Lecture 5 DNS. Computer Networking: A Top Down Approach. 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012

Domain Name Service. DNS Overview. October 2009 Computer Networking 1

EECS 3214: Computer Network Protocols and Applications

Application layer. Some network apps. Client-server architecture. Hybrid of client-server and P2P. Pure P2P architecture. Creating a network app

CS4/MSc Computer Networking. Lecture 3: The Application Layer

The Application Layer: & SMTP

Chapter 2. Application Layer. Chapter 2: Application Layer. Application layer - Overview. Some network apps. Creating a network appication

EECS 3214: Computer Network Protocols and Applications

HyperText Transfer Protocol

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

Chapter 2 Application Layer

Foundations of Telematics

Chapter 2 Application Layer

CSEN 503 Introduction to Communication Networks

Lecture 04: Application Layer (Part 01) Principles and the World Wide Web (HTTP) Dr. Anis Koubaa

DATA COMMUNICATOIN NETWORKING

Internet Services & Protocols. Application Layer and its Services

Computer Networks and Applications

Chapter II: Application Layer

Chapter P2P file sharing network applications 2.22 Web and HTTP 2.3 FTP DNS

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 5

CS 3516: Computer Networks

1-1. Switching Networks (Fall 2010) EE 586 Communication and. September Lecture 10

Chapter 2 Application Layer. Lecture 4: principles of network applications. Computer Networking: A Top Down Approach

CS 43: Computer Networks. 12: and SMTP September 28, 2018

Chapter 2. Application Layer. 2: Application Layer 1

SMTP. George Porter CSE 124 February 12, 2015

Chapter 2: Application layer

Network Application. Topic. Principle of Network Application. Principle of Network Application

Chapter 2 Application Layer

Network Applications Principles of Network Applications

Domain Name System (DNS) 김현철 ( 화 ) 정보통신융합서울대학교컴퓨터공학부

CompSci 356: Computer Network Architectures. Lecture 23: Application Layer Protocols Chapter 9.1. Xiaowei Yang

Part 2: Application Layer

Applications & Application-Layer Protocols: The Web & HTTP

CC451 Computer Networks

Part I: Network protocols: HTTP and beyond

Chapter 1 Introduction

Lecture 7: Application Layer Domain Name System

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 4

CSCD 330 Network Programming Winter 2015

Domain Name System (DNS)

Chapter 2 Application Layer

internet technologies and standards

CS 418 Web Programming Spring 2013 SENDING SCOTT G. AINSWORTH.

Applications Layer Protocols. Hui Chen, Ph.D. Dept. of Engineering & Computer Science Virginia State University Petersburg, VA 23806

Chapter 2: Application Layer. Chapter 2: application layer. outline. Some network apps. Client-server architecture. Application architectures

Transcription:

Chapter 2 APPLICATIONS Computer Networks Timothy Roscoe Summer 2007

Overview This week: Learn specific application layer protocols HTTP, FTP, SMTP, POP, DNS, etc. learn about protocols by examining popular application-level protocols conceptual and implementation aspects of network application protocols client-server paradigm service models Next week: How to program network applications? Socket API for Java and C Networks & Operating Systems Computer Networks T. Roscoe 2/2

Applications vs. Application-Layer Protocols Application: communicating, distributed process running in network hosts in user space exchange messages to implement application e.g. email, ftp, web Application-layer protocol one part of application define messages exchanged by applications and actions taken use communication services provided by transport layer protocols (TCP, UDP) application transport network data link physical application transport network data link physical application transport network data link physical Networks & Operating Systems Computer Networks T. Roscoe 2/3

Network applications: some jargon Process: program running within a host within same host, two processes can communicate using interprocess communication (defined by the Operating System). processes running on different hosts must communicate with an application-layer protocol through messages User agent: software process, interfacing with user above and network below implements applicationlevel protocol Examples Web: browser E-mail: mail reader streaming audio/video: media player Networks & Operating Systems Computer Networks T. Roscoe 2/4

Client-server paradigm Typical network app has two parts: Client and Server Client initiates contact with server ( client speaks first ) typically requests service from server Web: client implemented in browser email: client in mail reader Server provides requested service to client e.g. Web server sends requested Web page, mail server delivers e-mail application transport network data link physical request reply application transport network data link physical Networks & Operating Systems Computer Networks T. Roscoe 2/5

API: Application Programming Interface Defines interface between application and transport layers Most common Internet API: sockets two processes communicate by sending data into socket, reading data out of socket How does a process identify the other process with which it wants to communicate? IP ( Internet Protocol ) address of host running other process port number : allows receiving host to determine to which local process the message should be delivered lots more on this later Networks & Operating Systems Computer Networks T. Roscoe 2/6

What transport service does an app need? Data loss some apps (e.g. audio) can tolerate some loss other apps (e.g. file transfer) require 100% reliable data transfer Bandwidth some apps (e.g. multimedia) require minimum amount of bandwidth to be effective other apps ( elastic apps ) make use of whatever bandwidth they get Timing some apps (e.g. Internet telephony, interactive games) require low delay to be effective Networks & Operating Systems Computer Networks T. Roscoe 2/7

Common transport requirements Application Data loss Bandwidth Time Sensitive file transfer e-mail Web documents real-time audio/video, e.g VoIP stored audio/video interactive games financial apps no loss no loss loss-tolerant loss-tolerant loss-tolerant loss-tolerant no loss elastic elastic elastic audio: 5Kb-1Mb video:10kb-5mb same as above few Kbps up elastic no no no yes, 150 msec yes, few secs yes, 100 s msec yes and no Networks & Operating Systems Computer Networks T. Roscoe 2/8

Internet transport protocol services TCP service connection-oriented: setup required between client, server reliable transport between sending and receiving process flow control: sender won t overwhelm receiver congestion control: throttle sender when network overloaded does not provide timing, minimum bandwidth guarantees UDP service unreliable data transfer between sending and receiving process does not provide connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee Why bother? Why is there a UDP service at all?!? Networks & Operating Systems Computer Networks T. Roscoe 2/9

Internet apps: application, transport protocols Application Application layer protocol Underlying transport protocol e-mail remote terminal access World-wide web file transfer streaming multimedia remote file server Internet telephony SMTP [RFC 821] telnet [RFC 854] HTTP [RFC 2068] ftp [RFC 959] RTP, RTSP, etc. NFS, SMB SIP, Skype, etc. TCP TCP TCP TCP TCP or UDP TCP or UDP typically UDP Networks & Operating Systems Computer Networks T. Roscoe 2/10

The Web: The HTTP protocol HTTP: hypertext transfer protocol Web s application layer protocol client/server model client: browser that requests, receives, and displays Web objects server: Web server sends objects in response to requests HTTP 1.0: RFC 1945 HTTP 1.1: RFC 2616 PC running Internet Explorer Mac running Firefox HTTP request HTTP response HTTP request HTTP response Server running Apache Web server Networks & Operating Systems Computer Networks T. Roscoe 2/11

More on the HTTP protocol client initiates TCP connection (creates socket) to server, port 80 server accepts TCP connection from client HTTP messages (applicationlayer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) TCP connection closed HTTP is stateless server maintains no information about past client requests aside Protocols that maintain state are complex! past history (state) must be maintained if server/client crashes, their views of state may be inconsistent, must be reconciled Networks & Operating Systems Computer Networks T. Roscoe 2/12

Example for HTTP Suppose user enters URL http://www.inf.ethz.ch/education/index.html (assume that web page contains text, references to 10 jpeg images) 1. HTTP client initiates TCP connection to HTTP server (process) at www.inf.ethz.ch. Port 80 is default for HTTP server. 3. HTTP client sends HTTP request message (containing URL) into TCP connection socket time 2. HTTP server at host www.inf.ethz.ch waiting for TCP connection at port 80, accepts connection, notifies client 4. HTTP server receives request message, forms response message containing requested object (index.html in directory education), sends message into socket Networks & Operating Systems Computer Networks T. Roscoe 2/13

Example for HTTP (continued) 6. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg pictures 5. HTTP server closes TCP connection Then Steps 1-6 repeated for each of the 10 jpeg objects time Networks & Operating Systems Computer Networks T. Roscoe 2/14

Non-persistent vs. persistent connections Non-persistent HTTP/1.0 server parses request, responds, closes TCP connection 2 RTTs (round-trip-time) to fetch object TCP connection object request/transfer each transfer suffers from TCP s initially slow sending rate many browsers open multiple parallel connections Persistent default for HTTP/1.1 on same TCP connection: server, parses request, responds, parses new request, client sends requests for all referenced objects as soon as it receives base HTML fewer RTTs, less slow start Networks & Operating Systems Computer Networks T. Roscoe 2/15

HTTP message format: request two types of HTTP messages: request, response HTTP request message: ASCII (human-readable format) request line (GET, POST, HEAD commands) Carriage return and line feed indicate end of message header lines GET /somedir/page.html HTTP/1.1 Host: www.servername.com User-agent: Mozilla/4.0 Accept-language: de (extra carriage return, line feed) Networks & Operating Systems Computer Networks T. Roscoe 2/16

HTTP request message: the general format Networks & Operating Systems Computer Networks T. Roscoe 2/17

HTTP message format: response status line (protocol status code status phrase) data, e.g. requested html file header lines HTTP/1.1 200 OK Date: Tue, 27 Mar 2007 12:03:35 GMT Server: Apache/1.3.33 (Unix) Connection: close Content-Type: text/html; charset=iso-8859-1 Last-Modified: Mon, 22 Jun 1998 Content-Length: 6821 <HTML><HEAD>... Networks & Operating Systems Computer Networks T. Roscoe 2/18

HTTP response status codes First line of server -> client response message. A few sample codes: 200 OK request succeeded, requested object later in this message 301 Moved Permanently requested object moved, new location specified later in this message (Location:) 400 Bad Request request message not understood by server 404 Not Found requested document not found on this server 505 HTTP Version Not Supported Networks & Operating Systems Computer Networks T. Roscoe 2/19

An aside on Telnet Remote (character) terminal access [RFC 854, 1983!] Uses TCP transport, port 23 Lots of in-band control codes Surprisingly complex (15 pages + 40 further RFCs!) No security (encryption, etc.) until 2000. Largely superceded by Secure Shell (ssh) Hardly used any more *But * Standard in Unix: telnet <host> [<port>] Most Internet protocols are intentionally text based Ease of implementation, debugging, testing telnet is fantastically useful for protocol hacking Networks & Operating Systems Computer Networks T. Roscoe 2/20

Ultra-minimalist web browsing 1. Telnet to a Web server: telnet people.inf.ethz.ch 80 2. Type in a GET HTTP request: GET /troscoe/ HTTP/1.0 3. Check out response message sent by HTTP server Opens TCP connection to port 80 (default HTTP server port) at people.inf.ethz.ch. Anything typed in sent to people.inf.ethz.ch port 80 By typing this followed by a blank line (hit return twice), you send this minimal (but complete) GET request to the HTTP server But why doesn t this work for something useful like www.sbb.ch? Networks & Operating Systems Computer Networks T. Roscoe 2/21

More modern ultra-minimalist web browsing Lots of web sites on the same machine Only one port 80 Need to say which site you want 1. telnet www.sbb.ch 80 2. Type in a GET HTTP request: GET /index.html HTTP/1.0 Host: www.sbb.ch 3. Should work a lot better Sneak peek: www.sbb.ch is the name of the site, but not its address One address can have many names More on this later with DNS Networks & Operating Systems Computer Networks T. Roscoe 2/22

HTTP user-server interaction: authentication Authentication: control access to server content authorization credentials: typically name and password stateless: client must present authorization in each request authorization: header line in each request if no authorization: header, server refuses access, sends WWW authenticate: header line in response client usual request msg 401: authorization req. WWW-authenticate: usual request msg + Authorization: <cred> usual HTTP response msg usual request msg + Authorization: <cred> usual HTTP response msg server time Networks & Operating Systems Computer Networks T. Roscoe 2/23

Cookies: keeping state server-generated #, serverremembered #, later used for authentication remembering user preferences remembering previous choices ( privacy?) server sends cookie to client in response msg Set-cookie: 1678453 client presents cookie in later requests Cookie: 1678453 client usual HTTP request usual HTTP response + Set-cookie: # usual request msg Cookie: # usual HTTP response msg usual HTTP request Cookie: # usual HTTP response msg server cookiespecific action cookiespecific action Networks & Operating Systems Computer Networks T. Roscoe 2/24

A recent cookie from Google Set-Cookie: PREF=ID=313e7de24f3b48a3: TM=1175005089:LM=1175005089:S=OoXbqHqVOejOEVmc; expires=sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com Expires: when to throw this cookie away Domain: who to present this cookie to Path: which URLs to present this cookie with The rest: known only to Google (but ) Networks & Operating Systems Computer Networks T. Roscoe 2/25

Conditional GET: client-side caching Goal: don t send object if client has up-to-date cached version Client: specify date of cached copy in HTTP request If-modified-since: <date> Server: response contains no object if cached copy is up-todate: HTTP/1.0 304 Not Modified client HTTP request msg If-modified-since: <date> HTTP response HTTP/1.0 304 Not Modified HTTP request msg If-modified-since: <date> server object not modified object modified HTTP response HTTP/1.1 200 OK <data> Networks & Operating Systems Computer Networks T. Roscoe 2/26

Web Caches (a.k.a. proxy server) Goal: satisfy client request without involving origin server User sets browser: Web accesses via web cache Client sends all HTTP requests to web cache object in web cache: web cache returns object else web cache requests object from origin server, then returns object to client client client HTTP request HTTP response HTTP request HTTP response proxy server HTTP request HTTP response origin server origin server Networks & Operating Systems Computer Networks T. Roscoe 2/27

Why Web Caching? Assumption: cache is close to client (e.g. in same network) Smaller response time: cache closer to client Decrease traffic to distant servers Link out of institutional/local ISP network is often a bottleneck institutional network public Internet 1.5 Mbps access link origin servers 100 Mbps LAN institutional cache Networks & Operating Systems Computer Networks T. Roscoe 2/28

ftp: The file transfer protocol 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 user at host FTP user interface FTP client local file system file transfer FTP server remote file system Networks & Operating Systems Computer Networks T. Roscoe 2/29

ftp: separate control and data connections ftp client contacts ftp server at port 21, specifying TCP as transport protocol two parallel TCP connections opened control: exchange commands, responses between client, server. out of band control data: file data to/from server ftp server maintains state : current directory, earlier authentication FTP client TCP control connection port 21 TCP data connection port 20 FTP server Networks & Operating Systems Computer Networks T. Roscoe 2/30

ftp commands and responses Sample commands sent as ASCII text over control channel USER username PASS password LIST returns list of files in current directory RETR filename retrieves (gets) file STOR filename stores (puts) file onto remote host Sample return codes status code and phrase (as in HTTP) 331 Username OK, password required 125 data connection already open; transfer starting 425 Can t open data connection 452 Error writing file Networks & Operating Systems Computer Networks T. Roscoe 2/31

Good taste in protocol implementation Jon Postel in RFC 791: In general, an implementation should be conservative in its sending behaviour and liberal in its receiving behaviour The hardest thing about protocol implementation is expecting the unexpected. People send you the strangest stuff Worst-case example: electronic mail Networks & Operating Systems Computer Networks T. Roscoe 2/32

Electronic Mail Three major components user agents mail servers simple mail transfer protocol: SMTP User Agent a.k.a. mail reader mail server SMTP user agent SMTP mail server user agent user agent composing, editing, reading mail messages Examples: Outlook, Netscape Messenger, elm, Eudora mail server SMTP user agent outgoing, incoming messages stored on server user agent user agent outgoing message queue user mailbox Networks & Operating Systems Computer Networks T. Roscoe 2/33

Electronic Mail: mail servers mailbox contains incoming messages (yet to be read) 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 Why not sending directly? mail server SMTP mail server user agent user agent SMTP SMTP user agent mail server user agent user agent user agent outgoing message queue user mailbox Networks & Operating Systems Computer Networks T. Roscoe 2/34

Electronic Mail: SMTP uses TCP to reliably transfer email message from client to server, on port 25 direct transfer: sending server to receiving server three phases of transfer handshake (greeting) transfer of messages closure command/response interaction commands: ASCII text response: status code and phrase SMTP: RFC 821 Networks & Operating Systems Computer Networks T. Roscoe 2/35

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: Fancy lunch? 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 Networks & Operating Systems Computer Networks T. Roscoe 2/36

SMTP issues Trademark of Hormel Foods, Inc. Pork, mechanically recovered chicken, additives Inexplicably, a delicacy in Hawaii Immortalized by Monty Python Spam, spam, spam, spam, Unwanted, typically anonymous / forged email Networks & Operating Systems Computer Networks T. Roscoe 2/37

SMTP: more details Persistent connections Requires message (header & body) to be in 7-bit ASCII certain character strings not permitted in msg (e.g., CRLF.CRLF, which is used to determine the end of a message by the server). msg must be encoded (usually base-64 or quotedprintable) Comparison with HTTP HTTP: pull, email: push both have ASCII command/response interaction and status codes HTTP: each object encapsulated in its own response msg (1.0), or by use of content-length field (1.1) SMTP: multiple objects sent in multipart msg (as we will see on the next slides) Networks & Operating Systems Computer Networks T. Roscoe 2/38

Mail message format SMTP: protocol for exchanging email msgs RFC (2)822: standard for text message format: header lines, e.g. To: From: Subject: (!) Caution: these are not SMTP commands! They are like the header of a letter, whereas SMTP commands are like the address on the envelope body the message ASCII characters only header body blank line Networks & Operating Systems Computer Networks T. Roscoe 2/39

Message format: multimedia extensions MIME: multimedia mail extension, RFC 2045, 2046, additional lines in message header declare MIME content type MIME version method used to encode data multimedia data type, subtype, parameter declaration encoded data From: alice@crepes.fr To: bob@hamburger.edu Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg /9j/4RRARXhpZgAASUkqAAgAAAAKAA8BA gaoaaaahgaaababagagaaaapgaaabibaw ABAAAAAQAAABoBBQABAAAA3gAAABsBBQA... Networks & Operating Systems Computer Networks T. Roscoe 2/40

MIME types Content-Type: type/subtype; parameters Text example subtypes: plain, enriched, html Video example subtypes: mpeg, quicktime Image example subtypes: jpeg, gif Audio example subtypes: basic (8-bit mu-law encoded), 32kadpcm (32 kbps coding) Application other data that must be processed by reader before viewable example subtypes: msword, octet-stream Networks & Operating Systems Computer Networks T. Roscoe 2/41

MIME Multipart Type From: alice@crepes.fr To: bob@hamburger.edu Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=98766789 --98766789 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Dear Bob, Please find a picture of a crepe. --98766789 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data... /9j/4RRARXhpZgAASUkqAAgAAAAKAA8BAgAOAAAAhgAAABABAgAGAAAApg AAABIBAwABAAAAAQAAABoBBQABAAAA3gAAABsBBQA... --98766789-- Networks & Operating Systems Computer Networks T. Roscoe 2/42

Mail access protocols SMTP: delivery/storage to receiver s server In the old days, their own machine... Mail access protocol: retrieval from server POP: Post Office Protocol [RFC 1939] authorization (agent <-->server) and download IMAP: Internet Mail Access Protocol [RFC 2060] more features (more complex) manipulation of stored messages on server HTTP: Hotmail, Yahoo! Mail, Google Mail, etc. SMTP SMTP POP3 or IMAP user agent user agent sender s mail server receiver s mail server Networks & Operating Systems Computer Networks T. Roscoe 2/43

POP3 protocol Authorization phase client commands: user: declare username pass: password server responses +OK -ERR Transaction phase client commands list: list message numbers retr: retrieve message by number dele: delete quit S: +OK POP3 server ready C: user alice S: +OK C: pass hungry S: +OK user successfully logged on C: list S: 1 498 S: 2 912 S:. C: retr 1 S: <message 1 contents> S:. C: dele 1 C: retr 2 S: <message 2 contents> S:. C: dele 2 C: quit S: +OK POP3 server signing off Networks & Operating Systems Computer Networks T. Roscoe 2/44

DNS: Domain Name System People have many identifiers passport number, AHV number, student number, name, etc. Internet hosts, routers IP address (129.132.130.152); used for addressing datagrams Name (photek.ethz.ch); used by humans We need a map from names to IP addresses (and vice versa?) Domain Name System distributed database implemented in hierarchy of many name servers application-layer protocol host, routers, name servers to communicate to resolve names (name/address translation) note: is a core Internet function, but only implemented as applicationlayer protocol complexity at network s edge Networks & Operating Systems Computer Networks T. Roscoe 2/45

DNS name servers Why not centralize DNS? single point of failure traffic volume distant centralized database maintenance it does not scale! no server has all name-to-ip address mappings local name servers each ISP, company has local (default) name server host DNS query first goes to local name server authoritative name server for a host: stores that host s IP address, name can perform name/address translation for that host s name Networks & Operating Systems Computer Networks T. Roscoe 2/46

DNS: Root name servers contacted by local name server that cannot resolve name root name server contacts authoritative name server if name mapping not known gets mapping returns mapping to local name server Until recently, 13 root name servers worldwide a NSI Herndon, VA c PSInet Herndon, VA d U Maryland College Park, MD g DISA Vienna, VA h ARL Aberdeen, MD j NSI (TBD) Herndon, VA k RIPE London i NORDUnet Stockholm m WIDE Tokyo e NASA Mt View, CA f Internet Software C. Palo Alto, CA b USC-ISI Marina del Rey, CA l ICANN Marina del Rey, CA Networks & Operating Systems Computer Networks T. Roscoe 2/47

Simple DNS example host photek.ethz.ch wants IP address of gaia.cs.umass.edu 1. contact local DNS server, dns.ethz.ch (the primary resolver ) 2. dns.ethz.ch contacts root name server, if necessary 3. root name server contacts authoritative name server, dns.umass.edu, if necessary local name server dns.ethz.ch 1 2 6 root name server 5 3 4 authoritative name server dns.umass.edu requesting host photek.ethz.ch gaia.cs.umass.edu Networks & Operating Systems Computer Networks T. Roscoe 2/48

DNS extended example Root name server: may not know authoritative name server may know intermediate name server: who to contact to find authoritative name server 2 root name server 6 7 3 local name server dns.ethz.ch 1 8 intermediate name server dns.umass.edu 4 5 requesting host photek.ethz.ch authoritative name server dns.cs.umass.edu gaia.cs.umass.edu Networks & Operating Systems Computer Networks T. Roscoe 2/49

DNS Iterated queries Recursive query puts burden of name resolution on contacted name server heavy load? 2 root name server iterated query 3 4 Iterated query contacted server replies with name of server to contact I don t know this name, but ask this server local name server dns.ethz.ch 1 8 requesting host photek.ethz.ch 7 intermediate name server dns.umass.edu 5 6 authoritative name server dns.cs.umass.edu gaia.cs.umass.edu Networks & Operating Systems Computer Networks T. Roscoe 2/50

DNS: Caching and updating records once (any) name server learns mapping, it caches mapping cache entries timeout (disappear) after some time update/notify mechanisms under design by IETF RFC 2136 http://www.ietf.org/html.charters/dnsind-charter.html Networks & Operating Systems Computer Networks T. Roscoe 2/51

DNS resource records DNS: distributed database storing resource records (RR) RR format: (name, ttl, class, type, value) Type=A name is hostname value is IP address Type=NS name is domain (e.g. foo.com) value is IP address of authoritative name server for this domain 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 mail server associated with name Networks & Operating Systems Computer Networks T. Roscoe 2/52

Example of DNS lookup $ dig www.sbb.ch ; <<>> DiG 9.3.2-P1 <<>> www.sbb.ch ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18725 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.sbb.ch. IN A ;; ANSWER SECTION: www.sbb.ch. 30 IN A 194.150.245.35 ;; AUTHORITY SECTION: sbb.ch. 11 IN NS ns2.sbb.ch. sbb.ch. 11 IN NS ns1.sbb.ch. ;; Query time: 3 msec ;; SERVER: 129.132.98.12#53(129.132.98.12) ;; WHEN: Tue Mar 27 17:25:24 2007 ;; MSG SIZE rcvd: 80 Networks & Operating Systems Computer Networks T. Roscoe 2/53

More complex example of DNS lookup $ dig www.inf.ethz.ch ; <<>> DiG 9.3.2-P1 <<>> www.inf.ethz.ch ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12816 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 3, ADDITIONAL: 5 ;; QUESTION SECTION: ;www.inf.ethz.ch. IN A ;; ANSWER SECTION: www.inf.ethz.ch. 86400 IN CNAME www-css.ethz.ch. www-css.ethz.ch. 86400 IN A 129.132.46.11 ;; AUTHORITY SECTION: ethz.ch. 86400 IN NS scsnms.switch.ch. ethz.ch. 86400 IN NS dns1.ethz.ch. ethz.ch. 86400 IN NS dns3.ethz.ch. ;; ADDITIONAL SECTION: dns1.ethz.ch. 86400 IN A 129.132.98.12 dns3.ethz.ch. 86400 IN A 129.132.250.2 scsnms.switch.ch. 106745 IN A 130.59.1.30 scsnms.switch.ch. 106745 IN A 130.59.10.30 scsnms.switch.ch. 141765 IN AAAA 2001:620::1 Networks & Operating Systems Computer Networks T. Roscoe 2/54

DNS protocol, messages DNS protocol query and reply messages, both with same message format msg header identification: 16 bit number for query, reply to query uses same number flags: query or reply recursion desired recursion available reply is authoritative Networks & Operating Systems Computer Networks T. Roscoe 2/55

DNS protocol, messages Name, type fields for a query RRs in response to query records for authoritative servers additional helpful info that may be used Note: unlike others we have seen, DNS is a binary protocol! Networks & Operating Systems Computer Networks T. Roscoe 2/56

Other Internet application protocols are numerous File systems: NFS, SMB, AFS, etc. Encrypted sessions: SSH, SSL, TLS Filesharing: BitTorrent, Kazaa, Netnews: NNTP Network Management: SNMP Games: DOOM (port 666, naturally) Historical artifacts: ECHO, DISCARD, CHARGEN, QUOTE, DAYTIME, TIME, FINGER Next: programming application protocols using sockets. Networks & Operating Systems Computer Networks T. Roscoe 2/57