44
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and File Transfer 1

McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

Embed Size (px)

Citation preview

Page 1: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Network Protocols

Chapter 26 (Data Communication and Networking):

Remote Logging, Electronic Mail,and File Transfer

1

Page 2: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

26-1 REMOTE LOGGING26-1 REMOTE LOGGING

It would be impossible to write a specific client/server It would be impossible to write a specific client/server program for each demand. The better solution is a program for each demand. The better solution is a general-purpose client/server program that lets a user general-purpose client/server program that lets a user access any application program on a remote computer.access any application program on a remote computer.

TELNETTopics discussed in this section:Topics discussed in this section:

2

Page 3: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

TELNET is a general-purpose client/server application program.

Note

3

Page 4: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Telnet refers to TErminaL NETwrok (TELNET).

TELNET enables the establishment of a connection to a remote system in such a way that the local terminal appears to be a terminal at the remote system.

The server uses well known port 23 and the client uses ephemeral port.

TelnetTelnet

4

Page 5: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Figure 26.1 Local and remote log-in

5

Page 6: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

26-2 ELECTRONIC MAIL26-2 ELECTRONIC MAIL

One of the most popular Internet services is electronic mail (e-mail). The designers of the Internet probably never imagined the popularity of this application program. Its architecture consists of several components that we will discuss in this chapter.

ArchitectureUser AgentMessage Transfer Agent: SMTPMessage Access Agent: POP and IMAPWeb-Based Mail

Topics discussed in this section:Topics discussed in this section:

6

Page 7: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Email Terms User Agent (UA): is a program that allows you to receive

and send e-mail messages; it's usually just called an e-mail program.

Message Transfer Agent (MTA): the program that is responsible for receiving incoming e-mails and delivering the messages to individual users. (SMTP)

The MTA transfers messages between computers. Hidden from the average user, it is responsible for routing

messages to their proper destinations. MTAs receive messages from both MUAs and other MTAs

Message Access Agent (MAA): A client-server program that pulls the stored email messages. (POP and IMAP)

7

Page 8: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

E-Mail ArchitectureFirst Scenario

8

Page 9: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

When the sender and the receiver of an e-mail are on the same

system,we need only two user agents.

Note

9

Page 10: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Second Scenario

10

Page 11: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

When the sender and the receiver of an e-mail are on different

systems, weneed two UAs and a pair of MTAs (client and server).

Note

11

Page 12: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Third Scenario

12

Page 13: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

When the sender is connected to the mail server via LAN or a WAN,

weneed two UAs and two pairs of

MTAs (client and server).

Note

13

Page 14: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Fourth Scenario

14

Page 15: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

When both sender and receiver are connected to the mail server

via a LAN or a WAN, we need two

UAs, two pairs of MTAs and a pair of MAAs.

This is the most common situation today.

Note

15

Page 16: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

PUSH vs PULL in E-Mail

16

Page 17: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

It provides service to the user to make the process of sending and receiving a message easier

Service provided by a user agent User agent is a software package (program) that composes, reads, replies

to, and forward messages. It also handles mailboxes.

USER AGENT

17

Page 18: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

User Agent Types

Command-Driven Normally accepts a one-character command

from the keyboard to perform its task. For example, a user can type the character

r, at the command prompt, to reply to the sender of the message

GUI-Based Contain GUI components that allow the user

to interact with the software by using both the keyboard and the mouse.

Eudora, Microsoft’s Outlook, Gmail, Netscape, etc.

18

Page 19: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

A Mail Transfer Agent or MTA (also called a mail server, or a mail exchange server) is a computer program or software agent which transfers electronic mail messages from one computer to another

The MTA works behind the scenes, while the user usually interacts with another program, the Mail User Agent (MUA), which contacts a MTA for actual delivery of the mail.

Mail Transfer Agent

19

Page 20: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Mail Transfer Agent

20

Page 21: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Sending Mail

21

Page 22: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Email Address

Local part: Name of a special file, called the user mailbox, where all the mail received for a user is stored for retrieval by the user agent.

Domain Name: Organization usually selects one or more hosts to receive

and send email; they are called mail servers/exchangers. Domain name assigned to each mail exchanger either

comes from the DNS database or is a logical name (e.g., the name of the organization).

22

Page 23: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

MIME Electronic mail can send messages only in ASCII format.

In other words, it cannot be used for languages that are not supported by ASCII characters, such as French, German, Hebrew, Russian, Chinese, and Japanese.

Electronic mail cannot be used to send binary files or video or audio data.

Multipurpose Internet Mail Extensions (MIME) Supplementary protocol that allows non-ASCII data to be sent

through an e-mail (SMTP). MIME transforms non-ASCII data at the sender side to ASCII data

and delivers them to client SMTP to sent through the Internet. Reverse is done at the receiver side.

We think of MIME as a set of software functions that transforms non-ASCII data to ASCII data and vice versa.

23

Page 24: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

MIME

Network Virtual Terminal (NVT)

24

Page 25: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Message Transfer Agent: SMTP

25

Page 26: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

SMTP The actual mail transfer is done through Message Transfer

Agents (MTAs). To send mail, a system must have the client MTA. To receive mail, a system must have a server MTA. The formal protocol that defines the MTA client and server

in the Internet is called the Simple Mail Transfer Protocol (SMTP).

SMTP is used two times, between the sender and the sender's mail server and between the two mail servers.

