Sie sind auf Seite 1von 41

CCM 4300 Lecture 8

Computer Networks, Wireless and


Mobile Communications
Dr Shahedur Rahman
School of Science and Technology
1

Recap Last Lesson


 described the basics concepts of Virtual Circuit
and Datagram
 understood the IP protocol
 described the basics of the TCP and UDP
protocol

Session Content
||| Introduction to Electronic-mail system
||| Simple Mail Transport Protocol (SMTP)
- overview
- message formats and representation
||| Mail Access protocols
- overview of POP3 and IMAP
||| Domain Name server

Lesson objectives
 At the completion of this lesson you should be able to
- understand the Internet-mail system
- understand what DNS is
- describe different method of finding
addresses from the Internet directory server

Email: an introduction
||| Electronic mail (or e-mail) was one of the earliest applications on the
Internet and is still among the most heavily used today
||| From a general perspective, e-mail refers to the concept of creating,
sending, and storing messages or documents electronically.
||| Why is e-mail more popular then your regular snail mail?

1. Fast delivery compared to regular post and can include HTML


formatted text, images, sound and even video
2. Cost e-mail cost virtually nothing compared to regular post or
telephone call charge
3. E-mail can substitute for the telephone avoiding the process
of repeatedly exchanging voice mail messages
4. Effective for people working in different time zones.

Email Introduction - cont


||| Nearly every computer system has a program that servers as an
interface for e-mail service called user agents (sometimes referred to as
e-mail reader)
- compose, read, save, forward, etc
||| In addition, a local systems e-mail service also supports background
process
- how incoming and outgoing e-mail messages are stored
- how users are presented with incoming e-mail
- how often delivery of out going messages is attempted
||| The only activity that is not performed by the local user agent is
message delivery across a network, which is defined by a mail
application protocol
||| Three commonly used standard for message delivery are SMTP (Simple
Mail Transfer Protocol), X.400 and Common Messaging Calls (CMC)
6

Internetmail system
||| Three major components: user
agent, mail servers, and the
SMTP

user
agent
mail
server

 Mail Servers
||| mailbox contains incoming
messages (yet to be read) for user

SMTP
SMTP

||| message queue of outgoing (to be


sent) mail messages
||| smtp protocol between mail
servers to send email messages
(i.e. two sides a client side and
server side)
- client: sending mail server
- server: receiving mail
server

user
agent

SMTP
mail
server

mail
server

user
agent

user
agent

user
agent
user
agent

Outgoing message queue


User mailbox

Electronic Mail - user agent




Remember: Three major


components:




user agents
mail servers
simple mail transfer protocol:
SMTP

user
agent

also called mail reader

composing, editing, reading mail


messages;
e.g., Eudora (e-mail client used on MS
Windows and Apple Mac operating
systems), Outlook, elm (e-mail client
used on Unix), Netscape Messenger
outgoing, incoming messages stored
on server

user mailbox

mail
server

user
agent

SMTP

User Agent (UA)




outgoing
message queue

SMTP
SMTP
mail
server

mail
server

user
agent

user
agent

user
agent
user
agent
8

Electronic Mail: mail servers




Mail Servers


mailbox contains incoming


messages 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

user
agent
mail
server

user
agent

SMTP
SMTP
SMTP
mail
server

mail
server

user
agent

user
agent

user
agent
user
agent
9

Electronic Mail: SMTP [RFC 2821]


||| Uses TCP to reliably transfer e-mail message from client to server, port
|||
|||

|||

|||

25
Direct transfer: sending server to receiving server
(i.e. does not normally use intermediate mail servers)
Three phases of transfer
SMTP
- handshaking (greeting)
- transfer of messages
Closure
mail
mail
server
server
Internet
Command/response interaction
- commands: ASCII text
- response: status code (HTTP response)
and phrase (a three-digit number)
Messages must be in TEXT, TEXT DOS or 7-bit ASCII
(American Standard Code for Information Interchange) - meaning it uses
patterns of seven binary digits (a range of 0 to 127 decimal) to represent
each character - 1 extra bit for parity digit or check bit
10

Basic Operation of SMTP


SMTP
mail
Alices mail
server
server

mail

Internet

Barts mail
server
server

 Alice

invokes her user agent for e-mail, provides e-mail address (e.g. bart@
mdx.ac.uk) compose and then sends the message via user agent
 Alices


user agent sends message to her email server - placed in a message queue

The client side of SMTP opens a TCP connection to an SMTP server

 After

