一共三台服务器,

一、1做mail+dns。Ip192.168.13.1  lxy.com 网关192.168.13.254
二、2启用网卡转发。192.168.13.254/24 172.13.13.254/16
三、3做mail。Ip172.13.13.1 网关172.13.13.254  dns192.168.13.1  lixiao.com
开启网卡转发  echo 1  > /proc/sys/net.ipv4/ip_forward
   DNS
yum install bind-*
  编辑
/var/named/chroot/etc/named.conf 
/var/named/chroot/var/named/lxy.com.zone
 

 

 

         mail 
service sendmail stop 停 sendmail服务
 安装yum install httpd
 安装yum install postfix
 vim /etc/postfix/main.cf
修改以下字段
myhostname = mail.lxy.com
mydomain = lxy.com
myorigin = $mydomain
inet_interfaces = all
#inet_interfaces = localhost
mydestination = $myhostname, $mydomain
mynetworks = 192.168.13.0/24, 127.0.0.0/8
relay_domains = lxy.com
重启/etc/init.d/saslauthd restart
 vim /etc/sysconfig/saslauthd
修改
MECH=shadow
 
测试
testsaslauthd -u lxy -p 'lxy'
 
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
        
yum install dovecot
vim /etc/dovecot.conf 
     修改
protocols = pop3 pop3s
protocol pop3 {
listen = *:10100
}
 
yum install cyrus-imapd cyrus-imapd-devel
修改         vim /etc/postfix/main.cf
去掉注释 mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp
 
 cyradm -u cyrus localhost
cm user.lxy
cm user.lxy.Send
cm user.lxy.Trash
cm user.lxy.Drafts
 
安装配置webmail
yum install squirrelmail
/usr/share/squirrelmail/config/conf.pl 
zh_CN
gb2312
 
server httpd restart
再配置另一台mail
验证