Title: FTP: File Transfer Protocol
1FTP File Transfer Protocol
file transfer
user at host
remote file system
- ???s?µ?p??e?ta? ??a µetaf??? a??e??? ap?/p??? ??a
ap?µa???sµ??? s?st?µa - ???????e? t? µ??t??? client/server
- client ? p?e??? p?? e????e? t?? µetaf??? a??e???
(e?te ap? e?te p??? t? ap?µa???sµ??? s?st?µa) - server t? ap?µa???sµ??? s?st?µa
- FTP RFC 959 (pe?????fe? a?a??t??? t? p??t??????)
- FTP server a???e? st? port 21
2??a????sµ?? t?? s??d?se?? e??????/ ded?µ????
- O FTP Client s??d?eta? st?? FTP Server st? port
21, a?af????t?? t?? TCP ?? t? transport protocol - ? Client e??a? ep?s?? a?a??asµ???? ?a
p?st?p????e? p??? ap? t? ?d?? control connection
(port 21) - ?a?????ta? ta s?st? user-name/password, o Client
µp??e? ?a ???e? browse st? remote directory
st?????ta? ?at?????e? e?t???? p??? ap? t? control
connection - ?ta? ? Server de?te? e?t??? ??a µetaf??? e???
a??e??? a????e? ??a data connection (TCP) p???
t?? Client (port 20) - ?et? ap? t? µetaf??? e??? a??e??? ? Server
??e??e? t? data connection
- G?a t? µetaf??? e??? ????? a??e??? ? Server
a????e? de?te?? TCP data connection - Control connection out of band
- O FTP Server d?at??e? t?? ?at?stas? t??
s??d?se?? t?? p?st?p???s? p?? ??e? ???e? ?a? t?
current directory t?? ???e Client
3FTP µ???µata (a?t?se?? ap????se??)
- ??de??t???? a?t?se??
- St?????ta? ?? ASCII text p??? ap? t? control
connection - USER username
- PASS password
- LIST return list of file in current directory
- RETR filename retrieves (gets) file
- STOR filename stores (puts) file onto remote host
- ??de??t???? ap????se??
- ??d???? ap????se?? (?d?a ?????? µe t? HTTP) d??.
Status code ?a? Phrase - 331 Username OK, password required
- 125 data connection already open transfer
starting - 425 Cant open data connection
- 452 Error writing file
4Electronic Mail (e-mail)
- ?a ?????te?a s?stat???
- User Agents
- Mail Servers
- Simple Mail Transfer Protocol SMTP
- User Agent
- O Mail Client
- ??µ??????a, ??af? ?a? a?????s? µ???µ?t?? t??
??e?t??????? ta??d??µe??? - ?.?. Eudora, Microsoft Outlook, elm, Netscape
Messenger, Mozilla Thunderbird, Outlook Experss,
Opera ?t?. - ?a e?se???µe?a ?a? e?e???µe?a µ???µata
ap????e???ta? st?? mail server
5Electronic Mail mail servers
- Mail Servers
- mailbox pe????e? ta e?se???µe?a µ???µata
??e?t??????? ta??d??µe??? ??a t?? ???st? - message queue t?? e?e???µ???? µ???µ?t??
??e?t??????? ta??d??µe??? (a?t?? p?? ?a sta????) - SMTP protocol µeta?? t?? mail servers ??a t??
ap?st??? t?? µ???µ?t?? ??e?t??????? ta??d??µe??? - client sending mail server
- server receiving mail server
6Electronic Mail SMTP RFC 2821
- ?? SMTP ???s?µ?p??e? t? p??t?????? TCP ??a
e????µ??? µetaf??? t?? µ???µ?t?? ??e?t???????
ta??d??µe??? (connection st? port 25) - ? µetaf??? t?? µ???µ?t?? e??a? ?µes? ?p? t??
sending server st?? receiving server - ?at? t? µetaf??? ?aµß????? ???a t?e?? f?se??
- handshaking (greeting)
- ?etaf??? t?? µ???µ?t??
- ??e?s?µ? t?? s??des??
- ? a????ep?d?as? e??a? ??as??? a?ta??a?? µ???µ?t??
a?t?s?? - ap????s?? - ??t?se?? ASCII text
- ?p????se?? Status Code and Phrase (?p?? st? HTTP
? st? FTP) - ?a µ???µata t?? ??e?t??????? ta??d??µe??? p??pe?
?a ???s?µ?p????? ?a?a?t??e? ASCII t?? 7 bit
7Se????? ?p?st??? e-mail
- 1) ? ?a??? (mary_at_uop.gr) ???s?µ?p??e? ??p???? UA
??a ?a ste??e? t? µ???µa st?? ???? (p?? ??e?
d?e????s? nick_at_ntua.gr) - 2) ? UA t?? ?a???? st???e? t? µ???µa p?? ??e?
d?µ??????se? ? ?d?a st?? mail server t??. ??
µ???µa e?s???eta? se µ?a ???? µ???µ?t??. - 3) ? mail server t?? ?a???? ?e?t????e? ?? SMTP
Client, a??????ta? TCP connection µe t?? mail
server t?? ?????
- 4) O SMTP client st???e? t? µ???µa t?? ?a????
st?? SMTP server (t?? mail server t?? ?????) p???
ap? t? TCP connection - 5) ? mail server t?? ????? t?p??ete? t? µ???µa
st? a?t?st???? mailbox t?? ????? (st? mailbox p??
a?t?st???e? st? d?e????s? nick_at_ntua.gr) - 6) ?ta? ? ????? a????e? t?? d??? t?? UA ?a µp??e?
?a d?aß?se? t? µ???µa p?? ??e? ste??e? ? ?a???
1
2
6
3
4
5
8??de??t??? SMTP a????ep?d?as?
S 220 mailserver.uop.gr C HELO
mailserver S 250 Hello, pleased to meet
you C MAIL FROM ltmary_at_uop.grgt S
250 mary_at_uop.gr... Sender ok C RCPT TO
ltnick_at_ntua.grgt S 250 nick_at_ntua.gr ...
Recipient ok C DATA S 354 Enter
mail, end with "." on a line by itself C
Hi Nick! C Im writing... Bla bla bla ...
C . S 250 Message accepted for
delivery C QUIT S 221
mailserver.uop.gr closing connection
9????µ?ste ?a? µ???? sa? t? SMTP
- telnet servername 25
- ?e?te t? 220 reply ap? t?? server
- ?e ???s? t?? µ???µ?t?? a?t?s?? HELO, MAIL FROM,
RCPT TO, DATA, QUIT µp??e?te ?a ste??ete e-mail
????? t? ???s? ??p???? mail client (p.?. Outlook
Express)
10(No Transcript)
11?p?t??esµa
12SMTP ???a ????a ??a ?a ??e?s??µe
- ? ?????te?? d?af??? µe t? HTTP
- HTTP pull
- SMTP push
- ?? SMTP ???s?µ?p??e? ep?µ??e? (persistent) TCP
s??d?se?? - To SMTP apa?te? t? µ???µa (header body) ?a
e??a? ??d???p???µ??? ?at? ASCII t?? 7-bit - ? SMTP server ???s?µ?p??e? t? CRLF.CRLF (Enter,
te?e?a, Enter) ??a t?? ?a????sµ? t?? t?????
t?? µ???µat??
13Mail message format (RFC2822)
- To SMTP e??a? p??t?????? ??a t?? a?ta??a?? e-mail
µ???µ?t?? - ?? RFC 2822 ap?te?e? t? standard ??a t?
µ??f?p???s? t?? µ???µ?t?? ?e?µ???? - header lines, p.?.
- To
- From
- Subject
- d?af??e? fap? ta SMTP µ???µata
- body
- ?? ?????? µ???µa, µ??? ASCII ?a?a?t??e?
header
blank line
body
14Message format multipurpose extensions
- MIME Multipurpose Internet Mail Extension, RFC
2045, 2056 - Ta RFC p??s??t??? ??p??e? ??aµµ?? st? header ??a
t? d???s? t?? t?p?? t?? pe??e??µ???? t?? µ???µat??
MIME version
method used to encode data
multimedia data type, subtype, parameter
declaration
encoded data
15To ?aµßa??µe?? ????µa
16Mail access protocols
SMTP
access protocol
receivers mail server
- SMTP ap?st???/ap????e?s? st?? mail server t??
pa?a??pt? - Mail Access Protocols ??a t?? pa?a?aß? t??
µ???µat?? ap? t?? mail server - POP Post Office Protocol RFC 1939
- authorization (User agent lt--gtserver) and
download - IMAP Internet Mail Access Protocol RFC 1730
- ?e??ss?te?e? d??at?t?te? (p?? s???et?)
- ???at? ? d?a?e???s? t?? ap????e?µ???? µ???µ?t??
st?? mail server - HTTP hotmail, yahoo Mail, gmail ?t?.
17POP3 protocol
- ??se? t?? p??t??????? POP3 ? user agent a????e?
??a TCP connection st?? mail server st? port 110 - ?at? t?? a????ep?d?as? t?? UA µe t?? mail server
ß?se? t?? POP3 p?a?µat?p?????ta? ?? e??? 3
f?se?? - ????s??d?t?s? (Authorization)
- S??a??a?? (Transaction)
- ???µ???s? (Update)
18POP3 protocol
S OK POP3 server ready C user mary S OK
C pass mypassword S OK user successfully
logged on
- authorization phase
- client commands
- user declare username
- pass declare password
- server responses
- OK
- -ERR
- transaction phase, client
- list list message numbers
- retr retrieve message by number
- dele delete
- quit
C list S 1 498 S 2 912
S . C retr 1 S ltmessage 1
contentsgt S . C dele 1 C retr
2 S ltmessage 1 contentsgt S .
C dele 2 C quit S OK POP3 server
signing off
19POP3 ?a? IMAP
- ???a a??µ? ??a t? POP3
- St? p??????µe?? pa??de??µa ???eta? ???s? t??
download-and-delete mode. - ? ?a??? de? µp??e? ?a ?a?ad?aß?se? ta e-mail t??,
a? a????e? mail client - ?e ???s? ????? mode, t?? Download-and-keep,
e??a? d??at? ? a?t???af? t?? µ???µ?t?? se
d?af??et????? mail client - ?? p??t?????? POP3 de? d?at??e? t?? ?at?stas? se
???e s???d?
- IMAP
- ??at??e? ta µ???µata µ??? se ??a µ???? st??
server - ???e? t? d??at?t?ta st?? ???st? ?a ???a??se? ta
µ???µata se fa?????? (folders) µ?sa st?? ?d?? t??
server - ?? p??t?????? IMAP d?at??e? t?? ?at?stas? t??
???st? µeta?? t?? d?af??et???? s???d?? - ???µat??e? t??? d?af??et????? fa?????? (folders)
?a? d?µ?????e? s?s?et?se?? µeta?? t?? IDs t??
µ???µ?t?? ?a? t?? ???µ?t?? t?? fa?????
20???a a??µ? ??a t? IMAP
- ??a? IMAP server s?s?et??e? ???e µ???µa µe ??a?
f??e?? - ?ta? ??a µ???µa af???e?ta? st?? server,
s?s?et??eta? ?a? p??????eta? ?µesa st? INBOX
folder t?? pa?a??pt? - ? pa?a??pt?? µp??e? ?pe?ta ?a µeta????se? t?
µ???µa se ??a? ??? folder, ?a d?aß?se? t? µ???µa,
?a t? d?a????e? ?t?. - ?e ???s? t?? IMAP ???eta? ef??t? st??? ???ste?
?a - ??µ???????? fa?????? (folders) ?a? ?a µeta??????
ta µ???µata ap? t?? ??a? f??e?? st?? ????? - ?a a?a??t??? ta µ???µata st??? ap?µa???sµ?????
fa?????? - ?a a?a?t??? ??µµ?t?a t?? µ???µ?t??
21Web-based E-mail
- ?a st?????? ?a? ?a ????? p??sßas? sta e-mails
t??? µ?s? ?p???d?p?te Web browser - ? User ?gent e??a? ??s?ast??? ??a? ?a??????? web
browser - ? ???st?? ep???????e? µe t? ap?µa???sµ??? mailbox
t??, µ?s? t?? HTTP - ???? ?? mail servers ep?????????? µeta?? t??? µe
t? SMTP - S???stata? ?d?a?te?a ??a ???ste? p??
µeta??????ta? p??? a??? e????a ????? p??sßas? st?
??ad??t??!
22DNS Domain Name System
- Domain Name System, e??a? s??d?asµ??
- ?ata?eµ?µ???? ??s?? ?ed?µ???? ???p???µ????
?e?a????? ??a µe???? - a???µ? ???µ?t?? e??p??et?t??
- ???t??????? ep?p?d?? efa?µ????
- ??a t?? ep????????a µeta?? d??t?a??? ??µß?? ?a?
t?? a???t?s?/a?t?st????s? ???µ?t?? ap? t?? ??
d?e????se?? - S?µe??s? ?? DNS ap?te?e? ßas??? ?e?t?????a t??
??ad??t???, ?a? ???s?µ?p??e? t? UDP ??a t? - µetaf??? (port 53).
- O? p??t?????? ???s?µ?p??e?ta? ?a? ap? ???a
p??t?????a (p.?. HTTP, FTP, ?t?.)
- ?????p?? ????? p???? a?a?????st??? ?a?t?t?ta,
d?aßat????, ???µatep???µ?, ?t? - Internet hosts, routers
- ?a?a?t??????ta? ap? t?? IP d?e????s? (32 bit)
- ???? ??a e?????te?? a????p??? ???s?, ????? ??p???
???µa, p.?. www.yahoo.com - Q ? a?t?st????s? µeta?? t?? IP d?e????se?? ?a?
t?? ???µ?t?????
23?p??es?e? t?? DNS
- G?at? de? e??a? centralized t? DNS?
- Ta ?p???e p??ß??µa ??a single point of failure
- Ta a??a??ta? ? ????? ????s?? (traffic volume) se
s???e???µ??? s?µe?? - ? ??s? ?ed?µ???? ?a ?ta? ap?µa???sµ??? ??a
p?????? host - ?e? ?a ?ta? e????a epe?t?s?µ?
- ?p??es?e? t?? DNS
- ?et?f?as?-??t?st????s? t?? Hostnames se IP
d?e????se?? - ??t?st????s? ?e?d???µ?? (aliases) ??p???? hosts
st?? ?a??????? t??? d?e????se?? - ?.?. ?ta? ??p???? host ??e? p???p???? ???µa
- ??t?st???a ?a? ??a ta ?e?d???µa ??p???? mail
servers - ?ata??µ? t?? f??t???
- Replicated Web servers ??a set ap? IP
d?e????se?? ??a ??a ?a? µ??? ??a ???µa
24?ata?eµ?µ??? ?e?a????? ??s? ?ed?µ????
- ??a? Client ep???µe? t?? IP t?? www.amazon.com.
??a 1? p??s????s? - ? Client ??t? ??a? root server ??a ?a ß?e? t??
com DNS server - ? Client ??t? t?? com DNS server ??a ?a ß?e? t??
DNS server t?? amazon.com - ? Client ??t? t?? DNS server t?? amazon.com ??a
?a p??e? t?? IP d?e????s? t?? www.amazon.com
25?at?????e? t?? DNS servers
- Local DNS Servers (??p????)
- Root DNS Servers (???µ?????s??)
- Top-Level-Domain (TLD) DNS Servers
- Authoritative DNS Servers (?p?s?µ??)
26Local DNS Servers (??p????)
- Local DNS Servers (??p????)
- ?e? a?????? a?st??? st?? ?e?a???a
- ???e ISP (eta???a, pa?ep?st?µ?? ?t?) ??e? ??a?
- S?????? ?? t?p???? DNS servers ?a????ta? ?a?
default name servers - ?e?t??????? sa? proxy, p??????ta? ta e??t?µata
(queries) st?? ?e?a???a
27Root DNS Servers
- St??? Root DNS Servers s??d???ta? ?? t?p???? DNS
servers p?? de? µp????? ?a a?a?t?s??? ??p???
???µa - ??????? st?? ?e?a???a ?a? ?ta? ??p??a a?t?st????a
de? e??a? ???st? - S??d???ta? se ??p???? Authoritative ? TLD DNS
server - ?a?a????? t?? a?t?st????a ???µat?? IP ?a? t??
ep?st??f??? st?? t?p??? DNS server
a Verisign, Dulles, VA c Cogent, Herndon, VA
(also Los Angeles) d U Maryland College Park,
MD g US DoD Vienna, VA h ARL Aberdeen, MD j
Verisign, ( 11 locations)
k RIPE London (also Amsterdam, Frankfurt)
i Autonomica, Stockholm (plus 3 other locations)
m WIDE Tokyo
e NASA Mt View, CA f Internet Software C. Palo
Alto, CA (and 17 other locations)
13 root name servers worldwide
b USC-ISI Marina del Rey, CA l ICANN Los
Angeles, CA
28TLD ?a? Authoritative Servers
- Top-level domain (TLD) servers ??????? st??
?e?a???a ?a? e??a? ?pe?????? ??a ta domains com,
org, net, edu ?t? a??? ?a? ??a ta e????? domains
p.?. gr, uk, fr, jp ?t?. - Authoritative DNS servers ??????? ep?s?? st??
?e?a???a (ap?te???ta? t? te?e?ta?? ep?ped? t??)
?a? ap?te???? t??? DNS servers t?? ???a??sµ??,
pa?????ta? t?? a?t?st????se?? t?? e??p??et?t??
t?? ???a??sµ?? (p.?. t?? web ?a? mail servers t??
???a??sµ??) - ??? s??t???s? t??? µp??e? ?a t?? ??e? a?a??ße?
e?te ? ?d??? ? ???a??sµ?? e?te ? ISP t??
???a??sµ??
29?a??de??µa (1)
root DNS server
2
- ?st? ?t? ??p???? host t?? ntua.gr ep???µe? t?? IP
d?e????s? t?? sirios.cs.ucla.edu - ?pa?a??pt???? epe??t?se?? (iterated queries)
- ? ???e server apa?t? µe t? ???µa t?? ep?µe???
server µe t?? ?p??? p??pe? ?a s??de?e? - I dont know this name, but ask this server
3
TLD DNS server
4
5
6
7
1
8
authoritative DNS server dns.cs.ucla.edu
requesting host ntua.gr
sirios.cs.ucla.edu
30?a??de??µa (2)
- ?st? ?t? ??p???? host t?? ntua.gr ep???µe? t?? IP
d?e????s? t?? sirios.cs.ucla.edu - ??ad??µ???? epe??t?se?? (recursive queries)
- ??????e? ap? µ???? t?? ? ???e DNS server t?
d?ad??as?a e?t?p?sµ?? t?? ???µat??, ??t??ta?
ape??e?a? t?? ep?µe?? DNS server t?? ?e?a???a?
??a t? ??t??µe?? ???µa
31DNS caching
- ?ta? se ??p???? DNS server ???st?p??e?ta? µ?a
a?t?st????s? ?? d?e????s? ???µa, ?
a?t?st????s? a?t? ap????e?eta? p??s????? (DNS
server caches the mapping) - ?? a?t?st????se?? a?t?? d?a???f??ta? ?pe?ta ap?
t?? p???d? s???e???µ???? ???????? d?ast?µat?? - S??????, st??? t?p????? DNS servers ???eta?
p??s????? ap????e?s? t?? TLD servers - ?ts? ap?fe??eta? ? s???? ep?s?e?? st??? root DNS
servers
32DNS e???af??
- DNS St?? ?ata?eµ?µ??? ??s? ?ed?µ????
ap????e???ta? ta Resource Records (RR)
- TypeA
- name e??a? t? hostname
- value e??a? ? IP d?e????s?
- TypeCNAME
- name e??a? t? ?e?d???µ? (alias) t?? p?a?µat????
(canonical) ???µat??, p.?. ?? alias - www.ibm.com a?t?st?????eta? st? p?a?µat???
???µa - servereast.backup2.ibm.com
- value e??a? t? p?a?µat??? ???µa
- TypeNS
- name e??a? t? domain (p.?. yahoo.com)
- value e??a? ? IP d?e????s? address t?? ep?s?µ??
(authoritative) DNS server t?? s???e???µ????
domain
- TypeMX
- value e??a? t? ???µa t?? mailserver p?? s??d?eta?
µe t? a?t?st???? ?e?d???µ? t?? name
33?a??de??µa ??sa???? DNS e???af??
- ?st? ?t? µ???? d?µ?????????e t? d??t?? Network
Utopia µe domain networkuptopia.com - ?pa?te?ta?
- ?a???? t?? ep?s?µ?? (authoritative) DNS server
?a? t?? a?t?st????? ?? d?e????s?? - ??? e???af?? (RRs) st?? TLD DNS server, ?st?
- (networkutopia.com, dns1.networkutopia.com, NS)
- (dns1.networkutopia.com, 222.222.222.1, A)
- St?? ep?s?µ? (authoritative) DNS server p??pe? ?a
e?sa????? ep?s?? t??????st?? d?? e???af?? - µ?a e???af? t?p?? A ??a t?? ?e?t???? server
www.networkuptopia.com - ?a? µ?a e???af? t?p?? MX ??a t?? a?t?st????
mailserver t?? d??t???