Application Protocols Computer Networks 1 Outline FTP r

  • Slides: 31
Download presentation
Application Protocols Computer Networks 1

Application Protocols Computer Networks 1

Outline Ø FTP r Email r DNS 2

Outline Ø FTP r Email r DNS 2

FTP: the File Transfer Protocol user at host FTP user agent file transfer FTP

FTP: the File Transfer Protocol user at host FTP user agent file transfer FTP server local file system remote file system r ftp: RFC 959 r ftp client contacts ftp server, who listens at port 21 r two parallel TCP connections opened: m m control port 21: exchange commands, responses data port 20: file data to/from server 3

FTP: separate control, data connections TCP control connection port 21 r FTP client contacts

FTP: separate control, data connections TCP control connection port 21 r FTP client contacts FTP r r server at port 21, specifying TCP as transport protocol Client obtains authorization over control connection Client browses remote directory by sending commands over control connection. When server receives a command for a file transfer, the server opens a TCP data connection to client After transferring one file, server closes connection. FTP client TCP data connection port 20 FTP server r Server opens a second TCP data connection to transfer another file. r Control connection: “out of band” r FTP server maintains “state”: current directory, earlier authentication 4

Impacts of the FTP dual connections: for system administrators r Firewall ACL rules m

Impacts of the FTP dual connections: for system administrators r Firewall ACL rules m m FTP client Permit all connections initiated from inside Disable all connections initiated from outside r What does this bi-direction mean for firewall filters? r Can I disable all incoming connections? r What if incoming connections are all denied, can you download files? FTP server TCP control connection port 21 Intranet Internet TCP data connection port 20 Firewall Computer Networks 5

FTP Passive Mode r Passive (PASV) mode m m m Client initiates control connection

FTP Passive Mode r Passive (PASV) mode m m m Client initiates control connection by connecting to port 21 on server Client enables “Passive” mode Server responds with PORT command giving client the IP address and port to use for subsequent data connection (usually port 20, but can be bypassed) Client initiates data connection by connecting to specified port on server Most web browsers do PASVmode ftp TCP control connection port 21 FTP client Client connect to some server port FTP server 6

Outline q FTP Ø Email r DNS 7

Outline q FTP Ø Email r DNS 7

Electronic Mail outgoing message queue user mailbox user agent Three major components: r user

Electronic Mail outgoing message queue user mailbox user agent Three major components: r user agents r mail servers mail server r simple mail transfer SMTP protocol: SMTP User Agent r a. k. a. “mail reader” r composing, editing, reading mail messages r e. g. , Eudora, Outlook, elm, Netscape Messenger r outgoing, incoming messages stored on server SMTP mail server user agent SMTP user agent mail server user agent 8

Electronic Mail: mail servers user agent Mail Servers r mailbox contains incoming messages for

Electronic Mail: mail servers user agent Mail Servers r mailbox contains incoming messages for user r message queue of outgoing (to be sent) mail messages r SMTP protocol between mail servers to send email messages m client: sending mail server m “server”: receiving mail server SMTP mail server user agent SMTP user agent mail server user agent 9

Try SMTP interaction for yourself: r telnet servername 25 r see 220 reply from

Try SMTP interaction for yourself: r telnet servername 25 r see 220 reply from server r enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands above lets you send email without using email client (reader) 10

Sample SMTP interaction S: C: S: C: C: C: S: 220 hamburger. edu HELO

Sample SMTP interaction S: C: S: C: C: C: S: 220 hamburger. edu HELO crepes. fr 250 Hello crepes. fr, pleased to meet you MAIL FROM: <alice@crepes. fr> 250 alice@crepes. fr. . . Sender ok RCPT TO: <bob@hamburger. edu> 250 bob@hamburger. edu. . . Recipient ok DATA 354 Enter mail, end with ". " on a line by itself Do you like ketchup? How about pickles? . 250 Message accepted for delivery QUIT 221 hamburger. edu closing connection 11