some initial SMTP handshaking, the SMTP client sends Alices message into
the TCP connection

 At

Barts mail server host, the server side of SMTP receives the message - places
the message in Barts mailbox


Bart invokes his user agent to read the message at his convenience

11

Sample SMTP Interaction


||| Example transcript between client (C) {Jay@laa.ly} and server (S)
{tim@mdx.ac.uk} as soon as the TCP connection is established
S: 220 tim.mdx.ac.uk
C: HELO laa.ly
S: 250 Hello laa.ly, pleased to meet you
C: MAIL FROM: <jay@laa.ly>
S: 250 jay@laa.ly... Sender ok
C: RCPT TO: < tim @mdx.ac.uk>
S: 250 tim@mdx.ac.uk ... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 tim@mdx.ac.uk closing connection

||| Commands issued by client:


HELO identifies SMTP sender to SMTP
receiver
MAIL FROM begins mail exchange by
identifying originator
RCPT TO identifies mail recipient
DATA signifies message follows
QUIT Ends current session

||| Reply codes issued by server:


220- Service ready
221- Closing transmission
250 Requested action ok
354 end with <crlf>.<crlf>

12

SMTP: Recap


SMTP uses persistent


connections i.e., using the

Comparison with HTTP:

same TCP connection to send


and receive multiple HTTP
requests/responses, as opposed
to opening a new connection for
every single request/response
pair

SMTP requires message


(header & body) to be in 7bit ASCII
SMTP server uses
CRLF.CRLF(Carriage Return
and Line Feed) to determine

HTTP: pull (client) while SMTP:


push (server)
 both have ASCII
command/response
interaction, status codes
HTTP: each object encapsulated
in its own response msg
SMTP: multiple objects sent in
multipart msg

end of message because the


dialogue is character based
13

Mail message format


SMTP: protocol for exchanging
email msgs
RFC 822: standard for text
message format:
header lines, e.g.,
 To:
 From:
 Subject:

header

blank
line

body

different from SMTP


commands!
body
the message, ASCII
characters only
 RFC Request for Comments


14

Message format: multimedia extensions





MIME: Multimedia Mail Extension, RFC 2045, 2056


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@clubs.ly
To: bob@mdx.ac.uk
Subject: Picture of yummy crepe.
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
base64 encoded data .....
.........................
......base64 encoded data

MIME: Multipurpose Internet Mail Extensions

15

MIME(Multipurpose Internet Mail


Extensions)Types
||| The Content-Type field is used to specify the nature of the data in the
body of a MIME entity, by giving the media type and subtype names.
||| Currently there are 7 top-level types defined:
||| Application
||| Text
- textual information

||| Image
- image data

||| Audio
- audio data

||| Video
- video data

- any application-specific data


that doesn't fall into the previous
categories

||| Multipart
- an encoding that allows
multiple items, potentially of
different types, to be
concatenated together (this is
how mail messages with
attachments are sent)

||| Message
- an e-mail message, mostly
used with the RFC822 subtype

16

MIME(Multipurpose Internet Mail


Extensions)Types - continued
||| For each of the 7 types, there is a list of associated subtypes, such as text/html,
text/xml and text/plain that are dependent on the top type. Five of these types is as
follows:

||| Text
- example subtypes: plain,
html

||| Image
- example subtypes: jpeg,
gif

||| Audio
- requires an audio output
device to render the contents
- example subtypes: basic (8bit mu-law encoded), 32kadpcm
(32 kbps coding)

||| Video
- example subtypes: mpeg,
quicktime

||| Application
- other data that must be
processed by reader before
viewable
- example subtypes:
msword. mspowerpoint, etc

17

Multipart Type
||| Just as a web page, an e-mail message can contain many objects too
||| Internet e-mail, places all the objects (or parts) in the same message
||| When multimedia message contains more than one object (e.g.
images, ASCII text and some images), the message typically has
Content-type: multipart/mixed
||| This content type header line indicates to the receiving agent that the
message contains multiple objects
||| Receiving agent needs a means to determine
- where each object begins
- how each non ASCII was transfer-encoded
- the content type of each message
||| This is done by placing boundary characters between each object and
preceding each object in the message with Content-type and ContentTransfer-Encoding: header lines
18

Multipart Type - cont