As we will see shortly, another protocol is needed between the mail server and the receiver.

SMTP simply defines how commands and responses must be sent back and forth.

26

Page 27: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Simple Mail Transfer Protocol – SMTP

RANGE

27

Page 28: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Figure 26.9 Commands and responses

SMTP uses commands and responses to transfer messages between a MTA client and a MTA server.

Each command or reply is terminated by a two-character (carriage return and line feed).

Commands Commands are sent from the client to the server. Consists of a keyword followed by zero and more

arguments. SMTP defines 14 commands.

Responses Responses are sent from server to client. Response is a three-digit code that may be followed by

additional textual information.

28

Page 29: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

SMTP COMMANDS

29

Page 30: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Mail Transfer Phases

Process of transferring a mail message occurs in three phases

Connection establishment After a client has made a TCP connection to the well-known

port 25, the SMTP server starts the connection phase. Message transfer

After connection establishment, a single message between a sender and one or more recipients can be exchanged.

Connection termination After the message is transferred successfully, the client

terminates the connection.

30

Page 31: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Mail Delivery

Delivery of email from sender to receiver consists of three stages

1st stage Email goes from user agent to local server Mail does not go directly to remote server because the

remote server may not be available at all times. Mail is stored in the local server until it can be sent.

2nd stage Email is relayed by local server, which now acts as the

SMTP client, to the remote server, which is the SMTP server.

Email is delivered to remote server and not to the remote user agent; Email is stored in mailbox of the user for later retrieval..

Email server runs the SMTP server program. 3rd stage

Remote user agent uses a mail access protocol such as POP3 or IMAP4 to access the mailbox and obtain the mail.

31

Page 32: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Email Delivery

32

Page 33: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Mail Access Protocols

SMTP is a push protocol; it pushes the message from the sender to the receiver even if the receiver does not want it.

3rd stage needs a pull protocol; the operation must start with the recipient.

Mail must stay in the mail server mailbox until the recipient retrieves it.

33

Page 34: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Post Office Protocol

POP3 [Post Office Protocol] Client POP3 software is installed on the recipient

computer. Server POP3 software is installed on the mail

server. Client (user agent) opens a connection with the server on

TCP port 110. It then sends its user name and password to access the

mailbox. User can then list and receive mail messages, one by

one. POP3 modes

Delete mode: Mail is deleted from the mailbox after each retrieval.

Keep mode: Mail remains in the mailbox after retrieval. 34

Page 35: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Figure 26.19 POP3 and IMAP4

35

Page 36: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

POP3

36

Page 37: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

POP3 assumes that each time a client accesses the server, the whole mailbox will be cleared out (transferred).

POP3 does not allow user to organize mail on the server; user cannot have different folders on the server; POP3 does not allow the user to partially check the contents of the mail before downloading.

User can check the email header prior to downloading User can search the contents of email for a specific

string of characters prior to downloading User can partially download email. User can create, delete, or rename mailboxes on mail

server User can create a hierarchy of mailboxes in a folder for

email storage.

Internet Mail Access Protocol (IMAP)

37

Page 38: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

26-3 FILE TRANSFER PROTOCOL (FTP)26-3 FILE TRANSFER PROTOCOL (FTP)

Transferring files from one computer to another is one of the most common tasks expected from a networking or internetworking environment. As a matter of fact, the greatest volume of data exchange in the Internet today is due to file transfer.

File Transfer Protocol (FTP)Anonymous FTP

Topics discussed in this section:Topics discussed in this section:

38

Page 39: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP for copying a file from one host to another.

Although transferring files from one system to another seems simple and straightforward, some problems must be dealt with first.

For example, two systems may use different file name conventions. Two systems may have different ways to represent text and data.

It establishes two connections between the hosts. One connection is used for data transfer, the other for control information (commands and responses).

FTP can transfer one of the following file types across the data connection: an ASCII file, EBCDIC file, or image file.

File Transfer Protocol

39

Page 40: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

File Type: The ASCII file is the default format for transferring

text files. Each character is encoded using 7-bit ASCII. The sender transforms the file from its own representation into ASCII characters, and the receiver transforms the ASCII characters to its own representation.

If one or both ends of the connection use EBCDIC encoding (the file format used by IBM), the file can be transferred using EBCDIC encoding.

The image file is the default format for transferring binary files. The file is sent as continuous streams of bits without any interpretation or encoding.

File Transfer Protocol

40

Page 41: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Data Structure: FTP can transfer a file across the data connection

by using one of the following interpretations about the structure of the data: file structure, record structure, and page structure.

In the file structure format, the file is a continuous stream of bytes.

In the record structure, the file is divided into records. This can be used only with text files.

In the page structure, the file is divided into pages, with each page having a page number and a page header.

File Transfer Protocol

41

Page 42: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

FTP uses the services of TCP. It needs two TCP connections.

The well-known port 21 is used for the control connection and the

well-known port 20 for the data connection.

Note

42

Page 43: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Figure 26.21 FTP

43

Page 44: McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Network Protocols Chapter 26 (Data Communication and Networking): Remote Logging, Electronic Mail, and

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

To use FTP, a user needs an account to access the remote server.

Some sites have a set of files available for public access. To access these files, a user does not need to have an account or password.

Instead, the user can use anonymous as the user name and guest as the password.

User access to the system is very limited.

Anonymous FTP

44