DNS and electronic
Section 9.1.3 in the textbook
DNS purposes
???
Originally purpose was to translatehostnames into IP addresses
???
www.csd.uwo.ca is easier to rememberthan 129.100.23.247
???
Lets us do load balancing as wellDNS history
???
Most operating systems have a hosts filewhich is kept up-to-date locally and relates hostnames to IP addresses
???
Up until 1983, there was one, global hostsfile which was mailed out once every few days
???
Surprise! There are scalability issues hereStarEyes:Desktop mike$ cat /etc/hosts ##
# Host Database #
# localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ##
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost
DNS architecture
???
1983: DNS was created, which had a novelproperty in naming systems: ???domains???
???
Idea: one server would be in control overthe naming inside a particular domain. When finding the IP address of a host outside your domain, you need only know the IP address of the server for that domain
CS357b 62
Root DNS Servers
com DNS servers org DNS servers edu DNS servers
poly.edu DNS servers
umass.edu DNS servers yahoo.com
DNS servers amazon.comDNS servers
pbs.org DNS servers
Distributed, Hierarchical Database
Client wants IP for www.amazon.com; 1s tapproximation: ! Client queries a root serve r t o f i nd 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 www.amazon.com
CS357b 63
DNS: Root name servers
! 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
13 root name servers worldwide
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 17 other locations)
i Autonomica, Stockholm (plus 3 other locations) k RIPE London (also Amsterdam, Frankfurt)
m WIDE Tokyo 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)
CS357b 64
TLD and Authoritative Servers
!Top-level domain (TLD) servers: responsiblefor com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp.
"Network solutions maintains servers for com TLD
"Educause for edu T LD
!Authoritative DNS servers: organization???s DNS servers, providing authoritative hostname to IP mappings for organization???s servers (e.g., Web and mail).
"Can be maintained by organization or service provider
CS357b 65
Local Name Server
!Does not strictly belong to hierarchy !Each ISP (residential ISP, company,
university) has one.
"Also called ???default name server???
!When a host makes a DNS query, query is
sent to its local DNS server
"Acts as a proxy, forwards query into hierarchy.
CS357b 66 requesting host c i s . p o l y . e d u g a i a . c s . u m a s s . e d u root DNS server local DNS server d n s . p o l y . e d u 1 2 3 4 5 6 authoritative DN S server d n s . c s . u m a s s . e d u 7 8 TLD DNS server
Example
! Host at cis.poly.edu wants
IP address for gaia.cs.umass.edu.
! First, check locally.
! Then, check root. Root
notes .edu s u f f i x and suggests TLD servers for .edu.
! Check TLD server. This
provides the authoritative server.
! Check authoritative
server, and get the IP address!
! This uses both iterative
and recursive queries.
(Usually the way its done.) CS357b 67
requesting host c i s . p o l y . e d u g a i a . c s . u m a s s . e d u root DNS server local DNS server d n s . p o l y . e d u 1 2 4 5 6 authoritative DN S server d n s . c s . u m a s s . e d u 7 8 TLD DNS server 3
Recursive queries
recursive query:! puts burden of name
resolution on contacted name server ! heavy load? iterated query: ! contacted server
replies with name of server to contact ! ???I don???t know this
name, but ask this server???
CS357b 68
DNS: caching and updating records
! once (any) name server learns mapping, it caches mapping
"cache entries timeout (disappear) after some time
"TLD servers typically cached in local name servers
??? T hus root name servers not often visited
! update/notify mechanisms under design by IETF "RFC 2136
"http://www.ietf.org/html.charters/dnsind-charter.html
CS357b 69
DNS records
DNS: distributed database storing resource records (RR)
!Type=NS
"n a m eis domain (e.g. foo.com)
"v a l u e is IP address of authoritative name server for this domain
RR format: ( n a m e , v a l u e , t y p e , t t l )
!Type=A
"n a m eis hostname
"v a l u e is IP address
! Type=CNAME
"n a m eis alias name for some ???canonical??? (the real) name w w w . i b m . c o m is really s e r v e r e a s t . b a c k u p 2 . i b m . c o m
"v a l u eis canonical name
! Type=MX
"v a l u e is name of mail server associated with n a m e
CS357b 70
DNS protocol, messages
DNS protocol :queryand replymessages, both with same message format
message header ! identification: 16 b i t #
for query, reply to query uses same # ! flags: "query or reply "recursion desired "recursion available "reply is authoritative CS357b 71
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
CS357b 72
Inserting records into DNS
! Example: just created startup ???Network Utopia???
! Register name networkuptopia.com at a registrar (e.g., Network Solutions)
"Need to provide registrar with names and IP addresses of
your authoritative name server (primary and secondary)
"Registrar inserts two RRs into the com TLD server:
( n e t w o r k u t o p i a . c o m , d n s 1 . n e t w o r k u t o p i a . c o m , N S ) ( d n s 1 . n e t w o r k u t o p i a . c o m , 2 1 2 . 2 1 2 . 2 1 2 . 1 , A ) ! Put in authoritative server Type A record for
www.networkuptopia.com and Type MX record for mail.networkutopia.com.
! How do people get the IP address of your Web site?
DNS and load balancing
???
We???re in charge of our authoritative server(Masters of our Domain)
???
Just return a different CNAME recordeach time we???re queried
???
If we???re really fancy we can keep track ofwhich server is the least loaded and return a CNAME for that one
DNS and load balancing
???
How does this fit in with caching????
Actually we can return multiple records fora single hostname
???
All of them get cached???
Leave it up to the browser/whatever topick one at random
Electronic mail
???
One of the oldest (and suckiest) systemscurrently in use
???
Built around SMTP (Simple Mail TransferProtocol)
???
Transfers mail from one mail server toanother mail server
???
Computers that aren???t mail servers are aOld view
SMTP uwo.ca mit.eduOld view
SMTP uwo.ca mit.edu maryOld view
SMTP uwo.ca mit.edu mary From: [email protected] To: [email protected]Old view
SMTP uwo.ca mit.edu mary From: [email protected] To: [email protected]Old view
SMTP uwo.ca mit.edu mary From: [email protected] To: [email protected]Old view
SMTP uwo.ca mit.edu mary bill From: [email protected] To: [email protected]Old view
SMTP uwo.ca mit.edu mary bill From: [email protected] To: [email protected]Old view
SMTP uwo.ca mit.edu mary bill IMAP SMTP POP3 SMTPNew view
SMTPuwo.ca Webmail mit.edu IMAP
SMTP POP3
SMTP
New view
SMTP
uwo.ca Webmail mit.edu
F: [email protected] T: [email protected] IMAP SMTP POP3 SMTP
New view
SMTPuwo.ca Webmail mit.edu
F: [email protected] T: [email protected] IMAP SMTP POP3 SMTP
New view
SMTPuwo.ca Webmail mit.edu
IMAP SMTP POP3 SMTP
New view
SMTPuwo.ca Webmail mit.edu
F: [email protected] T: [email protected]
Email components
???
Mail transfer agents???
Speak SMTP and only SMTP???
E.g., sendmail, qmail, exim, Postfix, Microsoft Exchange???
Mail user agents???
Speak SMTP plus IMAP or POP3???
E.g., Mail.app, Thunderbird, mutt, Microsoft Outlook,webmail (e.g., SquirrelMail, Sun Java System Communication Express)
Simple Mail Transfer
Protocol
???
Runs on TCP/25???
Every MTA is both a server and client???
Three stages of SMTP connection:???
Handshaking/ authentication???
Transfer of messages???
Closure???
All communication is human readable???
Everything must be 7-bit ASCIIStatus codes
???
For historical reasons, we have two types ofstatus codes
???
Leading status codes: single number???
E.g., 220 = Service ready, 221 =Connection closing, 354 = Start mail input
New status codes
???
class . subject . detail???
class 2 = Success, class 4 = temporary failure, class 5 = permanent failure???
subject 1 = addressing status, subject 2 = mailbox status, etc.???
E.g., 2.1.5 = destination address valid???
E.g., 5.1.3 = bad syntax for destination address???
E.g., 4.2.2 = destination mailbox full???
Server gives both the old status codes and new status codes???
Why????
250 2.1.5 [email protected]OK.
???
SMTP is a push client-server protocol???
We???re limited to 7-bit ASCII???
How do email attachments work????
SMTP is unencrypted and unverified???
Spam is a big problemMail message format
???
There is some redundancy between SMTP(RFC 821) and mail format (RFC 822)
???
You have to list fill in the ???to??? and ???from???twice
???
Sometimes the SMTP server will modify(add headers to) a mail
CS357b 52
Mail message format
SMTP: protocol forexchanging email msgs RFC 822: standard for text
message format:
! header lines, e.g., "To: "From: "Subject: d i f f e r e n t from SMTP commands! ! body
"the ???message???, ASCI I characters only
header
body
blank line
Received: from harpo.mail.uwo.pri (brutus.mail.uwo.pri [172.29.32.39]) by harpo.mail.uwo.pri
(Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTP id <[email protected]>; Wed, 01 Apr 2009 11:28:39 -0400 (EDT)
Received: from swamp.mail.uwo.pri ([172.29.36.41])
by harpo.mail.uwo.pri (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPS id <[email protected]>; Wed, 01 Apr 2009 11:28:39 -0400 (EDT)
Received: from mail.service.csd.uwo.ca (name.service.csd.uwo.ca [129.100.23.252])
by swamp.mail.uwo.pri (8.13.1/8.13.1) with ESMTP id n31FSbA9004932; Wed, 01 Apr 2009 11:28:37 -0400
Date: Wed, 01 Apr 2009 11:28:09 -0400 From: Cheryl McGrath <[email protected]> Subject: Return of exam materials X-Sender: [email protected] To: [email protected]
Message-id: <[email protected]> MIME-version: 1.0
X-Mailer: QUALCOMM Windows Eudora Version 6.1.2.0 Content-type: text/plain; charset=us-ascii; format=flowed X-Client-Addr: 129.100.23.8
X-Client-Name: dazzle.admin.csd.uwo.ca X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-Spam-Score: 0.00 () [Tag at 5.00] SPF(pass,0) X-CanIt-Geo: ip=129.100.23.252; country=CA; region=ON; city=London; postalcode=n6a5b7; latitude=42.9833; longitude=-81.2500; http://maps.google.com/maps?q=42.9833,-81.2500&z=6 X-CanItPRO-Stream: tag_and_pass (inherits from default) X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 172.29.36.41 Hi there
Could everyone bring back any exam materials such as pencils, scantrons etc. which are left from the exams. This way I can see what is needed for the new exam period.
thanks Cheryl Cheryl McGrath Undergraduate Secretary Dept of Computer Science University of Western Ontario 519-661-3566, [email protected]
CS357b 53
Message format: multimedia extensions
! M I M E : multimedia mail extension, RFC 2045, 2056
! additional lines in msg header declare MIME content type F r o m : a l i c e @ c r e p e s . f r T o : b o b @ h a m b u r g e r . e d u S u b j e c t : P i c t u r e o f y u m m y c r e p e . M I M E - V e r s i o n : 1 . 0 C o n t e n t - T r a n s f e r - E n c o d i n g : b a s e 6 4 C o n t e n t - T y p e : i m a g e / j p e g b a s e 6 4 e n c o d e d d a t a . . . . . . . . . b a s e 6 4 e n c o d e d d a t a multimedia data type, subtype, parameter declaration method used to encode data MIME version encoded dat a CS357b 54 MIME types C o n t e n t - T y p e : t y p e / s u b t y p e ; p a r a m e t e r s T e x t ! example subtypes: p l a i n , h t m l Image ! example subtypes: j p e g , g i f Audio ! example subtypes: b a s i c (8-bit mu-law encoded), 3 2 k a d p c m (32 kbps coding) Video !example subtypes: m p e g , q u i c k t i m e Application
!other data that must be processed by reader before ???viewable??? !example subtypes: m s w o r d , o c t e t -s t r e a m
CS357b 55 Multipart Type F r o m : a l i c e @ c r e p e s . f r T o : b o b @ h a m b u r g e r . e d u S u b j e c t : P i c t u r e o f y u m m y c r e p e . M I M E - V e r s i o n : 1 . 0 C o n t e n t - T y p e : m u l t i p a r t / m i x e d ; b o u n d a r y = S t a r t O f N e x t P a r t - - S t a r t O f N e x t P a r t D e a r B o b , P l e a s e f i n d a p i c t u r e o f a c r e p e . - - S t a r t O f N e x t P a r t C o n t e n t - T r a n s f e r - E n c o d i n g : b a s e 6 4 C o n t e n t - T y p e : i m a g e / j p e g b a s e 6 4 e n c o d e d d a t a . . . . . . . . . b a s e 6 4 e n c o d e d d a t a - - S t a r t O f N e x t P a r t D o y o u w a n t t h e r e c i p l e ?
Base64
???
Used not just in email (MIME)???
Used any time we want to transfer an???octet stream??? (arbitrary bytes) over a protocol which is not 8-bit clean
???
Map bit-wise from an 8-bit space onto a6-bit space
???
Why 6 bits? Why not 7?A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 t
A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 t A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 t K A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 t K A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 t K A A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 t K A A 000000 d 011101 B 000001 ... ... C 000010 z 110011 ... ... 0 110100 Z 011001 ... ... a 011010 9 111101 b 011011 + 111110 c 011100 / 111111 10110100 10010000 00011101 t K Ad
CS357b 56
Mail access protocols
! 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: Hotmail , Yahoo! Mail, etc.
user agent sender???s mail server user agent SMTP SMTP access protocol receiver???s mail server CS357b 57
POP3 protocol
authorization phase ! client commands: "u s e r : declare username "p a s s : password ! server responses "+OK "- E R Rtransaction phase, client: ! l i s t : list message numbers ! r e t r : retrieve message by number ! d e l e : delete ! q u i t C : l i s t S : 1 4 9 8 S : 2 9 1 2 S : . C : r e t r 1 S : < m e s s a g e 1 c o n t e n t s > S : . C : d e l e 1 C : r e t r 2 S : < m e s s a g e 2 c o n t e n t s > S : . C : d e l e 2 C : q u i t S : + O K P O P 3 s e r v e r s i g n i n g o f f S : + O K P O P 3 s e r v e r r e a d y C : u s e r b o b S : + O K C : p a s s h u n g r y S : + O K u s e r s u c c e s s f u l l y l o g g e d o n CS357b 58
POP3 (more) and IMAP
More about POP3!Previous example uses
???download and delete??? mode.
!Bob cannot rread
e-mail if he changes client !???Download-and-keep???: copies of messages on different clients !POP3 is stateless across sessions I M A P
! Keep all messages in one place: the server
! Allows user to organize messages in folders
! IMAP keeps user state
across sessions:
"names of folders and mappings between message IDs and folder name
IMAP
???
All mail is stored on the mail server???
The MUA must request to explicitly deleteemails
???
IMAP extensions allow you to save addressbooks, etc., server side
???
IMAP never really caught on due to timing???
Kind of like 8-tracksWhat webmail can???t do
???
Webmail typically requires that emails bestored unencrypted server-side
???
I???ve seen a Firefox plug-in to address this,though it???s kind of dodgy
???
Not a huge deal since no one encrypts