||| Example showing some ASCII text, followed by JPEG image, and more ASCII text
From: jay@laa.ly
To: tim@mdx.ac.uk
Subject: Picture of yummy crepe.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=StartofNextPart
-- StartofNextPart
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain
Dear Bob,
Please find a picture of a crepe.
-- StartofNextPart
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
base64 encoded data .....
......base64 encoded data
-- StartofNextPart
Let me know if you would like the recipe .

19

Mail access protocols


SMTP

SMTP

user
agent
senders mail
server

access
protocol

user
agent

receivers mail
server

SMTP: delivery/storage to receivers server


Mail access protocol: retrieval from server


POP: Post Office Protocol [RFC 1939]


 authorisation (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.

20

POP3 protocol
authorisation phase
client commands:


user: declare
username
pass: password

server responses

+OK
 -ERR
transaction phase, client:


list: list message numbers


retr: retrieve message by
number
dele: delete
quit

S:
C:
S:
C:
S:
C:
S:
S:
S:
C:
S:
S:
C:
C:
S:
S:
C:
C:
S:

+OK POP3 server ready


user bob
+OK
pass hungry
+OK user successfully logged
list
1 498
2 912
.
retr 1
<message 1 contents>
.
dele 1
retr 2
<message 1 contents>
.
dele 2
quit
+OK POP3 server signing off
21

on

POP3 (more) and IMAP


More about POP3
Previous example uses
download and delete
mode.
Bob cannot re-read email if he changes client
Download-and-keep:
copies of messages on
different clients
POP3 is stateless across
sessions

IMAP
Keep all messages in one
place: the server
Allows user to organise
messages in folders
IMAP keeps user state
across sessions:
 names of folders and
mappings between
message IDs and folder
name

22

Secure e-mail
Alice wants to send secret e-mail message, m, to Bob.
KS
m

KS( )

+
KS

+( )
KB

K+B

KS(m )

KS(m )

+(K )
KB
S

Internet

KB+(KS )

KS( )

KS
K- ( )
B

K-B

generates random symmetric private key, KS.


encrypts message with KS
also encrypts KS with Bobs public key.
sends both KS(m) and eB(KS) to Bob.
23

Secure e-mail (continued)


Alice wants to provide sender authentication message

integrity.
+

KA

H(.)

KA( )

KA(H(m))

KA(H(m))

KA

Internet

KA( )

compare

H(m )

H( )

H(m )

Alice digitally signs message.

sends both message (in the clear) and digital signature.


24

Secure e-mail (continued)


Alice wants to provide secrecy, sender authentication,

message integrity.
-

KA

H( )

KA( )

KA(H(m))

KS

KS( )

m
KS

K B( )

Internet

KB(KS )

KB

Note: Alice uses both her private key, Bobs public key.
25

DNS: Domain Name System


People: many identifiers:
 SSN, name, passport #
Internet hosts, routers:
 IP address (32 bit) used for addressing
datagrams
 name, e.g.,
ww.yahoo.com - used
by humans
Q: map between IP
addresses and name ?


SSN: Secure Server Network

Domain Name System:




distributed database
implemented in hierarchy of
many name servers

application-layer protocol
host, routers, name servers
to communicate to resolve
names (address/name
translation)
 note: core Internet
function, implemented
as application-layer
protocol
 complexity at networks
edge
26

DNS
DNS services
Hostname to IP address
translation
Host aliasing
 Canonical and alias
names
Mail server aliasing
Load distribution
 Replicated Web
servers: set of IP
addresses for one
canonical name

Why not centralise DNS?


single point of failure
traffic volume
distant centralised database
maintenance


doesnt scale!

27

Distributed, Hierarchical Database


Root DNS Servers

com DNS servers


yahoo.com
amazon.com
DNS servers DNS servers

org DNS servers


pbs.org
DNS servers

edu DNS servers


ucl.ac.uk
ucla.edu
DNS serversDNS
serversDNS servers

Client wants IP for www.amazon.com; 1st approx:


 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 www.amazon.com
28

DNS: Root name servers


contacted by local name server that can not resolve name root name
server:
There are currently 13 root name servers specified, with names in the form
letter.root-servers.net






contacts authoritative name server if name mapping not known


gets mapping
returns mapping to local name server
a Verisign, Dulles, VA
c Cogent, Herndon, VA (also Los Angeles)
k RIPE London (also Amsterdam,
d U Maryland College Park, MD
Frankfurt)
g US DoD Vienna, VA
i Autonomica, Stockholm (plus 3
h ARL Aberdeen, MD
other locations)
j Verisign, ( 11 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

29

TLD and Authoritative Servers




Top-level domain (TLD) servers: responsible for


com, org, net, edu, gov, int, etc, and all top-level
country domains uk, fr, ca, jp, ly.
 Network solutions maintains servers for com TLD
 Educause for edu TLD
Authoritative DNS servers: organisations DNS
servers, providing authoritative hostname to IP
mappings for organisations servers (e.g., Web and
mail).
 Can be maintained by organisation or service
provider
30

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.

31

Types of queries


root DNS server

recursive query:

puts burden of name


resolution on contacted
name server
heavy load?


iterative query:

contacted server replies


with name of server to
contact
I dont know this name,
but ask this server

3
7

6
TLD DNS server

local DNS server


dns.cs.mdx.ac.uk

8
authoritative DNS server
dns.cs.ucl.ac.uk

requesting host
cs.mdx.ac.uk
gaia.cs.umass.edu
32

Example

root DNS server

Host at cs.mdx.ac.uk
wants IP address for
bob.cs.ucl.ac.uk


2
3

TLD DNS server


4
5

local DNS server


dns.mdx.ac.uk
1

authoritative DNS server


dns.cs.ucl.ac.uk

requesting host
cs.mdx.ac.uk
bob.cs.ucl.ac.uk
33

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

Thus root name servers not often visited


update/notify mechanisms under design by IETF
 RFC 2136


http://www.ietf.org/html.charters/dnsind-charter.html

34

DNS records
DNS: distributed db storing Resource Records (RR)
RR format: (name,

value, type, ttl)

Type=A
Type=CNAME
 name is hostname
 name is alias name for some
cannonical (the real) name
 value is IP address
Type=NS
www.ibm.com is really
servereast.backup2.ibm.com
 name is domain (e.g.
foo.com)
 value is cannonical name
Type=MX
 value is IP address of
authoritative name server
 value is name of
for this domain
mailserver associated
with name
35

DNS protocol, messages


DNS protocol: query and reply messages, both with
same message format
msg header
identification: 16 bit # for query,
reply to query uses same #
flags:





query or reply
recursion desired
recursion available
reply is authoritative

36

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

37

Inserting records into DNS


Example: just created startup Network Consultancy firm
Register name networkconsultancyfirm.co.uk 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 co.uk TLD server:

(networconsultancyfirm.co.uk,
dns1.networconsultancyfirm.co.uk, NS)
(dns1. networconsultancyfirm.co.uk, 212.212.212.1, A)
Put in authoritative server Type A record for www.
networkconsultancyfirm.co.uk.com and Type MX record for
networkconsultancyfirm.co.uk
How do people get the IP address of your Web site?

38

How do people get the IP address of your


Web site?
 Finding an IP can be as easy as looking at the full headers of
email that they've sent you, or monitoring network connections for
certain types of instant messaging and chat applications. Web sites
routinely get IP address information for all visitors. The very nature
of how the internet works dictates that when two computers talk to
each other, they know each other's IP addresses.
 But once an IP address is received, what can you tell about it?
 Some IP's are easy - they're static, and have a DNS name
associated with them. For example, in a Windows XP
Command Shell, enter the following command:
ping -a 17.254.3.183
 The -a switch tells ping to do a reverse DNS lookup,
and print the first domain name it finds associated with the
IP address you've specified.
39

How do people get the IP address of your


Web site? - continued
 If the ping doesn't return a domain name, we then go to ARIN (American
Registry for Internet Numbers) and use their IP whois tool:
 If an IP address, e.g., 206.124.145.17 is entered, we'll find that it's
part of a block of addresses assigned to an ISP. To determine who
actually uses that IP address the ISP is contacted, otherwise, the
physical location of a machine at a specific IP address is not easy to
determine.
 An IP address may, or may not, identify a specific computer. In many
cases, such as large corporations, it identifies a gateway that acts as a
router or proxy for any number of computers:
 Behind the gateway, the computers can all see each other, but from
the Internet the individual machines are indistinguishable from each
other ... they all look like they come from the same IP address.
 Same is true when using a router at home. You might have any
number of computers behind it, but from the internet, it appears as if
you have only one IP address. Your individual computers are not
directly accessible by default.
40

Summary
||| Introduction to Electronic-mail system
||| Simple Mail Transport Protocol (SMTP)
- overview
- message formats and representation
||| Mail Access protocols
- overview of POP3 and IMAP
||| Domain Name server

41

Das könnte Ihnen auch gefallen