SMTP (cont. ) r SMTP uses persistent connections r SMTP requires message (header &

SMTP (cont. ) r SMTP uses persistent connections r SMTP requires message (header & body) to be in 7 -bit ASCII r SMTP server uses CRLF to determine end of message Comparison with HTTP: r HTTP: pull r SMTP: push r both have ASCII command/response interaction, status codes r HTTP: each object encapsulated in its own response msg r SMTP: multiple objects sent in multipart msg 12

Mail message format SMTP: protocol for exchanging email msgs RFC 822: standard for text

Mail message format SMTP: protocol for exchanging email msgs RFC 822: standard for text message format: r header lines, e. g. , To: m From: m Subject: different from SMTP commands! m header blank line body r body m the “message”, ASCII characters only m What if I want to send data encoded other than ASCII? 13

Message format: multimedia extensions r MIME: multimedia mail extension, RFC 2045, 2056 r additional

Message format: multimedia extensions r MIME: multimedia mail extension, RFC 2045, 2056 r additional lines in msg 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: base 64 Content-Type: image/jpeg base 64 encoded data. . . . . base 64 encoded data 14

MIME types Content-Type: type/subtype; parameters Text r example subtypes: plain, html Image r example

MIME types Content-Type: type/subtype; parameters Text r example subtypes: plain, html Image r example subtypes: jpeg, gif Audio r exampe subtypes: basic (8 Video r example subtypes: mpeg, quicktime Application r other data that must be processed by reader before “viewable” r example subtypes: msword, octet-stream -bit mu-law encoded), 32 kadpcm (32 kbps coding) 15

Mail access protocols user agent SMTP sender’s mail server access protocol user agent receiver’s

Mail access protocols user agent SMTP sender’s mail server access protocol user agent receiver’s mail server SMTP: delivery/storage to receiver’s server r Mail access protocol: retrieval from server m POP: Post Office Protocol [RFC 1939] • authorization (agent <-->server) and download m IMAP: Internet Mail Access Protocol [RFC 1730] • more features (more complex) • manipulation of stored msgs on server m HTTP: Hotmail , Yahoo! Mail, etc. r 16

POP 3 protocol authorization phase r client commands: user: declare username m pass: password

POP 3 protocol authorization phase r client commands: user: declare username m pass: password r server responses m +OK m -ERR m transaction phase, client: r list: list message numbers r retr: retrieve message by number r dele: delete r quit S: C: S: +OK POP 3 server ready user bob +OK pass hungry +OK user successfully logged C: S: S: S: C: C: S: list 1 498 2 912. retr 1 <message 1 contents>. dele 1 retr 2 <message 1 contents>. dele 2 quit +OK POP 3 server signing off 17 on

POP 3 (more) and IMAP More about POP 3 r Previous example uses “download

POP 3 (more) and IMAP More about POP 3 r Previous example uses “download and delete” mode. r Bob cannot re-read e-mail if he changes client r “Download-and-keep”: copies of messages on different clients r POP 3 is stateless across sessions IMAP r Keep all messages in one place: the server r Allows user to organize messages in folders r IMAP keeps user state across sessions: m names of folders and mappings between message IDs and folder name 18

Outline q FTP q Email Ø DNS 19

Outline q FTP q Email Ø DNS 19

DNS: Domain Name System r Function m m m Machine like to use fix

DNS: Domain Name System r Function m m m Machine like to use fix length number e. g. , IP address (32 bit) - used for address Human like names, e. g. , church. cse. ogi. edu - used by humans Map between names (e. g. www. cs. uga. edu) and IP addresses (e. g. 128. 192. 251. 7) Domain Name System: r distributed database implemented in hierarchy of many name servers r application-layer protocol host, routers, name servers to communicate to resolve names (address/name translation) m note: core Internet function, implemented as application-layer protocol m complexity at network’s “edge” 20

Original Name to Address Mapping r Flat namespace m /etc/hosts m SRI kept main

Original Name to Address Mapping r Flat namespace m /etc/hosts m SRI kept main copy m Downloaded regularly r Problems m Count of hosts was increasing: • machine per domain machine per user • Many more downloads • Many more updates 21

DNS name servers Why not centralize DNS? r single point of failure r traffic

DNS name servers Why not centralize DNS? r single point of failure r traffic volume r distant centralized database r maintenance r doesn’t scale! r no server has all name-to-IP address mappings local name servers: m each ISP, company has local (default) name server • /etc/resolv. conf m host DNS query first goes to local name server authoritative name server: m m for a host: stores that host’s IP address, name can perform name/address translation for that host’s name 22

DNS: Domain Name System r Basic scheme: a hierarchical name space implemented by a

DNS: Domain Name System r Basic scheme: a hierarchical name space implemented by a distributed database called a zone 23

DNS: Root name servers a NSI Herndon, VA c PSInet Herndon, VA d U

DNS: Root name servers 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 r contacted by local name server that can not resolve name r root name server: m contacts authoritative name server if name mapping not known m gets mapping m returns mapping to local name server 13 root name servers worldwide 24

Simple DNS example Host atlas. cs. uga. edu wants IP address of gaia. cs.

Simple DNS example Host atlas. cs. uga. edu wants IP address of gaia. cs. umass. edu root name server 2 5 1. contacts its local DNS server, local name server dns 1. uga. edu 2. dns 1 contacts root name 1 server, if necessary 6 3. root name server contacts authoritative name server, dns. umass. edu, if requesting host necessary atlas. cs. uga. edu 3 4 authorititive name server dns. umass. edu gaia. cs. umass. edu 25

DNS example Root name server: 6 2 r may not know authoritative name server

DNS example Root name server: 6 2 r may not know authoritative name server r may know intermediate name server: who to contact to find authoritative name server root name server 7 local name server dns 1. uga. edu 1 8 requesting host 3 intermediate name server dns. umass. edu 4 5 authoritative name server dns. cs. umass. edu atlas. cs. uga. edu gaia. cs. umass. edu 26

DNS: Two Types of Queries root name server Recursive query: r puts burden of

DNS: Two Types of Queries root name server Recursive query: r puts burden of name resolution on contacted name server 2 Iterated query: 3 4 r contacted server replies with name of server to contact r “I don’t know this name, but ask this server” iterated query 7 local name server dns 1. uga. edu 1 8 intermediate name server dns. umass. edu 5 6 authoritative name server dns. cs. umass. edu requesting host atlas. cs. uga. edu gaia. cs. umass. edu 27

DNS: caching and updating records r once (any) name server learns mapping, it caches

DNS: caching and updating records r once (any) name server learns mapping, it caches mapping cache entries timeout (disappear) after some time r update/notify mechanisms under design by IETF m m RFC 2136 m http: //www. ietf. org/html. charters/dnsind-charter. html 28

DNS records DNS: distributed db storing resource records (RR) RR format: r Type=A m

DNS records DNS: distributed db storing resource records (RR) RR format: r Type=A m name is hostname m value is IP address (name, value, type, ttl) r Type=CNAME m name is alias name for some “cannonical” (the real) name www. ibm. com is really r Type=NS servereast. backup 2. ibm. com m name is domain (e. g. foo. com) m value is cannonical name m value is IP address of authoritative name server for this domain r Type=MX m value is name of mailserver associated with name 29

DNS protocol, messages DNS protocol : query and reply messages, both with same message

DNS protocol, messages DNS protocol : query and reply messages, both with same message format msg header r identification: 16 bit # for query, reply to query uses same # r flags: m query or reply m recursion desired m recursion available m reply is authoritative 30

DNS protocol, messages Name, type fields for a query RRs in reponse to query

DNS protocol, messages Name, type fields for a query RRs in reponse to query records for authoritative servers additional “helpful” info that may be used 31