8/1/12

THIẾT LẬP HỆ THỐNG MAIL TRAO ĐỔI CHO NHIỀU MIỀN

1.1.1.     THIẾT LẬP HỆ THỐNG MAIL TRAO ĐỔI CHO NHIỀU MIỀN

Hướng dẫn thực hiện

a.      Kiểm tra dns nhiều miền con
b.      Cấu hình relay mail cho 2 miền con từ miển serverlinux.vn
c.      Cấu hình mail gateway cho itdep.serverlinux.vn
d.      Cấu hình mail gateway cho pcm.serverlinux.vn
e.      Khởi tạo dịch vụ
f.       Kiểm tra hoạt động

Hướng dẫn thực hiện

a)   Kiểm tra cấu hình DNS
[root@dns1 named]# nslookup
> set type=any
> serverlinux.vn
Server:         192.168.1.17
Address:        192.168.1.17#53

serverlinux.vn
        origin = dns1.serverlinux.vn
        mail addr = root.serverlinux.vn
        serial = 2011022700
        refresh = 28800
        retry = 14400
        expire = 3600000
        minimum = 86400
serverlinux.vn  nameserver = dns1.serverlinux.vn.
serverlinux.vn  mail exchanger = 1 dns1.serverlinux.vn.
> itdep.serverlinux.vn
Server:         192.168.1.17
Address:        192.168.1.17#53

Name:   itdep.serverlinux.vn
Address: 192.168.1.28
itdep.serverlinux.vn    mail exchanger = 1 mail.itdep.serverlinux.vn.
> 192.168.1.17
Server:         192.168.1.17
Address:        192.168.1.17#53

17.1.168.192.in-addr.arpa       name = dns1.serverlinux.vn.
> 192.168.1.28
Server:         192.168.1.17
Address:        192.168.1.17#53

28.1.168.192.in-addr.arpa       name = itdep.serverlinux.vn.
28.1.168.192.in-addr.arpa       name = mail.itdep.serverlinux.vn.
b)  Cấu hình Access Relay Mail
[root@dns1 mail]# vi access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
# by default we allow relaying from localhost...
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
Connect:serverlinux.vn                  RELAY
Connect:192.168.1.17                    RELAY
Connect:itdep.serverlinux.vn            RELAY
Connect:192.168.1.28                    RELAY
c)   Biên dịch truy cập access
[root@dns1 mail]# makemap hash access < access
d)  Khởi động lại dịch vụ sendmail
[root@dns1 mail]# /etc/init.d/sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]
e)   Chỉnh sửa tập tin sendmail.cf trong DNS itdep.serverlinux.vn
#Thay đổi dòng 89
89 Cwlocalhost itdep.serverlinux.vn
90 # file containing names of hosts for which we receive email
91 Fw/etc/mail/local-host-names
92
93 # my official domain name
94 # ... define this only if sendmail cannot automatically determine your    domain
95 #Dj$w.Foo.COM
96
97 # host/domain names ending with a token in class P are canonical
98 CP.
99
100 # "Smart" relay host (may be null)
#Thay đổi dòng 101
101 DSmail.serverlinux.vn
f)    Khởi động lại dịch vụ sendmail trong itdep.serverlinux.vn
[root@dns1 mail]# /etc/init.d/sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]

g)   Tạo tài khoản hv trên itdep.serverlinux.vn và gửi mail giữa root và hv
[root@localhost mail]#useradd hv
[root@localhost mail]#passwd  hv
[root@localhost mail]# mail -v hv@itdep.serverlinux.vn
Subject: test1        
test1
.
Cc:
WARNING: local host name (localhost) is not qualified; see cf/README: WHO AM I?
hv@itdep.serverlinux.vn... Connecting to [127.0.0.1] via relay...
220 localhost ESMTP Sendmail 8.13.8/8.13.8; Fri, 23 Dec 2011 07:35:58 +0700
>>> EHLO localhost
250-localhost Hello localhost.localdomain [127.0.0.1], pleased to meet you
………………………………………………….
>>> .
250 2.0.0 pBN0Zw1U005360 Message accepted for delivery
hv@itdep.serverlinux.vn... Sent (pBN0Zw1U005360 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost closing connection
h)  Đăng nhập vào user hv và kiểm tra mail
[root@localhost mail]#su - hv
[root@localhost mail]# su - hv
[hv@localhost ~]$ mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/hv": 1 message 1 new
>N  1 root@localhost        Fri Dec 23 07:35  16/578   "test1"
& 1
Message 1:
From root@localhost  Fri Dec 23 07:35:58 2011
Date: Fri, 23 Dec 2011 07:35:58 +0700
From: root <root@localhost>
To: hv@itdep.serverlinux.vn
Subject: test1
test1
& quit
Saved 1 message in mbox
[hv@localhost ~]$

i)    Từ user sv@itdep.serverlinux.vngửi mail cho sv@serverlinux.vn
[root@localhost mail]# su - sv
 [sv@dns2 ~]$ mail -v sv@serverlinux.vn
Subject: chao sv serverlinux.vn
xin chao sv serverlinux.vn
.
EOT
sv@serverlinux.vn... Connecting to [127.0.0.1] via relay...
220 dns2.itdep.serverlinux.vn ESMTP Sendmail 8.14.4/8.14.4; Fri, 23 Dec 2011 09:24:46 -0500
>>> EHLO dns2.itdep.serverlinux.vn
……………………………………………………..
>>> QUIT
221 2.0.0 dns2.itdep.serverlinux.vn closing connection
[sv@dns2 ~]$
sv@serverlinux.vn nhận mail từ sv@itdep.serverlinux.vn
[root@localhost mail]# su - sv
[sv@localhost ~]$ mail
Heirloom Mail version 12.4 7/29/08.  Type ? for help.
"/var/spool/mail/sv": 3 messages 2 new
    1 root                  Fri Dec 23 09:07  21/793   "test"
>N  2 Mail Delivery Subsys  Fri Dec 23 09:18  66/2411  "Returned mail: see t"
 N  3 day la tai khoan dun  Fri Dec 23 09:24  23/1073  "chao sv serverlinux."
& 3
Message  3:
From sv@dns2.itdep.serverlinux.vn  Fri Dec 23 09:24:53 2011
Return-Path: <sv@dns2.itdep.serverlinux.vn>
From: day la tai khoan dung de test <sv@dns2.itdep.serverlinux.vn>
Date: Fri, 23 Dec 2011 09:24:45 -0500
To: sv@serverlinux.vn
Subject: chao sv serverlinux.vn
User-Agent: Heirloom mailx 12.4 7/29/08
Content-Type: text/plain; charset=us-ascii
Status: R

xin chao sv serverlinux.vn

& quit
Held 3 messages in /var/spool/mail/sv

Bài đăng phổ biến