WD1X.COM - 问答一下,轻松解决,电脑应用解决专家
主板显卡CPU内存显示器
硬盘维修显卡维修显示器维修
注册表系统命令DOS命令Win8
存储光存储鼠标键盘
内存维修打印机维修
WinXPWin7Win11Linux
硬件综合机箱电源散热器手机数码
主板维修CPU维修键盘鼠标维修
Word教程Excel教程PowerPointWPS
网络工具系统工具图像工具
数据库javascript服务器
PHP教程CSS教程XML教程

不同网段中的邮件服务器间的邮件转发

更新时间:2012-12-12 17:02 作者:佚名点击:

应题目要求 需要一台DNS服务器充当2个 mail服务器的域名解析服务器

1.设置DNS服务器  在DNS服务器上增加2块网卡 并分别设置IP地址。

设置主DNS配置文件.
vim /var/named/chroot/etc/named.conf
options {
      directory "/var/named";
};
zone "hanfangzhou.com" {
      type master;
      file "hanfangzhou.com.zone";
};
zone "laohu.com" {
      type master;
     file "laohu.com.zone";
};


配置2个mail服务器的区域文件


vim /var/named/chroot/var/named/hanfangzhou.com.zone
@               IN SOA  @       root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
hanfangzhou.com.        IN NS           mail.hanfangzhou.com.
mail                    IN A            192.168.18.48
hanfangzhou.com.        IN MX 10        mail.hanfangzhou.com.
vim /var/named/chroot/var/named/laohu.com.zone

@               IN SOA  @       root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
laoyu.com.        IN NS            mail.laohu.com.
mail              IN A             10.1.1.2
laoyu.com.        IN MX 10         mail.laohu.com.

重启DNS服务

service named restart

开启网卡转发

 vim /etc/sysctl.conf
net.ipv4.ip_forward = 1

MAIL服务器1(mail.hanfangzhou.com)的设置

停止sendmail服务 关闭开机加载项 service sendmail stop  chkconfig sendmail off
安装postfix      yum install postfix -y
修改配置文件 vim /etc/postfix/main.cf
69 myhostname = mail.hanfangzhou.com
77 mydomain = hanfangzhou.com
93 myorigin = $mydomain
107 inet_interfaces = all
155 mydestination = $myhostname, localhost.$mydomain, localhost
255 mynetworks = 192.168.18.0/24, 127.0.0.0/8
287 relay_domains = hanfangzhou.com
保存退出

设置SMTP认证配置文件

vim /etc/sysconfig/saslauthd
   MECH=shadow

保存退出

service saslauthd restart

检查防火墙和SElinux是否关闭
验证 建立用户chaoyue
[root@hanfangzhou ~]# useradd chaoyue
[root@hanfangzhou ~]# passwd chaoyue
Changing password for user chaoyue.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@hanfangzhou ~]# testsaslauthd -u chaoyue -p '123'
0: OK "Success."

配置postfix服务与smtp关联

vim /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = ''
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
broken_sasl_auth_clients = yes
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous

保存退出

service postfix restart         chkconfig postfix on
验证
perl -MMIME::Base64 -e 'print encode_base64(chaoyue);'
Y2hhb3l1ZQ==
perl -MMIME::Base64 -e 'print encode_base64(123);'
MTIz
[root@hanfangzhou ~]# telnet mail.hanfangzhou.com 25
Trying 192.168.18.48...
Connected to mail.hanfangzhou.com (192.168.18.48).
Escape character is '^]'.
220 mail.hanfangzhou.com ESMTP Postfix
auth login
334 VXNlcm5hbWU6
Y2hhb3l1ZQ==
334 UGFzc3dvcmQ6
MTIz
235 2.0.0 Authentication successful

安装dovecot服务  yum install dovecot -y

修改配置文件
vim /etc/dovecot.conf
protocols = pop3 pop3s

 protocol pop3 {
     listen = *:10100
#     ..
   }
service dovecot restart    chkconfig dovecot on

安装cyrus

yum install cyrus-imapd cyrus-imapd-devel -y
修改postfix主配置文件  vim /etc/postfix/main.cf
修改 456行 去掉注释符 mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp
service cyrus-imapd restart  chkconfig cyrus-imapd on
修改cyrus密码并建立chaoyue用户邮箱
[root@hanfangzhou ~]# passwd cyrus
Changing password for user cyrus.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@hanfangzhou ~]# cyradm -u cyrus localhost
IMAP Password:
              localhost.localdomain> cm user.chaoyue
localhost.localdomain> cm user.chaoyue.Send
localhost.localdomain> cm user.chaoyue.Trash
localhost.localdomain> cm user.chaoyue.Drafts
安装 webmail  squirrelmail   yum install squirrelmail -y
设置 wenmail   /usr/share/squirrelmail/config/conf.pl
重启HTTPD服务
同理设置MAIL服务器2(mail.laohu.com) 
测试

\
顶一下
(0)
0%
踩一下
(1)
100%
------分隔线----------------------------
你可能感兴趣的内容