Você está na página 1de 7

OPS535 Advanced Network Administration

SMTP Lab
Reference: RFC821 Simple Mail Transfer Protocol
SIMPLE MAIL TRANSFER PROTOCOL 1. INTRODUCTION The objective of Simple Mail Transfer Protocol (SMTP) is to transfer mail reliably and efficiently. SMTP is independent of the particular transmission subsystem and requires only a reliable ordered data stream channel. Appendices A, B, C, and D describe the use of SMTP with various transport services. A Glossary provides the definitions of terms as used in this document. An important feature of SMTP is its capability to relay mail across transport service environments. A transport service provides an interprocess communication environment (IPCE). An IPCE may cover one network, several networks, or a subset of a network. It is important to realize that transport systems (or IPCEs) are not one-to-one with networks. A process can communicate directly with another process through any mutually known IPCE. Mail is an application or use of interprocess communication. Mail can be communicated between processes in different IPCEs by relaying through a process connected to two (or more) IPCEs. More specifically, mail can be relayed between hosts on different transport systems by a host on both transport systems. - RFC821

Objective: Explore the command/response transaction of the Simple Mail Transfer Protocol This lab consists of THREE parts. We will first check the version of the SMTP server and make sure that the SMTP port is on. Secondly, we will establish an interactive SMTP session with the local SMTP server and study some of the major SMTP commands. Lastly, we will use the interactive SMTP session to send email to users and mailing list on the local machine.

Raymond.Chan@Senecac.on.ca

Last Updated: March 2011 Page 1 of 7

OPS535

OPS535 Advanced Network Administration

Part I: SMTP Server


(1) Login to your NIS server (VM3) as a regular user. The default SMTP server installed on a CentOS/RHEL is sendmail. Find out which version of the sendmail rpm is installed on the system. Command: rpm -q sendmail Sendmail Version: _______________________________________________________ (2) SMTP server uses one of the well-known ports. You can find out the port number used by smtp with the following command: Command: grep -w smtp /etc/services Output: ________________________________________________________________ The port number used by SMTP is ________ (3) There are two places (or commands) you can check to see whether there is a SMTP server running on your system. The 1st one is the output of the netstat -a command. Look for the SMTP port number under the Local Address column and record the line(s) that contain the SMTP port : (a) Command: netstat -a | grep smtp Output: ________________________________________________________________________ (b) Command: netstat -an | grep [smtp port number] (use the actual port #) Output: ________________________________________________________________________ (4) The other place is the output of the ps -ef | grep -v grep | grep sendmail command. Command: ps -ef | grep -v grep | grep sendmail Output: ________________________________________________________________________ _________________________________________________________________________ (Note: You need a different command if the system is running other SMTP server.)

Raymond.Chan@Senecac.on.ca

Last Updated: March 2011 Page 2 of 7

OPS535

OPS535 Advanced Network Administration

Part II: SMTP commands


(5) Login to your NIS server (VM3) as a regular user and execute the commands given in the Command column and record the output in the corresponding Response column. Do not proceed if the first command does not establish a connection to the SMPT port on the local host. Command Response telnet localhost smtp Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 localhost.localdomain ESMTP ...

HELO domain.com EHLO domain.com

NOOP RSET VERB EXPN ops535m VRFY toronto VRFY nobody HELP QUIT (6) su to root and backup the file /etc/mail/sendmail.cf to /etc/mail/sendmail.cf.org. (7) While you are still su to root, edit the file /etc/mail/sendmail.cf, change the line:
O PrivacyOptions=authwarnings,novrfy,noexpn,restrictqrun

to:
O PrivacyOptions=authwarnings,restrictqrun

(8) Save the changes and restart sendmail server. Command: service sendmail restart Type exit to exit from the root shell.

Raymond.Chan@Senecac.on.ca

Last Updated: March 2011 Page 3 of 7

OPS535

OPS535 Advanced Network Administration (9) Execute the commands in the Command column and record the output in the Response column as a regular user. Command Response telnet localhost smtp HELO domain.com EXPN ops535m VRFY toronto VRFY postmaster EXPN postmaster VRFY mailer-daemon EXPN mailer-daemon VRFY manager VRFY somebody QUIT (10) su to root, backup the file /etc/aliases to /etc/aliases.org and execute the following commands: # echo ops535m: # newaliases
adm,uucp,ftp >> /etc/aliases

(11) Record the output of the above commands: ___________________________________________________________________________

Raymond.Chan@Senecac.on.ca

Last Updated: March 2011 Page 4 of 7

OPS535

OPS535 Advanced Network Administration (12) Login as a regular user and execute the command in the Command column and record the output in the Response column. Command Response telnet localhost 25 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 localhost.localdomain ESMTP Sendmail ...

HELO domain.com EXPN ops535m


(may take a while to produce the output)

VRFY ops535m
(may take a while to product the output)

QUIT (13) In the NIS Lab, you were ask to create user nis101and nis102. Look up the login name from your /etc/passwd file and record them in the following table: Login Name UID User Name User 1 nis101

(The 5th field of a /etc/passwd record)

User 2 nis102 th If the 5 field for nis101 is empty, use the command chfn nis101 to set the Name[] field to Alice. Do the same for nis102 and set it to Bob (14) su to root and execute the following commands:
# echo smtp-lab: # newaliases nis101,nis102 >> /etc/aliases

(15) Login as a regular user and execute the commands in the Command column and record the output in the Response column. Command Response telnet localhost 25 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 localhost.localdomain ESMTP Sendmail ...

HELO domain.com EXPN smtp-lab


(may take a while to produce the output)

Raymond.Chan@Senecac.on.ca

Last Updated: March 2011 Page 5 of 7

OPS535

OPS535 Advanced Network Administration Command VRFY smtp-lab


(may take a while to produce the output)

Response

QUIT (16) Compare the results from step 5, 9, 12 and 15 for the EXPN and VRFY commands and comment on the results. ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ Question 1: How do you enable the EXPN and VRFY command in Sendmail? Question 2: How do you add a mailing list called helpdesk on your NIS server so that all email send to the helpdeskmail list will be forwarded to user nis102? Question 3: Would you be able to telnet from your other virtual machines to the SMPT port on your NIS server and repeat the task in step (9)? If not, what need to be changed on your NIS server to allow other machines to connect to the SMTP server on your NIS server?

Raymond.Chan@Senecac.on.ca

Last Updated: March 2011 Page 6 of 7

OPS535

OPS535 Advanced Network Administration

Part III Sending emails using the SMTP commands


(17) Login as a a regular user and connect to the local SMTP server. Use the information in the following table to send email to nis101, nis102, postmaster, ftp, ops535m and smtp-lab. From ws.podx.ca ws.podx.ca ws.podx.ca ws.podx.net ws.podx.net ws.podx.net To nis101 nis102 smtp-lab postmaster ftp ops535m Message Message for nis101 Test message 1. Message for nis102 Test message 2. Message for smtp-lab Test message 4 Message for postmaster Test message 5 Message for ftp Test message 6 Message for ops535m Test message 7 Final Destination of the Message

(18) Login as user1, and user2 and check out what messages they received: User User 1 User 2 Login_name nis101 nis102 Message received

Question 4: Who will actually receive the email for Test message 5? Question 5: Who will actually receive the email for Test message 6? Question 6: Who will actually receive the email for Test message 7?

Completing the Lab Upload your answers to questions 1 to 6 to MySeneca by the due date.

Raymond.Chan@Senecac.on.ca

Last Updated: March 2011 Page 7 of 7

OPS535

Você também pode gostar