分类: LINUX
2012-07-05 15:48:25
Linux下mail服务器应用之sendmail邮件系统的一个案例 sendmail邮件系统的一个案例
[root@mail ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@mail Server]# rpm -qa |grep -E "sendmail|m4"
[root@junjie Server]# rpm -ivh sendmail-cf-8.13.8-2.el5.i386.rpm
116 DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
[root@mail ~]# netstat -tupln |grep sendmail
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3407/sendmail: acce
[root@mail ~]# netstat -tupln |grep sendmail
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 4440/sendmail: acce
9 Connect:127.0.0.1 RELAY
增加:bj.com
[root@mail ~]# echo "123" |passwd --stdin user1
[root@mail ~]# echo "123" |passwd --stdin user2
[root@mail Server]# rpm -ivh bind-9.3.4-10.P1.el5.i386.rpm
[root@mail Server]# rpm -ivh bind-chroot-9.3.4-10.P1.el5.i386.rpm
[root@....Server]# rpm -ivh caching-nameserver-9.3.4-10.P1.el5.i386.rpm
[root@mail Server]# cd /var/named/chroot/etc/
[root@mail etc]# cp -p named.caching-nameserver.conf named.conf
[root@mail etc]# vim named.rfc1912.zones
增加以下几行:
20 zone "bj.com" IN {
22 file "bj.com.db";
23 allow-update { none; };
[root@mail named]# cp -p localhost.zone bj.com.db
9 @ IN NS ns.bj.com.
14 @ IN MX 10 mail
Starting named: [ OK ]
进行系统配置:
[root@mail named]# vim /etc/resolv.conf
[root@mail named]# vim /etc/sysconfig/network
127.0.0.1 mail.bj.com localhost.localdomain localh ost
Starting Dovecot Imap: [ OK ] [root@mail ~]# netstat -tupln |grep dovecot
(110,143,993(imaps),995(pop3s))
user1给user2发送信息:
Mar 23 10:45:50 mail sendmail[3938]: q2N2jovd003938: from=
Mar 23 10:45:50 mail sendmail[3939]: q2N2jovd003938: to=
Mar 23 10:46:08 mail dovecot: pop3-login: Login: user=
Mar 23 10:46:09 mail dovecot: POP3(user1): Disconnected: Logged out top=0/0, retr=1/1696, del=0/1, size=1679
Mar 23 10:58:20 mail sendmail[4012]: q2N2wKKs004012: from=
Mar 23 10:58:20 mail sendmail[4013]: q2N2wKKs004012: to=
Mar 23 10:59:09 mail dovecot: pop3-login: Aborted login: user=
Mar 23 10:59:09 mail dovecot: pop3-login: Login: user=
Mar 23 10:59:09 mail dovecot: POP3(user2): Disconnected: Logged out top=0/0, retr=1/1748, del=0/2, size=3448
[root@mail ~]# mount /dev/cdrom /mnt/cdrom/
[root@mail Server]# rpm -qa |grep -E "sendmail|m4"
[root@junjie Server]# rpm -ivh sendmail-cf-8.13.8-2.el5.i386.rpm
116 DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
[root@mail ~]# netstat -tupln |grep sendmail
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3607/sendmail: acce
[root@mail ~]# netstat -tupln |grep sendmail
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 3528/sendmail: acce
9 Connect:127.0.0.1 RELAY
增加:sh.com
[root@mail ~]# echo "123" |passwd --stdin user3
[root@mail ~]# echo "123" |passwd --stdin user4
[root@mail Server]# rpm -ivh bind-9.3.4-10.P1.el5.i386.rpm
[root@mail Server]# rpm -ivh bind-chroot-9.3.4-10.P1.el5.i386.rpm
[root@....Server]# rpm -ivh caching-nameserver-9.3.4-10.P1.el5.i386.rpm
[root@mail Server]# cd /var/named/chroot/etc/
[root@mail etc]# cp -p named.caching-nameserver.conf named.conf
27 allow-query { any; };
[root@mail etc]# vim named.rfc1912.zones
增加以下几行:
20 zone "sh.com" IN {
21 type master;
22 file "sh.com.db";
23 allow-update { none; };
[root@mail named]# cp -p localhost.zone sh.com.db
Starting named: [ OK ]
客户端测试dns解析:
[root@mail named]# vim /etc/resolv.conf
[root@mail named]# vim /etc/sysconfig/network
127.0.0.1 mail.sh.com localhost.localdomain localh ost
Starting Dovecot Imap: [ OK ] [root@mail ~]# netstat -tupln |grep dovecot
(110,143,993(imaps),995(pop3s))
[root@mail ~]# cd /var/named/chroot/etc/
[root@mail etc]# vim named.conf
[root@mail etc]# rndc reload
server reload successful
[root@mail etc]# vim named.rfc1912.zones
55 zone "6.106.10.in-addr.arpa" IN {
56 type master;
57 file "10.106.6.db";
58 allow-update { none; };
[root@mail etc]# cd ../var/named/
[root@mail named]# ll
[root@mail named]# cp -p named.local 10.106.6.db
[root@mail named]# vim 10.106.6.db
254 IN PTR mail.bj.com.
153 IN PTR mail.sh.com.
[root@mail named]# rndc reload
server reload successful
[root@mail ~]# cd /var/named/chroot/etc/
[root@mail etc]# vim named.conf
[root@mail etc]# rndc reload
server reload successful
[root@mail etc]# vim named.rfc1912.zones
55 zone "6.106.10.in-addr.arpa" IN {
56 type master;
57 file "10.106.6.db";
58 allow-update { none; };
[root@mail etc]# cd ../var/named/
[root@mail named]# ll
[root@mail named]# cp -p named.local 10.106.6.db
[root@mail named]# vim 10.106.6.db
254 IN PTR mail.bj.com.
153 IN PTR mail.sh.com.
[root@mail named]# rndc reload
server reload successful
⑪ :测试通信情况
(bj.com的客户user1@bj.com与sh.com的客户user3@sh.com通信)
mail.bj.com的日志信息:
Mar 23 15:46:07 mail dovecot: pop3-login: Aborted login: user=
Mar 23 15:46:07 mail dovecot: pop3-login: Login: user=
Mar 23 15:46:07 mail dovecot: POP3(user2): Disconnected: Logged out top=0/0, retr=0/0, del=0/3, size=5025
Mar 23 15:46:13 mail sendmail[2298]: q2N7kCbh002298: from=
Mar 23 15:46:16 mail sendmail[2300]: q2N7kCbh002298: to=
Mar 23 15:48:38 mail sendmail[2307]: q2N7mc6a002307: from=
Mar 23 15:48:38 mail sendmail[2308]: q2N7mc6a002307: to=
Mar 23 15:48:54 mail dovecot: pop3-login: Aborted login: user=
Mar 23 15:48:54 mail dovecot: pop3-login: Login: user=
Mar 23 15:48:54 mail dovecot: POP3(user1): Disconnected: Logged out top=0/0, retr=1/3623, del=0/1, size=3606
Mar 23 15:51:04 mail sendmail[2320]: q2N7p4Pg002320: from=
Mar 23 15:51:04 mail sendmail[2322]: q2N7p4Pg002320: to=
Mar 23 15:52:25 mail sendmail[2325]: q2N7qPlW002325: from=
Mar 23 15:52:25 mail sendmail[2326]: q2N7qPlW002325: to=
Mar 23 15:52:34 mail dovecot: pop3-login: Aborted login: user=
Mar 23 15:52:34 mail dovecot: pop3-login: Login: user=
Mar 23 15:52:34 mail dovecot: POP3(user1): Disconnected: Logged out top=0/0, retr=1/3786, del=0/2, size=7375
mail.sh.com的日志信息:
Mar 23 16:24:06 mail dovecot: pop3-login: Login: user=
Mar 23 16:24:06 mail dovecot: POP3(user3): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
Mar 23 16:24:07 mail dovecot: pop3-login: Login: user=
Mar 23 16:24:07 mail dovecot: POP3(user4): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
Mar 23 16:32:07 mail sendmail[3583]: q2N8W6jM003583: from=
Mar 23 16:32:08 mail sendmail[3584]: q2N8W6jM003583: to=
Mar 23 16:32:51 mail dovecot: pop3-login: Login: user=
Mar 23 16:32:51 mail dovecot: POP3(user3): Disconnected: Logged out top=0/0, retr=1/1898, del=1/1, size=1881
Mar 23 16:34:29 mail sendmail[3595]: q2N8YTvQ003595: from=
Mar 23 16:34:29 mail sendmail[3597]: q2N8YTvQ003595: to=
Mar 23 16:36:56 mail sendmail[3603]: q2N8aucK003603: from=
Mar 23 16:36:56 mail sendmail[3604]: q2N8aucK003603: to=
Mar 23 16:37:04 mail dovecot: pop3-login: Login: user=
Mar 23 16:37:04 mail dovecot: POP3(user3): Disconnected: Logged out top=0/0, retr=1/1909, del=1/1, size=1892
Mar 23 16:38:16 mail sendmail[3611]: q2N8cGVM003611: from=
Mar 23 16:38:16 mail sendmail[3613]: q2N8cGVM003611: to=
《完》
--xjzhujunjie
--2012/03/23-19:35